summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-07-20 15:03:17 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-07-20 15:03:17 +0000
commit7b4a6451f38153833bb1bf7ea19900410574cc1e (patch)
treef6d2159ad68fd398af251dffc13cc6b65e1c823f /usr.sbin/bgpd
parentac20646f75063a3e8ab7ab8b8a7365c4a3d6b4d8 (diff)
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.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.h6
-rw-r--r--usr.sbin/bgpd/kroute.c17
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;
}