diff options
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 0484cae02736..9ff1e6669ef2 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -50,39 +50,34 @@ | |||
50 | #define FFprint(a...) printk(KERN_DEBUG a) | 50 | #define FFprint(a...) printk(KERN_DEBUG a) |
51 | 51 | ||
52 | static struct sock *fibnl; | 52 | static struct sock *fibnl; |
53 | struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; | ||
53 | 54 | ||
54 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 55 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
55 | 56 | ||
56 | struct fib_table *ip_fib_local_table; | ||
57 | struct fib_table *ip_fib_main_table; | ||
58 | |||
59 | #define FIB_TABLE_HASHSZ 1 | ||
60 | static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; | ||
61 | |||
62 | static int __net_init fib4_rules_init(struct net *net) | 57 | static int __net_init fib4_rules_init(struct net *net) |
63 | { | 58 | { |
64 | ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL); | 59 | struct fib_table *local_table, *main_table; |
65 | if (ip_fib_local_table == NULL) | 60 | |
61 | local_table = fib_hash_init(RT_TABLE_LOCAL); | ||
62 | if (local_table == NULL) | ||
66 | return -ENOMEM; | 63 | return -ENOMEM; |
67 | 64 | ||
68 | ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN); | 65 | main_table = fib_hash_init(RT_TABLE_MAIN); |
69 | if (ip_fib_main_table == NULL) | 66 | if (main_table == NULL) |
70 | goto fail; | 67 | goto fail; |
71 | 68 | ||
72 | hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); | 69 | hlist_add_head_rcu(&local_table->tb_hlist, |
73 | hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]); | 70 | &fib_table_hash[TABLE_LOCAL_INDEX]); |
71 | hlist_add_head_rcu(&main_table->tb_hlist, | ||
72 | &fib_table_hash[TABLE_MAIN_INDEX]); | ||
74 | return 0; | 73 | return 0; |
75 | 74 | ||
76 | fail: | 75 | fail: |
77 | kfree(ip_fib_local_table); | 76 | kfree(local_table); |
78 | ip_fib_local_table = NULL; | ||
79 | return -ENOMEM; | 77 | return -ENOMEM; |
80 | } | 78 | } |
81 | #else | 79 | #else |
82 | 80 | ||
83 | #define FIB_TABLE_HASHSZ 256 | ||
84 | static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; | ||
85 | |||
86 | struct fib_table *fib_new_table(u32 id) | 81 | struct fib_table *fib_new_table(u32 id) |
87 | { | 82 | { |
88 | struct fib_table *tb; | 83 | struct fib_table *tb; |