net/netmon: when a new network is added, trigger netmon update (#10840)

Fixes #10107
This commit is contained in:
kari-ts 2024-01-12 16:03:04 -08:00 committed by GitHub
parent 236531c5fc
commit c9fd166cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}