diff options
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/include/net/route.h b/include/net/route.h index c4a068692dcc..486e37aff06c 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/route.h> | 32 | #include <linux/route.h> |
33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
34 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
35 | #include <linux/security.h> | ||
35 | 36 | ||
36 | #ifndef __KERNEL__ | 37 | #ifndef __KERNEL__ |
37 | #warning This file is not supposed to be used outside of kernel. | 38 | #warning This file is not supposed to be used outside of kernel. |
@@ -61,18 +62,18 @@ struct rtable | |||
61 | __u16 rt_type; | 62 | __u16 rt_type; |
62 | __u16 rt_multipath_alg; | 63 | __u16 rt_multipath_alg; |
63 | 64 | ||
64 | __u32 rt_dst; /* Path destination */ | 65 | __be32 rt_dst; /* Path destination */ |
65 | __u32 rt_src; /* Path source */ | 66 | __be32 rt_src; /* Path source */ |
66 | int rt_iif; | 67 | int rt_iif; |
67 | 68 | ||
68 | /* Info on neighbour */ | 69 | /* Info on neighbour */ |
69 | __u32 rt_gateway; | 70 | __be32 rt_gateway; |
70 | 71 | ||
71 | /* Cache lookup keys */ | 72 | /* Cache lookup keys */ |
72 | struct flowi fl; | 73 | struct flowi fl; |
73 | 74 | ||
74 | /* Miscellaneous cached information */ | 75 | /* Miscellaneous cached information */ |
75 | __u32 rt_spec_dst; /* RFC1122 specific destination */ | 76 | __be32 rt_spec_dst; /* RFC1122 specific destination */ |
76 | struct inet_peer *peer; /* long-living peer info */ | 77 | struct inet_peer *peer; /* long-living peer info */ |
77 | }; | 78 | }; |
78 | 79 | ||
@@ -108,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct; | |||
108 | 109 | ||
109 | struct in_device; | 110 | struct in_device; |
110 | extern int ip_rt_init(void); | 111 | extern int ip_rt_init(void); |
111 | extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, | 112 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
112 | u32 src, struct net_device *dev); | 113 | __be32 src, struct net_device *dev); |
113 | extern void ip_rt_advice(struct rtable **rp, int advice); | 114 | extern void ip_rt_advice(struct rtable **rp, int advice); |
114 | extern void rt_cache_flush(int how); | 115 | extern void rt_cache_flush(int how); |
115 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 116 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); |
116 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 117 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); |
117 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 118 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
118 | extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); | 119 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
119 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 120 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); |
120 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 121 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
121 | 122 | ||
122 | extern unsigned inet_addr_type(u32 addr); | 123 | extern unsigned inet_addr_type(__be32 addr); |
123 | extern void ip_rt_multicast_event(struct in_device *); | 124 | extern void ip_rt_multicast_event(struct in_device *); |
124 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 125 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); |
125 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 126 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
@@ -143,9 +144,9 @@ static inline char rt_tos2priority(u8 tos) | |||
143 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; | 144 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; |
144 | } | 145 | } |
145 | 146 | ||
146 | static inline int ip_route_connect(struct rtable **rp, u32 dst, | 147 | static inline int ip_route_connect(struct rtable **rp, __be32 dst, |
147 | u32 src, u32 tos, int oif, u8 protocol, | 148 | __be32 src, u32 tos, int oif, u8 protocol, |
148 | u16 sport, u16 dport, struct sock *sk) | 149 | __be16 sport, __be16 dport, struct sock *sk) |
149 | { | 150 | { |
150 | struct flowi fl = { .oif = oif, | 151 | struct flowi fl = { .oif = oif, |
151 | .nl_u = { .ip4_u = { .daddr = dst, | 152 | .nl_u = { .ip4_u = { .daddr = dst, |
@@ -166,11 +167,12 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, | |||
166 | ip_rt_put(*rp); | 167 | ip_rt_put(*rp); |
167 | *rp = NULL; | 168 | *rp = NULL; |
168 | } | 169 | } |
170 | security_sk_classify_flow(sk, &fl); | ||
169 | return ip_route_output_flow(rp, &fl, sk, 0); | 171 | return ip_route_output_flow(rp, &fl, sk, 0); |
170 | } | 172 | } |
171 | 173 | ||
172 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 174 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
173 | u16 sport, u16 dport, struct sock *sk) | 175 | __be16 sport, __be16 dport, struct sock *sk) |
174 | { | 176 | { |
175 | if (sport != (*rp)->fl.fl_ip_sport || | 177 | if (sport != (*rp)->fl.fl_ip_sport || |
176 | dport != (*rp)->fl.fl_ip_dport) { | 178 | dport != (*rp)->fl.fl_ip_dport) { |
@@ -182,6 +184,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
182 | fl.proto = protocol; | 184 | fl.proto = protocol; |
183 | ip_rt_put(*rp); | 185 | ip_rt_put(*rp); |
184 | *rp = NULL; | 186 | *rp = NULL; |
187 | security_sk_classify_flow(sk, &fl); | ||
185 | return ip_route_output_flow(rp, &fl, sk, 0); | 188 | return ip_route_output_flow(rp, &fl, sk, 0); |
186 | } | 189 | } |
187 | return 0; | 190 | return 0; |