summaryrefslogtreecommitdiff
path: root/bgpd/bgp_nht.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_nht.c')
-rw-r--r--bgpd/bgp_nht.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index c6fa37fa8d..9c8d7878c5 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -194,6 +194,16 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
bnc->srte_color, bnc->bgp->name_pretty,
peer);
}
+ } else {
+ if (BGP_DEBUG(nht, NHT)) {
+ char buf[PREFIX2STR_BUFFER];
+
+ zlog_debug(
+ "Found existing bnc %s(%s) flags 0x%x ifindex %d #paths %d peer %p",
+ bnc_str(bnc, buf, PREFIX2STR_BUFFER),
+ bnc->bgp->name_pretty, bnc->flags, bnc->ifindex,
+ bnc->path_count, bnc->nht_info);
+ }
}
if (is_bgp_static_route) {
@@ -237,6 +247,11 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
}
+ if (peer && (bnc->ifindex != ifindex)) {
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
+ bnc->ifindex = ifindex;
+ }
if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW) {
SET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
@@ -454,17 +469,21 @@ static void bgp_nht_ifp_table_handle(struct bgp *bgp,
bnc->last_update = bgp_clock();
bnc->change_flags = 0;
+ /*
+ * For interface based routes ( ala the v6 LL routes
+ * that this was written for ) the metric received
+ * for the connected route is 0 not 1.
+ */
+ bnc->metric = 0;
if (up) {
SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
SET_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED);
- bnc->metric = 1;
bnc->nexthop_num = 1;
} else {
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
SET_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED);
bnc->nexthop_num = 0;
- bnc->metric = 0;
}
evaluate_paths(bnc);
@@ -502,6 +521,11 @@ static int bgp_nht_ifp_initial(struct thread *thread)
if (!ifp)
return 0;
+ if (BGP_DEBUG(nht, NHT))
+ zlog_debug(
+ "Handle NHT initial update for Intf %s(%d) status %s",
+ ifp->name, ifp->ifindex, if_is_up(ifp) ? "up" : "down");
+
if (if_is_up(ifp))
bgp_nht_ifp_up(ifp);
else