summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-22 03:07:52 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-22 03:07:52 +0000
commit33cf526aaf12858b64ef09f6faa8ea0dfb656d3f (patch)
tree34cda4d73d4beb90e7d8b86c1def2b9d4eefa79f /usr.sbin
parent5b03280a870e2bd599f4b05fdf43cf3a2f8f829c (diff)
an RTM_IFINFO message can mean a lot. it does not necessarily mean that
the status of the interface in terms of our nexthop validation changed; it might be something like a speed change that we don't care about. save the decided state for nexthop verificartion in struct kif, and only walk through the attached (connected) routes & report upwards if the state actually changed.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/kroute.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 0bda2ac88ce..cd361114248 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.73 2004/01/18 19:15:00 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.74 2004/01/22 03:07:51 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -249,6 +249,7 @@ struct kif {
u_int8_t media_type;
u_int8_t link_state;
u_long baudrate;
+ u_int8_t nh_reachable; /* for nexthop verification */
};
struct session_up {
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 86129fc8102..eb07896d2ef 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.74 2004/01/18 19:15:00 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.75 2004/01/22 03:07:51 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -804,6 +804,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
struct kif_kr *kkr;
struct kroute_nexthop nh;
struct knexthop_node *n;
+ u_int8_t reachable;
if ((kif = kif_find(ifindex)) == NULL) {
logit(LOG_CRIT, "interface with index %u not found",
@@ -816,13 +817,19 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.media_type = ifd->ifi_type;
kif->k.baudrate = ifd->ifi_baudrate;
+ if ((reachable = (flags & IFF_UP) &&
+ (ifd->ifi_link_state != LINK_STATE_DOWN)) == kif->k.nh_reachable)
+ return; /* nothing changed wrt nexthop validity */
+
+ kif->k.nh_reachable = reachable;
+
LIST_FOREACH(kkr, &kif->kroute_l, entry) {
/*
* we treat link_state == LINK_STATE_UNKNOWN as valid
* not all interfaces have a conecpt of "link state" and/or
* do not report up
*/
- if ((flags & IFF_UP) && (kif->k.link_state != LINK_STATE_DOWN))
+ if (reachable)
kkr->kr->r.flags &= ~F_DOWN;
else
kkr->kr->r.flags |= F_DOWN;
@@ -1080,6 +1087,8 @@ fetchifs(int ifindex)
kif->k.link_state = ifm->ifm_data.ifi_link_state;
kif->k.media_type = ifm->ifm_data.ifi_type;
kif->k.baudrate = ifm->ifm_data.ifi_baudrate;
+ kif->k.nh_reachable = (kif->k.flags & IFF_UP) &&
+ (ifm->ifm_data.ifi_link_state != LINK_STATE_DOWN);
if ((sa = rti_info[RTAX_IFP]) != NULL)
if (sa->sa_family == AF_LINK) {