Skip tun interface traffic in prerouting UDP/ICMP chain

This commit is contained in:
世界 2026-01-28 14:34:10 +08:00
parent 2377e62d4a
commit 381bf9d40d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -192,6 +192,25 @@ func (r *autoRedirect) setupNFTables() error {
}, },
}, },
}) })
nft.AddRule(&nftables.Rule{
Table: table,
Chain: chainPreRoutingUDP,
Exprs: []expr.Any{
&expr.Meta{
Key: expr.MetaKeyIIFNAME,
Register: 1,
},
&expr.Cmp{
Op: expr.CmpOpEq,
Register: 1,
Data: nftablesIfname(r.tunOptions.Name),
},
&expr.Counter{},
&expr.Verdict{
Kind: expr.VerdictReturn,
},
},
})
nft.AddRule(&nftables.Rule{ nft.AddRule(&nftables.Rule{
Table: table, Table: table,
Chain: chainPreRoutingUDP, Chain: chainPreRoutingUDP,