From 2861fcffcacd38b64ff5b835a00aa25a3e249a8f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 14 May 2019 13:08:28 +0200 Subject: service: skip routes for interfaces that aren't up Signed-off-by: Jason A. Donenfeld --- service/ifaceconfig.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'service') diff --git a/service/ifaceconfig.go b/service/ifaceconfig.go index fe57873b..87afe90c 100644 --- a/service/ifaceconfig.go +++ b/service/ifaceconfig.go @@ -33,6 +33,11 @@ func bindSocketRoute(family winipcfg.AddressFamily, device *device.Device, ourLu if route.DestinationPrefix.PrefixLength != 0 || route.InterfaceLuid == ourLuid { continue } + ifrow, err := winipcfg.GetIfRow(route.InterfaceLuid, winipcfg.MibIfEntryNormalWithoutStatistics) + if err != nil || ifrow.OperStatus != winipcfg.IfOperStatusUp { + log.Printf("Found default route for interface %d, but not up, so skipping", route.InterfaceIndex) + continue + } if route.Metric < lowestMetric { lowestMetric = route.Metric index = route.InterfaceIndex -- cgit v1.2.3-59-g8ed1b