Skip to content

Commit

Permalink
ipn/ipnlocal: fix data race with capForcedNetfilter field
Browse files Browse the repository at this point in the history
Updates #cleanup

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I1fdad454198d7ea4a898dbff3062818b0db35167
  • Loading branch information
andrew-d committed Dec 22, 2023
1 parent 2716250 commit cae6edf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ipn/ipnlocal/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -4011,10 +4011,13 @@ func (b *LocalBackend) routerConfig(cfg *wgcfg.Config, prefs ipn.PrefsView, oneC
singleRouteThreshold = 1
}

netfilterKind := b.capForcedNetfilter
b.mu.Lock()
netfilterKind := b.capForcedNetfilter // protected by b.mu
b.mu.Unlock()

if prefs.NetfilterKind() != "" {
if b.capForcedNetfilter != "" {
b.logf("nodeattr netfilter preference %s overridden by c2n pref %s", b.capForcedNetfilter, prefs.NetfilterKind())
if netfilterKind != "" {
b.logf("nodeattr netfilter preference %s overridden by c2n pref %s", netfilterKind, prefs.NetfilterKind())
}
netfilterKind = prefs.NetfilterKind()
}
Expand Down

0 comments on commit cae6edf

Please sign in to comment.