summaryrefslogtreecommitdiff
path: root/StdLib
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib')
-rw-r--r--StdLib/EfiSocketLib/Tcp4.c14
-rw-r--r--StdLib/EfiSocketLib/Tcp6.c39
2 files changed, 48 insertions, 5 deletions
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c
index 5027ca343d..0643518f0d 100644
--- a/StdLib/EfiSocketLib/Tcp4.c
+++ b/StdLib/EfiSocketLib/Tcp4.c
@@ -512,7 +512,6 @@ EslTcp4ConnectStart (
//
// Verify the port connection
//
- pTcp4Protocol = pPort->pProtocol.TCPv4;
Status = pTcp4Protocol->GetModeData ( pTcp4Protocol,
NULL,
NULL,
@@ -525,7 +524,18 @@ EslTcp4ConnectStart (
//
// Port is not connected to the network
//
- Status = EFI_NO_MEDIA;
+ pTcp4->ConnectToken.CompletionToken.Status = EFI_NO_MEDIA;
+
+ //
+ // Continue with the next port
+ //
+ gBS->CheckEvent ( pTcp4->ConnectToken.CompletionToken.Event );
+ gBS->SignalEvent ( pTcp4->ConnectToken.CompletionToken.Event );
+
+ //
+ // Connection in progress
+ //
+ Status = EFI_SUCCESS;
}
else {
//
diff --git a/StdLib/EfiSocketLib/Tcp6.c b/StdLib/EfiSocketLib/Tcp6.c
index b070aaa724..dd0f086487 100644
--- a/StdLib/EfiSocketLib/Tcp6.c
+++ b/StdLib/EfiSocketLib/Tcp6.c
@@ -471,6 +471,7 @@ EslTcp6ConnectStart (
ESL_PORT * pPort;
ESL_TCP6_CONTEXT * pTcp6;
EFI_TCP6_PROTOCOL * pTcp6Protocol;
+ EFI_SIMPLE_NETWORK_MODE SnpModeData;
EFI_STATUS Status;
DBG_ENTER ( );
@@ -528,10 +529,41 @@ EslTcp6ConnectStart (
pPort->bConfigured = TRUE;
//
- // Attempt the connection to the remote system
+ // Verify the port connection
//
- Status = pTcp6Protocol->Connect ( pTcp6Protocol,
- &pTcp6->ConnectToken );
+ Status = pTcp6Protocol->GetModeData ( pTcp6Protocol,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &SnpModeData );
+ if ( !EFI_ERROR ( Status )) {
+ if ( SnpModeData.MediaPresentSupported
+ && ( !SnpModeData.MediaPresent )) {
+ //
+ // Port is not connected to the network
+ //
+ pTcp6->ConnectToken.CompletionToken.Status = EFI_NO_MEDIA;
+
+ //
+ // Continue with the next port
+ //
+ gBS->CheckEvent ( pTcp6->ConnectToken.CompletionToken.Event );
+ gBS->SignalEvent ( pTcp6->ConnectToken.CompletionToken.Event );
+
+ //
+ // Connection in progress
+ //
+ Status = EFI_SUCCESS;
+ }
+ else {
+ //
+ // Attempt the connection to the remote system
+ //
+ Status = pTcp6Protocol->Connect ( pTcp6Protocol,
+ &pTcp6->ConnectToken );
+ }
+ }
if ( !EFI_ERROR ( Status )) {
//
// Connection in progress
@@ -583,6 +615,7 @@ EslTcp6ConnectStart (
pSocket->errno = ETIMEDOUT;
break;
+ case EFI_NO_MEDIA:
case EFI_NETWORK_UNREACHABLE:
pSocket->errno = ENETDOWN;
break;