From 9191193d594bbd8eb7277a0cde5dde9a9451b04e Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 28 Sep 2023 17:59:22 +0200 Subject: [PATCH] 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: ddb5b4880ba8 ("bgpd: vpn-vrf route leaking") Signed-off-by: Philippe Guibert --- bgpd/bgp_mplsvpn.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 7d416cc48236..fde6ac01d218 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1903,14 +1903,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