-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgpd: fix label lost when vrf loopback comes back #16403
Conversation
bgpd/bgp_mplsvpn.h
Outdated
/* should not happen */ | ||
if (!ifp) { | ||
if (pmsg) | ||
*pmsg = "loopback interface not defined"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loopback or vrf interface not defined
bgpd/bgp_mplsvpn.h
Outdated
*pmsg = "loopback interface not defined"; | ||
return 0; | ||
} | ||
if (!if_is_up(ifp)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (if_is_vrf(ifp) && !if_is_up(ifp))
we do not care of the default lo being down
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bgpd/bgp_mplsvpn.h
Outdated
} | ||
if (!if_is_up(ifp)) { | ||
if (pmsg) | ||
*pmsg = "loopback interface is down"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vrf interface is down
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no more needed
VRF-label association drops when the VRF loopback goes down, however, it does not return once the interface is enabled again. Logs show that when VRF loopback goes down, a label drop message is sent to zebra and immediately resent label installation to zebra, trigged by "vpn_leak_postchange_all()": 2024/07/16 13:26:29 BGP: [RVJ1J-J2T22] ifp down r1-cust1 vrf id 7 2024/07/16 13:26:29 BGP: [WA2QY-06STJ] vpn_leak_zebra_vrf_label_withdraw: deleting label for vrf VRF r1-cust1 (id=7) 2024/07/16 13:26:30 BGP: [S82AC-6YAC8] vpn_leak_zebra_vrf_label_update: vrf VRF r1-cust1: afi IPv4: setting label 80 for vrf id 7 Since the interface is down, the netlink message is not send to kernel. Once the interface comes back, zebra ignore the installation assuming the label is already seen. To fix this, add a check for the interface status before attempting to reinstall the label. Signed-off-by: Loïc Sang <[email protected]>
The up/down state of the lo loopback interface does not determine the availability of the default vrf-lite. Do not update leak label at lo loopback up/down change. Fixes: b45c5cd ("bgpd: update route leak when vrf state changes") Signed-off-by: Louis Scalbert <[email protected]> Signed-off-by: Loïc Sang <[email protected]>
cc31751
to
c21c597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
VRF-label association drops when the VRF loopback goes down, however, it does not return once the interface is enabled again.
Logs show that when VRF loopback goes down, a label drop message is sent to zebra and immediately resent label installation to zebra: 2024/07/16 13:26:29 BGP: [RVJ1J-J2T22] ifp down r1-cust1 vrf id 7 2024/07/16 13:26:29 BGP: [WA2QY-06STJ] vpn_leak_zebra_vrf_label_withdraw: deleting label for vrf VRF r1-cust1 (id=7) 2024/07/16 13:26:30 BGP: [S82AC-6YAC8] vpn_leak_zebra_vrf_label_update: vrf VRF r1-cust1: afi IPv4: setting label 80 for vrf id 7
Since the interface is down, the netlink message is not send to kernel. Once the interface comes back, zebra ignore the installation assuming the label is already seen.
To fix this, add a check for the interface status before attempting to reinstall the label.