From owner-svn-src-all@FreeBSD.ORG Thu Mar 7 21:22:08 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46EA8311; Thu, 7 Mar 2013 21:22:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 21CF8365; Thu, 7 Mar 2013 21:22:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LM8YR014556; Thu, 7 Mar 2013 21:22:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LM86f014555; Thu, 7 Mar 2013 21:22:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201303072122.r27LM86f014555@svn.freebsd.org> From: Michael Tuexen Date: Thu, 7 Mar 2013 21:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247945 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:22:08 -0000 Author: tuexen Date: Thu Mar 7 21:22:07 2013 New Revision: 247945 URL: http://svnweb.freebsd.org/changeset/base/247945 Log: MFC r236961: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. Modified: stable/8/sys/netinet/udp_usrreq.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/udp_usrreq.c ============================================================================== --- stable/8/sys/netinet/udp_usrreq.c Thu Mar 7 21:17:37 2013 (r247944) +++ stable/8/sys/netinet/udp_usrreq.c Thu Mar 7 21:22:07 2013 (r247945) @@ -970,6 +970,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 @@ -985,6 +986,7 @@ udp_output(struct inpcb *inp, struct mbu } src.sin_family = 0; + tos = inp->inp_ip_tos; if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1022,6 +1024,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; @@ -1239,7 +1249,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 == 2)