aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/net/ip_fib.h12
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv6/ip6_fib.c5
4 files changed, 16 insertions, 5 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 3ac5f155c690..a192f7807659 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -237,6 +237,7 @@ struct fib6_table {
237 u32 tb6_id; 237 u32 tb6_id;
238 rwlock_t tb6_lock; 238 rwlock_t tb6_lock;
239 struct fib6_node tb6_root; 239 struct fib6_node tb6_root;
240 struct inet_peer_base tb6_peers;
240}; 241};
241 242
242#define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC 243#define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 78df0866cc38..4b347c0ca094 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -19,6 +19,7 @@
19#include <net/flow.h> 19#include <net/flow.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <net/fib_rules.h> 21#include <net/fib_rules.h>
22#include <net/inetpeer.h>
22 23
23struct fib_config { 24struct fib_config {
24 u8 fc_dst_len; 25 u8 fc_dst_len;
@@ -157,11 +158,12 @@ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
157 FIB_RES_SADDR(net, res)) 158 FIB_RES_SADDR(net, res))
158 159
159struct fib_table { 160struct fib_table {
160 struct hlist_node tb_hlist; 161 struct hlist_node tb_hlist;
161 u32 tb_id; 162 u32 tb_id;
162 int tb_default; 163 int tb_default;
163 int tb_num_default; 164 int tb_num_default;
164 unsigned long tb_data[0]; 165 struct inet_peer_base tb_peers;
166 unsigned long tb_data[0];
165}; 167};
166 168
167extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 169extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 18cbc15b20d5..9b0f25930fbc 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1843,6 +1843,8 @@ int fib_table_flush(struct fib_table *tb)
1843 if (ll && hlist_empty(&ll->list)) 1843 if (ll && hlist_empty(&ll->list))
1844 trie_leaf_remove(t, ll); 1844 trie_leaf_remove(t, ll);
1845 1845
1846 inetpeer_invalidate_tree(&tb->tb_peers);
1847
1846 pr_debug("trie_flush found=%d\n", found); 1848 pr_debug("trie_flush found=%d\n", found);
1847 return found; 1849 return found;
1848} 1850}
@@ -1991,6 +1993,7 @@ struct fib_table *fib_trie_table(u32 id)
1991 tb->tb_id = id; 1993 tb->tb_id = id;
1992 tb->tb_default = -1; 1994 tb->tb_default = -1;
1993 tb->tb_num_default = 0; 1995 tb->tb_num_default = 0;
1996 inet_peer_base_init(&tb->tb_peers);
1994 1997
1995 t = (struct trie *) tb->tb_data; 1998 t = (struct trie *) tb->tb_data;
1996 memset(t, 0, sizeof(*t)); 1999 memset(t, 0, sizeof(*t));
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 0c220a416626..7ef0743f06f0 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -197,6 +197,7 @@ static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
197 table->tb6_id = id; 197 table->tb6_id = id;
198 table->tb6_root.leaf = net->ipv6.ip6_null_entry; 198 table->tb6_root.leaf = net->ipv6.ip6_null_entry;
199 table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; 199 table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
200 inet_peer_base_init(&table->tb6_peers);
200 } 201 }
201 202
202 return table; 203 return table;
@@ -1633,6 +1634,7 @@ static int __net_init fib6_net_init(struct net *net)
1633 net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; 1634 net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
1634 net->ipv6.fib6_main_tbl->tb6_root.fn_flags = 1635 net->ipv6.fib6_main_tbl->tb6_root.fn_flags =
1635 RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; 1636 RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
1637 inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers);
1636 1638
1637#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1639#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1638 net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl), 1640 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)
1643 net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; 1645 net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
1644 net->ipv6.fib6_local_tbl->tb6_root.fn_flags = 1646 net->ipv6.fib6_local_tbl->tb6_root.fn_flags =
1645 RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; 1647 RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
1648 inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers);
1646#endif 1649#endif
1647 fib6_tables_init(net); 1650 fib6_tables_init(net);
1648 1651
@@ -1666,8 +1669,10 @@ static void fib6_net_exit(struct net *net)
1666 del_timer_sync(&net->ipv6.ip6_fib_timer); 1669 del_timer_sync(&net->ipv6.ip6_fib_timer);
1667 1670
1668#ifdef CONFIG_IPV6_MULTIPLE_TABLES 1671#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1672 inetpeer_invalidate_tree(&net->ipv6.fib6_local_tbl->tb6_peers);
1669 kfree(net->ipv6.fib6_local_tbl); 1673 kfree(net->ipv6.fib6_local_tbl);
1670#endif 1674#endif
1675 inetpeer_invalidate_tree(&net->ipv6.fib6_main_tbl->tb6_peers);
1671 kfree(net->ipv6.fib6_main_tbl); 1676 kfree(net->ipv6.fib6_main_tbl);
1672 kfree(net->ipv6.fib_table_hash); 1677 kfree(net->ipv6.fib_table_hash);
1673 kfree(net->ipv6.rt6_stats); 1678 kfree(net->ipv6.rt6_stats);