diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-31 07:52:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-31 07:52:59 -0400 |
commit | 94b92b88344641dbeadd2ef371549b7663a48fb1 (patch) | |
tree | 165ec138938f0621929323523438b080c98db52a /include/net/route.h | |
parent | 83229aa5e2c242163599266a686483e3b91ec07e (diff) |
ipv4: Use flowi4_init_output() in net/route.h
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/include/net/route.h b/include/net/route.h index f88429cad52a..b24288595e58 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -149,17 +149,12 @@ 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 flowi4 fl4 = { | 152 | struct flowi4 fl4; |
153 | .flowi4_oif = oif, | 153 | |
154 | .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0, | 154 | flowi4_init_output(&fl4, oif, sk ? sk->sk_mark : 0, tos, |
155 | .flowi4_mark = sk ? sk->sk_mark : 0, | 155 | RT_SCOPE_UNIVERSE, proto, |
156 | .daddr = daddr, | 156 | sk ? inet_sk_flowi_flags(sk) : 0, |
157 | .saddr = saddr, | 157 | daddr, saddr, dport, sport); |
158 | .flowi4_tos = tos, | ||
159 | .flowi4_proto = proto, | ||
160 | .fl4_dport = dport, | ||
161 | .fl4_sport = sport, | ||
162 | }; | ||
163 | if (sk) | 158 | if (sk) |
164 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 159 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
165 | return ip_route_output_flow(net, &fl4, sk); | 160 | return ip_route_output_flow(net, &fl4, sk); |
@@ -229,25 +224,21 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos, | |||
229 | __be16 sport, __be16 dport, | 224 | __be16 sport, __be16 dport, |
230 | struct sock *sk, bool can_sleep) | 225 | struct sock *sk, bool can_sleep) |
231 | { | 226 | { |
232 | struct flowi4 fl4 = { | ||
233 | .flowi4_oif = oif, | ||
234 | .flowi4_mark = sk->sk_mark, | ||
235 | .daddr = dst, | ||
236 | .saddr = src, | ||
237 | .flowi4_tos = tos, | ||
238 | .flowi4_proto = protocol, | ||
239 | .fl4_sport = sport, | ||
240 | .fl4_dport = dport, | ||
241 | }; | ||
242 | struct net *net = sock_net(sk); | 227 | struct net *net = sock_net(sk); |
243 | struct rtable *rt; | 228 | struct rtable *rt; |
229 | struct flowi4 fl4; | ||
230 | __u8 flow_flags; | ||
244 | 231 | ||
232 | flow_flags = 0; | ||
245 | if (inet_sk(sk)->transparent) | 233 | if (inet_sk(sk)->transparent) |
246 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; | 234 | flow_flags |= FLOWI_FLAG_ANYSRC; |
247 | if (protocol == IPPROTO_TCP) | 235 | if (protocol == IPPROTO_TCP) |
248 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; | 236 | flow_flags |= FLOWI_FLAG_PRECOW_METRICS; |
249 | if (can_sleep) | 237 | if (can_sleep) |
250 | fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP; | 238 | flow_flags |= FLOWI_FLAG_CAN_SLEEP; |
239 | |||
240 | flowi4_init_output(&fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, | ||
241 | protocol, flow_flags, dst, src, dport, sport); | ||
251 | 242 | ||
252 | if (!dst || !src) { | 243 | if (!dst || !src) { |
253 | rt = __ip_route_output_key(net, &fl4); | 244 | rt = __ip_route_output_key(net, &fl4); |
@@ -267,20 +258,17 @@ static inline struct rtable *ip_route_newports(struct rtable *rt, | |||
267 | __be16 dport, struct sock *sk) | 258 | __be16 dport, struct sock *sk) |
268 | { | 259 | { |
269 | if (sport != orig_sport || dport != orig_dport) { | 260 | if (sport != orig_sport || dport != orig_dport) { |
270 | struct flowi4 fl4 = { | 261 | struct flowi4 fl4; |
271 | .flowi4_oif = rt->rt_oif, | 262 | __u8 flow_flags; |
272 | .flowi4_mark = rt->rt_mark, | 263 | |
273 | .daddr = rt->rt_dst, | 264 | flow_flags = 0; |
274 | .saddr = rt->rt_src, | ||
275 | .flowi4_tos = rt->rt_tos, | ||
276 | .flowi4_proto = protocol, | ||
277 | .fl4_sport = sport, | ||
278 | .fl4_dport = dport | ||
279 | }; | ||
280 | if (inet_sk(sk)->transparent) | 265 | if (inet_sk(sk)->transparent) |
281 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; | 266 | flow_flags |= FLOWI_FLAG_ANYSRC; |
282 | if (protocol == IPPROTO_TCP) | 267 | if (protocol == IPPROTO_TCP) |
283 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; | 268 | flow_flags |= FLOWI_FLAG_PRECOW_METRICS; |
269 | flowi4_init_output(&fl4, rt->rt_oif, rt->rt_mark, rt->rt_tos, | ||
270 | RT_SCOPE_UNIVERSE, protocol, flow_flags, | ||
271 | rt->rt_dst, rt->rt_src, dport, sport); | ||
284 | ip_rt_put(rt); | 272 | ip_rt_put(rt); |
285 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 273 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); |
286 | return ip_route_output_flow(sock_net(sk), &fl4, sk); | 274 | return ip_route_output_flow(sock_net(sk), &fl4, sk); |