diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ip_fib.h | 55 | ||||
-rw-r--r-- | include/net/netlink.h | 10 | ||||
-rw-r--r-- | include/net/nexthop.h | 33 |
3 files changed, 71 insertions, 27 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 8e9ba563d342..42ed96fab3f5 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -20,25 +20,32 @@ | |||
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 | 22 | ||
23 | /* WARNING: The ordering of these elements must match ordering | 23 | struct fib_config { |
24 | * of RTA_* rtnetlink attribute numbers. | 24 | u8 fc_family; |
25 | */ | 25 | u8 fc_dst_len; |
26 | struct kern_rta { | 26 | u8 fc_src_len; |
27 | void *rta_dst; | 27 | u8 fc_tos; |
28 | void *rta_src; | 28 | u8 fc_protocol; |
29 | int *rta_iif; | 29 | u8 fc_scope; |
30 | int *rta_oif; | 30 | u8 fc_type; |
31 | void *rta_gw; | 31 | /* 1 byte unused */ |
32 | u32 *rta_priority; | 32 | u32 fc_table; |
33 | void *rta_prefsrc; | 33 | u32 fc_dst; |
34 | struct rtattr *rta_mx; | 34 | u32 fc_src; |
35 | struct rtattr *rta_mp; | 35 | u32 fc_gw; |
36 | unsigned char *rta_protoinfo; | 36 | int fc_oif; |
37 | u32 *rta_flow; | 37 | u32 fc_flags; |
38 | struct rta_cacheinfo *rta_ci; | 38 | u32 fc_priority; |
39 | struct rta_session *rta_sess; | 39 | u32 fc_prefsrc; |
40 | u32 *rta_mp_alg; | 40 | struct nlattr *fc_mx; |
41 | }; | 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 | }; | ||
42 | 49 | ||
43 | struct fib_info; | 50 | struct fib_info; |
44 | 51 | ||
@@ -154,12 +161,8 @@ struct fib_table { | |||
154 | u32 tb_id; | 161 | u32 tb_id; |
155 | unsigned tb_stamp; | 162 | unsigned tb_stamp; |
156 | 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); |
157 | int (*tb_insert)(struct fib_table *table, struct rtmsg *r, | 164 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
158 | struct kern_rta *rta, struct nlmsghdr *n, | 165 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
159 | struct netlink_skb_parms *req); | ||
160 | int (*tb_delete)(struct fib_table *table, struct rtmsg *r, | ||
161 | struct kern_rta *rta, struct nlmsghdr *n, | ||
162 | struct netlink_skb_parms *req); | ||
163 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, | 166 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, |
164 | struct netlink_callback *cb); | 167 | struct netlink_callback *cb); |
165 | int (*tb_flush)(struct fib_table *table); | 168 | int (*tb_flush)(struct fib_table *table); |
@@ -228,8 +231,6 @@ struct rtentry; | |||
228 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 231 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); |
229 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 232 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); |
230 | extern int fib_sync_up(struct net_device *dev); | 233 | extern int fib_sync_up(struct net_device *dev); |
231 | extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | ||
232 | struct kern_rta *rta, struct rtentry *r); | ||
233 | extern u32 __fib_res_prefsrc(struct fib_result *res); | 234 | extern u32 __fib_res_prefsrc(struct fib_result *res); |
234 | 235 | ||
235 | /* Exported by fib_hash.c */ | 236 | /* Exported by fib_hash.c */ |
diff --git a/include/net/netlink.h b/include/net/netlink.h index bf593eb59e1b..47044da167c5 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -192,6 +192,16 @@ struct nla_policy { | |||
192 | u16 minlen; | 192 | u16 minlen; |
193 | }; | 193 | }; |
194 | 194 | ||
195 | /** | ||
196 | * struct nl_info - netlink source information | ||
197 | * @nlh: Netlink message header of original request | ||
198 | * @pid: Netlink PID of requesting application | ||
199 | */ | ||
200 | struct nl_info { | ||
201 | struct nlmsghdr *nlh; | ||
202 | u32 pid; | ||
203 | }; | ||
204 | |||
195 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 205 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
196 | int (*cb)(struct sk_buff *, | 206 | int (*cb)(struct sk_buff *, |
197 | struct nlmsghdr *, int *)); | 207 | struct nlmsghdr *, int *)); |
diff --git a/include/net/nexthop.h b/include/net/nexthop.h new file mode 100644 index 000000000000..3334dbfa5aa4 --- /dev/null +++ b/include/net/nexthop.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __NET_NEXTHOP_H | ||
2 | #define __NET_NEXTHOP_H | ||
3 | |||
4 | #include <linux/rtnetlink.h> | ||
5 | #include <net/netlink.h> | ||
6 | |||
7 | static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining) | ||
8 | { | ||
9 | return remaining >= sizeof(*rtnh) && | ||
10 | rtnh->rtnh_len >= sizeof(*rtnh) && | ||
11 | rtnh->rtnh_len <= remaining; | ||
12 | } | ||
13 | |||
14 | static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh, | ||
15 | int *remaining) | ||
16 | { | ||
17 | int totlen = NLA_ALIGN(rtnh->rtnh_len); | ||
18 | |||
19 | *remaining -= totlen; | ||
20 | return (struct rtnexthop *) ((char *) rtnh + totlen); | ||
21 | } | ||
22 | |||
23 | static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh) | ||
24 | { | ||
25 | return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh))); | ||
26 | } | ||
27 | |||
28 | static inline int rtnh_attrlen(const struct rtnexthop *rtnh) | ||
29 | { | ||
30 | return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh)); | ||
31 | } | ||
32 | |||
33 | #endif | ||