diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-14 13:08:28 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-14 13:08:28 +0200 |
commit | c621e46a4f08a9fea78e579b2a2f1b6505828e06 (patch) | |
tree | 8fcfe910925c2a1c778cc952851a9732ad02e412 /service/ifaceconfig.go | |
parent | ui: at least try to make a tray on server core (diff) | |
download | wireguard-windows-c621e46a4f08a9fea78e579b2a2f1b6505828e06.tar.xz wireguard-windows-c621e46a4f08a9fea78e579b2a2f1b6505828e06.zip |
service: skip routes for interfaces that aren't up
Diffstat (limited to '')
-rw-r--r-- | service/ifaceconfig.go | 5 |
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 |