]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/EfiSocketLib/Socket.c
Update PXE driver to support PXE forced mode.
[mirror_edk2.git] / StdLib / EfiSocketLib / Socket.c
index a74dcd07f60021f5a2f74a841438038079c504a2..c7084a1a09646994edd6a99eb01c7c84b3f17e45 100644 (file)
@@ -1336,27 +1336,40 @@ EslSocketBindTest (
   pConfigData = (VOID *)pBuffer;\r
 \r
   //\r
-  //  Attempt to use this configuration\r
+  //  Validate that the port is connected\r
   //\r
-  Status = pPort->pfnConfigure ( pPort->pProtocol.v, pConfigData );\r
+  Status = pPort->pSocket->pApi->pfnVerifyLocalIpAddress ( pPort, pBuffer );\r
   if ( EFI_ERROR ( Status )) {\r
     DEBUG (( DEBUG_WARN | DEBUG_BIND,\r
-              "WARNING - Port 0x%08x failed configuration, Status: %r\r\n",\r
+              "WARNING - Port 0x%08x invalid IP address: %r\r\n",\r
               pPort,\r
               Status ));\r
     pPort->pSocket->errno = ErrnoValue;\r
   }\r
   else {\r
     //\r
-    //  Reset the port\r
+    //  Attempt to use this configuration\r
     //\r
-    Status = pPort->pfnConfigure ( pPort->pProtocol.v, NULL );\r
+    Status = pPort->pfnConfigure ( pPort->pProtocol.v, pConfigData );\r
     if ( EFI_ERROR ( Status )) {\r
-      DEBUG (( DEBUG_ERROR | DEBUG_BIND,\r
-                "ERROR - Port 0x%08x failed configuration reset, Status: %r\r\n",\r
+      DEBUG (( DEBUG_WARN | DEBUG_BIND,\r
+                "WARNING - Port 0x%08x failed configuration, Status: %r\r\n",\r
                 pPort,\r
                 Status ));\r
-      ASSERT ( EFI_SUCCESS == Status );\r
+      pPort->pSocket->errno = ErrnoValue;\r
+    }\r
+    else {\r
+      //\r
+      //  Reset the port\r
+      //\r
+      Status = pPort->pfnConfigure ( pPort->pProtocol.v, NULL );\r
+      if ( EFI_ERROR ( Status )) {\r
+        DEBUG (( DEBUG_ERROR | DEBUG_BIND,\r
+                  "ERROR - Port 0x%08x failed configuration reset, Status: %r\r\n",\r
+                  pPort,\r
+                  Status ));\r
+        ASSERT ( EFI_SUCCESS == Status );\r
+      }\r
     }\r
   }\r
 \r
@@ -1812,15 +1825,7 @@ EslSocketConnect (
           //  Set the next state if connected\r
           //\r
           if ( EFI_NOT_READY != Status ) {\r
-            if ( !EFI_ERROR ( Status )) {\r
-              pSocket->State = SOCKET_STATE_CONNECTED;\r
-\r
-              //\r
-              //  Start the receive operations\r
-              //\r
-              EslSocketRxStart ( pSocket->pPortList );\r
-            }\r
-            else {\r
+            if ( EFI_ERROR ( Status )) {\r
               pSocket->State = SOCKET_STATE_BOUND;\r
             }\r
           }\r
@@ -5128,7 +5133,7 @@ EslSocketRxPoll (
   <ul>\r
     <li>::EslIp4Receive to restart the receive engine to release flow control.</li>\r
     <li>::EslIp4RxComplete to continue the operation of the receive engine if flow control is not being applied.</li>\r
-    <li>::EslIp4SocketIsConfigured to start the recevie engine for the new socket.</li>\r
+    <li>::EslIp4SocketIsConfigured to start the receive engine for the new socket.</li>\r
     <li>::EslTcp4ListenComplete to start the recevie engine for the new socket.</li>\r
     <li>::EslTcp4Receive to restart the receive engine to release flow control.</li>\r
     <li>::EslTcp4RxComplete to continue the operation of the receive engine if flow control is not being applied.</li>\r
@@ -5924,10 +5929,24 @@ EslSocketTxStart (
       *ppActive = pIo;\r
     }\r
     else {\r
+      //\r
+      //  Display the transmit error\r
+      //\r
+      DEBUG (( DEBUG_TX | DEBUG_INFO,\r
+                "0x%08x, 0x%08x: pIo, pPacket transmit failure: %r\r\n",\r
+                pIo,\r
+                pPacket,\r
+                Status ));\r
       if ( EFI_SUCCESS == pSocket->TxError ) {\r
         pSocket->TxError = Status;\r
       }\r
 \r
+      //\r
+      //  Free the IO structure\r
+      //\r
+      pIo->pNext = *ppFree;\r
+      *ppFree = pIo;\r
+\r
       //\r
       //  Discard the transmit buffer\r
       //\r