File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ package main
55
66import (
77 "fmt"
8+ "os"
89
910 "github.com/containernetworking/plugins/pkg/ns"
1011 "github.com/containernetworking/plugins/pkg/utils/sysctl"
@@ -19,10 +20,18 @@ func sysctlEnableIPv6(nsPath string) error {
1920 name := fmt .Sprintf ("net.ipv6.conf.%s.disable_ipv6" , conf )
2021 value , err := sysctl .Sysctl (name )
2122 if err != nil {
23+ if os .IsNotExist (err ) {
24+ // The sysctl variable doesn't exist, so we can't set it
25+ continue
26+ }
2227 return fmt .Errorf ("failed to get sysctl variable %s: %w" , name , err )
2328 }
2429 if value != "0" {
2530 if _ , err = sysctl .Sysctl (name , "0" ); err != nil {
31+ if os .IsPermission (err ) {
32+ // We don't have permission to set the sysctl variable, so we can't set it
33+ continue
34+ }
2635 return fmt .Errorf ("failed to set sysctl variable %s to 0: %w" , name , err )
2736 }
2837 }
You can’t perform that action at this time.
0 commit comments