Merge branch 'master' of /repos/git/net-next-2.6
[pandora-kernel.git] / net / bridge / netfilter / ebt_ulog.c
index f9560f3..852f37c 100644 (file)
@@ -27,7 +27,7 @@
  *   flushed even if it is not full yet.
  *
  */
-
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -44,9 +44,6 @@
 #include <net/sock.h>
 #include "../br_private.h"
 
-#define PRINTR(format, args...) do { if (net_ratelimit()) \
-                               printk(format , ## args); } while (0)
-
 static unsigned int nlbufsiz = NLMSG_GOODSIZE;
 module_param(nlbufsiz, uint, 0600);
 MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) "
@@ -107,15 +104,14 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
        n = max(size, nlbufsiz);
        skb = alloc_skb(n, GFP_ATOMIC);
        if (!skb) {
-               PRINTR(KERN_ERR "ebt_ulog: can't alloc whole buffer "
-                      "of size %ub!\n", n);
+               pr_debug("cannot alloc whole buffer of size %ub!\n", n);
                if (n > size) {
                        /* try to allocate only as much as we need for
                         * current packet */
                        skb = alloc_skb(size, GFP_ATOMIC);
                        if (!skb)
-                               PRINTR(KERN_ERR "ebt_ulog: can't even allocate "
-                                      "buffer of size %ub\n", size);
+                               pr_debug("cannot even allocate "
+                                        "buffer of size %ub\n", size);
                }
        }
 
@@ -142,8 +138,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
 
        size = NLMSG_SPACE(sizeof(*pm) + copy_len);
        if (size > nlbufsiz) {
-               PRINTR("ebt_ulog: Size %Zd needed, but nlbufsiz=%d\n",
-                      size, nlbufsiz);
+               pr_debug("Size %Zd needed, but nlbufsiz=%d\n", size, nlbufsiz);
                return;
        }
 
@@ -217,8 +212,8 @@ unlock:
        return;
 
 nlmsg_failure:
-       printk(KERN_CRIT "ebt_ulog: error during NLMSG_PUT. This should "
-              "not happen, please report to author.\n");
+       pr_debug("error during NLMSG_PUT. This should "
+                "not happen, please report to author.\n");
        goto unlock;
 alloc_failure:
        goto unlock;
@@ -255,19 +250,19 @@ ebt_ulog_tg(struct sk_buff *skb, const struct xt_target_param *par)
        return EBT_CONTINUE;
 }
 
-static bool ebt_ulog_tg_check(const struct xt_tgchk_param *par)
+static int ebt_ulog_tg_check(const struct xt_tgchk_param *par)
 {
        struct ebt_ulog_info *uloginfo = par->targinfo;
 
        if (uloginfo->nlgroup > 31)
-               return false;
+               return -EINVAL;
 
        uloginfo->prefix[EBT_ULOG_PREFIX_LEN - 1] = '\0';
 
        if (uloginfo->qthreshold > EBT_ULOG_MAX_QLEN)
                uloginfo->qthreshold = EBT_ULOG_MAX_QLEN;
 
-       return true;
+       return 0;
 }
 
 static struct xt_target ebt_ulog_tg_reg __read_mostly = {
@@ -292,8 +287,8 @@ static int __init ebt_ulog_init(void)
        int i;
 
        if (nlbufsiz >= 128*1024) {
-               printk(KERN_NOTICE "ebt_ulog: Netlink buffer has to be <= 128kB,"
-                      " please try a smaller nlbufsiz parameter.\n");
+               pr_warning("Netlink buffer has to be <= 128kB,"
+                          " please try a smaller nlbufsiz parameter.\n");
                return -EINVAL;
        }
 
@@ -306,13 +301,10 @@ static int __init ebt_ulog_init(void)
        ebtulognl = netlink_kernel_create(&init_net, NETLINK_NFLOG,
                                          EBT_ULOG_MAXNLGROUPS, NULL, NULL,
                                          THIS_MODULE);
-       if (!ebtulognl) {
-               printk(KERN_WARNING KBUILD_MODNAME ": out of memory trying to "
-                      "call netlink_kernel_create\n");
+       if (!ebtulognl)
                ret = -ENOMEM;
-       } else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0) {
+       else if ((ret = xt_register_target(&ebt_ulog_tg_reg)) != 0)
                netlink_kernel_release(ebtulognl);
-       }
 
        if (ret == 0)
                nf_log_register(NFPROTO_BRIDGE, &ebt_ulog_logger);