diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/netmon/netmon.go | 7 | ||||
| -rw-r--r-- | net/netmon/netmon_linux.go | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/net/netmon/netmon.go b/net/netmon/netmon.go index b97b184d4..32d9b34a0 100644 --- a/net/netmon/netmon.go +++ b/net/netmon/netmon.go @@ -9,6 +9,7 @@ package netmon import ( "encoding/json" "errors" + "fmt" "net/netip" "runtime" "sync" @@ -18,6 +19,7 @@ import ( "tailscale.com/util/clientmetric" "tailscale.com/util/eventbus" "tailscale.com/util/set" + "tailscale.com/version/distro" ) // pollWallTimeInterval is how often we check the time to check @@ -118,6 +120,9 @@ type ChangeDelta struct { // The returned monitor is inactive until it's started by the Start method. // Use RegisterChangeCallback to get notified of network changes. func New(bus *eventbus.Bus, logf logger.Logf) (*Monitor, error) { + if distro.Get() == distro.ISH { + return NewStatic(), nil // netlink doesn't work in iSH + } logf = logger.WithPrefix(logf, "monitor: ") m := &Monitor{ logf: logf, @@ -129,7 +134,7 @@ func New(bus *eventbus.Bus, logf logger.Logf) (*Monitor, error) { m.changed = eventbus.Publish[*ChangeDelta](m.b) st, err := m.interfaceStateUncached() if err != nil { - return nil, err + return nil, fmt.Errorf("interface state: %w", err) } m.ifState = st diff --git a/net/netmon/netmon_linux.go b/net/netmon/netmon_linux.go index a1077c257..70aa50af3 100644 --- a/net/netmon/netmon_linux.go +++ b/net/netmon/netmon_linux.go @@ -17,6 +17,7 @@ import ( "tailscale.com/net/tsaddr" "tailscale.com/types/logger" "tailscale.com/util/eventbus" + "tailscale.com/version/distro" ) var debugNetlinkMessages = envknob.RegisterBool("TS_DEBUG_NETLINK") @@ -57,6 +58,10 @@ type nlConn struct { } func newOSMon(bus *eventbus.Bus, logf logger.Logf, m *Monitor) (osMon, error) { + if distro.Get() == distro.ISH { + println("XXX hi from ish") + return newPollingMon(logf, m) + } conn, err := netlink.Dial(unix.NETLINK_ROUTE, &netlink.Config{ // Routes get us most of the events of interest, but we need // address as well to cover things like DHCP deciding to give |
