Author: cgutman Date: Fri Aug 24 06:23:45 2012 New Revision: 57149
URL: http://svn.reactos.org/svn/reactos?rev=57149&view=rev Log: [MSAFD] - Stubplement support for SIOCATMARK [WSHTCPIP] - Add better debugging for unsupported options - Implement setting SO_DONTROUTE (nop) - Return WSAENOPROTOOPT for invalid SOL_SOCKET options
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c trunk/reactos/dll/win32/wshtcpip/wshtcpip.c trunk/reactos/dll/win32/wshtcpip/wshtcpip.h
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllmai... ============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Fri Aug 24 06:23:45 2012 @@ -2017,6 +2017,19 @@ *lpcbBytesReturned = sizeof(ULONG); return NO_ERROR; } + case SIOCATMARK: + if (cbOutBuffer < sizeof(BOOL) || IS_INTRESOURCE(lpvOutBuffer)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + + /* FIXME: Return false for now */ + *(BOOL*)lpvOutBuffer = FALSE; + + *lpcbBytesReturned = sizeof(BOOL); + *lpErrno = NO_ERROR; + return NO_ERROR; case SIO_GET_EXTENSION_FUNCTION_POINTER: *lpErrno = WSAEINVAL; return SOCKET_ERROR;
Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshtcpip/wshtcpip... ============================================================================== --- trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] Fri Aug 24 06:23:45 2012 @@ -161,6 +161,18 @@ { switch (Level) { + case SOL_SOCKET: + switch (OptionName) + { + case SO_KEEPALIVE: + /* FIXME: Return proper option */ + ASSERT(FALSE); + break; + default: + break; + } + break; + case IPPROTO_IP: switch (OptionName) { @@ -179,19 +191,26 @@ return AO_OPTION_IP_HDRINCL;
default: - DPRINT1("Unknown option name for IPPROTO_IP: %d\n", OptionName); - return 0; + break; } break;
- case SOL_SOCKET: - DPRINT1("SOL_SOCKET option %d\n", OptionName); + case IPPROTO_TCP: + switch (OptionName) + { + case TCP_NODELAY: + /* FIXME: Return proper option */ + ASSERT(FALSE); + break; + default: + break; + } + + default: break; - - default: - DPRINT1("Unknown level: %d\n", Level); - break; - } + } + + DPRINT1("Unknown level/option name: %d %d\n", Level, OptionName); return 0; }
@@ -208,6 +227,10 @@ OUT LPINT OptionLength) { UNIMPLEMENTED + + DPRINT1("Get: Unknown level/option name: %d %d\n", Level, OptionName); + + *OptionLength = 0;
return NO_ERROR; } @@ -317,6 +340,8 @@ OUT LPBOOL NeedsCompletion) { UNIMPLEMENTED + + DPRINT1("Ioctl: Unknown IOCTL code: %d\n", IoControlCode);
return NO_ERROR; } @@ -626,11 +651,71 @@
/* FIXME: We only handle address file object here */
+ switch (Level) + { + case SOL_SOCKET: + switch (OptionName) + { + case SO_DONTROUTE: + if (OptionLength < sizeof(BOOL)) + { + return WSAEFAULT; + } + Context->DontRoute = *(BOOL*)OptionValue; + /* This is silently ignored on Windows */ + return 0; + + case SO_KEEPALIVE: + /* FIXME -- We'll send this to TCPIP */ + DPRINT1("Set: SO_KEEPALIVE not yet supported\n"); + return 0; + + default: + /* Invalid option */ + DPRINT1("Set: Received unexpected SOL_SOCKET option %d\n", OptionName); + return WSAENOPROTOOPT; + } + break; + + case IPPROTO_IP: + switch (OptionName) + { + case IP_TTL: + case IP_DONTFRAGMENT: + case IP_HDRINCL: + /* Send these to TCPIP */ + break; + + default: + /* Invalid option -- FIXME */ + DPRINT1("Set: Received unsupported IPPROTO_IP option %d\n", OptionName); + return 0; + } + break; + + case IPPROTO_TCP: + switch (OptionName) + { + case TCP_NODELAY: + /* FIXME -- Send this to TCPIP */ + DPRINT1("Set: TCP_NODELAY not yet supported\n"); + return 0; + + default: + /* Invalid option */ + DPRINT1("Set: Received unexpected IPPROTO_TCP option %d\n", OptionName); + return 0; + } + break; + + default: + DPRINT1("Set: Received unexpected %d option %d\n", Level, OptionName); + return 0; + } + + /* If we get here, GetAddressOption must return something valid */ RealOptionName = GetAddressOption(Level, OptionName); - - /* FIXME: Support all options */ - if (!RealOptionName) - return 0; /* return WSAEINVAL; */ + ASSERT(RealOptionName != 0);
Info = HeapAlloc(GetProcessHeap(), 0, sizeof(*Info) + OptionLength); if (!Info)
Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshtcpip/wshtcpip... ============================================================================== --- trunk/reactos/dll/win32/wshtcpip/wshtcpip.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshtcpip/wshtcpip.h [iso-8859-1] Fri Aug 24 06:23:45 2012 @@ -42,6 +42,7 @@ DWORD AddrFileInstance; SOCKET_STATE SocketState; PQUEUED_REQUEST RequestQueue; + BOOL DontRoute; } SOCKET_CONTEXT, *PSOCKET_CONTEXT;
#endif /* __WSHTCPIP_H */