aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_ip.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 00:00:52 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:42 -0500
commit78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch)
tree9dccc5c16bf269d53d8499064ec95a998e84c646 /net/l2tp/l2tp_ip.c
parent1561747ddf9d28185548687b11aae7074d6129c4 (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/l2tp/l2tp_ip.c')
-rw-r--r--net/l2tp/l2tp_ip.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 2a698ff89db6..fce9bd3bd3fe 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -475,25 +475,17 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
475 if (opt && opt->srr) 475 if (opt && opt->srr)
476 daddr = opt->faddr; 476 daddr = opt->faddr;
477 477
478 { 478 /* If this fails, retransmit mechanism of transport layer will
479 struct flowi fl = { .oif = sk->sk_bound_dev_if, 479 * keep trying until route appears or the connection times
480 .fl4_dst = daddr, 480 * itself out.
481 .fl4_src = inet->inet_saddr, 481 */
482 .fl4_tos = RT_CONN_FLAGS(sk), 482 rt = ip_route_output_ports(sock_net(sk), sk,
483 .proto = sk->sk_protocol, 483 daddr, inet->inet_saddr,
484 .flags = inet_sk_flowi_flags(sk), 484 inet->inet_dport, inet->inet_sport,
485 .fl_ip_sport = inet->inet_sport, 485 sk->sk_protocol, RT_CONN_FLAGS(sk),
486 .fl_ip_dport = inet->inet_dport }; 486 sk->sk_bound_dev_if);
487 487 if (IS_ERR(rt))
488 /* If this fails, retransmit mechanism of transport layer will 488 goto no_route;
489 * keep trying until route appears or the connection times
490 * itself out.
491 */
492 security_sk_classify_flow(sk, &fl);
493 rt = ip_route_output_flow(sock_net(sk), &fl, sk);
494 if (IS_ERR(rt))
495 goto no_route;
496 }
497 sk_setup_caps(sk, &rt->dst); 489 sk_setup_caps(sk, &rt->dst);
498 } 490 }
499 skb_dst_set(skb, dst_clone(&rt->dst)); 491 skb_dst_set(skb, dst_clone(&rt->dst));