Skip to content

Commit 5c278c2

Browse files
mtparetclaude
andcommitted
fix: use IIFNAME instead of OIFNAME in nftables PREROUTING DNAT rule
In the PREROUTING chain, the output interface is not yet determined (routing hasn't happened), so MetaKeyOIFNAME always returns empty. This caused the DNAT rule to never match traffic correctly. Changed to MetaKeyIIFNAME (input interface) to match the behavior of the iptables implementation which correctly uses `-i tun`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 179ce06 commit 5c278c2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

util/linuxfw/nftables_runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (n *nftablesRunner) DNATNonTailscaleTraffic(tunname string, dst netip.Addr)
180180
Table: nat,
181181
Chain: preroutingCh,
182182
Exprs: []expr.Any{
183-
&expr.Meta{Key: expr.MetaKeyOIFNAME, Register: 1},
183+
&expr.Meta{Key: expr.MetaKeyIIFNAME, Register: 1},
184184
&expr.Cmp{
185185
Op: expr.CmpOpNeq,
186186
Register: 1,

0 commit comments

Comments
 (0)