diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-09-24 01:52:47 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-24 01:52:47 -0400 |
commit | 23930fa1cebfea6f79881c588ccd1b0781e49e3f (patch) | |
tree | 36d29e3f83661c4f5f45b6f74ac0d5f9886867a8 /include/net/ip_fib.h | |
parent | 36b35a5be0e4b406acd816e2122d153e875105be (diff) | |
parent | 4f5537de7c1531398e84e18a24f667e49cc94208 (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r-- | include/net/ip_fib.h | 104 |
1 files changed, 45 insertions, 59 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index a095d1dec7a4..fcc159a4ac17 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -18,26 +18,34 @@ | |||
18 | 18 | ||
19 | #include <net/flow.h> | 19 | #include <net/flow.h> |
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | 21 | #include <net/fib_rules.h> | |
22 | /* WARNING: The ordering of these elements must match ordering | 22 | |
23 | * of RTA_* rtnetlink attribute numbers. | 23 | struct fib_config { |
24 | */ | 24 | u8 fc_family; |
25 | struct kern_rta { | 25 | u8 fc_dst_len; |
26 | void *rta_dst; | 26 | u8 fc_src_len; |
27 | void *rta_src; | 27 | u8 fc_tos; |
28 | int *rta_iif; | 28 | u8 fc_protocol; |
29 | int *rta_oif; | 29 | u8 fc_scope; |
30 | void *rta_gw; | 30 | u8 fc_type; |
31 | u32 *rta_priority; | 31 | /* 1 byte unused */ |
32 | void *rta_prefsrc; | 32 | u32 fc_table; |
33 | struct rtattr *rta_mx; | 33 | u32 fc_dst; |
34 | struct rtattr *rta_mp; | 34 | u32 fc_src; |
35 | unsigned char *rta_protoinfo; | 35 | u32 fc_gw; |
36 | u32 *rta_flow; | 36 | int fc_oif; |
37 | struct rta_cacheinfo *rta_ci; | 37 | u32 fc_flags; |
38 | struct rta_session *rta_sess; | 38 | u32 fc_priority; |
39 | u32 *rta_mp_alg; | 39 | u32 fc_prefsrc; |
40 | }; | 40 | struct nlattr *fc_mx; |
41 | struct rtnexthop *fc_mp; | ||
42 | int fc_mx_len; | ||
43 | int fc_mp_len; | ||
44 | u32 fc_flow; | ||
45 | u32 fc_mp_alg; | ||
46 | u32 fc_nlflags; | ||
47 | struct nl_info fc_nlinfo; | ||
48 | }; | ||
41 | 49 | ||
42 | struct fib_info; | 50 | struct fib_info; |
43 | 51 | ||
@@ -149,15 +157,12 @@ struct fib_result_nl { | |||
149 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ | 157 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ |
150 | 158 | ||
151 | struct fib_table { | 159 | struct fib_table { |
152 | unsigned char tb_id; | 160 | struct hlist_node tb_hlist; |
161 | u32 tb_id; | ||
153 | unsigned tb_stamp; | 162 | unsigned tb_stamp; |
154 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 163 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
155 | int (*tb_insert)(struct fib_table *table, struct rtmsg *r, | 164 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
156 | struct kern_rta *rta, struct nlmsghdr *n, | 165 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
157 | struct netlink_skb_parms *req); | ||
158 | int (*tb_delete)(struct fib_table *table, struct rtmsg *r, | ||
159 | struct kern_rta *rta, struct nlmsghdr *n, | ||
160 | struct netlink_skb_parms *req); | ||
161 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, | 166 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, |
162 | struct netlink_callback *cb); | 167 | struct netlink_callback *cb); |
163 | int (*tb_flush)(struct fib_table *table); | 168 | int (*tb_flush)(struct fib_table *table); |
@@ -172,14 +177,14 @@ struct fib_table { | |||
172 | extern struct fib_table *ip_fib_local_table; | 177 | extern struct fib_table *ip_fib_local_table; |
173 | extern struct fib_table *ip_fib_main_table; | 178 | extern struct fib_table *ip_fib_main_table; |
174 | 179 | ||
175 | static inline struct fib_table *fib_get_table(int id) | 180 | static inline struct fib_table *fib_get_table(u32 id) |
176 | { | 181 | { |
177 | if (id != RT_TABLE_LOCAL) | 182 | if (id != RT_TABLE_LOCAL) |
178 | return ip_fib_main_table; | 183 | return ip_fib_main_table; |
179 | return ip_fib_local_table; | 184 | return ip_fib_local_table; |
180 | } | 185 | } |
181 | 186 | ||
182 | static inline struct fib_table *fib_new_table(int id) | 187 | static inline struct fib_table *fib_new_table(u32 id) |
183 | { | 188 | { |
184 | return fib_get_table(id); | 189 | return fib_get_table(id); |
185 | } | 190 | } |
@@ -199,35 +204,19 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result | |||
199 | } | 204 | } |
200 | 205 | ||
201 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 206 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
202 | #define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL]) | 207 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) |
203 | #define ip_fib_main_table (fib_tables[RT_TABLE_MAIN]) | 208 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) |
204 | |||
205 | extern struct fib_table * fib_tables[RT_TABLE_MAX+1]; | ||
206 | extern int fib_lookup(const struct flowi *flp, struct fib_result *res); | ||
207 | extern struct fib_table *__fib_new_table(int id); | ||
208 | extern void fib_rule_put(struct fib_rule *r); | ||
209 | 209 | ||
210 | static inline struct fib_table *fib_get_table(int id) | 210 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); |
211 | { | ||
212 | if (id == 0) | ||
213 | id = RT_TABLE_MAIN; | ||
214 | |||
215 | return fib_tables[id]; | ||
216 | } | ||
217 | |||
218 | static inline struct fib_table *fib_new_table(int id) | ||
219 | { | ||
220 | if (id == 0) | ||
221 | id = RT_TABLE_MAIN; | ||
222 | |||
223 | return fib_tables[id] ? : __fib_new_table(id); | ||
224 | } | ||
225 | 211 | ||
212 | extern struct fib_table *fib_new_table(u32 id); | ||
213 | extern struct fib_table *fib_get_table(u32 id); | ||
226 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | 214 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); |
227 | 215 | ||
228 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 216 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
229 | 217 | ||
230 | /* Exported by fib_frontend.c */ | 218 | /* Exported by fib_frontend.c */ |
219 | extern struct nla_policy rtm_ipv4_policy[]; | ||
231 | extern void ip_fib_init(void); | 220 | extern void ip_fib_init(void); |
232 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 221 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
233 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 222 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
@@ -243,23 +232,20 @@ struct rtentry; | |||
243 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 232 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); |
244 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 233 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); |
245 | extern int fib_sync_up(struct net_device *dev); | 234 | extern int fib_sync_up(struct net_device *dev); |
246 | extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | ||
247 | struct kern_rta *rta, struct rtentry *r); | ||
248 | extern u32 __fib_res_prefsrc(struct fib_result *res); | 235 | extern u32 __fib_res_prefsrc(struct fib_result *res); |
249 | 236 | ||
250 | /* Exported by fib_hash.c */ | 237 | /* Exported by fib_hash.c */ |
251 | extern struct fib_table *fib_hash_init(int id); | 238 | extern struct fib_table *fib_hash_init(u32 id); |
252 | 239 | ||
253 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 240 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
254 | /* Exported by fib_rules.c */ | 241 | extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb); |
242 | |||
243 | extern void __init fib4_rules_init(void); | ||
255 | 244 | ||
256 | extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
257 | extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
258 | extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
259 | #ifdef CONFIG_NET_CLS_ROUTE | 245 | #ifdef CONFIG_NET_CLS_ROUTE |
260 | extern u32 fib_rules_tclass(struct fib_result *res); | 246 | extern u32 fib_rules_tclass(struct fib_result *res); |
261 | #endif | 247 | #endif |
262 | extern void fib_rules_init(void); | 248 | |
263 | #endif | 249 | #endif |
264 | 250 | ||
265 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 251 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |