Discussion:
[edk2] [Patch] StdLib: Remove EfiSocketLib and Ip4Config Protocol dependency.
jiaxinwu
2015-07-08 00:29:05 UTC
Permalink
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <***@intel.com>
---
StdLib/EfiSocketLib/EfiSocketLib.inf | 4 +-
StdLib/EfiSocketLib/Ip4.c | 76 ++++++++++++++++++++----------------
StdLib/EfiSocketLib/Tcp4.c | 76 ++++++++++++++++++++----------------
StdLib/EfiSocketLib/Udp4.c | 76 ++++++++++++++++++++----------------
StdLib/Include/Efi/EfiSocketLib.h | 4 +-
5 files changed, 130 insertions(+), 106 deletions(-)

diff --git a/StdLib/EfiSocketLib/EfiSocketLib.inf b/StdLib/EfiSocketLib/EfiSocketLib.inf
index a68e241..29e06ec 100644
--- a/StdLib/EfiSocketLib/EfiSocketLib.inf
+++ b/StdLib/EfiSocketLib/EfiSocketLib.inf
@@ -1,10 +1,10 @@
#/** @file
# Component description file for the EFI socket library.
#
# 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
# 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
# http://opensource.org/licenses/bsd-license.php
@@ -50,11 +50,11 @@
MemoryAllocationLib
UefiBootServicesTableLib
UefiLib

[Protocols]
- gEfiIp4ConfigProtocolGuid
+ gEfiIp4Config2ProtocolGuid
gEfiIp6ConfigProtocolGuid
gEfiIp4ProtocolGuid
gEfiIp4ServiceBindingProtocolGuid
gEfiIp6ProtocolGuid
gEfiIp6ServiceBindingProtocolGuid
diff --git a/StdLib/EfiSocketLib/Ip4.c b/StdLib/EfiSocketLib/Ip4.c
index bca36ea..d3531b8 100644
--- a/StdLib/EfiSocketLib/Ip4.c
+++ b/StdLib/EfiSocketLib/Ip4.c
@@ -1,9 +1,9 @@
/** @file
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
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

@@ -1195,21 +1195,21 @@ EslIp4VerifyLocalIpAddress (
IN ESL_PORT * pPort,
IN EFI_IP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
+ EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
DEBUG (( DEBUG_BIND,
@@ -1233,79 +1233,87 @@ EslIp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size.
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pConfigData->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -1315,12 +1323,12 @@ EslIp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c
index 943af94..68477fb 100644
--- a/StdLib/EfiSocketLib/Tcp4.c
+++ b/StdLib/EfiSocketLib/Tcp4.c
@@ -1,9 +1,9 @@
/** @file
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
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

@@ -2245,21 +2245,21 @@ EslTcp4VerifyLocalIpAddress (
IN EFI_TCP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
EFI_TCP4_ACCESS_POINT * pAccess;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
+ EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
pAccess = &pConfigData->AccessPoint;
@@ -2284,79 +2284,87 @@ EslTcp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size.
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pAccess->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pAccess->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pAccess->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pAccess->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pAccess->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pAccess->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pAccess->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pAccess->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -2366,12 +2374,12 @@ EslTcp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/EfiSocketLib/Udp4.c b/StdLib/EfiSocketLib/Udp4.c
index 7fece75..ef2f9e3 100644
--- a/StdLib/EfiSocketLib/Udp4.c
+++ b/StdLib/EfiSocketLib/Udp4.c
@@ -1,9 +1,9 @@
/** @file
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
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
http://opensource.org/licenses/bsd-license.php

@@ -1047,21 +1047,21 @@ EslUdp4VerifyLocalIpAddress (
IN ESL_PORT * pPort,
IN EFI_UDP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
+ EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
DEBUG (( DEBUG_BIND,
@@ -1085,79 +1085,87 @@ EslUdp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pConfigData->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -1167,12 +1175,12 @@ EslUdp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/Include/Efi/EfiSocketLib.h b/StdLib/Include/Efi/EfiSocketLib.h
index efd6a61..7618d02 100644
--- a/StdLib/Include/Efi/EfiSocketLib.h
+++ b/StdLib/Include/Efi/EfiSocketLib.h
@@ -1,9 +1,9 @@
/** @file
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
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
http://opensource.org/licenses/bsd-license

@@ -22,11 +22,11 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>

#include <Protocol/EfiSocket.h>
-#include <Protocol/Ip4Config.h>
+#include <Protocol/Ip4Config2.h>
#include <Protocol/Ip6Config.h>
#include <Protocol/ServiceBinding.h>
#include <Protocol/Tcp4.h>
#include <Protocol/Tcp6.h>
#include <Protocol/Udp4.h>
--
1.9.5.msysgit.1
Leahy, Leroy P
2015-07-08 01:02:55 UTC
Permalink
This patch looks good to me. It has been verified by Jiaxin.

Lee Leahy
(425) 881-4919
Intel Corporation
Suite 125
2700 - 156th Ave NE
Bellevue, WA 98007-6554

-----Original Message-----
From: jiaxinwu [mailto:***@intel.com]
Sent: Tuesday, July 7, 2015 5:29 PM
To: edk2-***@lists.sourceforge.net
Subject: [edk2] [Patch] StdLib: Remove EfiSocketLib and Ip4Config Protocol dependency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <***@intel.com>
---
StdLib/EfiSocketLib/EfiSocketLib.inf | 4 +-
StdLib/EfiSocketLib/Ip4.c | 76 ++++++++++++++++++++----------------
StdLib/EfiSocketLib/Tcp4.c | 76 ++++++++++++++++++++----------------
StdLib/EfiSocketLib/Udp4.c | 76 ++++++++++++++++++++----------------
StdLib/Include/Efi/EfiSocketLib.h | 4 +-
5 files changed, 130 insertions(+), 106 deletions(-)

diff --git a/StdLib/EfiSocketLib/EfiSocketLib.inf b/StdLib/EfiSocketLib/EfiSocketLib.inf
index a68e241..29e06ec 100644
--- a/StdLib/EfiSocketLib/EfiSocketLib.inf
+++ b/StdLib/EfiSocketLib/EfiSocketLib.inf
@@ -1,10 +1,10 @@
#/** @file
# Component description file for the EFI socket library.
#
# 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 # 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 # http://opensource.org/licenses/bsd-license.php
@@ -50,11 +50,11 @@
MemoryAllocationLib
UefiBootServicesTableLib
UefiLib

[Protocols]
- gEfiIp4ConfigProtocolGuid
+ gEfiIp4Config2ProtocolGuid
gEfiIp6ConfigProtocolGuid
gEfiIp4ProtocolGuid
gEfiIp4ServiceBindingProtocolGuid
gEfiIp6ProtocolGuid
gEfiIp6ServiceBindingProtocolGuid
diff --git a/StdLib/EfiSocketLib/Ip4.c b/StdLib/EfiSocketLib/Ip4.c index bca36ea..d3531b8 100644
--- a/StdLib/EfiSocketLib/Ip4.c
+++ b/StdLib/EfiSocketLib/Ip4.c
@@ -1,9 +1,9 @@
/** @file
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
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

@@ -1195,21 +1195,21 @@ EslIp4VerifyLocalIpAddress (
IN ESL_PORT * pPort,
IN EFI_IP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo; EFI_IP4_CONFIG2_PROTOCOL *
+ pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
DEBUG (( DEBUG_BIND,
@@ -1233,79 +1233,87 @@ EslIp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size.
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pConfigData->StationAddress.Addr [ 3 ] ==
+ pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -1315,12 +1323,12 @@ EslIp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c index 943af94..68477fb 100644
--- a/StdLib/EfiSocketLib/Tcp4.c
+++ b/StdLib/EfiSocketLib/Tcp4.c
@@ -1,9 +1,9 @@
/** @file
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
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.

@@ -2245,21 +2245,21 @@ EslTcp4VerifyLocalIpAddress (
IN EFI_TCP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
EFI_TCP4_ACCESS_POINT * pAccess;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo; EFI_IP4_CONFIG2_PROTOCOL *
+ pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
pAccess = &pConfigData->AccessPoint; @@ -2284,79 +2284,87 @@ EslTcp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size.
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pAccess->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pAccess->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pAccess->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pAccess->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pAccess->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pAccess->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pAccess->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pAccess->StationAddress.Addr [ 3 ] ==
+ pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -2366,12 +2374,12 @@ EslTcp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/EfiSocketLib/Udp4.c b/StdLib/EfiSocketLib/Udp4.c index 7fece75..ef2f9e3 100644
--- a/StdLib/EfiSocketLib/Udp4.c
+++ b/StdLib/EfiSocketLib/Udp4.c
@@ -1,9 +1,9 @@
/** @file
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
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
http://opensource.org/licenses/bsd-license.php

@@ -1047,21 +1047,21 @@ EslUdp4VerifyLocalIpAddress (
IN ESL_PORT * pPort,
IN EFI_UDP4_CONFIG_DATA * pConfigData
)
{
UINTN DataSize;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo; EFI_IP4_CONFIG2_PROTOCOL *
+ pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;

DBG_ENTER ( );

//
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
//
DEBUG (( DEBUG_BIND,
@@ -1085,79 +1085,87 @@ EslUdp4VerifyLocalIpAddress (

//
// Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
Status ));
break;
}

//
- // Get the IP configuration data size
+ // Get the interface information size
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
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 ));
break;
}

//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
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;
break;
}

//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
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 ));
break;
}

//
// Display the current configuration
//
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));

//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pConfigData->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pConfigData->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pConfigData->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pConfigData->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pConfigData->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pConfigData->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pConfigData->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pConfigData->StationAddress.Addr [ 3 ] ==
+ pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}

//
// The IP address did not match
@@ -1167,12 +1175,12 @@ EslUdp4VerifyLocalIpAddress (
}

//
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}

//
// Return the IP address status
//
diff --git a/StdLib/Include/Efi/EfiSocketLib.h b/StdLib/Include/Efi/EfiSocketLib.h
index efd6a61..7618d02 100644
--- a/StdLib/Include/Efi/EfiSocketLib.h
+++ b/StdLib/Include/Efi/EfiSocketLib.h
@@ -1,9 +1,9 @@
/** @file
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
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
http://opensource.org/licenses/bsd-license

@@ -22,11 +22,11 @@
#include <Library/MemoryAllocationLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>

#include <Protocol/EfiSocket.h>
-#include <Protocol/Ip4Config.h>
+#include <Protocol/Ip4Config2.h>
#include <Protocol/Ip6Config.h>
#include <Protocol/ServiceBinding.h>
#include <Protocol/Tcp4.h>
#include <Protocol/Tcp6.h>
#include <Protocol/Udp4.h>
--
1.9.5.msysgit.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Loading...