honor config.NetworkInterface in NodeNetworks

This commit is contained in:
Mahmood Ali 2020-07-21 15:40:41 -04:00
parent 59d8f7acce
commit 91ba9ccefe
1 changed files with 6 additions and 2 deletions

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 ""
}