netfilter: xtables: change targets to return error code
[deliverable/linux.git] / net / netfilter / xt_CONNSECMARK.c
index b54c3756fdc3b942be616d6905b2ca62cb4cc0b4..2287a82a0703b4806bde7b18441e3ab3b3764e63 100644 (file)
@@ -15,6 +15,7 @@
  * published by the Free Software Foundation.
  *
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/netfilter/x_tables.h>
@@ -22,8 +23,6 @@
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_ecache.h>
 
-#define PFX "CONNSECMARK: "
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("James Morris <jmorris@redhat.com>");
 MODULE_DESCRIPTION("Xtables: target for copying between connection and security mark");
@@ -85,15 +84,15 @@ connsecmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
        return XT_CONTINUE;
 }
 
-static bool connsecmark_tg_check(const struct xt_tgchk_param *par)
+static int connsecmark_tg_check(const struct xt_tgchk_param *par)
 {
        const struct xt_connsecmark_target_info *info = par->targinfo;
 
        if (strcmp(par->table, "mangle") != 0 &&
            strcmp(par->table, "security") != 0) {
-               printk(KERN_INFO PFX "target only valid in the \'mangle\' "
-                      "or \'security\' tables, not \'%s\'.\n", par->table);
-               return false;
+               pr_info("target only valid in the \'mangle\' "
+                       "or \'security\' tables, not \'%s\'.\n", par->table);
+               return -EINVAL;
        }
 
        switch (info->mode) {
@@ -102,16 +101,16 @@ static bool connsecmark_tg_check(const struct xt_tgchk_param *par)
                break;
 
        default:
-               printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
+               pr_info("invalid mode: %hu\n", info->mode);
                return false;
        }
 
        if (nf_ct_l3proto_try_module_get(par->family) < 0) {
-               printk(KERN_WARNING "can't load conntrack support for "
-                                   "proto=%u\n", par->family);
-               return false;
+               pr_info("cannot load conntrack support for proto=%u\n",
+                       par->family);
+               return -EINVAL;
        }
-       return true;
+       return 0;
 }
 
 static void connsecmark_tg_destroy(const struct xt_tgdtor_param *par)
This page took 0.029551 seconds and 5 git commands to generate.