summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-04-24 21:55:34 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-20 10:24:15 +0200
commitfbe0bd6f77e0331e5491d1c65cd0d4b224f07761 (patch)
treeb8a8f07c296d70e3af339dde366111f2b3127ace
parent6ff43399c7cacff321a0c7331894c574c8323a6b (diff)
downloadlinux-stable-fbe0bd6f77e0331e5491d1c65cd0d4b224f07761.tar.gz
linux-stable-fbe0bd6f77e0331e5491d1c65cd0d4b224f07761.tar.bz2
linux-stable-fbe0bd6f77e0331e5491d1c65cd0d4b224f07761.zip
netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported
[ Upstream commit 0d7c83463fdf7841350f37960a7abadd3e650b41 ] Instead of EINVAL which should be used for malformed netlink messages. Fixes: eb31628e37a0 ("netfilter: nf_tables: Add support for IPv6 NAT") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/netfilter/nft_nat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index 4c48e9bb21e2..d2510e432c18 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -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;
break;
default:
- return -EINVAL;
+ return -EOPNOTSUPP;
}
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,
if (tb[NFTA_NAT_FLAGS]) {
priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS]));
if (priv->flags & ~NF_NAT_RANGE_MASK)
- return -EINVAL;
+ return -EOPNOTSUPP;
}
return 0;