Created
January 20, 2014 14:27
-
-
Save goldmann/8520776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/network.go b/network.go | |
index 22ea8ba..d4cbabd 100644 | |
--- a/network.go | |
+++ b/network.go | |
@@ -10,6 +10,7 @@ import ( | |
"github.com/dotcloud/docker/utils" | |
"log" | |
"net" | |
+ "os/exec" | |
"strconv" | |
"sync" | |
"syscall" | |
@@ -466,8 +467,14 @@ func (alloc *IPAllocator) run() { | |
} | |
if _, inUse = alloc.inUse[newNum]; !inUse { | |
- // We found an unused IP | |
- break | |
+ _, err := exec.Command("arping", "-f", "-c", "1", "-q", "-I", "docker0", intToIP(newNum).String()).Output() | |
+ if err != nil { | |
+ // We found an unused IP | |
+ break | |
+ } else { | |
+ // Address is already used by some other host on network | |
+ continue | |
+ } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment