util/linuxfw: insert rather than append nftables DNAT rule (#11303)

Ensure that the latest DNATNonTailscaleTraffic rule
gets inserted on top of any pre-existing rules.

Updates tailscale/tailscale#11281

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina 2024-02-29 16:53:43 +00:00 committed by GitHub
parent e324a5660f
commit 097c5ed927
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,7 +173,7 @@ func (n *nftablesRunner) DNATNonTailscaleTraffic(tunname string, dst netip.Addr)
},
},
}
n.conn.AddRule(dnatRule)
n.conn.InsertRule(dnatRule)
return n.conn.Flush()
}