[NETFILTER]: x_tables: create per-netns /proc/net/*_tables_*
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
715cf35ac9
commit
3cb609d57c
@@ -922,7 +922,7 @@ static const struct file_operations xt_target_ops = {
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
int xt_proto_init(int af)
|
||||
int xt_proto_init(struct net *net, int af)
|
||||
{
|
||||
#ifdef CONFIG_PROC_FS
|
||||
char buf[XT_FUNCTION_MAXNAMELEN];
|
||||
@@ -936,7 +936,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(&init_net, buf, 0440, &xt_table_ops);
|
||||
proc = proc_net_fops_create(net, buf, 0440, &xt_table_ops);
|
||||
if (!proc)
|
||||
goto out;
|
||||
proc->data = (void *)(unsigned long)af;
|
||||
@@ -944,14 +944,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(&init_net, buf, 0440, &xt_match_ops);
|
||||
proc = proc_net_fops_create(net, buf, 0440, &xt_match_ops);
|
||||
if (!proc)
|
||||
goto out_remove_tables;
|
||||
proc->data = (void *)(unsigned long)af;
|
||||
|
||||
strlcpy(buf, xt_prefix[af], sizeof(buf));
|
||||
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
|
||||
proc = proc_net_fops_create(&init_net, buf, 0440, &xt_target_ops);
|
||||
proc = proc_net_fops_create(net, buf, 0440, &xt_target_ops);
|
||||
if (!proc)
|
||||
goto out_remove_matches;
|
||||
proc->data = (void *)(unsigned long)af;
|
||||
@@ -963,34 +963,34 @@ 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(&init_net, buf);
|
||||
proc_net_remove(net, buf);
|
||||
|
||||
out_remove_tables:
|
||||
strlcpy(buf, xt_prefix[af], sizeof(buf));
|
||||
strlcat(buf, FORMAT_TABLES, sizeof(buf));
|
||||
proc_net_remove(&init_net, buf);
|
||||
proc_net_remove(net, buf);
|
||||
out:
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xt_proto_init);
|
||||
|
||||
void xt_proto_fini(int af)
|
||||
void xt_proto_fini(struct net *net, int af)
|
||||
{
|
||||
#ifdef CONFIG_PROC_FS
|
||||
char buf[XT_FUNCTION_MAXNAMELEN];
|
||||
|
||||
strlcpy(buf, xt_prefix[af], sizeof(buf));
|
||||
strlcat(buf, FORMAT_TABLES, sizeof(buf));
|
||||
proc_net_remove(&init_net, buf);
|
||||
proc_net_remove(net, buf);
|
||||
|
||||
strlcpy(buf, xt_prefix[af], sizeof(buf));
|
||||
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
|
||||
proc_net_remove(&init_net, buf);
|
||||
proc_net_remove(net, buf);
|
||||
|
||||
strlcpy(buf, xt_prefix[af], sizeof(buf));
|
||||
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
|
||||
proc_net_remove(&init_net, buf);
|
||||
proc_net_remove(net, buf);
|
||||
#endif /*CONFIG_PROC_FS*/
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xt_proto_fini);
|
||||
|
Reference in New Issue
Block a user