Use netlink instead of shelling out to weave docker-bridge-ip

This commit is contained in:
Adam Harrison committed 2016-02-04 14:00:01 +00:00
1 parent 1d3c80ab49
commit e2ec2b436d
3 files changed
+16 -7

No files matched your search

-1
View File
@@ -36,7 +36,6 @@ func callWeave(args ...string) ([]byte, []byte, error) {
}
}
propagateEnv("DOCKER_BRIDGE")
propagateEnv("DOCKER_HOST")
// Propagate WEAVE_DEBUG, to make debugging easier.
+7 -3
View File
@@ -61,6 +61,7 @@ type Config struct {
Version string
WithoutDNS bool
NoMulticastRoute bool
DockerBridge string
DockerHost string
ProcPath string
}
@@ -151,11 +152,14 @@ func NewProxy(c Config) (*Proxy, error) {
p.client = client.Client
if !p.WithoutDNS {
dockerBridgeIP, stderr, err := callWeave("docker-bridge-ip")
netDevs, err := GetBridgeNetDev(c.ProcPath, c.DockerBridge)
if err != nil {
return nil, fmt.Errorf(string(stderr))
return nil, err
}
p.dockerBridgeIP = string(dockerBridgeIP)
if len(netDevs) != 1 || len(netDevs[0].CIDRs) != 1 {
return nil, fmt.Errorf("Could not obtain address of %s", c.DockerBridge)
}
p.dockerBridgeIP = netDevs[0].CIDRs[0].IP.String()
}
p.hostnameMatchRegexp, err = regexp.Compile(c.HostnameMatch)