summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-12-26 20:59:55 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-12-26 20:59:55 +0000
commit9942ca11ea91ce6e37d0666a3c93d728126ae057 (patch)
tree3d79b76ae1807a844ad6753b1cf677ae79e218fd /usr.sbin
parentc4e8f05dc74bc167e19c10fa6246513737c64199 (diff)
fix logging in send_nexthop_update
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 77eec4923c5..e5a8d8aec2e 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.39 2003/12/26 18:33:11 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.40 2003/12/26 20:59:54 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -404,11 +404,20 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf)
void
send_nexthop_update(struct kroute_nexthop *msg)
{
- logit(LOG_INFO, "nexthop %s now %s%s%s%s", log_ntoa(msg->nexthop),
+ char *gw = NULL;
+
+ if (msg->gateway)
+ if (asprintf(&gw, ": via %s", log_ntoa(msg->gateway)) == -1) {
+ log_err("send_nexthop_update");
+ quit = 1;
+ }
+
+ logit(LOG_INFO, "nexthop %s now %s%s%s", log_ntoa(msg->nexthop),
msg->valid ? "valid" : "invalid",
msg->connected ? ": directly connected" : "",
- msg->gateway ? ": via " : "",
- msg->gateway ? log_ntoa(msg->gateway) : "");
+ msg->gateway ? gw : "");
+
+ free(gw);
if (imsg_compose(&ibuf_rde, IMSG_NEXTHOP_UPDATE, 0,
msg, sizeof(struct kroute_nexthop)) == -1)