aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/ipv6/ip6_fib.c7
-rw-r--r--net/ipv6/route.c28
3 files changed, 26 insertions, 12 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9b3a2d0e4269..a1d872dacad6 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2431,6 +2431,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2431{ 2431{
2432 struct inet6_dev *idev; 2432 struct inet6_dev *idev;
2433 struct inet6_ifaddr *ifa, **bifa; 2433 struct inet6_ifaddr *ifa, **bifa;
2434 struct net *net = dev->nd_net;
2434 int i; 2435 int i;
2435 2436
2436 ASSERT_RTNL(); 2437 ASSERT_RTNL();
@@ -2438,7 +2439,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2438 if (dev == init_net.loopback_dev && how == 1) 2439 if (dev == init_net.loopback_dev && how == 1)
2439 how = 0; 2440 how = 0;
2440 2441
2441 rt6_ifdown(dev); 2442 rt6_ifdown(net, dev);
2442 neigh_ifdown(&nd_tbl, dev); 2443 neigh_ifdown(&nd_tbl, dev);
2443 2444
2444 idev = __in6_dev_get(dev); 2445 idev = __in6_dev_get(dev);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 7b549f0bc428..0f9dc81f0e61 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1350,7 +1350,7 @@ static void fib6_clean_tree(struct fib6_node *root,
1350 fib6_walk(&c.w); 1350 fib6_walk(&c.w);
1351} 1351}
1352 1352
1353void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), 1353void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
1354 int prune, void *arg) 1354 int prune, void *arg)
1355{ 1355{
1356 struct fib6_table *table; 1356 struct fib6_table *table;
@@ -1360,7 +1360,7 @@ void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
1360 1360
1361 rcu_read_lock(); 1361 rcu_read_lock();
1362 for (h = 0; h < FIB_TABLE_HASHSZ; h++) { 1362 for (h = 0; h < FIB_TABLE_HASHSZ; h++) {
1363 head = &init_net.ipv6.fib_table_hash[h]; 1363 head = &net->ipv6.fib_table_hash[h];
1364 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) { 1364 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
1365 write_lock_bh(&table->tb6_lock); 1365 write_lock_bh(&table->tb6_lock);
1366 fib6_clean_tree(&table->tb6_root, func, prune, arg); 1366 fib6_clean_tree(&table->tb6_root, func, prune, arg);
@@ -1450,7 +1450,8 @@ void fib6_run_gc(unsigned long dummy)
1450 gc_args.more = 0; 1450 gc_args.more = 0;
1451 1451
1452 icmp6_dst_gc(&gc_args.more); 1452 icmp6_dst_gc(&gc_args.more);
1453 fib6_clean_all(fib6_age, 0, NULL); 1453
1454 fib6_clean_all(&init_net, fib6_age, 0, NULL);
1454 1455
1455 if (gc_args.more) 1456 if (gc_args.more)
1456 mod_timer(&ip6_fib_timer, jiffies + 1457 mod_timer(&ip6_fib_timer, jiffies +
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
1873void rt6_ifdown(struct net_device *dev) 1873void 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
1878struct rt6_mtu_change_arg 1878struct 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
1934static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { 1934static 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
2319static int ipv6_route_show(struct seq_file *m, void *v) 2319static 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
2325static int ipv6_route_open(struct inode *inode, struct file *file) 2326static 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
2334static 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
2330static const struct file_operations ipv6_route_proc_fops = { 2342static 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
2338static int rt6_stats_seq_show(struct seq_file *seq, void *v) 2350static int rt6_stats_seq_show(struct seq_file *seq, void *v)
@@ -2570,7 +2582,7 @@ xfrm6_init:
2570out_proc_init: 2582out_proc_init:
2571 ipv6_route_proc_fini(&init_net); 2583 ipv6_route_proc_fini(&init_net);
2572out_fib6_init: 2584out_fib6_init:
2573 rt6_ifdown(NULL); 2585 rt6_ifdown(&init_net, NULL);
2574 fib6_gc_cleanup(); 2586 fib6_gc_cleanup();
2575out_kmem_cache: 2587out_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}