From cf4a44352f9d868e4ab16b09a2d7837cdd0ec311 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 18 Nov 2015 19:01:39 -0800 Subject: [PATCH] Allow no interfaces in network fingerprinter --- client/fingerprint/network.go | 7 ++++++- main.go | 0 2 files changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 main.go diff --git a/client/fingerprint/network.go b/client/fingerprint/network.go index 23ce44554..ad9fe2944 100644 --- a/client/fingerprint/network.go +++ b/client/fingerprint/network.go @@ -64,6 +64,11 @@ func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) return false, fmt.Errorf("Error while detecting network interface during fingerprinting: %v", err) } + // No interface could be found + if intf == nil { + return false, nil + } + if ip, err = f.ipAddress(intf); err != nil { return false, fmt.Errorf("Unable to find IP address of interface: %s, err: %v", intf.Name, err) } @@ -229,7 +234,7 @@ func (f *NetworkFingerprint) findInterface(deviceName string) (*net.Interface, e } if len(interfaces) == 0 { - return nil, errors.New("No network interfaces were detected") + return nil, nil } return &interfaces[0], nil } diff --git a/main.go b/main.go old mode 100644 new mode 100755