summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/bgpctl.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-06-06 17:15:08 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-06-06 17:15:08 +0000
commitaaaa8c4cd2c233936b52691fe56a2ba6746af26e (patch)
tree0e3d58fd0a75cdd664b4f7bfe112edb029c8a252 /usr.sbin/bgpctl/bgpctl.c
parentcbaf44da3b32495f202def87c3a418f9d49905c2 (diff)
allow show fib to be limited to inet or inet6 families, claudio ok
Diffstat (limited to 'usr.sbin/bgpctl/bgpctl.c')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index c26bf7bec6c..abea9b25330 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.83 2005/06/06 00:00:33 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.84 2005/06/06 17:15:07 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -145,10 +145,19 @@ main(int argc, char *argv[])
show_summary_head();
break;
case SHOW_FIB:
- if (!res->addr.af)
- imsg_compose(ibuf, IMSG_CTL_KROUTE, 0, 0, -1,
- &res->flags, sizeof(res->flags));
- else
+ if (!res->addr.af) {
+ struct buf *msg;
+
+ if ((msg = imsg_create(ibuf, IMSG_CTL_KROUTE, 0, 0,
+ sizeof(res->flags) + sizeof(res->af))) == NULL)
+ errx(1, "imsg_create failure");
+ if (imsg_add(msg, &res->flags, sizeof(res->flags)) ==
+ -1 ||
+ imsg_add(msg, &res->af, sizeof(res->af)) == -1)
+ errx(1, "imsg_add failure");
+ if (imsg_close(ibuf, msg) < 0)
+ errx(1, "imsg_close error");
+ } else
imsg_compose(ibuf, IMSG_CTL_KROUTE_ADDR, 0, 0, -1,
&res->addr, sizeof(res->addr));
show_fib_head();