diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 7ccfae4ba4..dc2b0b679b 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -60,13 +60,15 @@ static int bgp_nht_ifp_initial(struct thread *thread); static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc) { return (bgp_zebra_num_connects() == 0 - || (bnc && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID))); + || (bnc && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) + && bnc->nexthop_num > 0)); } static int bgp_isvalid_labeled_nexthop(struct bgp_nexthop_cache *bnc) { return (bgp_zebra_num_connects() == 0 - || (bnc && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID))); + || (bnc && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID) + && bnc->nexthop_num > 0)); } static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc) @@ -477,6 +479,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc, bnc->nexthop = nhlist_head; } else { bnc->flags &= ~BGP_NEXTHOP_VALID; + bnc->flags &= ~BGP_NEXTHOP_LABELED_VALID; bnc->nexthop_num = nhr->nexthop_num; /* notify bgp fsm if nbr ip goes from valid->invalid */