Date: Tue, 12 Jun 2012 14:56:08 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r236961 - head/sys/netinet Message-ID: <201206121456.q5CEu8eI059721@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Tue Jun 12 14:56:08 2012 New Revision: 236961 URL: http://svn.freebsd.org/changeset/base/236961 Log: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. MFC after: 3 days Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Tue Jun 12 14:40:19 2012 (r236960) +++ head/sys/netinet/udp_usrreq.c Tue Jun 12 14:56:08 2012 (r236961) @@ -956,6 +956,7 @@ udp_output(struct inpcb *inp, struct mbu int ipflags; u_short fport, lport; int unlock_udbinfo; + u_char tos; /* * udp_output() may need to temporarily bind or connect the current @@ -972,6 +973,7 @@ udp_output(struct inpcb *inp, struct mbu src.sin_family = 0; INP_RLOCK(inp); + tos = inp->inp_ip_tos; if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1010,6 +1012,14 @@ udp_output(struct inpcb *inp, struct mbu *(struct in_addr *)CMSG_DATA(cm); break; + case IP_TOS: + if (cm->cmsg_len != CMSG_LEN(sizeof(u_char))) { + error = EINVAL; + break; + } + tos = *(u_char *)CMSG_DATA(cm); + break; + default: error = ENOPROTOOPT; break; @@ -1225,7 +1235,7 @@ udp_output(struct inpcb *inp, struct mbu ui->ui_sum = 0; ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ - ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */ + ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); if (unlock_udbinfo == UH_WLOCKED)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206121456.q5CEu8eI059721>