]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/netfilter/xt_connlimit.c
netfilter: xtables: change matches to return error code
[mirror_ubuntu-bionic-kernel.git] / net / netfilter / xt_connlimit.c
index 26997ce90e48bf861b1cf3fcac712b6889b9f8e7..68e89f08140b8cf98c6a0e106e906d613c580d89 100644 (file)
@@ -5,13 +5,13 @@
  *   Nov 2002: Martin Bene <martin.bene@icomedias.com>:
  *             only ignore TIME_WAIT or gone connections
  *   (C) CC Computer Consultants GmbH, 2007
- *   Contact: <jengelh@computergmbh.de>
  *
  * based on ...
  *
  * Kernel module to match connection tracking information.
  * GPL (C) 1999  Rusty Russell (rusty@rustcorp.com.au).
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/in.h>
 #include <linux/in6.h>
 #include <linux/ip.h>
@@ -216,7 +216,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
        return false;
 }
 
-static bool connlimit_mt_check(const struct xt_mtchk_param *par)
+static int connlimit_mt_check(const struct xt_mtchk_param *par)
 {
        struct xt_connlimit_info *info = par->matchinfo;
        unsigned int i;
@@ -226,23 +226,23 @@ static bool connlimit_mt_check(const struct xt_mtchk_param *par)
                connlimit_rnd_inited = true;
        }
        if (nf_ct_l3proto_try_module_get(par->family) < 0) {
-               printk(KERN_WARNING "cannot load conntrack support for "
-                      "address family %u\n", par->family);
-               return false;
+               pr_info("cannot load conntrack support for "
+                       "address family %u\n", par->family);
+               return -EINVAL;
        }
 
        /* init private data */
        info->data = kmalloc(sizeof(struct xt_connlimit_data), GFP_KERNEL);
        if (info->data == NULL) {
                nf_ct_l3proto_module_put(par->family);
-               return false;
+               return -EINVAL;
        }
 
        spin_lock_init(&info->data->lock);
        for (i = 0; i < ARRAY_SIZE(info->data->iphash); ++i)
                INIT_LIST_HEAD(&info->data->iphash[i]);
 
-       return true;
+       return 0;
 }
 
 static void connlimit_mt_destroy(const struct xt_mtdtor_param *par)