aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/ip_fib.h25
1 files changed, 5 insertions, 20 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 0dcbf166eb94..8e9ba563d342 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -150,6 +150,7 @@ struct fib_result_nl {
150#endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ 150#endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */
151 151
152struct fib_table { 152struct fib_table {
153 struct hlist_node tb_hlist;
153 u32 tb_id; 154 u32 tb_id;
154 unsigned tb_stamp; 155 unsigned tb_stamp;
155 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); 156 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
@@ -200,29 +201,13 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result
200} 201}
201 202
202#else /* CONFIG_IP_MULTIPLE_TABLES */ 203#else /* CONFIG_IP_MULTIPLE_TABLES */
203#define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL]) 204#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL)
204#define ip_fib_main_table (fib_tables[RT_TABLE_MAIN]) 205#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN)
205 206
206extern struct fib_table * fib_tables[RT_TABLE_MAX+1];
207extern int fib_lookup(struct flowi *flp, struct fib_result *res); 207extern int fib_lookup(struct flowi *flp, struct fib_result *res);
208extern struct fib_table *__fib_new_table(u32 id);
209
210static inline struct fib_table *fib_get_table(u32 id)
211{
212 if (id == 0)
213 id = RT_TABLE_MAIN;
214
215 return fib_tables[id];
216}
217
218static inline struct fib_table *fib_new_table(u32 id)
219{
220 if (id == 0)
221 id = RT_TABLE_MAIN;
222
223 return fib_tables[id] ? : __fib_new_table(id);
224}
225 208
209extern struct fib_table *fib_new_table(u32 id);
210extern struct fib_table *fib_get_table(u32 id);
226extern void fib_select_default(const struct flowi *flp, struct fib_result *res); 211extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
227 212
228#endif /* CONFIG_IP_MULTIPLE_TABLES */ 213#endif /* CONFIG_IP_MULTIPLE_TABLES */