aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tunnel/defaultroutemonitor.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/tunnel/defaultroutemonitor.go b/tunnel/defaultroutemonitor.go
index c102b644..68853fd1 100644
--- a/tunnel/defaultroutemonitor.go
+++ b/tunnel/defaultroutemonitor.go
@@ -33,8 +33,14 @@ func bindSocketRoute(family winipcfg.AddressFamily, device *device.Device, ourLU
if err != nil || ifrow.OperStatus != winipcfg.IfOperStatusUp {
continue
}
- if r[i].Metric < lowestMetric {
- lowestMetric = r[i].Metric
+
+ iface, err := r[i].InterfaceLUID.IPInterface(family)
+ if err != nil {
+ continue
+ }
+
+ if r[i].Metric + iface.Metric < lowestMetric {
+ lowestMetric = r[i].Metric + iface.Metric
index = r[i].InterfaceIndex
luid = r[i].InterfaceLUID
}