NetworkPkg: Remove IpSecDxe and Ip4Config Protocol dependency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17874 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jiaxinwu 2015-07-08 03:09:28 +00:00 committed by jiaxinwu
parent 6c5c70d68d
commit 395616868f
3 changed files with 37 additions and 20 deletions

View File

@ -18,7 +18,7 @@
#include <Protocol/Udp4.h> #include <Protocol/Udp4.h>
#include <Protocol/Udp6.h> #include <Protocol/Udp6.h>
#include <Protocol/Ip4Config.h> #include <Protocol/Ip4Config2.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>

View File

@ -1,7 +1,7 @@
/** @file /** @file
Provide IPsec Key Exchange (IKE) service general interfaces. Provide IPsec Key Exchange (IKE) service general interfaces.
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials 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
@ -212,15 +212,15 @@ IkeOpenOutputUdp (
IN EFI_IP_ADDRESS *RemoteIp IN EFI_IP_ADDRESS *RemoteIp
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_IP4_CONFIG_PROTOCOL *Ip4Cfg; EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2;
EFI_IP4_IPCONFIG_DATA *Ip4CfgData; EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
UINTN BufSize; UINTN BufSize;
EFI_IP6_MODE_DATA Ip6ModeData; EFI_IP6_MODE_DATA Ip6ModeData;
EFI_UDP6_PROTOCOL *Udp6; EFI_UDP6_PROTOCOL *Udp6;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Ip4CfgData = NULL; IfInfo = NULL;
BufSize = 0; BufSize = 0;
// //
@ -236,35 +236,52 @@ IkeOpenOutputUdp (
// //
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
UdpService->NicHandle, UdpService->NicHandle,
&gEfiIp4ConfigProtocolGuid, &gEfiIp4Config2ProtocolGuid,
(VOID **) &Ip4Cfg (VOID **) &Ip4Cfg2
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto ON_EXIT; goto ON_EXIT;
} }
Status = Ip4Cfg->GetData (Ip4Cfg, &BufSize, NULL); //
// Get the interface information size.
//
Status = Ip4Cfg2->GetData (
Ip4Cfg2,
Ip4Config2DataTypeInterfaceInfo,
&BufSize,
NULL
);
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) { if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
goto ON_EXIT; goto ON_EXIT;
} }
Ip4CfgData = AllocateZeroPool (BufSize); IfInfo = AllocateZeroPool (BufSize);
if (Ip4CfgData == NULL) { if (IfInfo == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT; goto ON_EXIT;
} }
Status = Ip4Cfg->GetData (Ip4Cfg, &BufSize, Ip4CfgData); //
// Get the interface info.
//
Status = Ip4Cfg2->GetData (
Ip4Cfg2,
Ip4Config2DataTypeInterfaceInfo,
&BufSize,
IfInfo
);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto ON_EXIT; goto ON_EXIT;
} }
CopyMem ( CopyMem (
&UdpService->DefaultAddress.v4, &UdpService->DefaultAddress.v4,
&Ip4CfgData->StationAddress, &IfInfo->StationAddress,
sizeof (EFI_IPv4_ADDRESS) sizeof (EFI_IPv4_ADDRESS)
); );
@ -331,8 +348,8 @@ IkeOpenOutputUdp (
UdpService->IsConfigured = TRUE; UdpService->IsConfigured = TRUE;
ON_EXIT: ON_EXIT:
if (Ip4CfgData != NULL) { if (IfInfo != NULL) {
FreePool (Ip4CfgData); FreePool (IfInfo);
} }
return Status; return Status;

View File

@ -6,7 +6,7 @@
# packet-level security for IP datagram. It provides the IP packet protection via # packet-level security for IP datagram. It provides the IP packet protection via
# ESP and it supports IKEv2 for key negotiation. # ESP and it supports IKEv2 for key negotiation.
# #
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # 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
@ -89,7 +89,7 @@
PcdLib PcdLib
[Protocols] [Protocols]
gEfiIp4ConfigProtocolGuid ## SOMETIMES_CONSUMES gEfiIp4Config2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiUdp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES gEfiUdp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES
gEfiUdp4ProtocolGuid ## SOMETIMES_CONSUMES gEfiUdp4ProtocolGuid ## SOMETIMES_CONSUMES
gEfiUdp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES gEfiUdp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES