Commit ffc31d3d7719555cd784ecaf82e9c237f3a747ab
Committed by
David S. Miller
1 parent
49e8a279a1
Exists in
master
and in
4 other branches
[NETNS]: /proc/net/arp namespacing.
Seqfile operation showing /proc/net/arp are already namespace aware. All we need is to register this file for each namespace. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 18 additions and 2 deletions Side-by-side Diff
net/ipv4/arp.c
... | ... | @@ -1377,11 +1377,27 @@ |
1377 | 1377 | .release = seq_release_net, |
1378 | 1378 | }; |
1379 | 1379 | |
1380 | -static int __init arp_proc_init(void) | |
1380 | + | |
1381 | +static int __net_init arp_net_init(struct net *net) | |
1381 | 1382 | { |
1382 | - if (!proc_net_fops_create(&init_net, "arp", S_IRUGO, &arp_seq_fops)) | |
1383 | + if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops)) | |
1383 | 1384 | return -ENOMEM; |
1384 | 1385 | return 0; |
1386 | +} | |
1387 | + | |
1388 | +static void __net_exit arp_net_exit(struct net *net) | |
1389 | +{ | |
1390 | + proc_net_remove(net, "arp"); | |
1391 | +} | |
1392 | + | |
1393 | +static struct pernet_operations arp_net_ops = { | |
1394 | + .init = arp_net_init, | |
1395 | + .exit = arp_net_exit, | |
1396 | +}; | |
1397 | + | |
1398 | +static int __init arp_proc_init(void) | |
1399 | +{ | |
1400 | + return register_pernet_subsys(&arp_net_ops); | |
1385 | 1401 | } |
1386 | 1402 | |
1387 | 1403 | #else /* CONFIG_PROC_FS */ |