diff options
author | 2009-07-20 15:03:16 +0000 | |
---|---|---|
committer | 2009-07-20 15:03:16 +0000 | |
commit | faddb310281c261aaae4c13123682cf04cc9ae0c (patch) | |
tree | 2acc2f16a2332e7f7612dd23323d5c4197445f02 | |
parent | On config reload errors free the list of ribs so that following reloads (diff) | |
download | wireguard-openbsd-faddb310281c261aaae4c13123682cf04cc9ae0c.tar.xz wireguard-openbsd-faddb310281c261aaae4c13123682cf04cc9ae0c.zip |
Include more info in the bgpctl show nexthop ctl message. Mainly add the
gateway used for non-connected routes. This info was missing all the time
and often resulted in massive confusion when the nexthop selection choosed
a bad nexthop.
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 6 | ||||
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index a8dbaa4c535..7c0da04b9dc 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.241 2009/06/12 16:42:53 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.242 2009/07/20 15:03:16 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -437,8 +437,10 @@ struct pftable_msg { struct ctl_show_nexthop { struct bgpd_addr addr; - u_int8_t valid; + struct bgpd_addr gateway; struct kif kif; + u_int8_t valid; + u_int8_t connected; }; struct ctl_neighbor { diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index d16cf3b4156..f90d8a837f2 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.169 2009/06/25 15:54:22 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.170 2009/07/20 15:03:16 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -587,11 +587,26 @@ 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; 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)); + } ifindex = kr6->r.ifindex; break; } |