提交 9855d5cf 编写于 作者: P Pablo Neira Ayuso 提交者: Yang Yingliang

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

stable inclusion
from linux-4.19.201
commit 1cb5995a39eb3dc97a7539d00d2c82be030e0bb8

--------------------------------

[ Upstream commit a33f387e ]

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

Fixes: d07db988 ("netfilter: nf_tables: introduce nft_validate_register_load()")
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 82795e52
...@@ -153,7 +153,9 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, ...@@ -153,7 +153,9 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
alen = FIELD_SIZEOF(struct nf_nat_range, min_addr.ip6); alen = FIELD_SIZEOF(struct nf_nat_range, min_addr.ip6);
break; break;
default: default:
return -EAFNOSUPPORT; if (tb[NFTA_NAT_REG_ADDR_MIN])
return -EAFNOSUPPORT;
break;
} }
priv->family = family; priv->family = family;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册