Explorar o código

Updated handling of disable_ipv6 file

Signed-off-by: Jim Carroll <jim.carroll@docker.com>
Jim Carroll %!s(int64=7) %!d(string=hai) anos
pai
achega
9da8e04c70
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      libnetwork/osl/namespace_linux.go

+ 9 - 0
libnetwork/osl/namespace_linux.go

@@ -616,6 +616,15 @@ func reexecSetIPv6() {
 		value = byte('0')
 	}
 
+	if _, err := os.Stat(path); err != nil {
+		if os.IsNotExist(err) {
+			logrus.Warnf("file does not exist: %s : %v Has IPv6 been disabled in this node's kernel?", path, err)
+			os.Exit(0)
+		}
+		logrus.Errorf("failed to stat %s : %v", path, err)
+		os.Exit(5)
+	}
+
 	if err = ioutil.WriteFile(path, []byte{value, '\n'}, 0644); err != nil {
 		logrus.Errorf("failed to %s IPv6 forwarding for container's interface %s: %v", action, os.Args[2], err)
 		os.Exit(4)