Merge pull request #16403 from lsang6WIND/vpn_leak_label

bgpd: fix label lost when vrf loopback comes back
This commit is contained in:
Russ White 2024-07-23 10:54:12 -04:00 committed by GitHub
commit ea5498ec5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -280,7 +280,8 @@ done:
*
* Sending this vrf-label association is qualified by a) whether vrf->vpn
* exporting is active ("export vpn" is enabled, vpn-policy RD and RT list
* are set) and b) whether vpn-policy label is set.
* are set), b) whether vpn-policy label is set and c) the vrf loopback
* interface is up.
*
* If any of these conditions do not hold, then we send MPLS_LABEL_NONE
* for this vrf, which zebra interprets to mean "delete this vrf-label
@ -288,6 +289,7 @@ done:
*/
void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi)
{
struct interface *ifp;
mpls_label_t label = MPLS_LABEL_NONE;
int debug = BGP_DEBUG(vpn, VPN_LEAK_LABEL);
@ -301,7 +303,9 @@ void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi)
}
if (vpn_leak_to_vpn_active(bgp, afi, NULL, false)) {
label = bgp->vpn_policy[afi].tovpn_label;
ifp = if_get_vrf_loopback(bgp->vrf_id);
if (ifp && if_is_vrf(ifp) && if_is_up(ifp))
label = bgp->vpn_policy[afi].tovpn_label;
}
if (debug) {

View File

@ -234,7 +234,7 @@ static int bgp_ifp_up(struct interface *ifp)
hook_call(bgp_vrf_status_changed, bgp, ifp);
bgp_nht_ifp_up(ifp);
if (bgp_get_default() && if_is_loopback(ifp)) {
if (bgp_get_default() && if_is_vrf(ifp)) {
vpn_leak_zebra_vrf_label_update(bgp, AFI_IP);
vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6);
vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP);
@ -289,7 +289,7 @@ static int bgp_ifp_down(struct interface *ifp)
hook_call(bgp_vrf_status_changed, bgp, ifp);
bgp_nht_ifp_down(ifp);
if (bgp_get_default() && if_is_loopback(ifp)) {
if (bgp_get_default() && if_is_vrf(ifp)) {
vpn_leak_zebra_vrf_label_withdraw(bgp, AFI_IP);
vpn_leak_zebra_vrf_label_withdraw(bgp, AFI_IP6);
vpn_leak_zebra_vrf_sid_withdraw(bgp, AFI_IP);