diff options
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r-- | include/net/ip_fib.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 6e1fd8690..afcec35f6 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -36,7 +36,7 @@ struct kern_rta struct fib_nh { - struct device *nh_dev; + struct net_device *nh_dev; unsigned nh_flags; unsigned char nh_scope; #ifdef CONFIG_IP_ROUTE_MULTIPATH @@ -58,16 +58,18 @@ struct fib_info { struct fib_info *fib_next; struct fib_info *fib_prev; - int fib_refcnt; + int fib_treeref; + atomic_t fib_clntref; + int fib_dead; unsigned fib_flags; int fib_protocol; u32 fib_prefsrc; u32 fib_priority; -#define FIB_MAX_METRICS RTAX_RTT - unsigned fib_metrics[FIB_MAX_METRICS]; + unsigned fib_metrics[RTAX_MAX]; #define fib_mtu fib_metrics[RTAX_MTU-1] #define fib_window fib_metrics[RTAX_WINDOW-1] #define fib_rtt fib_metrics[RTAX_RTT-1] +#define fib_advmss fib_metrics[RTAX_ADVMSS-1] int fib_nhs; #ifdef CONFIG_IP_ROUTE_MULTIPATH int fib_power; @@ -83,7 +85,6 @@ struct fib_rule; struct fib_result { - u32 *prefix; unsigned char prefixlen; unsigned char nh_sel; unsigned char type; @@ -94,6 +95,7 @@ struct fib_result #endif }; + #ifdef CONFIG_IP_ROUTE_MULTIPATH #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) @@ -171,6 +173,7 @@ extern __inline__ void fib_select_default(const struct rt_key *key, struct fib_r extern struct fib_table * fib_tables[RT_TABLE_MAX+1]; extern int fib_lookup(const struct rt_key *key, struct fib_result *res); extern struct fib_table *__fib_new_table(int id); +extern void fib_rule_put(struct fib_rule *r); extern __inline__ struct fib_table *fib_get_table(int id) { @@ -200,11 +203,11 @@ extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, - struct device *dev, u32 *spec_dst, u32 *itag); + struct net_device *dev, u32 *spec_dst, u32 *itag); extern void fib_select_multipath(const struct rt_key *key, struct fib_result *res); /* Exported by fib_semantics.c */ -extern int ip_fib_check_default(u32 gw, struct device *dev); +extern int ip_fib_check_default(u32 gw, struct net_device *dev); extern void fib_release_info(struct fib_info *); extern int fib_semantic_match(int type, struct fib_info *, const struct rt_key *, struct fib_result*); @@ -214,8 +217,8 @@ extern int fib_nh_match(struct rtmsg *r, struct nlmsghdr *, struct kern_rta *rta extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, u8 tb_id, u8 type, u8 scope, void *dst, int dst_len, u8 tos, struct fib_info *fi); -extern int fib_sync_down(u32 local, struct device *dev, int force); -extern int fib_sync_up(struct device *dev); +extern int fib_sync_down(u32 local, struct net_device *dev, int force); +extern int fib_sync_up(struct net_device *dev); extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, struct kern_rta *rta, struct rtentry *r); extern void fib_node_get_info(int type, int dead, struct fib_info *fi, u32 prefix, u32 mask, char *buffer); @@ -254,4 +257,23 @@ extern __inline__ void fib_combine_itag(u32 *itag, struct fib_result *res) #endif } +extern void free_fib_info(struct fib_info *fi); + +extern __inline__ void fib_info_put(struct fib_info *fi) +{ + if (atomic_dec_and_test(&fi->fib_clntref)) + free_fib_info(fi); +} + +extern __inline__ void fib_res_put(struct fib_result *res) +{ + if (res->fi) + fib_info_put(res->fi); +#ifdef CONFIG_IP_MULTIPLE_TABLES + if (res->r) + fib_rule_put(res->r); +#endif +} + + #endif _NET_FIB_H |