[TCPIP]
authorCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 04:39:49 +0000 (04:39 +0000)
committerCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 04:39:49 +0000 (04:39 +0000)
- Return STATUS_INVALID_ADDRESS if the caller tries to get a non-local address
- Return STATUS_ADDRESS_ALREADY_EXISTS if the caller uses an address that is in use
[MSAFD]
- Translate STATUS_ADDRESS_ALREADY_EXISTS -> WSAEADDRINUSE, STATUS_LOCAL_DISCONNECT -> WSAECONNABORTED, and STATUS_REMOTE_DISCONNECT -> WSAECONNRESET
[IP]
- Translate OSK_EADDRINUSE -> STATUS_ADDRESS_ALREADY_EXISTS, OSK_ECONNABORTED -> STATUS_LOCAL_DISCONNECT, and OSK_ECONNRESET -> STATUS_REMOTE_DISCONNECT
- Fixes waiting for binding during ws2_32 sock winetest

svn path=/trunk/; revision=47379

reactos/dll/win32/msafd/misc/dllmain.c
reactos/drivers/network/tcpip/tcpip/fileobjs.c
reactos/lib/drivers/ip/transport/tcp/tcp.c

index f501eb0..e8126c9 100644 (file)
@@ -373,6 +373,18 @@ TranslateNtStatusError(NTSTATUS Status)
           DbgPrint("MSAFD: STATUS_CANCELLED\n");
           return WSA_OPERATION_ABORTED;
 
+       case STATUS_ADDRESS_ALREADY_EXISTS:
+          DbgPrint("MSAFD: STATUS_ADDRESS_ALREADY_EXISTS\n");
+          return WSAEADDRINUSE;
+
+       case STATUS_LOCAL_DISCONNECT:
+          DbgPrint("MSAFD: STATUS_LOCAL_DISCONNECT\n");
+          return WSAECONNABORTED;
+
+       case STATUS_REMOTE_DISCONNECT:
+          DbgPrint("MSAFD: STATUS_REMOTE_DISCONNECT\n");
+          return WSAECONNRESET;
+
        default:
           DbgPrint("MSAFD: Unhandled NTSTATUS value: 0x%x\n", Status);
           return WSAENETDOWN;
index bd7968e..70357fc 100644 (file)
@@ -265,7 +265,7 @@ NTSTATUS FileOpenAddress(
       !AddrLocateInterface(&AddrFile->Address)) {
          ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
          TI_DbgPrint(MIN_TRACE, ("Non-local address given (0x%X).\n", A2S(&AddrFile->Address)));
-         return STATUS_INVALID_PARAMETER;
+         return STATUS_INVALID_ADDRESS;
   }
 
   TI_DbgPrint(MID_TRACE, ("Opening address %s for communication (P=%d U=%d).\n",
@@ -282,7 +282,7 @@ NTSTATUS FileOpenAddress(
            AddrFile->Port == 0xffff)
       {
           ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
-          return STATUS_INVALID_PARAMETER;
+          return STATUS_ADDRESS_ALREADY_EXISTS;
       }
 
       AddEntity(CO_TL_ENTITY, AddrFile, CO_TL_TCP);
@@ -300,7 +300,7 @@ NTSTATUS FileOpenAddress(
            AddrFile->Port == 0xffff)
       {
           ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
-          return STATUS_INVALID_PARAMETER;
+          return STATUS_ADDRESS_ALREADY_EXISTS;
       }
 
       TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
index 187c9a5..e033ff6 100644 (file)
@@ -574,10 +574,11 @@ NTSTATUS TCPTranslateError( int OskitError ) {
     switch( OskitError ) {
     case 0: Status = STATUS_SUCCESS; break;
     case OSK_EADDRNOTAVAIL: Status = STATUS_INVALID_ADDRESS; break;
+    case OSK_EADDRINUSE: Status = STATUS_ADDRESS_ALREADY_EXISTS; break;
     case OSK_EAFNOSUPPORT: Status = STATUS_INVALID_CONNECTION; break;
     case OSK_ECONNREFUSED: Status = STATUS_REMOTE_NOT_LISTENING; break;
-    case OSK_ECONNRESET:
-    case OSK_ECONNABORTED: Status = STATUS_REMOTE_DISCONNECT; break;
+    case OSK_ECONNRESET: Status = STATUS_REMOTE_DISCONNECT; break;
+    case OSK_ECONNABORTED: Status = STATUS_LOCAL_DISCONNECT; break;
     case OSK_EWOULDBLOCK:
     case OSK_EINPROGRESS: Status = STATUS_PENDING; break;
     case OSK_EINVAL: Status = STATUS_INVALID_PARAMETER; break;