mirror of https://github.com/acidanthera/audk.git
StdLib: Remove EfiSocketLib and Ip4Config Protocol dependency.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: jiaxinwu <jiaxin.wu@intel.com> Reviewed-by: "Leahy, Leroy P" <leroy.p.leahy@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17875 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
395616868f
commit
c581e5037d
|
@ -2,7 +2,7 @@
|
||||||
# Component description file for the EFI socket library.
|
# Component description file for the EFI socket library.
|
||||||
#
|
#
|
||||||
# This module implements the socket layer.
|
# This module implements the socket layer.
|
||||||
# Copyright (c) 2011, Intel Corporation
|
# Copyright (c) 2011 - 2015, Intel Corporation
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
UefiLib
|
UefiLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiIp4ConfigProtocolGuid
|
gEfiIp4Config2ProtocolGuid
|
||||||
gEfiIp6ConfigProtocolGuid
|
gEfiIp6ConfigProtocolGuid
|
||||||
gEfiIp4ProtocolGuid
|
gEfiIp4ProtocolGuid
|
||||||
gEfiIp4ServiceBindingProtocolGuid
|
gEfiIp4ServiceBindingProtocolGuid
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implement the IP4 driver support for the socket layer.
|
Implement the IP4 driver support for the socket layer.
|
||||||
|
|
||||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
|
@ -1197,8 +1197,8 @@ EslIp4VerifyLocalIpAddress (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
EFI_IP4_IPCONFIG_DATA * pIpConfigData;
|
EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
|
||||||
EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
|
EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
|
||||||
ESL_SERVICE * pService;
|
ESL_SERVICE * pService;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
@ -1207,7 +1207,7 @@ EslIp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Use break instead of goto
|
// Use break instead of goto
|
||||||
//
|
//
|
||||||
pIpConfigData = NULL;
|
pIfInfo = NULL;
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
//
|
//
|
||||||
// Determine if the IP address is specified
|
// Determine if the IP address is specified
|
||||||
|
@ -1235,12 +1235,14 @@ EslIp4VerifyLocalIpAddress (
|
||||||
// Open the configuration protocol
|
// Open the configuration protocol
|
||||||
//
|
//
|
||||||
pService = pPort->pService;
|
pService = pPort->pService;
|
||||||
Status = gBS->OpenProtocol ( pService->Controller,
|
Status = gBS->OpenProtocol (
|
||||||
&gEfiIp4ConfigProtocolGuid,
|
pService->Controller,
|
||||||
(VOID **)&pIpConfigProtocol,
|
&gEfiIp4Config2ProtocolGuid,
|
||||||
NULL,
|
(VOID **)&pIpConfig2Protocol,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
||||||
|
@ -1249,39 +1251,45 @@ EslIp4VerifyLocalIpAddress (
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration data size
|
// Get the interface information size.
|
||||||
//
|
//
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
NULL );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to get IP Configuration data size, Status: %r\r\n",
|
"ERROR - Failed to get the interface information size, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate the configuration data buffer
|
// Allocate the interface information buffer
|
||||||
//
|
//
|
||||||
pIpConfigData = AllocatePool ( DataSize );
|
pIfInfo = AllocatePool ( DataSize );
|
||||||
if ( NULL == pIpConfigData ) {
|
if ( NULL == pIfInfo ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Not enough memory to allocate IP Configuration data!\r\n" ));
|
"ERROR - Not enough memory to allocate the interface information buffer!\r\n" ));
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration
|
// Get the interface info.
|
||||||
//
|
//
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
pIpConfigData );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
pIfInfo
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to return IP Configuration data, Status: %r\r\n",
|
"ERROR - Failed to return the interface info, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1291,19 +1299,19 @@ EslIp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
DEBUG (( DEBUG_BIND,
|
DEBUG (( DEBUG_BIND,
|
||||||
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
||||||
pIpConfigData->StationAddress.Addr [ 0 ],
|
pIfInfo->StationAddress.Addr [ 0 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 1 ],
|
pIfInfo->StationAddress.Addr [ 1 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 2 ],
|
pIfInfo->StationAddress.Addr [ 2 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 3 ]));
|
pIfInfo->StationAddress.Addr [ 3 ]));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assume the port is not configured
|
// Assume the port is not configured
|
||||||
//
|
//
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
|
if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
|
&& ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
|
&& ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
|
&& ( pConfigData->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1317,8 +1325,8 @@ EslIp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Free the buffer if necessary
|
// Free the buffer if necessary
|
||||||
//
|
//
|
||||||
if ( NULL != pIpConfigData ) {
|
if ( NULL != pIfInfo ) {
|
||||||
FreePool ( pIpConfigData );
|
FreePool ( pIfInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implement the TCP4 driver support for the socket layer.
|
Implement the TCP4 driver support for the socket layer.
|
||||||
|
|
||||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
|
@ -2247,8 +2247,8 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
{
|
{
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
EFI_TCP4_ACCESS_POINT * pAccess;
|
EFI_TCP4_ACCESS_POINT * pAccess;
|
||||||
EFI_IP4_IPCONFIG_DATA * pIpConfigData;
|
EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
|
||||||
EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
|
EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
|
||||||
ESL_SERVICE * pService;
|
ESL_SERVICE * pService;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
@ -2257,7 +2257,7 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Use break instead of goto
|
// Use break instead of goto
|
||||||
//
|
//
|
||||||
pIpConfigData = NULL;
|
pIfInfo = NULL;
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
//
|
//
|
||||||
// Determine if the IP address is specified
|
// Determine if the IP address is specified
|
||||||
|
@ -2286,12 +2286,14 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
// Open the configuration protocol
|
// Open the configuration protocol
|
||||||
//
|
//
|
||||||
pService = pPort->pService;
|
pService = pPort->pService;
|
||||||
Status = gBS->OpenProtocol ( pService->Controller,
|
Status = gBS->OpenProtocol (
|
||||||
&gEfiIp4ConfigProtocolGuid,
|
pService->Controller,
|
||||||
(VOID **)&pIpConfigProtocol,
|
&gEfiIp4Config2ProtocolGuid,
|
||||||
NULL,
|
(VOID **)&pIpConfig2Protocol,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
||||||
|
@ -2300,39 +2302,45 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration data size
|
// Get the interface information size.
|
||||||
//
|
//
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
NULL );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to get IP Configuration data size, Status: %r\r\n",
|
"ERROR - Failed to get the interface information size, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate the configuration data buffer
|
// Allocate the interface information buffer
|
||||||
//
|
//
|
||||||
pIpConfigData = AllocatePool ( DataSize );
|
pIfInfo = AllocatePool ( DataSize );
|
||||||
if ( NULL == pIpConfigData ) {
|
if ( NULL == pIfInfo ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Not enough memory to allocate IP Configuration data!\r\n" ));
|
"ERROR - Not enough memory to allocate the interface information buffer!\r\n" ));
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration
|
// Get the interface info.
|
||||||
//
|
//
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
pIpConfigData );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
pIfInfo
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to return IP Configuration data, Status: %r\r\n",
|
"ERROR - Failed to return the interface info, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2342,19 +2350,19 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
DEBUG (( DEBUG_BIND,
|
DEBUG (( DEBUG_BIND,
|
||||||
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
||||||
pIpConfigData->StationAddress.Addr [ 0 ],
|
pIfInfo->StationAddress.Addr [ 0 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 1 ],
|
pIfInfo->StationAddress.Addr [ 1 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 2 ],
|
pIfInfo->StationAddress.Addr [ 2 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 3 ]));
|
pIfInfo->StationAddress.Addr [ 3 ]));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assume the port is not configured
|
// Assume the port is not configured
|
||||||
//
|
//
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (( pAccess->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
|
if (( pAccess->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
|
||||||
&& ( pAccess->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
|
&& ( pAccess->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
|
||||||
&& ( pAccess->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
|
&& ( pAccess->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
|
||||||
&& ( pAccess->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
|
&& ( pAccess->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2368,8 +2376,8 @@ EslTcp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Free the buffer if necessary
|
// Free the buffer if necessary
|
||||||
//
|
//
|
||||||
if ( NULL != pIpConfigData ) {
|
if ( NULL != pIfInfo ) {
|
||||||
FreePool ( pIpConfigData );
|
FreePool ( pIfInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implement the UDP4 driver support for the socket layer.
|
Implement the UDP4 driver support for the socket layer.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2015, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1049,8 +1049,8 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
EFI_IP4_IPCONFIG_DATA * pIpConfigData;
|
EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
|
||||||
EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
|
EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
|
||||||
ESL_SERVICE * pService;
|
ESL_SERVICE * pService;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Use break instead of goto
|
// Use break instead of goto
|
||||||
//
|
//
|
||||||
pIpConfigData = NULL;
|
pIfInfo = NULL;
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
//
|
//
|
||||||
// Determine if the IP address is specified
|
// Determine if the IP address is specified
|
||||||
|
@ -1087,12 +1087,14 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
// Open the configuration protocol
|
// Open the configuration protocol
|
||||||
//
|
//
|
||||||
pService = pPort->pService;
|
pService = pPort->pService;
|
||||||
Status = gBS->OpenProtocol ( pService->Controller,
|
Status = gBS->OpenProtocol (
|
||||||
&gEfiIp4ConfigProtocolGuid,
|
pService->Controller,
|
||||||
(VOID **)&pIpConfigProtocol,
|
&gEfiIp4Config2ProtocolGuid,
|
||||||
NULL,
|
(VOID **)&pIpConfig2Protocol,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
|
||||||
|
@ -1101,39 +1103,45 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration data size
|
// Get the interface information size
|
||||||
//
|
//
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
NULL );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
if ( EFI_BUFFER_TOO_SMALL != Status ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to get IP Configuration data size, Status: %r\r\n",
|
"ERROR - Failed to get the interface information size, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate the configuration data buffer
|
// Allocate the interface information buffer
|
||||||
//
|
//
|
||||||
pIpConfigData = AllocatePool ( DataSize );
|
pIfInfo = AllocatePool ( DataSize );
|
||||||
if ( NULL == pIpConfigData ) {
|
if ( NULL == pIfInfo ) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Not enough memory to allocate IP Configuration data!\r\n" ));
|
"ERROR - Not enough memory to allocate the interface information buffer!\r\n" ));
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP configuration
|
// Get the interface info.
|
||||||
//
|
//
|
||||||
Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
|
Status = pIpConfig2Protocol->GetData (
|
||||||
&DataSize,
|
pIpConfig2Protocol,
|
||||||
pIpConfigData );
|
Ip4Config2DataTypeInterfaceInfo,
|
||||||
|
&DataSize,
|
||||||
|
pIfInfo
|
||||||
|
);
|
||||||
if ( EFI_ERROR ( Status )) {
|
if ( EFI_ERROR ( Status )) {
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Failed to return IP Configuration data, Status: %r\r\n",
|
"ERROR - Failed to return the interface info, Status: %r\r\n",
|
||||||
Status ));
|
Status ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1143,19 +1151,19 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
DEBUG (( DEBUG_BIND,
|
DEBUG (( DEBUG_BIND,
|
||||||
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
"Actual adapter IP address: %d.%d.%d.%d\r\n",
|
||||||
pIpConfigData->StationAddress.Addr [ 0 ],
|
pIfInfo->StationAddress.Addr [ 0 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 1 ],
|
pIfInfo->StationAddress.Addr [ 1 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 2 ],
|
pIfInfo->StationAddress.Addr [ 2 ],
|
||||||
pIpConfigData->StationAddress.Addr [ 3 ]));
|
pIfInfo->StationAddress.Addr [ 3 ]));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assume the port is not configured
|
// Assume the port is not configured
|
||||||
//
|
//
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
|
if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
|
&& ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
|
&& ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
|
||||||
&& ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
|
&& ( pConfigData->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,8 +1177,8 @@ EslUdp4VerifyLocalIpAddress (
|
||||||
//
|
//
|
||||||
// Free the buffer if necessary
|
// Free the buffer if necessary
|
||||||
//
|
//
|
||||||
if ( NULL != pIpConfigData ) {
|
if ( NULL != pIfInfo ) {
|
||||||
FreePool ( pIpConfigData );
|
FreePool ( pIfInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Definitions for the EFI Socket layer library.
|
Definitions for the EFI Socket layer library.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2015, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
|
|
||||||
#include <Protocol/EfiSocket.h>
|
#include <Protocol/EfiSocket.h>
|
||||||
#include <Protocol/Ip4Config.h>
|
#include <Protocol/Ip4Config2.h>
|
||||||
#include <Protocol/Ip6Config.h>
|
#include <Protocol/Ip6Config.h>
|
||||||
#include <Protocol/ServiceBinding.h>
|
#include <Protocol/ServiceBinding.h>
|
||||||
#include <Protocol/Tcp4.h>
|
#include <Protocol/Tcp4.h>
|
||||||
|
|
Loading…
Reference in New Issue