]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/bridge/netfilter/ebt_ulog.c
[NETNS]: Consolidate kernel netlink socket destruction.
[net-next-2.6.git] / net / bridge / netfilter / ebt_ulog.c
index 9411db62591754b5592a783040e48763ddc92514..8e7b00b68d3868107dd52f01a82a9262f2f34f49 100644 (file)
@@ -36,9 +36,9 @@
 #include <linux/timer.h>
 #include <linux/netlink.h>
 #include <linux/netdevice.h>
-#include <linux/module.h>
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_ulog.h>
+#include <net/netfilter/nf_log.h>
 #include <net/sock.h>
 #include "../br_private.h"
 
@@ -279,7 +279,7 @@ static struct ebt_watcher ulog = {
        .me             = THIS_MODULE,
 };
 
-static struct nf_logger ebt_ulog_logger = {
+static const struct nf_logger ebt_ulog_logger = {
        .name           = EBT_ULOG_WATCHER,
        .logfn          = &ebt_log_packet,
        .me             = THIS_MODULE,
@@ -301,19 +301,16 @@ static int __init ebt_ulog_init(void)
                spin_lock_init(&ulog_buffers[i].lock);
        }
 
-       ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS,
-                                         NULL, NULL, THIS_MODULE);
+       ebtulognl = netlink_kernel_create(&init_net, NETLINK_NFLOG,
+                                         EBT_ULOG_MAXNLGROUPS, NULL, NULL,
+                                         THIS_MODULE);
        if (!ebtulognl)
                ret = -ENOMEM;
        else if ((ret = ebt_register_watcher(&ulog)))
-               sock_release(ebtulognl->sk_socket);
+               netlink_kernel_release(ebtulognl);
 
-       if (nf_log_register(PF_BRIDGE, &ebt_ulog_logger) < 0) {
-               printk(KERN_WARNING "ebt_ulog: not logging via ulog "
-                      "since somebody else already registered for PF_BRIDGE\n");
-               /* we cannot make module load fail here, since otherwise
-                * ebtables userspace would abort */
-       }
+       if (ret == 0)
+               nf_log_register(PF_BRIDGE, &ebt_ulog_logger);
 
        return ret;
 }
@@ -336,7 +333,7 @@ static void __exit ebt_ulog_fini(void)
                }
                spin_unlock_bh(&ub->lock);
        }
-       sock_release(ebtulognl->sk_socket);
+       netlink_kernel_release(ebtulognl);
 }
 
 module_init(ebt_ulog_init);