Skip to content

Commit 430fdae

Browse files
committed
fix
1 parent 6f067ef commit 430fdae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

network/cni/config_linux.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ func bridgeTapInNS(ifName, brName, tapName string) error {
102102
if masterErr := netlink.LinkSetMaster(link, brLink); masterErr != nil {
103103
return fmt.Errorf("set %s master %s: %w", ifName, brName, masterErr)
104104
}
105+
// Disable MAC learning on the uplink (eth0) port. Without this, frames
106+
// from tap0 traverse br0 → eth0 → cni0 and bounce back via eth0, causing
107+
// br0 to learn the guest MAC on the eth0 port instead of tap0. ARP replies
108+
// then get forwarded to eth0 (back to cni0) instead of tap0 (to the guest).
109+
if learnErr := netlink.LinkSetLearning(link, false); learnErr != nil {
110+
return fmt.Errorf("set %s learning off: %w", ifName, learnErr)
111+
}
105112
if masterErr := netlink.LinkSetMaster(tapLink, brLink); masterErr != nil {
106113
return fmt.Errorf("set %s master %s: %w", tapName, brName, masterErr)
107114
}

0 commit comments

Comments
 (0)