Cygwin: tcp: fix IPPROTO_TCP option handling

- Drop definitions from <cygwin/sockets.h>
- Drop options only available on BSD
- Fix value of TCP_MAXSEG.  It was still defined as the BSD value
  while WinSock uses another value
- Handle the fact that TCP_MAXSEG is a R/O value in WinSock

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-06-30 13:33:57 +02:00
parent c11b0343c0
commit e037192b50
3 changed files with 16 additions and 11 deletions

View File

@ -23,6 +23,7 @@
#endif
#include <w32api/ws2tcpip.h>
#include <w32api/mswsock.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <asm/byteorder.h>
#include <sys/socket.h>
@ -1682,6 +1683,20 @@ fhandler_socket_inet::setsockopt (int level, int optname, const void *optval,
}
default:
break;
case IPPROTO_TCP:
switch (optname)
{
case TCP_MAXSEG:
/* Winsock doesn't support setting TCP_MAXSEG, only requesting it
via getsockopt. Make this a no-op. */
ignore = true;
break;
default:
break;
}
break;
}
/* Call Winsock setsockopt (or not) */

View File

@ -300,12 +300,6 @@ struct OLD_msghdr
/* IPX options */
#define IPX_TYPE 1
/* TCP options - this way around because someone left a set in the c library includes */
#ifndef TCP_NODELAY
#define TCP_NODELAY 0x0001
#define TCP_MAXSEG 2
#endif
/* SUS symbolic values for the second parm to shutdown(2) */
#define SHUT_RD 0 /* == Win32 SD_RECEIVE */
#define SHUT_WR 1 /* == Win32 SD_SEND */

View File

@ -123,11 +123,7 @@ struct tcphdr {
/*
* User-settable options (used with setsockopt).
*/
#ifndef TCP_NODELAY
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_MAXSEG 0x02 /* set maximum segment size */
#endif
#define TCP_NOPUSH 0x04 /* don't push last block of write */
#define TCP_NOOPT 0x08 /* don't use TCP options */
#define TCP_MAXSEG 0x04 /* get maximum segment size (r/o on windows) */
#endif