diff options
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ed3a76b30fd9..5aa3691c578d 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -655,6 +655,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
655 | struct flowi fl; | 655 | struct flowi fl; |
656 | int addr_len = msg->msg_namelen; | 656 | int addr_len = msg->msg_namelen; |
657 | int hlimit = -1; | 657 | int hlimit = -1; |
658 | int tclass = -1; | ||
658 | u16 proto; | 659 | u16 proto; |
659 | int err; | 660 | int err; |
660 | 661 | ||
@@ -740,7 +741,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
740 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 741 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |
741 | opt->tot_len = sizeof(struct ipv6_txoptions); | 742 | opt->tot_len = sizeof(struct ipv6_txoptions); |
742 | 743 | ||
743 | err = datagram_send_ctl(msg, &fl, opt, &hlimit); | 744 | err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass); |
744 | if (err < 0) { | 745 | if (err < 0) { |
745 | fl6_sock_release(flowlabel); | 746 | fl6_sock_release(flowlabel); |
746 | return err; | 747 | return err; |
@@ -755,8 +756,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
755 | } | 756 | } |
756 | if (opt == NULL) | 757 | if (opt == NULL) |
757 | opt = np->opt; | 758 | opt = np->opt; |
758 | if (flowlabel) | 759 | opt = fl6_merge_options(&opt_space, flowlabel, opt); |
759 | opt = fl6_merge_options(&opt_space, flowlabel, opt); | ||
760 | 760 | ||
761 | fl.proto = proto; | 761 | fl.proto = proto; |
762 | rawv6_probe_proto_opt(&fl, msg); | 762 | rawv6_probe_proto_opt(&fl, msg); |
@@ -782,10 +782,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
782 | if (final_p) | 782 | if (final_p) |
783 | ipv6_addr_copy(&fl.fl6_dst, final_p); | 783 | ipv6_addr_copy(&fl.fl6_dst, final_p); |
784 | 784 | ||
785 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { | 785 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) |
786 | dst_release(dst); | ||
787 | goto out; | 786 | goto out; |
788 | } | ||
789 | 787 | ||
790 | if (hlimit < 0) { | 788 | if (hlimit < 0) { |
791 | if (ipv6_addr_is_multicast(&fl.fl6_dst)) | 789 | if (ipv6_addr_is_multicast(&fl.fl6_dst)) |
@@ -798,6 +796,12 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
798 | hlimit = ipv6_get_hoplimit(dst->dev); | 796 | hlimit = ipv6_get_hoplimit(dst->dev); |
799 | } | 797 | } |
800 | 798 | ||
799 | if (tclass < 0) { | ||
800 | tclass = np->cork.tclass; | ||
801 | if (tclass < 0) | ||
802 | tclass = 0; | ||
803 | } | ||
804 | |||
801 | if (msg->msg_flags&MSG_CONFIRM) | 805 | if (msg->msg_flags&MSG_CONFIRM) |
802 | goto do_confirm; | 806 | goto do_confirm; |
803 | 807 | ||
@@ -806,8 +810,9 @@ back_from_confirm: | |||
806 | err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl, (struct rt6_info*)dst, msg->msg_flags); | 810 | err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl, (struct rt6_info*)dst, msg->msg_flags); |
807 | } else { | 811 | } else { |
808 | lock_sock(sk); | 812 | lock_sock(sk); |
809 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, len, 0, | 813 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, |
810 | hlimit, opt, &fl, (struct rt6_info*)dst, msg->msg_flags); | 814 | len, 0, hlimit, tclass, opt, &fl, (struct rt6_info*)dst, |
815 | msg->msg_flags); | ||
811 | 816 | ||
812 | if (err) | 817 | if (err) |
813 | ip6_flush_pending_frames(sk); | 818 | ip6_flush_pending_frames(sk); |