diff options
-rw-r--r-- | net/ipv4/fib_frontend.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 767120111d90..718b0a16ea40 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -1176,35 +1176,20 @@ static void ip_fib_net_exit(struct net *net) | |||
1176 | 1176 | ||
1177 | rtnl_lock(); | 1177 | rtnl_lock(); |
1178 | 1178 | ||
1179 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
1180 | RCU_INIT_POINTER(net->ipv4.fib_local, NULL); | ||
1181 | RCU_INIT_POINTER(net->ipv4.fib_main, NULL); | ||
1182 | RCU_INIT_POINTER(net->ipv4.fib_default, NULL); | ||
1183 | #endif | ||
1184 | |||
1179 | for (i = 0; i < FIB_TABLE_HASHSZ; i++) { | 1185 | for (i = 0; i < FIB_TABLE_HASHSZ; i++) { |
1180 | struct hlist_head *head = &net->ipv4.fib_table_hash[i]; | 1186 | struct hlist_head *head = &net->ipv4.fib_table_hash[i]; |
1181 | struct hlist_node *tmp; | 1187 | struct hlist_node *tmp; |
1182 | struct fib_table *tb; | 1188 | struct fib_table *tb; |
1183 | 1189 | ||
1184 | /* this is done in two passes as flushing the table could | ||
1185 | * cause it to be reallocated in order to accommodate new | ||
1186 | * tnodes at the root as the table shrinks. | ||
1187 | */ | ||
1188 | hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) | ||
1189 | fib_table_flush(tb); | ||
1190 | |||
1191 | hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) { | 1190 | hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) { |
1192 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
1193 | switch (tb->tb_id) { | ||
1194 | case RT_TABLE_LOCAL: | ||
1195 | RCU_INIT_POINTER(net->ipv4.fib_local, NULL); | ||
1196 | break; | ||
1197 | case RT_TABLE_MAIN: | ||
1198 | RCU_INIT_POINTER(net->ipv4.fib_main, NULL); | ||
1199 | break; | ||
1200 | case RT_TABLE_DEFAULT: | ||
1201 | RCU_INIT_POINTER(net->ipv4.fib_default, NULL); | ||
1202 | break; | ||
1203 | default: | ||
1204 | break; | ||
1205 | } | ||
1206 | #endif | ||
1207 | hlist_del(&tb->tb_hlist); | 1191 | hlist_del(&tb->tb_hlist); |
1192 | fib_table_flush(tb); | ||
1208 | fib_free_table(tb); | 1193 | fib_free_table(tb); |
1209 | } | 1194 | } |
1210 | } | 1195 | } |