Skip to contentSkip to conversation

netfilter: nft_nat: allow to specify layer 4 protocol NAT only

PATCH New Pablo Neira Ayuso 1 participant 1 message Jul 20, 2021

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nft_nat: allow to specify layer 4 protocol NAT only

nft_nat reports a bogus EAFNOSUPPORT if no layer 3 information is specified.

Fixes d07db9884a5f ("netfilter: nf_tables: introduce nft_validate_register_load()")
---
 net/netfilter/nft_nat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nft_nat.c +3 -1
index 0840c635b752..be1595d6979d 100644
@@ -201,7 +201,9 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 		alen = sizeof_field(struct nf_nat_range, min_addr.ip6);
 		break;
 	default:
-		return -EAFNOSUPPORT;
+		if (tb[NFTA_NAT_REG_ADDR_MIN])
+			return -EAFNOSUPPORT;
+		break;
 	}
 	priv->family = family;
 
Signature · 1 line
2.30.2