Commit 2380d1ce authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Khalid Elmously

netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported

BugLink: https://bugs.launchpad.net/bugs/1884564

[ Upstream commit 0d7c8346 ]

Instead of EINVAL which should be used for malformed netlink messages.

Fixes: eb31628e ("netfilter: nf_tables: Add support for IPv6 NAT")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent dfcbdecc
...@@ -135,7 +135,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, ...@@ -135,7 +135,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
priv->type = NF_NAT_MANIP_DST; priv->type = NF_NAT_MANIP_DST;
break; break;
default: default:
return -EINVAL; return -EOPNOTSUPP;
} }
err = nft_nat_validate(ctx, expr, NULL); err = nft_nat_validate(ctx, expr, NULL);
...@@ -206,7 +206,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, ...@@ -206,7 +206,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
if (tb[NFTA_NAT_FLAGS]) { if (tb[NFTA_NAT_FLAGS]) {
priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS]));
if (priv->flags & ~NF_NAT_RANGE_MASK) if (priv->flags & ~NF_NAT_RANGE_MASK)
return -EINVAL; return -EOPNOTSUPP;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment