diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-09-07 21:19:03 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-09-07 21:19:03 -0400 |
commit | 41a1f8ea4fbfcdc4232f023732584aae2220de31 (patch) | |
tree | 9939686b354ced0b22d81efcbc12f5ed90372b09 /net/ipv6/udp.c | |
parent | 333fad5364d6b457c8d837f7d05802d2aaf8a961 (diff) |
[IPV6]: Support IPV6_{RECV,}TCLASS socket options / ancillary data.
Based on patch from David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index aa6eaf3f18a6..dbd18a9d1669 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -637,6 +637,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
637 | int addr_len = msg->msg_namelen; | 637 | int addr_len = msg->msg_namelen; |
638 | int ulen = len; | 638 | int ulen = len; |
639 | int hlimit = -1; | 639 | int hlimit = -1; |
640 | int tclass = -1; | ||
640 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; | 641 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
641 | int err; | 642 | int err; |
642 | 643 | ||
@@ -758,7 +759,7 @@ do_udp_sendmsg: | |||
758 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 759 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |
759 | opt->tot_len = sizeof(*opt); | 760 | opt->tot_len = sizeof(*opt); |
760 | 761 | ||
761 | err = datagram_send_ctl(msg, fl, opt, &hlimit); | 762 | err = datagram_send_ctl(msg, fl, opt, &hlimit, &tclass); |
762 | if (err < 0) { | 763 | if (err < 0) { |
763 | fl6_sock_release(flowlabel); | 764 | fl6_sock_release(flowlabel); |
764 | return err; | 765 | return err; |
@@ -814,6 +815,12 @@ do_udp_sendmsg: | |||
814 | hlimit = ipv6_get_hoplimit(dst->dev); | 815 | hlimit = ipv6_get_hoplimit(dst->dev); |
815 | } | 816 | } |
816 | 817 | ||
818 | if (tclass < 0) { | ||
819 | tclass = np->tclass; | ||
820 | if (tclass < 0) | ||
821 | tclass = 0; | ||
822 | } | ||
823 | |||
817 | if (msg->msg_flags&MSG_CONFIRM) | 824 | if (msg->msg_flags&MSG_CONFIRM) |
818 | goto do_confirm; | 825 | goto do_confirm; |
819 | back_from_confirm: | 826 | back_from_confirm: |
@@ -833,9 +840,10 @@ back_from_confirm: | |||
833 | 840 | ||
834 | do_append_data: | 841 | do_append_data: |
835 | up->len += ulen; | 842 | up->len += ulen; |
836 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, ulen, sizeof(struct udphdr), | 843 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, ulen, |
837 | hlimit, opt, fl, (struct rt6_info*)dst, | 844 | sizeof(struct udphdr), hlimit, tclass, opt, fl, |
838 | corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags); | 845 | (struct rt6_info*)dst, |
846 | corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags); | ||
839 | if (err) | 847 | if (err) |
840 | udp_v6_flush_pending_frames(sk); | 848 | udp_v6_flush_pending_frames(sk); |
841 | else if (!corkreq) | 849 | else if (!corkreq) |