summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2006-06-15 10:05:18 +0000
committerclaudio <claudio@openbsd.org>2006-06-15 10:05:18 +0000
commitba099d616fb9969634a0ed2550117c8a4e10498a (patch)
tree32f2f69f6ddd1e95a7240d166f8e5086d1d99ef1
parentInstead of passing three different kinds of arguments in show rib control (diff)
downloadwireguard-openbsd-ba099d616fb9969634a0ed2550117c8a4e10498a.tar.xz
wireguard-openbsd-ba099d616fb9969634a0ed2550117c8a4e10498a.zip
Use new struct ctl_show_rib_request for show rib requests. OK henning@
-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;