SOL_TCP is nonstandard and not in the reserved namespace
authorRich Felker <dalias@aerifal.cx>
Thu, 31 Jan 2013 05:49:53 +0000 (00:49 -0500)
committerRich Felker <dalias@aerifal.cx>
Thu, 31 Jan 2013 05:49:53 +0000 (00:49 -0500)
alternatively, we could define it in sys/socket.h since SO* is
reserved there, and tcp.h includes sys/socket.h in extensions mode.

note that SOL_TCP is simply wrong and it's only here for compatibility
with broken applications. the correct argument to pass for setting TCP
socket options is IPPROTO_TCP, which of course has the same value as
SOL_TCP but works everywhere.

include/netinet/tcp.h

index 94e54cf..f0fc125 100644 (file)
@@ -18,9 +18,8 @@
 #define TCP_CONGESTION  13
 #define TCP_MD5SIG      14
 
 #define TCP_CONGESTION  13
 #define TCP_MD5SIG      14
 
-#define SOL_TCP 6
-
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define SOL_TCP 6
 #include <sys/types.h>
 #include <sys/socket.h>
 #endif
 #include <sys/types.h>
 #include <sys/socket.h>
 #endif