Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Replace '.' with '/' on sysctl interface names #9

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion macvtap.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"net"
"runtime"
"strings"

"github.com/vishvananda/netlink"

Expand Down Expand Up @@ -181,8 +182,11 @@ func createMacvtap(conf *NetConf, ifName string, netns ns.NetNS) (*current.Inter

func configureArp(macvtapConfig netlink.Link, netns ns.NetNS) error {
err := netns.Do(func(_ ns.NetNS) error {
// For sysctl, dots are replaced with forward slashes
name := strings.Replace(macvtapConfig.Attrs().Name, ".", "/", -1)

// TODO: duplicate following lines for ipv6 support, when it will be added in other places
ipv4SysctlValueName := fmt.Sprintf(IPv4InterfaceArpProxySysctlTemplate, macvtapConfig.Attrs().Name)
ipv4SysctlValueName := fmt.Sprintf(IPv4InterfaceArpProxySysctlTemplate, name)
if _, err := sysctl.Sysctl(ipv4SysctlValueName, "1"); err != nil {
// remove the newly added link and ignore errors, because we already are in a failed state
_ = netlink.LinkDel(macvtapConfig)
Expand Down