diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-08 05:35:08 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:08 -0400 |
commit | 8e9df80180b73d4107bf8fbf28b1633c541d2770 (patch) | |
tree | 572b4bc6e53839818e545b0a7ba84234b0a027ce /net/ipv4 | |
parent | 0d55af8791bfb42e04cc456b348910582f230343 (diff) |
netfilter: netns nf_conntrack: per-netns /proc/net/stat/nf_conntrack, /proc/net/stat/ip_conntrack
Show correct conntrack count, while I'm at it.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index fdc85b370783..313ebf00ee36 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -285,6 +285,7 @@ static const struct file_operations ip_exp_file_ops = { | |||
285 | 285 | ||
286 | static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) | 286 | static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) |
287 | { | 287 | { |
288 | struct net *net = seq_file_net(seq); | ||
288 | int cpu; | 289 | int cpu; |
289 | 290 | ||
290 | if (*pos == 0) | 291 | if (*pos == 0) |
@@ -294,7 +295,7 @@ static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) | |||
294 | if (!cpu_possible(cpu)) | 295 | if (!cpu_possible(cpu)) |
295 | continue; | 296 | continue; |
296 | *pos = cpu+1; | 297 | *pos = cpu+1; |
297 | return per_cpu_ptr(init_net.ct.stat, cpu); | 298 | return per_cpu_ptr(net->ct.stat, cpu); |
298 | } | 299 | } |
299 | 300 | ||
300 | return NULL; | 301 | return NULL; |
@@ -302,13 +303,14 @@ static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) | |||
302 | 303 | ||
303 | static void *ct_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 304 | static void *ct_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
304 | { | 305 | { |
306 | struct net *net = seq_file_net(seq); | ||
305 | int cpu; | 307 | int cpu; |
306 | 308 | ||
307 | for (cpu = *pos; cpu < NR_CPUS; ++cpu) { | 309 | for (cpu = *pos; cpu < NR_CPUS; ++cpu) { |
308 | if (!cpu_possible(cpu)) | 310 | if (!cpu_possible(cpu)) |
309 | continue; | 311 | continue; |
310 | *pos = cpu+1; | 312 | *pos = cpu+1; |
311 | return per_cpu_ptr(init_net.ct.stat, cpu); | 313 | return per_cpu_ptr(net->ct.stat, cpu); |
312 | } | 314 | } |
313 | 315 | ||
314 | return NULL; | 316 | return NULL; |
@@ -320,7 +322,8 @@ static void ct_cpu_seq_stop(struct seq_file *seq, void *v) | |||
320 | 322 | ||
321 | static int ct_cpu_seq_show(struct seq_file *seq, void *v) | 323 | static int ct_cpu_seq_show(struct seq_file *seq, void *v) |
322 | { | 324 | { |
323 | unsigned int nr_conntracks = atomic_read(&init_net.ct.count); | 325 | struct net *net = seq_file_net(seq); |
326 | unsigned int nr_conntracks = atomic_read(&net->ct.count); | ||
324 | const struct ip_conntrack_stat *st = v; | 327 | const struct ip_conntrack_stat *st = v; |
325 | 328 | ||
326 | if (v == SEQ_START_TOKEN) { | 329 | if (v == SEQ_START_TOKEN) { |
@@ -360,7 +363,8 @@ static const struct seq_operations ct_cpu_seq_ops = { | |||
360 | 363 | ||
361 | static int ct_cpu_seq_open(struct inode *inode, struct file *file) | 364 | static int ct_cpu_seq_open(struct inode *inode, struct file *file) |
362 | { | 365 | { |
363 | return seq_open(file, &ct_cpu_seq_ops); | 366 | return seq_open_net(inode, file, &ct_cpu_seq_ops, |
367 | sizeof(struct seq_net_private)); | ||
364 | } | 368 | } |
365 | 369 | ||
366 | static const struct file_operations ct_cpu_seq_fops = { | 370 | static const struct file_operations ct_cpu_seq_fops = { |
@@ -368,7 +372,7 @@ static const struct file_operations ct_cpu_seq_fops = { | |||
368 | .open = ct_cpu_seq_open, | 372 | .open = ct_cpu_seq_open, |
369 | .read = seq_read, | 373 | .read = seq_read, |
370 | .llseek = seq_lseek, | 374 | .llseek = seq_lseek, |
371 | .release = seq_release, | 375 | .release = seq_release_net, |
372 | }; | 376 | }; |
373 | 377 | ||
374 | static int __net_init ip_conntrack_net_init(struct net *net) | 378 | static int __net_init ip_conntrack_net_init(struct net *net) |