diff --git a/monitor_windows.go b/monitor_windows.go index a930c53..bf3b24c 100644 --- a/monitor_windows.go +++ b/monitor_windows.go @@ -1,6 +1,7 @@ package tun import ( + "net/netip" "sync" "github.com/sagernet/sing-tun/internal/winipcfg" @@ -10,6 +11,10 @@ import ( "golang.org/x/sys/windows" ) +// zeroTierFakeGatewayIp from +// https://github.com/zerotier/ZeroTierOne/blob/1.8.6/osdep/WindowsEthernetTap.cpp#L994 +var zeroTierFakeGatewayIp = netip.MustParseAddr("25.255.255.254") + type networkUpdateMonitor struct { routeListener *winipcfg.RouteChangeCallback interfaceListener *winipcfg.InterfaceChangeCallback @@ -67,6 +72,10 @@ func (m *defaultInterfaceMonitor) checkUpdate() error { var index int for _, row := range rows { + if row.NextHop.Addr() == zeroTierFakeGatewayIp { + continue + } + ifrow, err := row.InterfaceLUID.Interface() if err != nil || ifrow.OperStatus != winipcfg.IfOperStatusUp { continue