Skip to content
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

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

lsang6WIND
Copy link

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.

/* should not happen */
if (!ifp) {
if (pmsg)
*pmsg = "loopback interface not defined";
Copy link
Contributor

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

*pmsg = "loopback interface not defined";
return 0;
}
if (!if_is_up(ifp)) {
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
if (!if_is_up(ifp)) {
if (pmsg)
*pmsg = "loopback interface is down";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vrf interface is down

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more needed

Loïc Sang added 2 commits July 17, 2024 15:41
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]>
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@riw777 riw777 merged commit ea5498e into FRRouting:master Jul 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants