Skip to content

Commit

Permalink
move GetDefaultInterfaceName call
Browse files Browse the repository at this point in the history
  • Loading branch information
wjordan committed Dec 17, 2022
1 parent 301fd49 commit a4d0480
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client/fingerprint/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ func (f *NetworkFingerprint) Fingerprint(req *FingerprintRequest, resp *Fingerpr

func (f *NetworkFingerprint) createNodeNetworkResources(ifaces []net.Interface, disallowLinkLocal bool, conf *config.Config) ([]*structs.NodeNetworkResource, error) {
nets := make([]*structs.NodeNetworkResource, 0)
ri, err := sockaddr.NewRouteInfo()
if err != nil {
return nil, err
}
defaultIface, err := ri.GetDefaultInterfaceName()
if err != nil {
return nil, err
}
for _, iface := range ifaces {
speed := f.linkSpeed(iface.Name)
if speed == 0 {
Expand All @@ -152,14 +160,6 @@ func (f *NetworkFingerprint) createNodeNetworkResources(ifaces []net.Interface,
return nil, err
}
var networkAddrs, linkLocalAddrs []structs.NodeNetworkAddress
ri, err := sockaddr.NewRouteInfo()
if err != nil {
return nil, err
}
defaultIface, err := ri.GetDefaultInterfaceName()
if err != nil {
return nil, err
}
for _, addr := range addrs {
// Find the IP Addr and the CIDR from the Address
var ip net.IP
Expand Down

0 comments on commit a4d0480

Please sign in to comment.