]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/ipv4/netfilter/ipt_MASQUERADE.c
netfilter: nat: add dependencies on conntrack module
[mirror_ubuntu-bionic-kernel.git] / net / ipv4 / netfilter / ipt_MASQUERADE.c
index 34cfb9b0bc0aa42f8df296797141b3cb4a78a243..a03e4e7ef5f90eb55fdf8aba91ccf3b635ffb4ff 100644 (file)
@@ -41,7 +41,7 @@ static int masquerade_tg_check(const struct xt_tgchk_param *par)
                pr_debug("bad rangesize %u\n", mr->rangesize);
                return -EINVAL;
        }
-       return 0;
+       return nf_ct_netns_get(par->net, par->family);
 }
 
 static unsigned int
@@ -59,6 +59,11 @@ masquerade_tg(struct sk_buff *skb, const struct xt_action_param *par)
                                      xt_out(par));
 }
 
+static void masquerade_tg_destroy(const struct xt_tgdtor_param *par)
+{
+       nf_ct_netns_put(par->net, par->family);
+}
+
 static struct xt_target masquerade_tg_reg __read_mostly = {
        .name           = "MASQUERADE",
        .family         = NFPROTO_IPV4,
@@ -67,6 +72,7 @@ static struct xt_target masquerade_tg_reg __read_mostly = {
        .table          = "nat",
        .hooks          = 1 << NF_INET_POST_ROUTING,
        .checkentry     = masquerade_tg_check,
+       .destroy        = masquerade_tg_destroy,
        .me             = THIS_MODULE,
 };