Merge pull request #8486 from hashicorp/b-node-network-devices-1

honor config.NetworkInterface in NodeNetworks
This commit is contained in:
Mahmood Ali 2020-07-22 10:44:28 -04:00 committed by GitHub
commit a1e31c78fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,13 +235,17 @@ func deriveAddressAlias(iface net.Interface, addr net.IP, config *config.Config)
}
}
ri, err := sockaddr.NewRouteInfo()
if err == nil {
if config.NetworkInterface != "" {
if config.NetworkInterface == iface.Name {
return "default"
}
} else if ri, err := sockaddr.NewRouteInfo(); err == nil {
defaultIface, err := ri.GetDefaultInterfaceName()
if err == nil && iface.Name == defaultIface {
return "default"
}
}
return ""
}