aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/x_tables.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2008-01-31 04:49:16 -0800
committerDavid S. Miller <davem@davemloft.net>2008-01-31 19:28:05 -0800
commit715cf35ac9291f31a4fea7d022695a64cac0af80 (patch)
tree2bdc67caa0b6cca6d580c0c2fc9642fbccf0a1f6 /net/netfilter/x_tables.c
parent025d93d148d46bedb26905975f5d9c83d280b46e (diff)
downloadlinux-715cf35ac9291f31a4fea7d022695a64cac0af80.tar.gz
[NETFILTER]: x_tables: netns propagation for /proc/net/*_tables_names
Propagate netns together with AF down to ->start/->next/->stop iterators. Choose table based on netns and AF for showing. 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>
Diffstat (limited to 'net/netfilter/x_tables.c')
-rw-r--r--net/netfilter/x_tables.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 89e322d3b36174..12ed64c0bc9ad8 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -720,27 +720,33 @@ void *xt_unregister_table(struct xt_table *table)
EXPORT_SYMBOL_GPL(xt_unregister_table);
#ifdef CONFIG_PROC_FS
+struct xt_names_priv {
+ struct seq_net_private p;
+ int af;
+};
static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
{
- struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ struct net *net = priv->p.net;
+ int af = priv->af;
mutex_lock(&xt[af].mutex);
- return seq_list_start(&init_net.xt.tables[af], *pos);
+ return seq_list_start(&net->xt.tables[af], *pos);
}
static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ struct net *net = priv->p.net;
+ int af = priv->af;
- return seq_list_next(v, &init_net.xt.tables[af], pos);
+ return seq_list_next(v, &net->xt.tables[af], pos);
}
static void xt_table_seq_stop(struct seq_file *seq, void *v)
{
- struct proc_dir_entry *pde = seq->private;
- u_int16_t af = (unsigned long)pde->data;
+ struct xt_names_priv *priv = seq->private;
+ int af = priv->af;
mutex_unlock(&xt[af].mutex);
}
@@ -765,12 +771,13 @@ static const struct seq_operations xt_table_seq_ops = {
static int xt_table_open(struct inode *inode, struct file *file)
{
int ret;
+ struct xt_names_priv *priv;
- ret = seq_open(file, &xt_table_seq_ops);
+ ret = seq_open_net(inode, file, &xt_table_seq_ops,
+ sizeof(struct xt_names_priv));
if (!ret) {
- struct seq_file *seq = file->private_data;
-
- seq->private = PDE(inode);
+ priv = ((struct seq_file *)file->private_data)->private;
+ priv->af = (unsigned long)PDE(inode)->data;
}
return ret;
}