[IPV4]: Get rid of redundant IPCB->opts initialisation
[pandora-kernel.git] / net / netfilter / nf_conntrack_standalone.c
index c72aa3c..5fcab2e 100644 (file)
@@ -17,7 +17,6 @@
  * Derived from net/ipv4/netfilter/ip_conntrack_standalone.c
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/netfilter.h>
 #include <linux/module.h>
@@ -213,6 +212,11 @@ static int ct_seq_show(struct seq_file *s, void *v)
                return -ENOSPC;
 #endif
 
+#ifdef CONFIG_NF_CONNTRACK_SECMARK
+       if (seq_printf(s, "secmark=%u ", conntrack->secmark))
+               return -ENOSPC;
+#endif
+
        if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
                return -ENOSPC;
        
@@ -455,6 +459,8 @@ extern unsigned int nf_ct_generic_timeout;
 static int log_invalid_proto_min = 0;
 static int log_invalid_proto_max = 255;
 
+int nf_conntrack_checksum = 1;
+
 static struct ctl_table_header *nf_ct_sysctl_header;
 
 static ctl_table nf_ct_sysctl_table[] = {
@@ -482,6 +488,14 @@ static ctl_table nf_ct_sysctl_table[] = {
                .mode           = 0444,
                .proc_handler   = &proc_dointvec,
        },
+       {
+               .ctl_name       = NET_NF_CONNTRACK_CHECKSUM,
+               .procname       = "nf_conntrack_checksum",
+               .data           = &nf_conntrack_checksum,
+               .maxlen         = sizeof(unsigned int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        {
                .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
                .procname       = "nf_conntrack_tcp_timeout_syn_sent",
@@ -649,63 +663,6 @@ static ctl_table nf_ct_net_table[] = {
 EXPORT_SYMBOL(nf_ct_log_invalid);
 #endif /* CONFIG_SYSCTL */
 
-static int init_or_cleanup(int init)
-{
-#ifdef CONFIG_PROC_FS
-       struct proc_dir_entry *proc, *proc_exp, *proc_stat;
-#endif
-       int ret = 0;
-
-       if (!init) goto cleanup;
-
-       ret = nf_conntrack_init();
-       if (ret < 0)
-               goto cleanup_nothing;
-
-#ifdef CONFIG_PROC_FS
-       proc = proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops);
-       if (!proc) goto cleanup_init;
-
-       proc_exp = proc_net_fops_create("nf_conntrack_expect", 0440,
-                                       &exp_file_ops);
-       if (!proc_exp) goto cleanup_proc;
-
-       proc_stat = create_proc_entry("nf_conntrack", S_IRUGO, proc_net_stat);
-       if (!proc_stat)
-               goto cleanup_proc_exp;
-
-       proc_stat->proc_fops = &ct_cpu_seq_fops;
-       proc_stat->owner = THIS_MODULE;
-#endif
-#ifdef CONFIG_SYSCTL
-       nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
-       if (nf_ct_sysctl_header == NULL) {
-               printk("nf_conntrack: can't register to sysctl.\n");
-               ret = -ENOMEM;
-               goto cleanup_proc_stat;
-       }
-#endif
-
-       return ret;
-
- cleanup:
-#ifdef CONFIG_SYSCTL
-       unregister_sysctl_table(nf_ct_sysctl_header);
- cleanup_proc_stat:
-#endif
-#ifdef CONFIG_PROC_FS
-       remove_proc_entry("nf_conntrack", proc_net_stat);
- cleanup_proc_exp:
-       proc_net_remove("nf_conntrack_expect");
- cleanup_proc:
-       proc_net_remove("nf_conntrack");
- cleanup_init:
-#endif /* CNFIG_PROC_FS */
-       nf_conntrack_cleanup();
- cleanup_nothing:
-       return ret;
-}
-
 int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto)
 {
        int ret = 0;
@@ -808,12 +765,66 @@ void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto)
 
 static int __init nf_conntrack_standalone_init(void)
 {
-       return init_or_cleanup(1);
+#ifdef CONFIG_PROC_FS
+       struct proc_dir_entry *proc, *proc_exp, *proc_stat;
+#endif
+       int ret = 0;
+
+       ret = nf_conntrack_init();
+       if (ret < 0)
+               return ret;
+
+#ifdef CONFIG_PROC_FS
+       proc = proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops);
+       if (!proc) goto cleanup_init;
+
+       proc_exp = proc_net_fops_create("nf_conntrack_expect", 0440,
+                                       &exp_file_ops);
+       if (!proc_exp) goto cleanup_proc;
+
+       proc_stat = create_proc_entry("nf_conntrack", S_IRUGO, proc_net_stat);
+       if (!proc_stat)
+               goto cleanup_proc_exp;
+
+       proc_stat->proc_fops = &ct_cpu_seq_fops;
+       proc_stat->owner = THIS_MODULE;
+#endif
+#ifdef CONFIG_SYSCTL
+       nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
+       if (nf_ct_sysctl_header == NULL) {
+               printk("nf_conntrack: can't register to sysctl.\n");
+               ret = -ENOMEM;
+               goto cleanup_proc_stat;
+       }
+#endif
+       return ret;
+
+#ifdef CONFIG_SYSCTL
+ cleanup_proc_stat:
+#endif
+#ifdef CONFIG_PROC_FS
+       remove_proc_entry("nf_conntrack", proc_net_stat);
+ cleanup_proc_exp:
+       proc_net_remove("nf_conntrack_expect");
+ cleanup_proc:
+       proc_net_remove("nf_conntrack");
+ cleanup_init:
+#endif /* CNFIG_PROC_FS */
+       nf_conntrack_cleanup();
+       return ret;
 }
 
 static void __exit nf_conntrack_standalone_fini(void)
 {
-       init_or_cleanup(0);
+#ifdef CONFIG_SYSCTL
+       unregister_sysctl_table(nf_ct_sysctl_header);
+#endif
+#ifdef CONFIG_PROC_FS
+       remove_proc_entry("nf_conntrack", proc_net_stat);
+       proc_net_remove("nf_conntrack_expect");
+       proc_net_remove("nf_conntrack");
+#endif /* CNFIG_PROC_FS */
+       nf_conntrack_cleanup();
 }
 
 module_init(nf_conntrack_standalone_init);
@@ -854,6 +865,7 @@ EXPORT_SYMBOL(nf_ct_proto_put);
 EXPORT_SYMBOL(nf_ct_l3proto_find_get);
 EXPORT_SYMBOL(nf_ct_l3proto_put);
 EXPORT_SYMBOL(nf_ct_l3protos);
+EXPORT_SYMBOL_GPL(nf_conntrack_checksum);
 EXPORT_SYMBOL(nf_conntrack_expect_alloc);
 EXPORT_SYMBOL(nf_conntrack_expect_put);
 EXPORT_SYMBOL(nf_conntrack_expect_related);