Merge pull request #585 from dverbeir/ipam_sysctl_dot

pkg/ipam: convert dots to slashes in interface names for sysctl
This commit is contained in:
Piotr Skamruk 2021-02-24 17:37:47 +01:00 committed by GitHub
commit 47927f5084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,8 @@ import (
) )
const ( const (
DisableIPv6SysctlTemplate = "net.ipv6.conf.%s.disable_ipv6" // Note: use slash as separator so we can have dots in interface name (VLANs)
DisableIPv6SysctlTemplate = "net/ipv6/conf/%s/disable_ipv6"
) )
// ConfigureIface takes the result of IPAM plugin and // ConfigureIface takes the result of IPAM plugin and
@ -68,8 +69,11 @@ func ConfigureIface(ifName string, res *current.Result) error {
// Read current sysctl value // Read current sysctl value
value, err := sysctl.Sysctl(ipv6SysctlValueName) value, err := sysctl.Sysctl(ipv6SysctlValueName)
if err != nil || value == "0" { if err != nil {
// FIXME: log warning if unable to read sysctl value fmt.Fprintf(os.Stderr, "ipam_linux: failed to read sysctl %q: %v\n", ipv6SysctlValueName, err)
continue
}
if value == "0" {
continue continue
} }