inet: Add inetpeer tree roots to the FIB tables.
authorDavid S. Miller <davem@davemloft.net>
Mon, 11 Jun 2012 07:01:52 +0000 (00:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Jun 2012 09:09:16 +0000 (02:09 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_fib.h
include/net/ip_fib.h
net/ipv4/fib_trie.c
net/ipv6/ip6_fib.c

index 3ac5f155c6902935a9cd55dfbab33f4888c5bcce..a192f7807659e8e70824c57b230daef20930ad1b 100644 (file)
@@ -237,6 +237,7 @@ struct fib6_table {
        u32                     tb6_id;
        rwlock_t                tb6_lock;
        struct fib6_node        tb6_root;
+       struct inet_peer_base   tb6_peers;
 };
 
 #define RT6_TABLE_UNSPEC       RT_TABLE_UNSPEC
index 78df0866cc3878c4c49dfabc30c53d16d5299800..4b347c0ca09470270424c419b935bffdad7a5abb 100644 (file)
@@ -19,6 +19,7 @@
 #include <net/flow.h>
 #include <linux/seq_file.h>
 #include <net/fib_rules.h>
+#include <net/inetpeer.h>
 
 struct fib_config {
        u8                      fc_dst_len;
@@ -157,11 +158,12 @@ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
                                         FIB_RES_SADDR(net, res))
 
 struct fib_table {
-       struct hlist_node tb_hlist;
-       u32             tb_id;
-       int             tb_default;
-       int             tb_num_default;
-       unsigned long   tb_data[0];
+       struct hlist_node       tb_hlist;
+       u32                     tb_id;
+       int                     tb_default;
+       int                     tb_num_default;
+       struct inet_peer_base   tb_peers;
+       unsigned long           tb_data[0];
 };
 
 extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
index 18cbc15b20d5cc3dfc10c52ff344fa60a7ed3560..9b0f25930fbc309acdefc4a3ada98aefa40a6050 100644 (file)
@@ -1843,6 +1843,8 @@ int fib_table_flush(struct fib_table *tb)
        if (ll && hlist_empty(&ll->list))
                trie_leaf_remove(t, ll);
 
+       inetpeer_invalidate_tree(&tb->tb_peers);
+
        pr_debug("trie_flush found=%d\n", found);
        return found;
 }
@@ -1991,6 +1993,7 @@ struct fib_table *fib_trie_table(u32 id)
        tb->tb_id = id;
        tb->tb_default = -1;
        tb->tb_num_default = 0;
+       inet_peer_base_init(&tb->tb_peers);
 
        t = (struct trie *) tb->tb_data;
        memset(t, 0, sizeof(*t));
index 0c220a416626af196f534ab062920c169f6dcd7a..7ef0743f06f0524a21685ef06d353402c47bef53 100644 (file)
@@ -197,6 +197,7 @@ static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
                table->tb6_id = id;
                table->tb6_root.leaf = net->ipv6.ip6_null_entry;
                table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+               inet_peer_base_init(&table->tb6_peers);
        }
 
        return table;
@@ -1633,6 +1634,7 @@ static int __net_init fib6_net_init(struct net *net)
        net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
        net->ipv6.fib6_main_tbl->tb6_root.fn_flags =
                RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+       inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers);
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
        net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl),
@@ -1643,6 +1645,7 @@ static int __net_init fib6_net_init(struct net *net)
        net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
        net->ipv6.fib6_local_tbl->tb6_root.fn_flags =
                RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+       inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers);
 #endif
        fib6_tables_init(net);
 
@@ -1666,8 +1669,10 @@ static void fib6_net_exit(struct net *net)
        del_timer_sync(&net->ipv6.ip6_fib_timer);
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
+       inetpeer_invalidate_tree(&net->ipv6.fib6_local_tbl->tb6_peers);
        kfree(net->ipv6.fib6_local_tbl);
 #endif
+       inetpeer_invalidate_tree(&net->ipv6.fib6_main_tbl->tb6_peers);
        kfree(net->ipv6.fib6_main_tbl);
        kfree(net->ipv6.fib_table_hash);
        kfree(net->ipv6.rt6_stats);