diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-04-24 21:55:35 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-04-28 00:53:54 +0200 |
commit | 4566aa440008103c9bd364f38c03ca5309acc8f4 (patch) | |
tree | 7ca8994482b87769be8cd0c88c4a38c3b9183e4f /net | |
parent | netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported (diff) | |
download | linux-4566aa440008103c9bd364f38c03ca5309acc8f4.tar.xz linux-4566aa440008103c9bd364f38c03ca5309acc8f4.zip |
netfilter: nft_nat: set flags from initialization path
This patch sets the NAT flags from the control plane path.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_nat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index bb49a217635e..5c7ff213c030 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c @@ -55,7 +55,6 @@ static void nft_nat_eval(const struct nft_expr *expr, ®s->data[priv->sreg_addr_max], sizeof(range.max_addr.ip6)); } - range.flags |= NF_NAT_RANGE_MAP_IPS; } if (priv->sreg_proto_min) { @@ -63,10 +62,9 @@ static void nft_nat_eval(const struct nft_expr *expr, ®s->data[priv->sreg_proto_min]); range.max_proto.all = (__force __be16)nft_reg_load16( ®s->data[priv->sreg_proto_max]); - range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; } - range.flags |= priv->flags; + range.flags = priv->flags; regs->verdict.code = nf_nat_setup_info(ct, &range, priv->type); } @@ -169,6 +167,8 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, } else { priv->sreg_addr_max = priv->sreg_addr_min; } + + priv->flags |= NF_NAT_RANGE_MAP_IPS; } plen = sizeof_field(struct nf_nat_range, min_addr.all); @@ -191,10 +191,12 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, } else { priv->sreg_proto_max = priv->sreg_proto_min; } + + priv->flags |= NF_NAT_RANGE_PROTO_SPECIFIED; } 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) return -EOPNOTSUPP; } |