netfilter: nat: really support inet nat without l3 address
Subsystems (3)
Florian Westphal
maintainerPATCH 1/1 netfilter: nat: really support inet nat without l3 address
When no l3 address is given, priv->family is set to NFPROTO_INET and the evaluation function isn't called.
Call it too so l4-only rewrite can work.
Also add a test case for this.
Fixes a33f387ecd5aa ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")
Reported-by Yi Chen <[email protected]>
Signed-off-by Florian Westphal <[email protected]>
--- net/netfilter/nft_nat.c | 3 +- tools/testing/selftests/netfilter/nft_nat.sh | 43 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-)
net/netfilter/nft_nat.c +2 -1
@@ -335,7 +335,8 @@ static void nft_nat_inet_eval(const struct nft_expr *expr, {const struct nft_nat *priv =nft_expr_priv (expr); -if (priv->family ==nft_pf (pkt)) +if (priv->family ==nft_pf (pkt) || + priv->family ==NFPROTO_INET )nft_nat_eval (expr, regs, pkt); }
tools/testing/selftests/netfilter/nft_nat.sh +43 -0
55 lines not on this page · raw message
Signature · 1 line
2.36.1
Quoted 5 lines · Florian Westphal
When no l3 address is given,
priv->familyis set toNFPROTO_INETand the evaluation function isn't called.Call it too so l4-only rewrite can work.
Also add a test case for this.
Applied to nf, thanks