Skip to content

zebra: fix upon detach vxlan interface, bridge present in zevpn ctx - #236

Open
mwinter-osr wants to merge 1 commit into
opensourcerouting:masterfrom
mwinter-osr:PR20974
Open

mwinter-osr wants to merge 1 commit into
opensourcerouting:masterfrom
mwinter-osr:PR20974

Conversation

@mwinter-osr

Copy link
Copy Markdown
Member

In an evpn context, when detaching a vxlan interface from a bridged interface, then the context remains with the bridged interface:

ip link set dev vxlan101 nomaster
[..]
PE1# show evpn vni
VNI Type VxLAN IF # MACs # ARPs # Remote VTEPs Tenant VRF VLAN BRIDGE
101 L2 vxlan101 0 0 0 default 1 br101

Fix this by removing the bridge pointer.

Fixes: b7cfce9 ("zebra, lib: zebra changes for symmetric routing support")

Original PR20974 by lsang6WIND

In an evpn context, when detaching a vxlan interface from a bridged
interface, then the context remains with the bridged interface:

> ip link set dev vxlan101 nomaster
> [..]
> PE1# show evpn vni
> VNI        Type VxLAN IF              # MACs   # ARPs   # Remote VTEPs  Tenant VRF      VLAN       BRIDGE
> 101        L2   vxlan101              0        0        0               default         1          br101

Fix this by removing the bridge pointer.

Fixes: b7cfce9 ("zebra, lib: zebra changes for symmetric routing support")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Loïc Sang <loic.sang@6wind.com>
@greptile-apps

greptile-apps Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Greptile Summary

Adds a single-line fix — zevpn_bridge_if_set(zevpn, zevpn->bridge_if, false) — in the L2-VNI "removed from bridge" branch of zebra_vxlan_if_update_vni(), preventing a stale bridge_if pointer in the EVPN context after ip link set dev vxlan101 nomaster.

  • P0 — missing topotest: No regression test is included. The scenario is fully reproducible and must have a topotest (per FRR policy) before merging.
  • P2 — L3-VNI same bug unfixed: The symmetric early-return path for L3-VNI (line 248) omits the equivalent zl3vni_bridge_if_set(..., false) call, leaving zl3vni->bridge_if stale after detach.

Confidence Score: 4/5

  • The one-line fix is correct and minimal, but mandatory FRR policy requires a topotest before merging — do not merge without one.
  • Score is 4 rather than 5 because of the P0 missing topotest finding. The code change itself is correct, targeted, and consistent with the same pattern used in zebra_evpn_vxlan_del(). The P2 L3-VNI gap is pre-existing and does not block this fix.
  • zebra/zebra_vxlan_if.c — specifically the L3-VNI early-return path at line 246–249 which has the same unfixed stale-bridge-pointer issue.

Important Files Changed

Filename Overview
zebra/zebra_vxlan_if.c Adds one-line fix clearing zevpn->bridge_if in the L2-VNI "removed from bridge" update path; analogous L3-VNI path (line 248) has the same unfixed gap, and no topotest accompanies the fix.

Sequence Diagram

sequenceDiagram
    participant Kernel as Linux Kernel
    participant ZIF as zebra_vxlan_if.c
    participant ZEVPN as zevpn (L2-VNI ctx)
    participant BGP as BGP Client

    Note over Kernel,BGP: ip link set dev vxlan101 nomaster
    Kernel->>ZIF: "netlink MASTER_CHANGE (bridge_ifindex=IFINDEX_INTERNAL)"
    ZIF->>ZIF: "zebra_vxlan_if_update_vni()<br/>chgflags has ZEBRA_VXLIF_MASTER_CHANGE"

    Note over ZIF: L2-VNI path (BEFORE fix)
    ZIF->>ZEVPN: "svi_if = NULL"
    ZIF->>BGP: zebra_evpn_send_del_to_client()
    ZIF->>ZEVPN: neigh/mac/vtep del_all()
    Note over ZEVPN: bridge_if still points to br101 ← stale!
    ZIF->>ZIF: return 0

    Note over ZIF: L2-VNI path (AFTER fix — this PR)
    ZIF->>ZEVPN: "svi_if = NULL"
    ZIF->>BGP: zebra_evpn_send_del_to_client()
    ZIF->>ZEVPN: neigh/mac/vtep del_all()
    ZIF->>ZEVPN: "zevpn_bridge_if_set(false) → bridge_if = NULL ✓"
    ZIF->>ZIF: return 0
Loading

Comments Outside Diff (1)

  1. zebra/zebra_vxlan_if.c, line 246-249 (link)

    P2 L3-VNI path has the same stale-bridge-pointer bug

    The symmetric L3-VNI "removed from bridge" early-return path only calls zebra_vxlan_process_l3vni_oper_down() and returns without clearing zl3vni->bridge_if. After ip link set dev <vxlan> nomaster on an L3-VNI interface, show evpn vni detail will still display the stale bridge name — the identical symptom this PR fixes for L2-VNI. The fix pattern is already established:

    		if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE) &&
    		    (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
    			zebra_vxlan_process_l3vni_oper_down(zl3vni);
    			zl3vni_bridge_if_set(zl3vni, zl3vni->bridge_if, false /* unset */);
    			return 0;
    		}
    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: zebra/zebra_vxlan_if.c
    Line: 246-249
    
    Comment:
    **L3-VNI path has the same stale-bridge-pointer bug**
    
    The symmetric L3-VNI "removed from bridge" early-return path only calls `zebra_vxlan_process_l3vni_oper_down()` and returns without clearing `zl3vni->bridge_if`. After `ip link set dev <vxlan> nomaster` on an L3-VNI interface, `show evpn vni detail` will still display the stale bridge name — the identical symptom this PR fixes for L2-VNI. The fix pattern is already established:
    
    ```c
    		if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE) &&
    		    (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
    			zebra_vxlan_process_l3vni_oper_down(zl3vni);
    			zl3vni_bridge_if_set(zl3vni, zl3vni->bridge_if, false /* unset */);
    			return 0;
    		}
    ```
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: zebra/zebra_vxlan_if.c
Line: 330-331

Comment:
**No topotest for the fixed scenario**

This bug is fully reproducible with `ip link set dev vxlan101 nomaster` in an EVPN context, yet no topotest is added to prevent regression. Per FRR policy, every bug fix must be accompanied by a topotest. The existing EVPN topotest suites (`bgp_evpn_mh`, `bgp_evpn_vxlan_topo1`) would be natural homes for a test that attaches, verifies the bridge pointer, detaches, and verifies `show evpn vni` shows no BRIDGE field.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: zebra/zebra_vxlan_if.c
Line: 246-249

Comment:
**L3-VNI path has the same stale-bridge-pointer bug**

The symmetric L3-VNI "removed from bridge" early-return path only calls `zebra_vxlan_process_l3vni_oper_down()` and returns without clearing `zl3vni->bridge_if`. After `ip link set dev <vxlan> nomaster` on an L3-VNI interface, `show evpn vni detail` will still display the stale bridge name — the identical symptom this PR fixes for L2-VNI. The fix pattern is already established:

```c
		if (CHECK_FLAG(chgflags, ZEBRA_VXLIF_MASTER_CHANGE) &&
		    (zif->brslave_info.bridge_ifindex == IFINDEX_INTERNAL)) {
			zebra_vxlan_process_l3vni_oper_down(zl3vni);
			zl3vni_bridge_if_set(zl3vni, zl3vni->bridge_if, false /* unset */);
			return 0;
		}
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "zebra: fix upon detach vxlan interface, ..." | Re-trigger Greptile

Comment thread zebra/zebra_vxlan_if.c
Comment on lines +330 to 331
zevpn_bridge_if_set(zevpn, zevpn->bridge_if, false /* unset */);
return 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 No topotest for the fixed scenario

This bug is fully reproducible with ip link set dev vxlan101 nomaster in an EVPN context, yet no topotest is added to prevent regression. Per FRR policy, every bug fix must be accompanied by a topotest. The existing EVPN topotest suites (bgp_evpn_mh, bgp_evpn_vxlan_topo1) would be natural homes for a test that attaches, verifies the bridge pointer, detaches, and verifies show evpn vni shows no BRIDGE field.

Prompt To Fix With AI
This is a comment left during a code review.
Path: zebra/zebra_vxlan_if.c
Line: 330-331

Comment:
**No topotest for the fixed scenario**

This bug is fully reproducible with `ip link set dev vxlan101 nomaster` in an EVPN context, yet no topotest is added to prevent regression. Per FRR policy, every bug fix must be accompanied by a topotest. The existing EVPN topotest suites (`bgp_evpn_mh`, `bgp_evpn_vxlan_topo1`) would be natural homes for a test that attaches, verifies the bridge pointer, detaches, and verifies `show evpn vni` shows no BRIDGE field.

How can I resolve this? If you propose a fix, please make it concise.

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.

2 participants