Conversation
Greptile SummaryThis PR fixes a bug in
Confidence Score: 5/5Safe to merge — the change is a narrow, well-placed guard that prevents stale NHGs from being reinstalled during VRF migration, with no impact on the normal reinstall path. The fix is a single conditional inserted before the activation and kernel-install logic in No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant K as Kernel
participant Z as Zebra
participant NHG as NHG Table
Note over K,NHG: Interface migrates from VRF A → VRF B
K->>Z: NETLINK: interface nomaster (leaves VRF A)
Z->>Z: zebra_interface_nhg_reinstall(ifp)
loop nhg_dependents walk
Z->>NHG: "Check nhe->nhg.nexthop->vrf_id"
alt "vrf_id != ifp->vrf->vrf_id (stale old-VRF NHG)"
Z-->>Z: skip (new guard) ✓
else "vrf_id == ifp->vrf->vrf_id (current VRF)"
Z->>Z: SET NEXTHOP_FLAG_ACTIVE
Z->>Z: zebra_nhg_set_valid_if_active()
Z->>K: zebra_nhg_install_kernel()
end
end
Reviews (3): Last reviewed commit: "tests: verify stale NHGs stay inactive a..." | Re-trigger Greptile |
|
can you outline a sequence of events in a topotest that shows this problem to me? I would like to understand it a bit better. |
|
Updated, please help reivew it. Thanks @donaldsharp |
|
@Mergifyio rebase |
❌ Unable to rebase: Mergify can't impersonate
|
6c3fa2e to
25a24d3
Compare
|
@donaldsharp |
|
@donaldsharp can you take a look at it? any comment? thanks :-) |
When an interface migrates between VRFs, `zebra_interface_nhg_reinstall()` iterates all NHGs in the interface's zif->nhg_dependents tree and reinstalls them. However, the interface's nhg_dependents tree still contains singleton NHGs created while the interface belonged to the previous VRF. `zebra_interface_nhg_reinstall()` MAYBE blindly re-activate and reinstall these stale NHGs. Zebra keeps an installed or queued nexthop entry alive for a short period after its last route reference is removed. When the interface moves to another VRF at this short period, the down path clears the entry's VALID/INSTALLED state. The following up path calls `zebra_interface_nhg_reinstall()`, which reinstalls all entries still attached to that interface. Just skip the NHGs whose nexthop belongs to a different VRF than the interface's current VRF, which should remain inactive until their keep-around timer expires. Signed-off-by: anlan_cs <anlan_cs@126.com>
The test records the route's nexthop-group ID. It then withdraws the route and immediately moves the interface to the default VRF. At this point the old nexthop entry should not be installed after the interface VRF change. Signed-off-by: anlan_cs <anlan_cs@126.com>
0c55685 to
4fb3b4f
Compare
|
Rebase it... |
|
Let's give this a try @Mergifyio rebase |
When an interface migrates between VRFs,
zebra_interface_nhg_reinstall()iterates all NHGs in the interface's zif->nhg_dependents tree and reinstalls them. However, the interface's nhg_dependents tree still contains singleton NHGs created while the interface belonged to the previous VRF.zebra_interface_nhg_reinstall()MAYBE blindly re-activate and reinstall these stale NHGs.Please check the commit log for details.