From owner-svn-src-stable@FreeBSD.ORG Fri Mar 1 03:04:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6AA866E; Fri, 1 Mar 2013 03:04:58 +0000 (UTC) (envelope-from jhb@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 C460E212; Fri, 1 Mar 2013 03:04:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2134wix061257; Fri, 1 Mar 2013 03:04:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2134wBl061250; Fri, 1 Mar 2013 03:04:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303010304.r2134wBl061250@svn.freebsd.org> From: John Baldwin Date: Fri, 1 Mar 2013 03:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247525 - in stable/9/sys: netinet sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 01 Mar 2013 03:04:58 -0000 Author: jhb Date: Fri Mar 1 03:04:57 2013 New Revision: 247525 URL: http://svnweb.freebsd.org/changeset/base/247525 Log: MFC 245823,245824,246210 - Use decimal values for UDP, TCP, and UNIX domain socket options rather than hex to avoid implying that these constants should be treated as bit masks. - Add placeholder constants to reserve a portion of the socket option name space for use by downstream vendors to add custom options. Modified: stable/9/sys/netinet/tcp.h stable/9/sys/netinet/udp.h stable/9/sys/sys/socket.h stable/9/sys/sys/un.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp.h ============================================================================== --- stable/9/sys/netinet/tcp.h Fri Mar 1 02:59:56 2013 (r247524) +++ stable/9/sys/netinet/tcp.h Fri Mar 1 03:04:57 2013 (r247525) @@ -149,20 +149,25 @@ struct tcphdr { #endif /* __BSD_VISIBLE */ /* - * User-settable options (used with setsockopt). + * User-settable options (used with setsockopt). These are discrete + * values and are not masked together. Some values appear to be + * bitmasks for historical reasons. */ -#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_NODELAY 1 /* don't delay send to coalesce packets */ #if __BSD_VISIBLE -#define TCP_MAXSEG 0x02 /* set maximum segment size */ -#define TCP_NOPUSH 0x04 /* don't push last block of write */ -#define TCP_NOOPT 0x08 /* don't use TCP options */ -#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */ -#define TCP_INFO 0x20 /* retrieve tcp_info structure */ -#define TCP_CONGESTION 0x40 /* get/set congestion control algorithm */ -#define TCP_KEEPINIT 0x80 /* N, time to establish connection */ -#define TCP_KEEPIDLE 0x100 /* L,N,X start keeplives after this period */ -#define TCP_KEEPINTVL 0x200 /* L,N interval between keepalives */ -#define TCP_KEEPCNT 0x400 /* L,N number of keepalives before close */ +#define TCP_MAXSEG 2 /* set maximum segment size */ +#define TCP_NOPUSH 4 /* don't push last block of write */ +#define TCP_NOOPT 8 /* don't use TCP options */ +#define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ +#define TCP_INFO 32 /* retrieve tcp_info structure */ +#define TCP_CONGESTION 64 /* get/set congestion control algorithm */ +#define TCP_KEEPINIT 128 /* N, time to establish connection */ +#define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ +#define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ +#define TCP_KEEPCNT 1024 /* L,N number of keepalives before close */ + +/* Start of reserved space for third-party user-settable options. */ +#define TCP_VENDOR SO_VENDOR #define TCP_CA_NAME_MAX 16 /* max congestion control name length */ Modified: stable/9/sys/netinet/udp.h ============================================================================== --- stable/9/sys/netinet/udp.h Fri Mar 1 02:59:56 2013 (r247524) +++ stable/9/sys/netinet/udp.h Fri Mar 1 03:04:57 2013 (r247525) @@ -48,8 +48,10 @@ struct udphdr { /* * User-settable options (used with setsockopt). */ -#define UDP_ENCAP 0x01 +#define UDP_ENCAP 1 +/* Start of reserved space for third-party user-settable options. */ +#define UDP_VENDOR SO_VENDOR /* * UDP Encapsulation of IPsec Packets options. Modified: stable/9/sys/sys/socket.h ============================================================================== --- stable/9/sys/sys/socket.h Fri Mar 1 02:59:56 2013 (r247524) +++ stable/9/sys/sys/socket.h Fri Mar 1 03:04:57 2013 (r247525) @@ -143,6 +143,15 @@ typedef __uid_t uid_t; #endif /* + * Space reserved for new socket options added by third-party vendors. + * This range applies to all socket option levels. New socket options + * in FreeBSD should always use an option value less than SO_VENDOR. + */ +#if __BSD_VISIBLE +#define SO_VENDOR 0x80000000 +#endif + +/* * Structure used for manipulating linger option. */ struct linger { Modified: stable/9/sys/sys/un.h ============================================================================== --- stable/9/sys/sys/un.h Fri Mar 1 02:59:56 2013 (r247524) +++ stable/9/sys/sys/un.h Fri Mar 1 03:04:57 2013 (r247525) @@ -53,9 +53,12 @@ struct sockaddr_un { #if __BSD_VISIBLE /* Socket options. */ -#define LOCAL_PEERCRED 0x001 /* retrieve peer credentials */ -#define LOCAL_CREDS 0x002 /* pass credentials to receiver */ -#define LOCAL_CONNWAIT 0x004 /* connects block until accepted */ +#define LOCAL_PEERCRED 1 /* retrieve peer credentials */ +#define LOCAL_CREDS 2 /* pass credentials to receiver */ +#define LOCAL_CONNWAIT 4 /* connects block until accepted */ + +/* Start of reserved space for third-party socket options. */ +#define LOCAL_VENDOR SO_VENDOR #ifndef _KERNEL