Skip to content

Fix: Activate VRF IGP interface only when there are viable neighbors#2524

Merged
ipspace merged 1 commit intodevfrom
igp-vrf-active
Jul 12, 2025
Merged

Fix: Activate VRF IGP interface only when there are viable neighbors#2524
ipspace merged 1 commit intodevfrom
igp-vrf-active

Conversation

@ipspace
Copy link
Owner

@ipspace ipspace commented Jul 10, 2025

The original VRF IGP code checked whether the IGP should be active in the VRF based on whether adjacent nodes were running the same IGP, but not whether they could form an IGP adjacency with the node.

This fix is not perfect, but better than the original -- when checking whether a neighbor is a viable IGP neighbor, it checks not just the IGP module (for example, are both running OSPF), but also whether the two devices have any AF in common on the shared link. That results in IGP not being run between a router connected to a switch with L2-only VLAN (but might still result in IGP being active if the switch has an IP address but does not run IGP in that VRF).

The relevant transformation test was modified to:

  • Run OSPF in the underlay
  • Put VLANs into a VRF on the router-on-a-stick (to trigger the VRF interface migration code)
  • Have a single OSPF router in the overlay (the original test had two routers, so we'd always get OSPF adjacencies).

Fixes #2275 (mostly, without going into too many edge cases)

The original VRF IGP code checked whether the IGP should be active in
the VRF based on whether adjacent nodes were running the same IGP, but
not whether they could form an IGP adjacency with the node.

This fix is not perfect, but better than the original -- when checking
whether a neighbor is a viable IGP neighbor, it checks not just the
IGP module (for example, are both running OSPF), but also whether the
two devices have any AF in common on the shared link. That results in
IGP not being run between a router connected to a switch with L2-only
VLAN (but might still result in IGP being active if the switch has
an IP address but does not run IGP in that VRF).

The relevant transformation test was modified to:

* Run OSPF in the underlay
* Put VLANs into a VRF on the router-on-a-stick (to trigger the
  VRF interface migration code)
* Have a single OSPF router in the overlay (the original test had
  two routers, so we'd always get OSPF adjacencies).

Fixes #2275 (mostly, without going into too many edge cases)
@ipspace ipspace requested a review from jbemmel July 10, 2025 14:15
node.vrfs[l.vrf][proto].active = True
for af in ['ipv4','ipv6']: # ... and has at least one AF in common
if af in l and af in neighbor: # ... with our interface
node.vrfs[l.vrf][proto].active = True # Found one? Let's keep the routing protocol active
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we track this by address family? OSPFv2 and OSPFv3 are not the same thing...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can break the outer for loop once the flag has been set

Copy link
Owner Author

Choose a reason for hiding this comment

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

Should we track this by address family? OSPFv2 and OSPFv3 are not the same thing...

The address families are tracked elsewhere (based on what is configured on global/VRF interfaces). Here, we're just checking whether there's an AF match between current device and its neighbors.

However, the "for" loop could be rewritten as "for af in ...[proto].af" if the af dictionary is already set at that moment. Thanks for the suggestion: have to check...

Copy link
Owner Author

Choose a reason for hiding this comment

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

Update: the VRF proto.af data is not set, so it cannot be used here. We might fix this bit if we ever implement #2398.

Copy link
Collaborator

@jbemmel jbemmel left a comment

Choose a reason for hiding this comment

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

minor question

@ipspace ipspace merged commit 6dd866a into dev Jul 12, 2025
11 checks passed
@ipspace ipspace deleted the igp-vrf-active branch July 12, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OSPF is activated in VXLAN-backed VRF with no OSPF neighbors

2 participants