From c9fd166cc6d85308ed987a04cf715125efead557 Mon Sep 17 00:00:00 2001 From: kari-ts <135075563+kari-ts@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:03:04 -0800 Subject: [PATCH] net/netmon: when a new network is added, trigger netmon update (#10840) Fixes #10107 --- net/netmon/netmon.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/net/netmon/netmon.go b/net/netmon/netmon.go index b0872034a..39cde33ba 100644 --- a/net/netmon/netmon.go +++ b/net/netmon/netmon.go @@ -478,6 +478,28 @@ func (m *Monitor) IsMajorChangeFrom(s1, s2 *interfaces.State) bool { return true } } + // Iterate over s2 in case there is a field in s2 that doesn't exist in s1 + for iname, i := range s2.Interface { + if iname == m.tsIfName { + // Ignore changes in the Tailscale interface itself. + continue + } + ips := s2.InterfaceIPs[iname] + if !m.isInterestingInterface(i, ips) { + continue + } + i1, ok := s1.Interface[iname] + if !ok { + return true + } + ips1, ok := s1.InterfaceIPs[iname] + if !ok { + return true + } + if !i.Equal(i1) || !prefixesMajorEqual(ips, ips1) { + return true + } + } return false }