bgpd: fix bgp node created at withdraw event

The prefixes unexportation triggers an attempt to create
the VPN prefix node if that prefix was not already present.

For instance, if a given prefix is not exported because of
a route-map filtering, the withdraw process will try to
create the node with the 'bgp_afi_node_get()' command.

Fix this by replacing this call by the 'bgp_safi_node_lookup()'
function.

Fixes: ddb5b4880b ("bgpd: vpn-vrf route leaking")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2023-09-28 17:59:22 +02:00
parent e746985295
commit b43ea569d9

View File

@ -1904,14 +1904,14 @@ void vpn_leak_from_vrf_withdraw(struct bgp *to_bgp, /* to */
return;
}
if (debug)
zlog_debug("%s: withdrawing (path_vrf=%p)", __func__, path_vrf);
bn = bgp_afi_node_get(to_bgp->rib[afi][safi], afi, safi, p,
&(from_bgp->vpn_policy[afi].tovpn_rd));
bn = bgp_safi_node_lookup(to_bgp->rib[afi][safi], safi, p,
&(from_bgp->vpn_policy[afi].tovpn_rd));
if (!bn)
return;
if (debug)
zlog_debug("%s: withdrawing (path_vrf=%p)", __func__, path_vrf);
/*
* vrf -> vpn
* match original bpi imported from