mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-01 04:09:01 +00:00
bgpd: fix invalid labeled nexthop check
the code processing an NHT update was only resetting the BGP_NEXTHOP_VALID flag, so labeled nexthops were considered valid even if there was no nexthop. Reset the flag in response to the update, and also make the isvalid_nexthop functions a little more robust by checking the number of nexthops. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
b38f1fd03d
commit
c3b95419ba
@ -60,13 +60,15 @@ static int bgp_nht_ifp_initial(struct thread *thread);
|
|||||||
static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc)
|
static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc)
|
||||||
{
|
{
|
||||||
return (bgp_zebra_num_connects() == 0
|
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)
|
static int bgp_isvalid_labeled_nexthop(struct bgp_nexthop_cache *bnc)
|
||||||
{
|
{
|
||||||
return (bgp_zebra_num_connects() == 0
|
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)
|
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;
|
bnc->nexthop = nhlist_head;
|
||||||
} else {
|
} else {
|
||||||
bnc->flags &= ~BGP_NEXTHOP_VALID;
|
bnc->flags &= ~BGP_NEXTHOP_VALID;
|
||||||
|
bnc->flags &= ~BGP_NEXTHOP_LABELED_VALID;
|
||||||
bnc->nexthop_num = nhr->nexthop_num;
|
bnc->nexthop_num = nhr->nexthop_num;
|
||||||
|
|
||||||
/* notify bgp fsm if nbr ip goes from valid->invalid */
|
/* notify bgp fsm if nbr ip goes from valid->invalid */
|
||||||
|
Loading…
Reference in New Issue
Block a user