fix: fixed gateway regexp for macOS (closes #645)

This commit is contained in:
Simone Margaritelli 2019-11-11 17:27:42 +01:00
commit 9c3790764a
2 changed files with 4 additions and 5 deletions

View file

@ -25,7 +25,7 @@ func FindGateway(iface *Endpoint) (*Endpoint, error) {
for _, line := range strings.Split(output, "\n") {
if line = str.Trim(line); strings.Contains(line, ifName) {
m := IPv4RouteParser.FindStringSubmatch(line)
if len(m) == IPv4RouteTokens {
if len(m) >= IPv4RouteTokens {
Debug("FindGateway(%s) line '%s' matched with %v", iface.Name(), line, m)
return IPv4RouteIsGateway(ifName, m, func(gateway string) (*Endpoint, error) {
if gateway == iface.IpAddress {