From owner-svn-src-stable@FreeBSD.ORG Sun Jul 1 08:53:56 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D13E106564A; Sun, 1 Jul 2012 08:53:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16EDF8FC14; Sun, 1 Jul 2012 08:53:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q618rtKG078564; Sun, 1 Jul 2012 08:53:55 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q618rtdT078562; Sun, 1 Jul 2012 08:53:55 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207010853.q618rtdT078562@svn.freebsd.org> From: Michael Tuexen Date: Sun, 1 Jul 2012 08:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237911 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2012 08:53:56 -0000 Author: tuexen Date: Sun Jul 1 08:53:55 2012 New Revision: 237911 URL: http://svn.freebsd.org/changeset/base/237911 Log: MFC r236961: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. Modified: stable/9/sys/netinet/udp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/udp_usrreq.c ============================================================================== --- stable/9/sys/netinet/udp_usrreq.c Sun Jul 1 08:47:15 2012 (r237910) +++ stable/9/sys/netinet/udp_usrreq.c Sun Jul 1 08:53:55 2012 (r237911) @@ -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 @@ -971,6 +972,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 @@ -1008,6 +1010,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; @@ -1223,7 +1233,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)