]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/netfilter/x_tables.c
[NET]: Make /proc/net per network namespace
[net-next-2.6.git] / net / netfilter / x_tables.c
index cc2baa6d5a7ac5d75d6a9ec3686e755787dc64ff..d9a3bded0d00ac6f48001842c6f55e18429eb8d4 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/mutex.h>
 #include <linux/mm.h>
+#include <net/net_namespace.h>
 
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_arp.h>
@@ -795,7 +796,7 @@ int xt_proto_init(int af)
 #ifdef CONFIG_PROC_FS
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_TABLES, sizeof(buf));
-       proc = proc_net_fops_create(buf, 0440, &xt_file_ops);
+       proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
        if (!proc)
                goto out;
        proc->data = (void *) ((unsigned long) af | (TABLE << 16));
@@ -803,14 +804,14 @@ int xt_proto_init(int af)
 
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_MATCHES, sizeof(buf));
-       proc = proc_net_fops_create(buf, 0440, &xt_file_ops);
+       proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
        if (!proc)
                goto out_remove_tables;
        proc->data = (void *) ((unsigned long) af | (MATCH << 16));
 
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_TARGETS, sizeof(buf));
-       proc = proc_net_fops_create(buf, 0440, &xt_file_ops);
+       proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops);
        if (!proc)
                goto out_remove_matches;
        proc->data = (void *) ((unsigned long) af | (TARGET << 16));
@@ -822,12 +823,12 @@ int xt_proto_init(int af)
 out_remove_matches:
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_MATCHES, sizeof(buf));
-       proc_net_remove(buf);
+       proc_net_remove(&init_net, buf);
 
 out_remove_tables:
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_TABLES, sizeof(buf));
-       proc_net_remove(buf);
+       proc_net_remove(&init_net, buf);
 out:
        return -1;
 #endif
@@ -841,15 +842,15 @@ void xt_proto_fini(int af)
 
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_TABLES, sizeof(buf));
-       proc_net_remove(buf);
+       proc_net_remove(&init_net, buf);
 
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_TARGETS, sizeof(buf));
-       proc_net_remove(buf);
+       proc_net_remove(&init_net, buf);
 
        strlcpy(buf, xt_prefix[af], sizeof(buf));
        strlcat(buf, FORMAT_MATCHES, sizeof(buf));
-       proc_net_remove(buf);
+       proc_net_remove(&init_net, buf);
 #endif /*CONFIG_PROC_FS*/
 }
 EXPORT_SYMBOL_GPL(xt_proto_fini);