Only use ports with a network connection (media present) when connecting to a remote host.

Fix bug causing early exit with NO_MEDIA.
Add fix to TCP6.

Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13432 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lpleahy 2012-06-07 17:38:09 +00:00
parent a391483e42
commit 3a2fc8780f
2 changed files with 48 additions and 5 deletions

View File

@ -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 {
//

View File

@ -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;