[NETNS][IPV6] ip6_fib - fib6_clean_all handle several network namespaces
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 4 Mar 2008 07:27:06 +0000 (23:27 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Mar 2008 07:27:06 +0000 (23:27 -0800)
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>
include/net/ip6_fib.h
include/net/ip6_route.h
net/ipv6/addrconf.c
net/ipv6/ip6_fib.c
net/ipv6/route.c

index 4d4c8ac..e54075d 100644 (file)
@@ -195,7 +195,8 @@ struct fib6_node            *fib6_locate(struct fib6_node *root,
                                             struct in6_addr *daddr, int dst_len,
                                             struct in6_addr *saddr, int src_len);
 
-extern void                    fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
+extern void                    fib6_clean_all(struct net *net,
+                                              int (*func)(struct rt6_info *, void *arg),
                                               int prune, void *arg);
 
 extern int                     fib6_add(struct fib6_node *root,
index 8d155a6..a158abe 100644 (file)
@@ -121,7 +121,7 @@ struct rt6_rtnl_dump_arg
 };
 
 extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
-extern void rt6_ifdown(struct net_device *dev);
+extern void rt6_ifdown(struct net *net, struct net_device *dev);
 extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
 
 extern rwlock_t rt6_lock;
index 9b3a2d0..a1d872d 100644 (file)
@@ -2431,6 +2431,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 {
        struct inet6_dev *idev;
        struct inet6_ifaddr *ifa, **bifa;
+       struct net *net = dev->nd_net;
        int i;
 
        ASSERT_RTNL();
@@ -2438,7 +2439,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
        if (dev == init_net.loopback_dev && how == 1)
                how = 0;
 
-       rt6_ifdown(dev);
+       rt6_ifdown(net, dev);
        neigh_ifdown(&nd_tbl, dev);
 
        idev = __in6_dev_get(dev);
index 7b549f0..0f9dc81 100644 (file)
@@ -1350,7 +1350,7 @@ static void fib6_clean_tree(struct fib6_node *root,
        fib6_walk(&c.w);
 }
 
-void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
+void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
                    int prune, void *arg)
 {
        struct fib6_table *table;
@@ -1360,7 +1360,7 @@ void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
 
        rcu_read_lock();
        for (h = 0; h < FIB_TABLE_HASHSZ; h++) {
-               head = &init_net.ipv6.fib_table_hash[h];
+               head = &net->ipv6.fib_table_hash[h];
                hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
                        write_lock_bh(&table->tb6_lock);
                        fib6_clean_tree(&table->tb6_root, func, prune, arg);
@@ -1450,7 +1450,8 @@ void fib6_run_gc(unsigned long dummy)
        gc_args.more = 0;
 
        icmp6_dst_gc(&gc_args.more);
-       fib6_clean_all(fib6_age, 0, NULL);
+
+       fib6_clean_all(&init_net, fib6_age, 0, NULL);
 
        if (gc_args.more)
                mod_timer(&ip6_fib_timer, jiffies +
Simple merge