summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-07-20 19:22:50 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2021-07-23 15:18:03 +0300
commita33f387ecd5aafae514095c2c4a8c24f7aea7e8b (patch)
tree5386a3a627ccd1d4cef245c2c577c8fc2149150c /net
parent30a56a2b881821625f79837d4d968c679852444e (diff)
downloadlinux-a33f387ecd5aafae514095c2c4a8c24f7aea7e8b.tar.xz
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()") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_nat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index 0840c635b752..be1595d6979d 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -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;