diff options
author | 2016-11-15 21:36:42 +0100 | |
---|---|---|
committer | 2016-12-04 21:17:16 +0100 | |
commit | 20afd423976ef3df0ce5719909ffd4416f9ef986 (patch) | |
tree | 840d7c3ef4faff8abf68cd3c895036d4eb0c4932 /net/netfilter | |
parent | netfilter: nat: add dependencies on conntrack module (diff) | |
download | linux-20afd423976ef3df0ce5719909ffd4416f9ef986.tar.gz linux-20afd423976ef3df0ce5719909ffd4416f9ef986.tar.bz2 linux-20afd423976ef3df0ce5719909ffd4416f9ef986.zip |
netfilter: nf_tables: add conntrack dependencies for nat/masq/redir expressions
so that conntrack core will add the needed hooks in this namespace.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nft_masq.c | 2 | ||||
-rw-r--r-- | net/netfilter/nft_nat.c | 11 | ||||
-rw-r--r-- | net/netfilter/nft_redir.c | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/net/netfilter/nft_masq.c b/net/netfilter/nft_masq.c index bf92de01410f..11ce016cd479 100644 --- a/net/netfilter/nft_masq.c +++ b/net/netfilter/nft_masq.c @@ -77,7 +77,7 @@ int nft_masq_init(const struct nft_ctx *ctx, } } - return 0; + return nf_ct_netns_get(ctx->net, ctx->afi->family); } EXPORT_SYMBOL_GPL(nft_masq_init); diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index ee2d71753746..19a7bf3236f9 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c @@ -209,7 +209,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, return -EINVAL; } - return 0; + return nf_ct_netns_get(ctx->net, family); } static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) @@ -257,12 +257,21 @@ nla_put_failure: return -1; } +static void +nft_nat_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) +{ + const struct nft_nat *priv = nft_expr_priv(expr); + + nf_ct_netns_put(ctx->net, priv->family); +} + static struct nft_expr_type nft_nat_type; static const struct nft_expr_ops nft_nat_ops = { .type = &nft_nat_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_nat)), .eval = nft_nat_eval, .init = nft_nat_init, + .destroy = nft_nat_destroy, .dump = nft_nat_dump, .validate = nft_nat_validate, }; diff --git a/net/netfilter/nft_redir.c b/net/netfilter/nft_redir.c index 967e09b099b2..40dcd05146d5 100644 --- a/net/netfilter/nft_redir.c +++ b/net/netfilter/nft_redir.c @@ -79,7 +79,7 @@ int nft_redir_init(const struct nft_ctx *ctx, return -EINVAL; } - return 0; + return nf_ct_netns_get(ctx->net, ctx->afi->family); } EXPORT_SYMBOL_GPL(nft_redir_init); |