aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/ifaceconfig.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 13:08:28 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 13:08:28 +0200
commit2861fcffcacd38b64ff5b835a00aa25a3e249a8f (patch)
tree8fcfe910925c2a1c778cc952851a9732ad02e412 /service/ifaceconfig.go
parentui: at least try to make a tray on server core (diff)
downloadwireguard-windows-2861fcffcacd38b64ff5b835a00aa25a3e249a8f.tar.xz
wireguard-windows-2861fcffcacd38b64ff5b835a00aa25a3e249a8f.zip
service: skip routes for interfaces that aren't up
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'service/ifaceconfig.go')
-rw-r--r--service/ifaceconfig.go5
1 files changed, 5 insertions, 0 deletions
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