l2tp_ip6.c (0eea505058740aa45486145296ef4fefbd8cab85) l2tp_ip6.c (45f6fad84cc305103b28d73482b344d7f5b76f39)
1/*
2 * L2TPv3 IP encapsulation support for IPv6
3 *
4 * Copyright (c) 2012 Katalix Systems Ltd
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 472 unchanged lines hidden (view full) ---

481 * control frames.
482 */
483static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
484{
485 struct ipv6_txoptions opt_space;
486 DECLARE_SOCKADDR(struct sockaddr_l2tpip6 *, lsa, msg->msg_name);
487 struct in6_addr *daddr, *final_p, final;
488 struct ipv6_pinfo *np = inet6_sk(sk);
1/*
2 * L2TPv3 IP encapsulation support for IPv6
3 *
4 * Copyright (c) 2012 Katalix Systems Ltd
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 472 unchanged lines hidden (view full) ---

481 * control frames.
482 */
483static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
484{
485 struct ipv6_txoptions opt_space;
486 DECLARE_SOCKADDR(struct sockaddr_l2tpip6 *, lsa, msg->msg_name);
487 struct in6_addr *daddr, *final_p, final;
488 struct ipv6_pinfo *np = inet6_sk(sk);
489 struct ipv6_txoptions *opt_to_free = NULL;
489 struct ipv6_txoptions *opt = NULL;
490 struct ip6_flowlabel *flowlabel = NULL;
491 struct dst_entry *dst = NULL;
492 struct flowi6 fl6;
493 int addr_len = msg->msg_namelen;
494 int hlimit = -1;
495 int tclass = -1;
496 int dontfrag = -1;

--- 73 unchanged lines hidden (view full) ---

570 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
571 if (flowlabel == NULL)
572 return -EINVAL;
573 }
574 if (!(opt->opt_nflen|opt->opt_flen))
575 opt = NULL;
576 }
577
490 struct ipv6_txoptions *opt = NULL;
491 struct ip6_flowlabel *flowlabel = NULL;
492 struct dst_entry *dst = NULL;
493 struct flowi6 fl6;
494 int addr_len = msg->msg_namelen;
495 int hlimit = -1;
496 int tclass = -1;
497 int dontfrag = -1;

--- 73 unchanged lines hidden (view full) ---

571 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
572 if (flowlabel == NULL)
573 return -EINVAL;
574 }
575 if (!(opt->opt_nflen|opt->opt_flen))
576 opt = NULL;
577 }
578
578 if (opt == NULL)
579 opt = np->opt;
579 if (!opt) {
580 opt = txopt_get(np);
581 opt_to_free = opt;
582 }
580 if (flowlabel)
581 opt = fl6_merge_options(&opt_space, flowlabel, opt);
582 opt = ipv6_fixup_options(&opt_space, opt);
583
584 fl6.flowi6_proto = sk->sk_protocol;
585 if (!ipv6_addr_any(daddr))
586 fl6.daddr = *daddr;
587 else

--- 38 unchanged lines hidden (view full) ---

626 ip6_flush_pending_frames(sk);
627 else if (!(msg->msg_flags & MSG_MORE))
628 err = l2tp_ip6_push_pending_frames(sk);
629 release_sock(sk);
630done:
631 dst_release(dst);
632out:
633 fl6_sock_release(flowlabel);
583 if (flowlabel)
584 opt = fl6_merge_options(&opt_space, flowlabel, opt);
585 opt = ipv6_fixup_options(&opt_space, opt);
586
587 fl6.flowi6_proto = sk->sk_protocol;
588 if (!ipv6_addr_any(daddr))
589 fl6.daddr = *daddr;
590 else

--- 38 unchanged lines hidden (view full) ---

629 ip6_flush_pending_frames(sk);
630 else if (!(msg->msg_flags & MSG_MORE))
631 err = l2tp_ip6_push_pending_frames(sk);
632 release_sock(sk);
633done:
634 dst_release(dst);
635out:
636 fl6_sock_release(flowlabel);
637 txopt_put(opt_to_free);
634
635 return err < 0 ? err : len;
636
637do_confirm:
638 dst_confirm(dst);
639 if (!(msg->msg_flags & MSG_PROBE) || len)
640 goto back_from_confirm;
641 err = 0;

--- 163 unchanged lines hidden ---
638
639 return err < 0 ? err : len;
640
641do_confirm:
642 dst_confirm(dst);
643 if (!(msg->msg_flags & MSG_PROBE) || len)
644 goto back_from_confirm;
645 err = 0;

--- 163 unchanged lines hidden ---