raw.c (0eea505058740aa45486145296ef4fefbd8cab85) | raw.c (45f6fad84cc305103b28d73482b344d7f5b76f39) |
---|---|
1/* 2 * RAW sockets for IPv6 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Adapted from linux/net/ipv4/raw.c --- 719 unchanged lines hidden (view full) --- 728 729 offset -= rfv->hlen; 730 731 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb); 732} 733 734static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 735{ | 1/* 2 * RAW sockets for IPv6 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Adapted from linux/net/ipv4/raw.c --- 719 unchanged lines hidden (view full) --- 728 729 offset -= rfv->hlen; 730 731 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb); 732} 733 734static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 735{ |
736 struct ipv6_txoptions *opt_to_free = NULL; |
|
736 struct ipv6_txoptions opt_space; 737 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); 738 struct in6_addr *daddr, *final_p, final; 739 struct inet_sock *inet = inet_sk(sk); 740 struct ipv6_pinfo *np = inet6_sk(sk); 741 struct raw6_sock *rp = raw6_sk(sk); 742 struct ipv6_txoptions *opt = NULL; 743 struct ip6_flowlabel *flowlabel = NULL; --- 90 unchanged lines hidden (view full) --- 834 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 835 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 836 if (!flowlabel) 837 return -EINVAL; 838 } 839 if (!(opt->opt_nflen|opt->opt_flen)) 840 opt = NULL; 841 } | 737 struct ipv6_txoptions opt_space; 738 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); 739 struct in6_addr *daddr, *final_p, final; 740 struct inet_sock *inet = inet_sk(sk); 741 struct ipv6_pinfo *np = inet6_sk(sk); 742 struct raw6_sock *rp = raw6_sk(sk); 743 struct ipv6_txoptions *opt = NULL; 744 struct ip6_flowlabel *flowlabel = NULL; --- 90 unchanged lines hidden (view full) --- 835 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 836 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 837 if (!flowlabel) 838 return -EINVAL; 839 } 840 if (!(opt->opt_nflen|opt->opt_flen)) 841 opt = NULL; 842 } |
842 if (!opt) 843 opt = np->opt; | 843 if (!opt) { 844 opt = txopt_get(np); 845 opt_to_free = opt; 846 } |
844 if (flowlabel) 845 opt = fl6_merge_options(&opt_space, flowlabel, opt); 846 opt = ipv6_fixup_options(&opt_space, opt); 847 848 fl6.flowi6_proto = proto; 849 rfv.msg = msg; 850 rfv.hlen = 0; 851 err = rawv6_probe_proto_opt(&rfv, &fl6); --- 49 unchanged lines hidden (view full) --- 901 else if (!(msg->msg_flags & MSG_MORE)) 902 err = rawv6_push_pending_frames(sk, &fl6, rp); 903 release_sock(sk); 904 } 905done: 906 dst_release(dst); 907out: 908 fl6_sock_release(flowlabel); | 847 if (flowlabel) 848 opt = fl6_merge_options(&opt_space, flowlabel, opt); 849 opt = ipv6_fixup_options(&opt_space, opt); 850 851 fl6.flowi6_proto = proto; 852 rfv.msg = msg; 853 rfv.hlen = 0; 854 err = rawv6_probe_proto_opt(&rfv, &fl6); --- 49 unchanged lines hidden (view full) --- 904 else if (!(msg->msg_flags & MSG_MORE)) 905 err = rawv6_push_pending_frames(sk, &fl6, rp); 906 release_sock(sk); 907 } 908done: 909 dst_release(dst); 910out: 911 fl6_sock_release(flowlabel); |
912 txopt_put(opt_to_free); |
|
909 return err < 0 ? err : len; 910do_confirm: 911 dst_confirm(dst); 912 if (!(msg->msg_flags & MSG_PROBE) || len) 913 goto back_from_confirm; 914 err = 0; 915 goto done; 916} --- 422 unchanged lines hidden --- | 913 return err < 0 ? err : len; 914do_confirm: 915 dst_confirm(dst); 916 if (!(msg->msg_flags & MSG_PROBE) || len) 917 goto back_from_confirm; 918 err = 0; 919 goto done; 920} --- 422 unchanged lines hidden --- |