summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-01-22 19:45:04 +0000
committerjhb <jhb@FreeBSD.org>2013-01-22 19:45:04 +0000
commite1b160d5be401f7ce823db4c2f488555f80c830e (patch)
tree457d8ed013c861c4337002956caa74c1f7bdcb13
parent2f487068869e542b856aac642ad680f1ae7ad83a (diff)
downloadFreeBSD-src-e1b160d5be401f7ce823db4c2f488555f80c830e.zip
FreeBSD-src-e1b160d5be401f7ce823db4c2f488555f80c830e.tar.gz
Use decimal values for UDP and TCP socket options rather than hex to avoid
implying that these constants should be treated as bit masks. Reviewed by: net MFC after: 1 week
-rw-r--r--sys/netinet/tcp.h26
-rw-r--r--sys/netinet/udp.h2
2 files changed, 15 insertions, 13 deletions
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index c714360..1613301 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -149,20 +149,22 @@ 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 */
#define TCP_CA_NAME_MAX 16 /* max congestion control name length */
diff --git a/sys/netinet/udp.h b/sys/netinet/udp.h
index 2dbcaca..cea2667 100644
--- a/sys/netinet/udp.h
+++ b/sys/netinet/udp.h
@@ -48,7 +48,7 @@ struct udphdr {
/*
* User-settable options (used with setsockopt).
*/
-#define UDP_ENCAP 0x01
+#define UDP_ENCAP 1
/*
OpenPOWER on IntegriCloud