Explorar o código

Merge pull request #5457 from tiborvass/5423-bridge-ip

Fix bridge ip comparison
Michael Crosby %!s(int64=11) %!d(string=hai) anos
pai
achega
20bcb80f40
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      daemon/networkdriver/bridge/driver.go

+ 6 - 2
daemon/networkdriver/bridge/driver.go

@@ -97,8 +97,12 @@ func InitDriver(job *engine.Job) engine.Status {
 		network = addr.(*net.IPNet)
 		// validate that the bridge ip matches the ip specified by BridgeIP
 		if bridgeIP != "" {
-			if !network.IP.Equal(net.ParseIP(bridgeIP)) {
-				return job.Errorf("bridge ip (%s) does not match existing bridge configuration %s", network.IP, bridgeIP)
+			bip, _, err := net.ParseCIDR(bridgeIP)
+			if err != nil {
+				return job.Error(err)
+			}
+			if !network.IP.Equal(bip) {
+				return job.Errorf("bridge ip (%s) does not match existing bridge configuration %s", network.IP, bip)
 			}
 		}
 	}