diff options
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r-- | include/net/ip_fib.h | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 78df0866cc3..000c4674e18 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 | ||
23 | struct fib_config { | 24 | struct 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 | ||
159 | struct fib_table { | 160 | struct 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 | ||
167 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, | 169 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, |
@@ -218,20 +220,55 @@ extern void __net_exit fib4_rules_exit(struct net *net); | |||
218 | extern u32 fib_rules_tclass(const struct fib_result *res); | 220 | extern u32 fib_rules_tclass(const struct fib_result *res); |
219 | #endif | 221 | #endif |
220 | 222 | ||
221 | extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res); | ||
222 | |||
223 | extern struct fib_table *fib_new_table(struct net *net, u32 id); | 223 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
224 | extern struct fib_table *fib_get_table(struct net *net, u32 id); | 224 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
225 | 225 | ||
226 | extern int __fib_lookup(struct net *net, struct flowi4 *flp, | ||
227 | struct fib_result *res); | ||
228 | |||
229 | static inline int fib_lookup(struct net *net, struct flowi4 *flp, | ||
230 | struct fib_result *res) | ||
231 | { | ||
232 | if (!net->ipv4.fib_has_custom_rules) { | ||
233 | res->r = NULL; | ||
234 | if (net->ipv4.fib_local && | ||
235 | !fib_table_lookup(net->ipv4.fib_local, flp, res, | ||
236 | FIB_LOOKUP_NOREF)) | ||
237 | return 0; | ||
238 | if (net->ipv4.fib_main && | ||
239 | !fib_table_lookup(net->ipv4.fib_main, flp, res, | ||
240 | FIB_LOOKUP_NOREF)) | ||
241 | return 0; | ||
242 | if (net->ipv4.fib_default && | ||
243 | !fib_table_lookup(net->ipv4.fib_default, flp, res, | ||
244 | FIB_LOOKUP_NOREF)) | ||
245 | return 0; | ||
246 | return -ENETUNREACH; | ||
247 | } | ||
248 | return __fib_lookup(net, flp, res); | ||
249 | } | ||
250 | |||
226 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 251 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
227 | 252 | ||
228 | /* Exported by fib_frontend.c */ | 253 | /* Exported by fib_frontend.c */ |
229 | extern const struct nla_policy rtm_ipv4_policy[]; | 254 | extern const struct nla_policy rtm_ipv4_policy[]; |
230 | extern void ip_fib_init(void); | 255 | extern void ip_fib_init(void); |
256 | extern __be32 fib_compute_spec_dst(struct sk_buff *skb); | ||
231 | extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, | 257 | extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, |
232 | u8 tos, int oif, struct net_device *dev, | 258 | u8 tos, int oif, struct net_device *dev, |
233 | __be32 *spec_dst, u32 *itag); | 259 | struct in_device *idev, u32 *itag); |
234 | extern void fib_select_default(struct fib_result *res); | 260 | extern void fib_select_default(struct fib_result *res); |
261 | #ifdef CONFIG_IP_ROUTE_CLASSID | ||
262 | static inline int fib_num_tclassid_users(struct net *net) | ||
263 | { | ||
264 | return net->ipv4.fib_num_tclassid_users; | ||
265 | } | ||
266 | #else | ||
267 | static inline int fib_num_tclassid_users(struct net *net) | ||
268 | { | ||
269 | return 0; | ||
270 | } | ||
271 | #endif | ||
235 | 272 | ||
236 | /* Exported by fib_semantics.c */ | 273 | /* Exported by fib_semantics.c */ |
237 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); | 274 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |