The macvlan is initially created in a separate network namespaceand the sysctl must be set in that namespace too.Fixes #208.
The macvlan is initially created in a separate network namespace and the sysctl must be set in that namespace too. Fixes #208.
This commit is contained in:
commit
72e98b97d6
@ -106,6 +106,7 @@ func createMacvlan(conf *NetConf, ifName string, netns *os.File) error {
|
||||
return fmt.Errorf("failed to create macvlan: %v", err)
|
||||
}
|
||||
|
||||
return ns.WithNetNS(netns, false, func(_ *os.File) error {
|
||||
// TODO: duplicate following lines for ipv6 support, when it will be added in other places
|
||||
ipv4SysctlValueName := fmt.Sprintf(IPv4InterfaceArpProxySysctlTemplate, tmpName)
|
||||
if _, err := sysctl.Sysctl(ipv4SysctlValueName, "1"); err != nil {
|
||||
@ -114,9 +115,9 @@ func createMacvlan(conf *NetConf, ifName string, netns *os.File) error {
|
||||
return fmt.Errorf("failed to set proxy_arp on newly added interface %q: %v", tmpName, err)
|
||||
}
|
||||
|
||||
return ns.WithNetNS(netns, false, func(_ *os.File) error {
|
||||
err := renameLink(tmpName, ifName)
|
||||
if err != nil {
|
||||
_ = netlink.LinkDel(mv)
|
||||
return fmt.Errorf("failed to rename macvlan to %q: %v", ifName, err)
|
||||
}
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user