Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / net / netfilter / nfnetlink_log.c
index 3e3f544..b59d3b2 100644 (file)
@@ -321,7 +321,7 @@ static int
 nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags)
 {
        spin_lock_bh(&inst->lock);
-       inst->flags = ntohs(flags);
+       inst->flags = flags;
        spin_unlock_bh(&inst->lock);
 
        return 0;
@@ -366,6 +366,9 @@ __nfulnl_send(struct nfulnl_instance *inst)
        if (timer_pending(&inst->timer))
                del_timer(&inst->timer);
 
+       if (!inst->skb)
+               return 0;
+
        if (inst->qlen > 1)
                inst->lastnlh->nlmsg_type = NLMSG_DONE;
 
@@ -902,7 +905,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
        if (nfula[NFULA_CFG_FLAGS-1]) {
                u_int16_t flags =
                        *(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
-               nfulnl_set_flags(inst, ntohl(flags));
+               nfulnl_set_flags(inst, ntohs(flags));
        }
 
 out_put:
@@ -1033,17 +1036,13 @@ static struct file_operations nful_file_ops = {
 
 #endif /* PROC_FS */
 
-static int
-init_or_cleanup(int init)
+static int __init nfnetlink_log_init(void)
 {
        int i, status = -ENOMEM;
 #ifdef CONFIG_PROC_FS
        struct proc_dir_entry *proc_nful;
 #endif
        
-       if (!init)
-               goto cleanup;
-
        for (i = 0; i < INSTANCE_BUCKETS; i++)
                INIT_HLIST_HEAD(&instance_table[i]);
        
@@ -1066,30 +1065,25 @@ init_or_cleanup(int init)
                goto cleanup_subsys;
        proc_nful->proc_fops = &nful_file_ops;
 #endif
-
        return status;
 
-cleanup:
-       nf_log_unregister_logger(&nfulnl_logger);
 #ifdef CONFIG_PROC_FS
-       remove_proc_entry("nfnetlink_log", proc_net_netfilter);
 cleanup_subsys:
-#endif
        nfnetlink_subsys_unregister(&nfulnl_subsys);
+#endif
 cleanup_netlink_notifier:
        netlink_unregister_notifier(&nfulnl_rtnl_notifier);
        return status;
 }
 
-static int __init nfnetlink_log_init(void)
-{
-       
-       return init_or_cleanup(1);
-}
-
 static void __exit nfnetlink_log_fini(void)
 {
-       init_or_cleanup(0);
+       nf_log_unregister_logger(&nfulnl_logger);
+#ifdef CONFIG_PROC_FS
+       remove_proc_entry("nfnetlink_log", proc_net_netfilter);
+#endif
+       nfnetlink_subsys_unregister(&nfulnl_subsys);
+       netlink_unregister_notifier(&nfulnl_rtnl_notifier);
 }
 
 MODULE_DESCRIPTION("netfilter userspace logging");