diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 00:00:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:42 -0500 |
commit | 78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch) | |
tree | 9dccc5c16bf269d53d8499064ec95a998e84c646 /net/ipv4/ip_output.c | |
parent | 1561747ddf9d28185548687b11aae7074d6129c4 (diff) |
ipv4: Create and use route lookup helpers.
The idea here is this minimizes the number of places one has to edit
in order to make changes to how flows are defined and used.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 171f483b21d5..916152dbdce4 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -339,26 +339,19 @@ int ip_queue_xmit(struct sk_buff *skb) | |||
339 | if(opt && opt->srr) | 339 | if(opt && opt->srr) |
340 | daddr = opt->faddr; | 340 | daddr = opt->faddr; |
341 | 341 | ||
342 | { | 342 | /* If this fails, retransmit mechanism of transport layer will |
343 | struct flowi fl = { .oif = sk->sk_bound_dev_if, | 343 | * keep trying until route appears or the connection times |
344 | .mark = sk->sk_mark, | 344 | * itself out. |
345 | .fl4_dst = daddr, | 345 | */ |
346 | .fl4_src = inet->inet_saddr, | 346 | rt = ip_route_output_ports(sock_net(sk), sk, |
347 | .fl4_tos = RT_CONN_FLAGS(sk), | 347 | daddr, inet->inet_saddr, |
348 | .proto = sk->sk_protocol, | 348 | inet->inet_dport, |
349 | .flags = inet_sk_flowi_flags(sk), | 349 | inet->inet_sport, |
350 | .fl_ip_sport = inet->inet_sport, | 350 | sk->sk_protocol, |
351 | .fl_ip_dport = inet->inet_dport }; | 351 | RT_CONN_FLAGS(sk), |
352 | 352 | sk->sk_bound_dev_if); | |
353 | /* If this fails, retransmit mechanism of transport layer will | 353 | if (IS_ERR(rt)) |
354 | * keep trying until route appears or the connection times | 354 | goto no_route; |
355 | * itself out. | ||
356 | */ | ||
357 | security_sk_classify_flow(sk, &fl); | ||
358 | rt = ip_route_output_flow(sock_net(sk), &fl, sk); | ||
359 | if (IS_ERR(rt)) | ||
360 | goto no_route; | ||
361 | } | ||
362 | sk_setup_caps(sk, &rt->dst); | 355 | sk_setup_caps(sk, &rt->dst); |
363 | } | 356 | } |
364 | skb_dst_set_noref(skb, &rt->dst); | 357 | skb_dst_set_noref(skb, &rt->dst); |