diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-04 02:27:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-04 02:27:06 -0500 |
commit | f3db48517f59133610f558f29de8834d7b007691 (patch) | |
tree | d4a69e551fb9f10ea64430a26e917ce1d77e39ff /net/ipv6/route.c | |
parent | 58f09b78b730cf0d936597272bf35b3d615e967c (diff) |
[NETNS][IPV6] ip6_fib - fib6_clean_all handle several network namespaces
The function fib6_clean_all takes the network namespace as
parameter. That allows to flush the routes related to a specific
network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 09206f7ba525..2e6da2afd948 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1870,9 +1870,9 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) | |||
1870 | return 0; | 1870 | return 0; |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | void rt6_ifdown(struct net_device *dev) | 1873 | void rt6_ifdown(struct net *net, struct net_device *dev) |
1874 | { | 1874 | { |
1875 | fib6_clean_all(fib6_ifdown, 0, dev); | 1875 | fib6_clean_all(net, fib6_ifdown, 0, dev); |
1876 | } | 1876 | } |
1877 | 1877 | ||
1878 | struct rt6_mtu_change_arg | 1878 | struct rt6_mtu_change_arg |
@@ -1928,7 +1928,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned mtu) | |||
1928 | .mtu = mtu, | 1928 | .mtu = mtu, |
1929 | }; | 1929 | }; |
1930 | 1930 | ||
1931 | fib6_clean_all(rt6_mtu_change_route, 0, &arg); | 1931 | fib6_clean_all(dev->nd_net, rt6_mtu_change_route, 0, &arg); |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { | 1934 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { |
@@ -2318,13 +2318,25 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) | |||
2318 | 2318 | ||
2319 | static int ipv6_route_show(struct seq_file *m, void *v) | 2319 | static int ipv6_route_show(struct seq_file *m, void *v) |
2320 | { | 2320 | { |
2321 | fib6_clean_all(rt6_info_route, 0, m); | 2321 | struct net *net = (struct net *)m->private; |
2322 | fib6_clean_all(net, rt6_info_route, 0, m); | ||
2322 | return 0; | 2323 | return 0; |
2323 | } | 2324 | } |
2324 | 2325 | ||
2325 | static int ipv6_route_open(struct inode *inode, struct file *file) | 2326 | static int ipv6_route_open(struct inode *inode, struct file *file) |
2326 | { | 2327 | { |
2327 | return single_open(file, ipv6_route_show, NULL); | 2328 | struct net *net = get_proc_net(inode); |
2329 | if (!net) | ||
2330 | return -ENXIO; | ||
2331 | return single_open(file, ipv6_route_show, net); | ||
2332 | } | ||
2333 | |||
2334 | static int ipv6_route_release(struct inode *inode, struct file *file) | ||
2335 | { | ||
2336 | struct seq_file *seq = file->private_data; | ||
2337 | struct net *net = seq->private; | ||
2338 | put_net(net); | ||
2339 | return single_release(inode, file); | ||
2328 | } | 2340 | } |
2329 | 2341 | ||
2330 | static const struct file_operations ipv6_route_proc_fops = { | 2342 | static const struct file_operations ipv6_route_proc_fops = { |
@@ -2332,7 +2344,7 @@ static const struct file_operations ipv6_route_proc_fops = { | |||
2332 | .open = ipv6_route_open, | 2344 | .open = ipv6_route_open, |
2333 | .read = seq_read, | 2345 | .read = seq_read, |
2334 | .llseek = seq_lseek, | 2346 | .llseek = seq_lseek, |
2335 | .release = single_release, | 2347 | .release = ipv6_route_release, |
2336 | }; | 2348 | }; |
2337 | 2349 | ||
2338 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) | 2350 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) |
@@ -2570,7 +2582,7 @@ xfrm6_init: | |||
2570 | out_proc_init: | 2582 | out_proc_init: |
2571 | ipv6_route_proc_fini(&init_net); | 2583 | ipv6_route_proc_fini(&init_net); |
2572 | out_fib6_init: | 2584 | out_fib6_init: |
2573 | rt6_ifdown(NULL); | 2585 | rt6_ifdown(&init_net, NULL); |
2574 | fib6_gc_cleanup(); | 2586 | fib6_gc_cleanup(); |
2575 | out_kmem_cache: | 2587 | out_kmem_cache: |
2576 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); | 2588 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); |
@@ -2582,7 +2594,7 @@ void ip6_route_cleanup(void) | |||
2582 | fib6_rules_cleanup(); | 2594 | fib6_rules_cleanup(); |
2583 | ipv6_route_proc_fini(&init_net); | 2595 | ipv6_route_proc_fini(&init_net); |
2584 | xfrm6_fini(); | 2596 | xfrm6_fini(); |
2585 | rt6_ifdown(NULL); | 2597 | rt6_ifdown(&init_net, NULL); |
2586 | fib6_gc_cleanup(); | 2598 | fib6_gc_cleanup(); |
2587 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); | 2599 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); |
2588 | } | 2600 | } |