mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 10:04:18 +00:00
Merge pull request #14963 from donaldsharp/bgp_nht_fix
bgpd: Ensure BGP does not stop monitoring nexthops
This commit is contained in:
commit
c659e1c349
@ -26,6 +26,8 @@ PREDECL_RBTREE_UNIQ(bgp_nexthop_cache);
|
|||||||
|
|
||||||
/* BGP nexthop cache value structure. */
|
/* BGP nexthop cache value structure. */
|
||||||
struct bgp_nexthop_cache {
|
struct bgp_nexthop_cache {
|
||||||
|
afi_t afi;
|
||||||
|
|
||||||
/* The ifindex of the outgoing interface *if* it's a v6 LL */
|
/* The ifindex of the outgoing interface *if* it's a v6 LL */
|
||||||
ifindex_t ifindex_ipv6_ll;
|
ifindex_t ifindex_ipv6_ll;
|
||||||
|
|
||||||
|
@ -386,6 +386,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
|
|||||||
bnc = bnc_find(tree, &p, srte_color, ifindex);
|
bnc = bnc_find(tree, &p, srte_color, ifindex);
|
||||||
if (!bnc) {
|
if (!bnc) {
|
||||||
bnc = bnc_new(tree, &p, srte_color, ifindex);
|
bnc = bnc_new(tree, &p, srte_color, ifindex);
|
||||||
|
bnc->afi = afi;
|
||||||
bnc->bgp = bgp_nexthop;
|
bnc->bgp = bgp_nexthop;
|
||||||
if (BGP_DEBUG(nht, NHT))
|
if (BGP_DEBUG(nht, NHT))
|
||||||
zlog_debug("Allocated bnc %pFX(%d)(%u)(%s) peer %p",
|
zlog_debug("Allocated bnc %pFX(%d)(%u)(%s) peer %p",
|
||||||
@ -1162,6 +1163,11 @@ static void register_zebra_rnh(struct bgp_nexthop_cache *bnc)
|
|||||||
*/
|
*/
|
||||||
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc)
|
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc)
|
||||||
{
|
{
|
||||||
|
struct bgp_nexthop_cache *import;
|
||||||
|
struct bgp_nexthop_cache *nexthop;
|
||||||
|
|
||||||
|
struct bgp *bgp = bnc->bgp;
|
||||||
|
|
||||||
/* Check if we have already registered */
|
/* Check if we have already registered */
|
||||||
if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
|
if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
|
||||||
return;
|
return;
|
||||||
@ -1171,6 +1177,19 @@ static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import = bnc_find(&bgp->import_check_table[bnc->afi], &bnc->prefix, 0,
|
||||||
|
0);
|
||||||
|
nexthop = bnc_find(&bgp->nexthop_cache_table[bnc->afi], &bnc->prefix, 0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this entry has both a import and a nexthop entry
|
||||||
|
* then let's not send the unregister quite as of yet
|
||||||
|
* wait until we only have 1 left
|
||||||
|
*/
|
||||||
|
if (import && nexthop)
|
||||||
|
return;
|
||||||
|
|
||||||
sendmsg_zebra_rnh(bnc, ZEBRA_NEXTHOP_UNREGISTER);
|
sendmsg_zebra_rnh(bnc, ZEBRA_NEXTHOP_UNREGISTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user