Преглед на файлове

Merge pull request #756 from mgleung/fix-iface-regex

Fix a bug with the iface-regex that always returned an error
Tom Denham преди 7 години
родител
ревизия
67a6cee4ba
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      main.go

+ 4 - 1
main.go

@@ -374,7 +374,10 @@ func LookupExtIface(ifname string, ifregex string) (*backend.ExternalInterface,
 			}
 		}
 
-		return nil, fmt.Errorf("Could not match pattern %s to any of the available network interfaces", ifregex)
+		// Check that nothing was matched
+		if iface == nil {
+			return nil, fmt.Errorf("Could not match pattern %s to any of the available network interfaces", ifregex)
+		}
 	} else {
 		log.Info("Determining IP address of default interface")
 		if iface, err = ip.GetDefaultGatewayIface(); err != nil {