From b55183a894ce23691df0c9c6b6fec645a777d401 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 1 Feb 2013 15:32:20 +0000 Subject: [PATCH] Add placeholder constants to reserve a portion of the socket option name space for use by downstream vendors to add custom options. MFC after: 2 weeks --- sys/netinet/tcp.h | 3 +++ sys/netinet/udp.h | 2 ++ sys/sys/socket.h | 9 +++++++++ sys/sys/un.h | 3 +++ 4 files changed, 17 insertions(+) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 1613301a402f..fb2f8108d4f6 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -166,6 +166,9 @@ struct tcphdr { #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 */ #define TCPI_OPT_TIMESTAMPS 0x01 diff --git a/sys/netinet/udp.h b/sys/netinet/udp.h index cea26673c38c..c2d638dde321 100644 --- a/sys/netinet/udp.h +++ b/sys/netinet/udp.h @@ -50,6 +50,8 @@ struct udphdr { */ #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. diff --git a/sys/sys/socket.h b/sys/sys/socket.h index d7c6c792d52f..c29a689b5915 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -142,6 +142,15 @@ typedef __uid_t uid_t; #define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #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. */ diff --git a/sys/sys/un.h b/sys/sys/un.h index 6ab84748bbdf..7837e76ee709 100644 --- a/sys/sys/un.h +++ b/sys/sys/un.h @@ -57,6 +57,9 @@ struct sockaddr_un { #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 /* actual length of an initialized sockaddr_un */