diff options
Diffstat (limited to 'net/l2tp/l2tp_ip6.c')
-rw-r--r-- | net/l2tp/l2tp_ip6.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 927547171bc7..c74f5a91ff6a 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -60,10 +60,9 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | |||
60 | struct in6_addr *laddr, | 60 | struct in6_addr *laddr, |
61 | int dif, u32 tunnel_id) | 61 | int dif, u32 tunnel_id) |
62 | { | 62 | { |
63 | struct hlist_node *node; | ||
64 | struct sock *sk; | 63 | struct sock *sk; |
65 | 64 | ||
66 | sk_for_each_bound(sk, node, &l2tp_ip6_bind_table) { | 65 | sk_for_each_bound(sk, &l2tp_ip6_bind_table) { |
67 | struct in6_addr *addr = inet6_rcv_saddr(sk); | 66 | struct in6_addr *addr = inet6_rcv_saddr(sk); |
68 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); | 67 | struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); |
69 | 68 | ||
@@ -242,10 +241,17 @@ static void l2tp_ip6_close(struct sock *sk, long timeout) | |||
242 | 241 | ||
243 | static void l2tp_ip6_destroy_sock(struct sock *sk) | 242 | static void l2tp_ip6_destroy_sock(struct sock *sk) |
244 | { | 243 | { |
244 | struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); | ||
245 | |||
245 | lock_sock(sk); | 246 | lock_sock(sk); |
246 | ip6_flush_pending_frames(sk); | 247 | ip6_flush_pending_frames(sk); |
247 | release_sock(sk); | 248 | release_sock(sk); |
248 | 249 | ||
250 | if (tunnel) { | ||
251 | l2tp_tunnel_closeall(tunnel); | ||
252 | sock_put(sk); | ||
253 | } | ||
254 | |||
249 | inet6_destroy_sock(sk); | 255 | inet6_destroy_sock(sk); |
250 | } | 256 | } |
251 | 257 | ||
@@ -554,8 +560,8 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
554 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 560 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |
555 | opt->tot_len = sizeof(struct ipv6_txoptions); | 561 | opt->tot_len = sizeof(struct ipv6_txoptions); |
556 | 562 | ||
557 | err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, | 563 | err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, |
558 | &hlimit, &tclass, &dontfrag); | 564 | &hlimit, &tclass, &dontfrag); |
559 | if (err < 0) { | 565 | if (err < 0) { |
560 | fl6_sock_release(flowlabel); | 566 | fl6_sock_release(flowlabel); |
561 | return err; | 567 | return err; |
@@ -646,7 +652,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
646 | struct msghdr *msg, size_t len, int noblock, | 652 | struct msghdr *msg, size_t len, int noblock, |
647 | int flags, int *addr_len) | 653 | int flags, int *addr_len) |
648 | { | 654 | { |
649 | struct inet_sock *inet = inet_sk(sk); | 655 | struct ipv6_pinfo *np = inet6_sk(sk); |
650 | struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)msg->msg_name; | 656 | struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)msg->msg_name; |
651 | size_t copied = 0; | 657 | size_t copied = 0; |
652 | int err = -EOPNOTSUPP; | 658 | int err = -EOPNOTSUPP; |
@@ -688,8 +694,8 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
688 | lsa->l2tp_scope_id = IP6CB(skb)->iif; | 694 | lsa->l2tp_scope_id = IP6CB(skb)->iif; |
689 | } | 695 | } |
690 | 696 | ||
691 | if (inet->cmsg_flags) | 697 | if (np->rxopt.all) |
692 | ip_cmsg_recv(msg, skb); | 698 | ip6_datagram_recv_ctl(sk, msg, skb); |
693 | 699 | ||
694 | if (flags & MSG_TRUNC) | 700 | if (flags & MSG_TRUNC) |
695 | copied = skb->len; | 701 | copied = skb->len; |