mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-21 20:22:41 +09:00
feature/conn25: do not lock mu in packetFilterAllow (#22534)
packetFilterAllow holds c.mu while touching nothing it protects. It only calls getIPSets, a func field assigned once in newConn25 that reads the config out of an atomic pointer. Its siblings transitIPInPool and destinationInPools already call it unlocked. Drop the acquisition, which besides being dead was a lock-ordering hazard if getIPSets ever grows a lock of its own. Updates https://github.com/tailscale/corp/issues/38924 Change-Id: I2942a9b0a6a57378473393c62611c557f07e71b3 Signed-off-by: Mazdak Nasab <mazdak.nasab@gmail.com>
This commit is contained in:
1 parent
4f7439b415
commit
8dc50105e4
1 file changed
-2
@@ -152,8 +152,6 @@ func (c *connector) destinationInPools(dst netip.Addr) bool {
|
||||
// packetFilterAllow returns true if the provided packet has a Src that is in
|
||||
// the configured transit IP range for this connector, false otherwise.
|
||||
func (c *connector) packetFilterAllow(p packet.Parsed) (bool, string) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ipSets := c.getIPSets()
|
||||
if ipSets.v4Transit != nil && ipSets.v4Transit.Contains(p.Dst.Addr()) {
|
||||
return true, packetFilterAllowReason
|
||||
|
||||
Reference in new issue
Block a user