summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/bgpctl.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-06-15 10:05:19 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-06-15 10:05:19 +0000
commit8e1d137156feaabc9707cb42be31332f82a1f8cb (patch)
tree4c4cf34d10b6366de1f8c81d59635b329327c345 /usr.sbin/bgpctl/bgpctl.c
parent175dee5314d2a5fe45aef0cd8722f9ce3d0305c0 (diff)
Use new struct ctl_show_rib_request for show rib requests. OK henning@
Diffstat (limited to 'usr.sbin/bgpctl/bgpctl.c')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index b006b86ed5b..dd0454b009e 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.106 2006/06/14 17:10:42 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.107 2006/06/15 10:05:18 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -104,7 +104,9 @@ main(int argc, char *argv[])
struct network_config net;
struct parse_result *res;
struct ctl_neighbor neighbor;
+ struct ctl_show_rib_request ribreq;
char *sockname;
+ enum imsg_type type;
sockname = SOCKET_NAME;
while ((ch = getopt(argc, argv, "ns:")) != -1) {
@@ -194,21 +196,20 @@ main(int argc, char *argv[])
NULL, 0);
break;
case SHOW_RIB:
- if (res->as.type != AS_NONE)
- imsg_compose(ibuf, IMSG_CTL_SHOW_RIB_AS, 0, 0, -1,
- &res->as, sizeof(res->as));
- else if (res->addr.af) {
- struct ctl_show_rib_prefix msg;
-
- bzero(&msg, sizeof(msg));
- memcpy(&msg.prefix, &res->addr, sizeof(res->addr));
- msg.prefixlen = res->prefixlen;
- msg.flags = res->flags;
- imsg_compose(ibuf, IMSG_CTL_SHOW_RIB_PREFIX, 0, 0, -1,
- &msg, sizeof(msg));
- } else
- imsg_compose(ibuf, IMSG_CTL_SHOW_RIB, 0, 0, -1,
- &res->af, sizeof(res->af));
+ bzero(&ribreq, sizeof(ribreq));
+ type = IMSG_CTL_SHOW_RIB;
+ if (res->as.type != AS_NONE) {
+ memcpy(&ribreq.as, &res->as, sizeof(res->as));
+ type = IMSG_CTL_SHOW_RIB_AS;
+ }
+ if (res->addr.af) {
+ memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
+ ribreq.prefixlen = res->prefixlen;
+ type = IMSG_CTL_SHOW_RIB_PREFIX;
+ }
+ ribreq.af = res->af;
+ ribreq.flags = res->flags;
+ imsg_compose(ibuf, type, 0, 0, -1, &ribreq, sizeof(ribreq));
if (!(res->flags & F_CTL_DETAIL))
show_rib_summary_head();
break;