pkg/mesh: ignore CNI IP from private IPs

We need to ignore the CNI IP address from the searched IPs, as this will
not be a routable IP address.
This commit is contained in:
Lucas Servén Marín
2019-05-13 17:35:05 +02:00
parent 8ed1b549d1
commit d7ad946ff4
3 changed files with 60 additions and 9 deletions

View File

@@ -234,7 +234,11 @@ func New(backend Backend, encapsulate Encapsulate, granularity Granularity, host
if err := ioutil.WriteFile(PrivateKeyPath, private, 0600); err != nil {
return nil, fmt.Errorf("failed to write private key to disk: %v", err)
}
privateIP, publicIP, err := getIP(hostname)
cniIndex, err := cniDeviceIndex()
if err != nil {
return nil, fmt.Errorf("failed to query netlink for CNI device: %v", err)
}
privateIP, publicIP, err := getIP(hostname, cniIndex)
if err != nil {
return nil, fmt.Errorf("failed to find public IP: %v", err)
}