]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
Allow connection on the same machine.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 12:30:06 +0000 (12:30 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Nov 2005 12:30:06 +0000 (12:30 +0000)
All sockets can be used by all threads.
Fix a few typos.
(Integrate 592 from branch) (Rev 625)

git-svn-id: svn://openib.tc.cornell.edu/gen1@181 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/sdp/kernel/SdpGenUtils.h
trunk/ulp/sdp/kernel/SdpSocket.cpp
trunk/ulp/sdp/kernel/SdpUserFile.cpp

index 458f28958e0ebe6d45a2e2523a10c59fd4ff2b30..53356d1f54f24bf1eaccc47b7c76403ef84c61c5 100644 (file)
@@ -82,6 +82,7 @@ void* __cdecl operator new(size_t n, void *addr ) throw();
 int IbalToWsaError(const       ib_api_status_t ib_status );\r
 \r
 #define INADDR_ANY              (ULONG)0x00000000\r
+#define INADDR_LOOPBACK         0x7f000001\r
 \r
 // This error codes are taken from winsock2.h (the file can not)\r
 // be included from kernel mode\r
index de3717bbb74181c9f5debbd78d7babc8b1ab7bd4..0c373d0fad3566c552501330c877aa82e7d43155 100644 (file)
@@ -13,7 +13,7 @@ static NTSTATUS __accept_requests(SdpSocket * pSdpSocket);
 static void AL_API\r
 cm_rej_callback(IN ib_cm_rej_rec_t *p_cm_rej_rec )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("dispatch level = %d\n", KeGetCurrentIrql()));\r
+    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("dispatch level = %d\n", KeGetCurrentIrql()));\r
     // BUGBUG: This should be used to return error to the connecting side\r
 }\r
 \r
@@ -180,7 +180,7 @@ NTSTATUS SdpSocket::WSPSend(
         WspSendOut   *pWspSendOut\r
         )\r
 {    \r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p \n",this));\r
+    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p size = %d \n",this, pWspSendIn->BufferSize));\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;    \r
     NTSTATUS rc1; // used only to check that there are no more errors on the \r
@@ -442,6 +442,7 @@ NTSTATUS SdpSocket::WSPConnect(
     ib_gid_t   DestPortGid;\r
     \r
     ib_path_rec_t path_rec;\r
+    ULONG SrcIp = 0;\r
         \r
     SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p remote addresses ip=%d.%d.%d.%d:%d\n",\r
         this,\r
@@ -483,6 +484,13 @@ NTSTATUS SdpSocket::WSPConnect(
         // No explicit bind was done, we use the default addresses\r
         m_SrcIp = pWspConnectIn->SrcIP;\r
     }\r
+    if (m_SrcIp == INADDR_LOOPBACK) {\r
+        // This is the loopback case, we use the dest IP in order to\r
+        // get the port\r
+        SrcIp = pWspConnectIn->DestIP;\r
+    } else {\r
+        SrcIp = m_SrcIp;\r
+    }\r
 \r
     // Now that we know the source IP we can decide about the src port\r
     if (m_SrcPort == 0) {\r
@@ -497,9 +505,8 @@ NTSTATUS SdpSocket::WSPConnect(
         // We need to connect to the global table of ports\r
 \r
     }\r
-\r
     \r
-    rc = g_pSdpDriver->m_pSdpArp->SourcePortGidFromIP(m_SrcIp, &m_SrcPortGuid, &m_SrcCaGuid);\r
+    rc = g_pSdpDriver->m_pSdpArp->SourcePortGidFromIP(SrcIp, &m_SrcPortGuid, &m_SrcCaGuid);\r
     if (!NT_SUCCESS(rc)) {\r
         SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc ));\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
@@ -1489,7 +1496,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
     if( ib_status != IB_SUCCESS ) {\r
         SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_rep failed ib_status = 0x%d\n", ib_status ));\r
         rc = IB2Status(ib_status);\r
-        goto Cleanup;\r
+        goto ErrorLocked;\r
     }\r
 \r
     // Add this socket to the list of sockets ?????? should this also be done on errors ????\r
index 760d7084dfad72ad7789a560d3821bd6ffbf14a8..77003e088dff6abb8c12bfdca93eea094bb421fb 100644 (file)
@@ -115,6 +115,7 @@ SdpSocket *SdpUserFile::SocketByPointer(VOID *Socket, bool LookInGlobal)
         pSdpSocket = g_pSdpDriver->m_SdpGlobalSockets->SocketByPointer(Socket, false);\r
         if (pSdpSocket) {\r
             // We will now move this socket to the correct place\r
+#if 0            \r
             RemoveSocket(pSdpSocket); // removes it no meter from\r
             rc = AddSocket(pSdpSocket);\r
             if(!NT_SUCCESS(rc)) {\r
@@ -123,7 +124,7 @@ SdpSocket *SdpUserFile::SocketByPointer(VOID *Socket, bool LookInGlobal)
                 pSdpSocket->Release();\r
                 pSdpSocket = NULL;\r
             }\r
-            \r
+#endif            \r
         }\r
         \r
 \r