]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/netfilter/xt_helper.c
[NETFILTER]: nf_conntrack: support for layer 3 protocol load on demand
[linux-2.6-omap-h63xx.git] / net / netfilter / xt_helper.c
index 7d2d68b9155ff3e33f87a08fb8e89777b8a1267e..101f0005e987556d50b2dfbfcdd92abb4fe1f2e7 100644 (file)
@@ -144,15 +144,31 @@ static int check(const char *tablename,
 {
        struct xt_helper_info *info = matchinfo;
 
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+       if (nf_ct_l3proto_try_module_get(match->family) < 0) {
+               printk(KERN_WARNING "can't load nf_conntrack support for "
+                                   "proto=%d\n", match->family);
+               return 0;
+       }
+#endif
        info->name[29] = '\0';
        return 1;
 }
 
+static void
+destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize)
+{
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+       nf_ct_l3proto_module_put(match->family);
+#endif
+}
+
 static struct xt_match helper_match = {
        .name           = "helper",
        .match          = match,
        .matchsize      = sizeof(struct xt_helper_info),
        .checkentry     = check,
+       .destroy        = destroy,
        .family         = AF_INET,
        .me             = THIS_MODULE,
 };
@@ -161,6 +177,7 @@ static struct xt_match helper6_match = {
        .match          = match,
        .matchsize      = sizeof(struct xt_helper_info),
        .checkentry     = check,
+       .destroy        = destroy,
        .family         = AF_INET6,
        .me             = THIS_MODULE,
 };