summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-07-23 14:53:21 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-07-23 14:53:21 +0000
commit27ef27e0a991017a05548fec8fd64f665b827df9 (patch)
treeff9dde8264deefdfe7f46b5ece497c82ec5c8700
parent0830473ffdea46f4046c4676e523d641c5009fea (diff)
Send the used kroute along with the nexthop information. This allows us
to show all necessary information in bgpctl show next. OK henning@
-rw-r--r--usr.sbin/bgpd/bgpd.h9
-rw-r--r--usr.sbin/bgpd/kroute.c23
2 files changed, 13 insertions, 19 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 7c0da04b9dc..7c08e1f9a7e 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.242 2009/07/20 15:03:16 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.243 2009/07/23 14:53:18 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -437,10 +437,13 @@ struct pftable_msg {
struct ctl_show_nexthop {
struct bgpd_addr addr;
- struct bgpd_addr gateway;
struct kif kif;
+ union {
+ struct kroute kr4;
+ struct kroute6 kr6;
+ } kr;
u_int8_t valid;
- u_int8_t connected;
+ u_int8_t krvalid;;
};
struct ctl_neighbor {
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index c3ad29dd6fd..e90e2775ed0 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.171 2009/07/23 10:20:44 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.172 2009/07/23 14:53:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -587,26 +587,17 @@ kr_show_route(struct imsg *imsg)
case AF_INET:
kr = h->kroute;
snh.valid = kroute_validate(&kr->r);
- snh.connected =
- kr->r.flags & F_CONNECTED;
- if ((snh.gateway.v4.s_addr =
- kr->r.nexthop.s_addr) != 0)
- snh.gateway.af = AF_INET;
+ snh.krvalid = 1;
+ memcpy(&snh.kr.kr4, &kr->r,
+ sizeof(snh.kr.kr4));
ifindex = kr->r.ifindex;
break;
case AF_INET6:
kr6 = h->kroute;
snh.valid = kroute6_validate(&kr6->r);
- snh.connected =
- kr6->r.flags & F_CONNECTED;
- if (memcmp(&kr6->r.nexthop,
- &in6addr_any,
- sizeof(struct in6_addr)) != 0) {
- snh.gateway.af = AF_INET6;
- memcpy(&snh.gateway.v6,
- &kr6->r.nexthop,
- sizeof(struct in6_addr));
- }
+ snh.krvalid = 1;
+ memcpy(&snh.kr.kr6, &kr6->r,
+ sizeof(snh.kr.kr6));
ifindex = kr6->r.ifindex;
break;
}