diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 01:12:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:48 -0500 |
commit | 9d6ec938019c6b16cb9ec96598ebe8f20de435fe (patch) | |
tree | 9b850eb7fd48a6e5ffc15f47afd2e3edc93f5290 /include/net/route.h | |
parent | 68a5e3dd0a0056d8b349f9eea3756adda53ec17a (diff) |
ipv4: Use flowi4 in public route lookup interfaces.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/include/net/route.h b/include/net/route.h index 4c207f9fe0cb..80b0353f4f41 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -122,12 +122,12 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | |||
122 | __be32 src, struct net_device *dev); | 122 | __be32 src, struct net_device *dev); |
123 | extern void rt_cache_flush(struct net *net, int how); | 123 | extern void rt_cache_flush(struct net *net, int how); |
124 | extern void rt_cache_flush_batch(struct net *net); | 124 | extern void rt_cache_flush_batch(struct net *net); |
125 | extern struct rtable *__ip_route_output_key(struct net *, const struct flowi *flp); | 125 | extern struct rtable *__ip_route_output_key(struct net *, const struct flowi4 *flp); |
126 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi *flp, | 126 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
127 | struct sock *sk); | 127 | struct sock *sk); |
128 | extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); | 128 | extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); |
129 | 129 | ||
130 | static inline struct rtable *ip_route_output_key(struct net *net, struct flowi *flp) | 130 | static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp) |
131 | { | 131 | { |
132 | return ip_route_output_flow(net, flp, NULL); | 132 | return ip_route_output_flow(net, flp, NULL); |
133 | } | 133 | } |
@@ -135,13 +135,13 @@ static inline struct rtable *ip_route_output_key(struct net *net, struct flowi * | |||
135 | static inline struct rtable *ip_route_output(struct net *net, __be32 daddr, | 135 | static inline struct rtable *ip_route_output(struct net *net, __be32 daddr, |
136 | __be32 saddr, u8 tos, int oif) | 136 | __be32 saddr, u8 tos, int oif) |
137 | { | 137 | { |
138 | struct flowi fl = { | 138 | struct flowi4 fl4 = { |
139 | .flowi_oif = oif, | 139 | .flowi4_oif = oif, |
140 | .fl4_dst = daddr, | 140 | .daddr = daddr, |
141 | .fl4_src = saddr, | 141 | .saddr = saddr, |
142 | .fl4_tos = tos, | 142 | .flowi4_tos = tos, |
143 | }; | 143 | }; |
144 | return ip_route_output_key(net, &fl); | 144 | return ip_route_output_key(net, &fl4); |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk, | 147 | static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk, |
@@ -149,35 +149,35 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct sock | |||
149 | __be16 dport, __be16 sport, | 149 | __be16 dport, __be16 sport, |
150 | __u8 proto, __u8 tos, int oif) | 150 | __u8 proto, __u8 tos, int oif) |
151 | { | 151 | { |
152 | struct flowi fl = { | 152 | struct flowi4 fl4 = { |
153 | .flowi_oif = oif, | 153 | .flowi4_oif = oif, |
154 | .flowi_flags = sk ? inet_sk_flowi_flags(sk) : 0, | 154 | .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0, |
155 | .flowi_mark = sk ? sk->sk_mark : 0, | 155 | .flowi4_mark = sk ? sk->sk_mark : 0, |
156 | .fl4_dst = daddr, | 156 | .daddr = daddr, |
157 | .fl4_src = saddr, | 157 | .saddr = saddr, |
158 | .fl4_tos = tos, | 158 | .flowi4_tos = tos, |
159 | .flowi_proto = proto, | 159 | .flowi4_proto = proto, |
160 | .fl4_dport = dport, | 160 | .uli.ports.dport = dport, |
161 | .fl4_sport = sport, | 161 | .uli.ports.sport = sport, |
162 | }; | 162 | }; |
163 | if (sk) | 163 | if (sk) |
164 | security_sk_classify_flow(sk, &fl); | 164 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
165 | return ip_route_output_flow(net, &fl, sk); | 165 | return ip_route_output_flow(net, &fl4, sk); |
166 | } | 166 | } |
167 | 167 | ||
168 | static inline struct rtable *ip_route_output_gre(struct net *net, | 168 | static inline struct rtable *ip_route_output_gre(struct net *net, |
169 | __be32 daddr, __be32 saddr, | 169 | __be32 daddr, __be32 saddr, |
170 | __be32 gre_key, __u8 tos, int oif) | 170 | __be32 gre_key, __u8 tos, int oif) |
171 | { | 171 | { |
172 | struct flowi fl = { | 172 | struct flowi4 fl4 = { |
173 | .flowi_oif = oif, | 173 | .flowi4_oif = oif, |
174 | .fl4_dst = daddr, | 174 | .daddr = daddr, |
175 | .fl4_src = saddr, | 175 | .saddr = saddr, |
176 | .fl4_tos = tos, | 176 | .flowi4_tos = tos, |
177 | .flowi_proto = IPPROTO_GRE, | 177 | .flowi4_proto = IPPROTO_GRE, |
178 | .fl4_gre_key = gre_key, | 178 | .uli.gre_key = gre_key, |
179 | }; | 179 | }; |
180 | return ip_route_output_key(net, &fl); | 180 | return ip_route_output_key(net, &fl4); |
181 | } | 181 | } |
182 | 182 | ||
183 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | 183 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, |
@@ -228,36 +228,36 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos, | |||
228 | __be16 sport, __be16 dport, | 228 | __be16 sport, __be16 dport, |
229 | struct sock *sk, bool can_sleep) | 229 | struct sock *sk, bool can_sleep) |
230 | { | 230 | { |
231 | struct flowi fl = { | 231 | struct flowi4 fl4 = { |
232 | .flowi_oif = oif, | 232 | .flowi4_oif = oif, |
233 | .flowi_mark = sk->sk_mark, | 233 | .flowi4_mark = sk->sk_mark, |
234 | .fl4_dst = dst, | 234 | .daddr = dst, |
235 | .fl4_src = src, | 235 | .saddr = src, |
236 | .fl4_tos = tos, | 236 | .flowi4_tos = tos, |
237 | .flowi_proto = protocol, | 237 | .flowi4_proto = protocol, |
238 | .fl4_sport = sport, | 238 | .uli.ports.sport = sport, |
239 | .fl4_dport = dport, | 239 | .uli.ports.dport = dport, |
240 | }; | 240 | }; |
241 | struct net *net = sock_net(sk); | 241 | struct net *net = sock_net(sk); |
242 | struct rtable *rt; | 242 | struct rtable *rt; |
243 | 243 | ||
244 | if (inet_sk(sk)->transparent) | 244 | if (inet_sk(sk)->transparent) |
245 | fl.flowi_flags |= FLOWI_FLAG_ANYSRC; | 245 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; |
246 | if (protocol == IPPROTO_TCP) | 246 | if (protocol == IPPROTO_TCP) |
247 | fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS; | 247 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; |
248 | if (can_sleep) | 248 | if (can_sleep) |
249 | fl.flowi_flags |= FLOWI_FLAG_CAN_SLEEP; | 249 | fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP; |
250 | 250 | ||
251 | if (!dst || !src) { | 251 | if (!dst || !src) { |
252 | rt = __ip_route_output_key(net, &fl); | 252 | rt = __ip_route_output_key(net, &fl4); |
253 | if (IS_ERR(rt)) | 253 | if (IS_ERR(rt)) |
254 | return rt; | 254 | return rt; |
255 | fl.fl4_dst = rt->rt_dst; | 255 | fl4.daddr = rt->rt_dst; |
256 | fl.fl4_src = rt->rt_src; | 256 | fl4.saddr = rt->rt_src; |
257 | ip_rt_put(rt); | 257 | ip_rt_put(rt); |
258 | } | 258 | } |
259 | security_sk_classify_flow(sk, &fl); | 259 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
260 | return ip_route_output_flow(net, &fl, sk); | 260 | return ip_route_output_flow(net, &fl4, sk); |
261 | } | 261 | } |
262 | 262 | ||
263 | static inline struct rtable *ip_route_newports(struct rtable *rt, | 263 | static inline struct rtable *ip_route_newports(struct rtable *rt, |
@@ -266,23 +266,23 @@ static inline struct rtable *ip_route_newports(struct rtable *rt, | |||
266 | __be16 dport, struct sock *sk) | 266 | __be16 dport, struct sock *sk) |
267 | { | 267 | { |
268 | if (sport != orig_sport || dport != orig_dport) { | 268 | if (sport != orig_sport || dport != orig_dport) { |
269 | struct flowi fl = { | 269 | struct flowi4 fl4 = { |
270 | .flowi_oif = rt->rt_oif, | 270 | .flowi4_oif = rt->rt_oif, |
271 | .flowi_mark = rt->rt_mark, | 271 | .flowi4_mark = rt->rt_mark, |
272 | .fl4_dst = rt->rt_key_dst, | 272 | .daddr = rt->rt_key_dst, |
273 | .fl4_src = rt->rt_key_src, | 273 | .saddr = rt->rt_key_src, |
274 | .fl4_tos = rt->rt_tos, | 274 | .flowi4_tos = rt->rt_tos, |
275 | .flowi_proto = protocol, | 275 | .flowi4_proto = protocol, |
276 | .fl4_sport = sport, | 276 | .uli.ports.sport = sport, |
277 | .fl4_dport = dport | 277 | .uli.ports.dport = dport |
278 | }; | 278 | }; |
279 | if (inet_sk(sk)->transparent) | 279 | if (inet_sk(sk)->transparent) |
280 | fl.flowi_flags |= FLOWI_FLAG_ANYSRC; | 280 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; |
281 | if (protocol == IPPROTO_TCP) | 281 | if (protocol == IPPROTO_TCP) |
282 | fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS; | 282 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; |
283 | ip_rt_put(rt); | 283 | ip_rt_put(rt); |
284 | security_sk_classify_flow(sk, &fl); | 284 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
285 | return ip_route_output_flow(sock_net(sk), &fl, sk); | 285 | return ip_route_output_flow(sock_net(sk), &fl4, sk); |
286 | } | 286 | } |
287 | return rt; | 287 | return rt; |
288 | } | 288 | } |