X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=NetworkPkg%2FIpSecDxe%2FIkeService.c;h=4c0f6f5eb108de2eeff210fa77eed45beeea0c0e;hb=6c4194c99e2ec6251b657ec8fb5834332f544b7b;hp=12ee030e70561c591f26b686b0b45a5a92cc2b0f;hpb=4b0f5775e7b7b7e7fff0bc7c41342dd4e52d3886;p=mirror_edk2.git diff --git a/NetworkPkg/IpSecDxe/IkeService.c b/NetworkPkg/IpSecDxe/IkeService.c index 12ee030e70..4c0f6f5eb1 100644 --- a/NetworkPkg/IpSecDxe/IkeService.c +++ b/NetworkPkg/IpSecDxe/IkeService.c @@ -1,7 +1,7 @@ /** @file Provide IPsec Key Exchange (IKE) service general interfaces. - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2016, 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 @@ -15,7 +15,6 @@ #include "IkeService.h" #include "IpSecConfigImpl.h" -#include "Ikev2/Utility.h" IKE_EXCHANGE_INTERFACE *mIkeExchange[] = { &mIkev1Exchange, @@ -36,10 +35,10 @@ EFI_UDP4_CONFIG_DATA mUdp4Conf = { 0, 1000000, FALSE, - {0,0,0,0}, - {0,0,0,0}, + {{0,0,0,0}}, + {{0,0,0,0}}, IKE_DEFAULT_PORT, - {0,0,0,0}, + {{0,0,0,0}}, 0 }; @@ -55,9 +54,9 @@ EFI_UDP6_CONFIG_DATA mUdp6Conf = { 0, 1000000, //Access Point - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, IKE_DEFAULT_PORT, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, 0 }; @@ -212,15 +211,15 @@ IkeOpenOutputUdp ( IN EFI_IP_ADDRESS *RemoteIp ) { - EFI_STATUS Status; - EFI_IP4_CONFIG_PROTOCOL *Ip4Cfg; - EFI_IP4_IPCONFIG_DATA *Ip4CfgData; - UINTN BufSize; - EFI_IP6_MODE_DATA Ip6ModeData; - EFI_UDP6_PROTOCOL *Udp6; + EFI_STATUS Status; + EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2; + EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo; + UINTN BufSize; + EFI_IP6_MODE_DATA Ip6ModeData; + EFI_UDP6_PROTOCOL *Udp6; Status = EFI_SUCCESS; - Ip4CfgData = NULL; + IfInfo = NULL; BufSize = 0; // @@ -236,35 +235,52 @@ IkeOpenOutputUdp ( // Status = gBS->HandleProtocol ( UdpService->NicHandle, - &gEfiIp4ConfigProtocolGuid, - (VOID **) &Ip4Cfg + &gEfiIp4Config2ProtocolGuid, + (VOID **) &Ip4Cfg2 ); if (EFI_ERROR (Status)) { 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) { goto ON_EXIT; } - Ip4CfgData = AllocateZeroPool (BufSize); + IfInfo = AllocateZeroPool (BufSize); - if (Ip4CfgData == NULL) { + if (IfInfo == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } - Status = Ip4Cfg->GetData (Ip4Cfg, &BufSize, Ip4CfgData); + // + // Get the interface info. + // + Status = Ip4Cfg2->GetData ( + Ip4Cfg2, + Ip4Config2DataTypeInterfaceInfo, + &BufSize, + IfInfo + ); + if (EFI_ERROR (Status)) { goto ON_EXIT; } CopyMem ( &UdpService->DefaultAddress.v4, - &Ip4CfgData->StationAddress, + &IfInfo->StationAddress, sizeof (EFI_IPv4_ADDRESS) ); @@ -312,6 +328,31 @@ IkeOpenOutputUdp ( UdpIoFreeIo (UdpService->Output); goto ON_EXIT; } + + if (Ip6ModeData.AddressList != NULL) { + FreePool (Ip6ModeData.AddressList); + } + + if (Ip6ModeData.GroupTable != NULL) { + FreePool (Ip6ModeData.GroupTable); + } + + if (Ip6ModeData.RouteTable != NULL) { + FreePool (Ip6ModeData.RouteTable); + } + + if (Ip6ModeData.NeighborCache != NULL) { + FreePool (Ip6ModeData.NeighborCache); + } + + if (Ip6ModeData.PrefixTable != NULL) { + FreePool (Ip6ModeData.PrefixTable); + } + + if (Ip6ModeData.IcmpTypeList != NULL) { + FreePool (Ip6ModeData.IcmpTypeList); + } + // // Reconfigure udp6 io without remote address. // @@ -331,8 +372,8 @@ IkeOpenOutputUdp ( UdpService->IsConfigured = TRUE; ON_EXIT: - if (Ip4CfgData != NULL) { - FreePool (Ip4CfgData); + if (IfInfo != NULL) { + FreePool (IfInfo); } return Status; @@ -346,6 +387,7 @@ ON_EXIT: @param[in] Private Point to IPSEC_PRIVATE_DATA @param[in] Controller Handler for NIC card. + @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. @retval EFI_SUCCESS The Operation is successful. @retval EFI_OUT_OF_RESOURCE The required system resource can't be allocated. @@ -354,7 +396,8 @@ ON_EXIT: EFI_STATUS IkeOpenInputUdp4 ( IN IPSEC_PRIVATE_DATA *Private, - IN EFI_HANDLE Controller + IN EFI_HANDLE Controller, + IN EFI_HANDLE ImageHandle ) { IKE_UDP_SERVICE *Udp4Srv; @@ -378,7 +421,7 @@ IkeOpenInputUdp4 ( // Udp4Srv->Input = UdpIoCreateIo ( Controller, - Private->ImageHandle, + ImageHandle, IkeConfigUdp4, UDP_IO_UDP4_VERSION, NULL @@ -390,7 +433,7 @@ IkeOpenInputUdp4 ( } Udp4Srv->NicHandle = Controller; - Udp4Srv->ImageHandle = Private->ImageHandle; + Udp4Srv->ImageHandle = ImageHandle; Udp4Srv->ListHead = &(Private->Udp4List); Udp4Srv->IpVersion = UDP_IO_UDP4_VERSION; Udp4Srv->IsConfigured = FALSE; @@ -417,6 +460,7 @@ IkeOpenInputUdp4 ( @param[in] Private Point to IPSEC_PRIVATE_DATA @param[in] Controller Handler for NIC card. + @param[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance. @retval EFI_SUCCESS The Operation is successful. @retval EFI_OUT_OF_RESOURCE The required system resource can't be allocated. @@ -425,7 +469,8 @@ IkeOpenInputUdp4 ( EFI_STATUS IkeOpenInputUdp6 ( IN IPSEC_PRIVATE_DATA *Private, - IN EFI_HANDLE Controller + IN EFI_HANDLE Controller, + IN EFI_HANDLE ImageHandle ) { IKE_UDP_SERVICE *Udp6Srv; @@ -446,7 +491,7 @@ IkeOpenInputUdp6 ( // Udp6Srv->Input = UdpIoCreateIo ( Controller, - Private->ImageHandle, + ImageHandle, IkeConfigUdp6, UDP_IO_UDP6_VERSION, NULL @@ -458,7 +503,7 @@ IkeOpenInputUdp6 ( } Udp6Srv->NicHandle = Controller; - Udp6Srv->ImageHandle = Private->ImageHandle; + Udp6Srv->ImageHandle = ImageHandle; Udp6Srv->ListHead = &(Private->Udp6List); Udp6Srv->IpVersion = UDP_IO_UDP6_VERSION; Udp6Srv->IsConfigured = FALSE;