Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1676 from zhabinecho/fix-veth-arp-bug
Browse files Browse the repository at this point in the history
network: delete IP addrs on bridge model to prevent ARP conflict
  • Loading branch information
amshinde authored May 16, 2019
2 parents d4f4644 + bdb1047 commit 90539ac
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion virtcontainers/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,16 @@ func bridgeNetworkPair(endpoint Endpoint, queues int, disableVhostNet bool) erro
netPair.VirtIface.Name, netPair.Name, err)
}

// Clear the IP addresses from the veth interface to prevent ARP conflict
netPair.VirtIface.Addrs, err = netlink.AddrList(link, netlink.FAMILY_V4)
if err != nil {
return fmt.Errorf("Unable to obtain veth IP addresses: %s", err)
}

if err := clearIPs(link, netPair.VirtIface.Addrs); err != nil {
return fmt.Errorf("Unable to clear veth IP addresses: %s", err)
}

if err := netHandle.LinkSetUp(link); err != nil {
return fmt.Errorf("Could not enable veth %s: %s", netPair.VirtIface.Name, err)
}
Expand Down Expand Up @@ -1001,7 +1011,8 @@ func unBridgeNetworkPair(endpoint Endpoint) error {
return fmt.Errorf("Could not detach veth %s: %s", netPair.VirtIface.Name, err)
}

return nil
// Restore the IPs that were cleared
return setIPs(link, netPair.VirtIface.Addrs)
}

func removeTCFiltering(endpoint Endpoint) error {
Expand Down

0 comments on commit 90539ac

Please sign in to comment.