mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-03 13:56:36 +09:00
feature/conn25: use transitIPInPool in connector.packetFilterAllow (#22660)
packetFilterAllow inlined the same per-family transit pool lookup that transitIPInPool already does. Call that instead. Also fix a doc comment that said it checked the packet's Src, but it has always checked Dst. Updates #cleanup Change-Id: I1f236c5120168a0a8b16f8125773efcb09426bc8 Signed-off-by: Mazdak Nasab <mazdak.nasab@gmail.com>
This commit is contained in:
1 parent
649ca43716
commit
08d91f4b90
1 file changed
+2
-6
@@ -149,14 +149,10 @@ func (c *connector) destinationInPools(dst netip.Addr) bool {
|
||||
return (magic != nil && magic.Contains(dst)) || (transit != nil && transit.Contains(dst))
|
||||
}
|
||||
|
||||
// packetFilterAllow returns true if the provided packet has a Src that is in
|
||||
// packetFilterAllow returns true if the provided packet has a Dst that is in
|
||||
// the configured transit IP range for this connector, false otherwise.
|
||||
func (c *connector) packetFilterAllow(p packet.Parsed) (bool, string) {
|
||||
ipSets := c.getIPSets()
|
||||
if ipSets.v4Transit != nil && ipSets.v4Transit.Contains(p.Dst.Addr()) {
|
||||
return true, packetFilterAllowReason
|
||||
}
|
||||
if ipSets.v6Transit != nil && ipSets.v6Transit.Contains(p.Dst.Addr()) {
|
||||
if c.transitIPInPool(p.Dst.Addr()) {
|
||||
return true, packetFilterAllowReason
|
||||
}
|
||||
return false, ""
|
||||
|
||||
Reference in new issue
Block a user