aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_ip.c')
-rw-r--r--net/l2tp/l2tp_ip.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 110efb704c9b..5c04f3e42704 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -320,11 +320,12 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
320 if (ipv4_is_multicast(lsa->l2tp_addr.s_addr)) 320 if (ipv4_is_multicast(lsa->l2tp_addr.s_addr))
321 goto out; 321 goto out;
322 322
323 rc = ip_route_connect(&rt, lsa->l2tp_addr.s_addr, saddr, 323 rt = ip_route_connect(lsa->l2tp_addr.s_addr, saddr,
324 RT_CONN_FLAGS(sk), oif, 324 RT_CONN_FLAGS(sk), oif,
325 IPPROTO_L2TP, 325 IPPROTO_L2TP,
326 0, 0, sk, 1); 326 0, 0, sk, true);
327 if (rc) { 327 if (IS_ERR(rt)) {
328 rc = PTR_ERR(rt);
328 if (rc == -ENETUNREACH) 329 if (rc == -ENETUNREACH)
329 IP_INC_STATS_BH(&init_net, IPSTATS_MIB_OUTNOROUTES); 330 IP_INC_STATS_BH(&init_net, IPSTATS_MIB_OUTNOROUTES);
330 goto out; 331 goto out;
@@ -474,24 +475,17 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
474 if (opt && opt->srr) 475 if (opt && opt->srr)
475 daddr = opt->faddr; 476 daddr = opt->faddr;
476 477
477 { 478 /* If this fails, retransmit mechanism of transport layer will
478 struct flowi fl = { .oif = sk->sk_bound_dev_if, 479 * keep trying until route appears or the connection times
479 .fl4_dst = daddr, 480 * itself out.
480 .fl4_src = inet->inet_saddr, 481 */
481 .fl4_tos = RT_CONN_FLAGS(sk), 482 rt = ip_route_output_ports(sock_net(sk), sk,
482 .proto = sk->sk_protocol, 483 daddr, inet->inet_saddr,
483 .flags = inet_sk_flowi_flags(sk), 484 inet->inet_dport, inet->inet_sport,
484 .fl_ip_sport = inet->inet_sport, 485 sk->sk_protocol, RT_CONN_FLAGS(sk),
485 .fl_ip_dport = inet->inet_dport }; 486 sk->sk_bound_dev_if);
486 487 if (IS_ERR(rt))
487 /* If this fails, retransmit mechanism of transport layer will 488 goto no_route;
488 * keep trying until route appears or the connection times
489 * itself out.
490 */
491 security_sk_classify_flow(sk, &fl);
492 if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0))
493 goto no_route;
494 }
495 sk_setup_caps(sk, &rt->dst); 489 sk_setup_caps(sk, &rt->dst);
496 } 490 }
497 skb_dst_set(skb, dst_clone(&rt->dst)); 491 skb_dst_set(skb, dst_clone(&rt->dst));
@@ -673,7 +667,7 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
673MODULE_DESCRIPTION("L2TP over IP"); 667MODULE_DESCRIPTION("L2TP over IP");
674MODULE_VERSION("1.0"); 668MODULE_VERSION("1.0");
675 669
676/* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like 670/* Use the value of SOCK_DGRAM (2) directory, because __stringify doesn't like
677 * enums 671 * enums
678 */ 672 */
679MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); 673MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP);