netfilter: nft_nat: Fix inet l4-only NAT
Subsystems (2)
Phil Sutter
reviewerPATCH 1/1 netfilter: nft_nat: Fix inet l4-only NAT
If nat expression does not specify an address, its family value is NFPROTO_INET. Disable the check against the packet's family in that case.
Fixes a33f387ecd5aa ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")
Signed-off-by Phil Sutter <[email protected]>
--- net/netfilter/nft_nat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_nat.c +1 -1
@@ -335,7 +335,7 @@ 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 ==NFPROTO_INET || priv->family ==nft_pf (pkt))nft_nat_eval (expr, regs, pkt); }
Signature · 1 line
2.34.1
Phil Sutter
reviewerQuoted 6 lines · Phil Sutter
If nat expression does not specify an address, its family value is
NFPROTO_INET. Disable the check against the packet's family in that case.Fixes a33f387ecd5aa ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")Signed-off-by Phil Sutter <[email protected]>
Argh. Duplicate work with Florian (message-ID [email protected]), please use his patch - it adds a test as well.
Sorry for the noise!
Pablo Neira Ayuso
maintainerQuoted 6 lines · Phil Sutter
If nat expression does not specify an address, its family value is
NFPROTO_INET. Disable the check against the packet's family in that case.Fixes a33f387ecd5aa ("netfilter: nft_nat: allow to specify layer 4 protocol NAT only")Signed-off-by Phil Sutter <[email protected]>
Florian posted this:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/
Quoted 20 lines
--- net/netfilter/nft_nat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/netfilter/nft_nat.c +1
-1@@ -335,7 +335,7 @@ 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 ==NFPROTO_INET || priv->family ==nft_pf (pkt))nft_nat_eval (expr, regs, pkt); }Signature · 1 line
2.34.1