]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/IkeService.c
NetworkPkg: Remove IpSecDxe and Ip4Config Protocol dependency.
[mirror_edk2.git] / NetworkPkg / IpSecDxe / IkeService.c
index 8e2c794dc3da9be2aea5677d594c681935b96837..6594963f5dfba2c731c29954bce3c9234ea4c16a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide IPsec Key Exchange (IKE) service general interfaces.\r
 \r
-  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -212,15 +212,15 @@ IkeOpenOutputUdp (
   IN EFI_IP_ADDRESS            *RemoteIp\r
   )\r
 {\r
-  EFI_STATUS              Status;\r
-  EFI_IP4_CONFIG_PROTOCOL *Ip4Cfg;\r
-  EFI_IP4_IPCONFIG_DATA   *Ip4CfgData;\r
-  UINTN                   BufSize;\r
-  EFI_IP6_MODE_DATA       Ip6ModeData;\r
-  EFI_UDP6_PROTOCOL       *Udp6;\r
+  EFI_STATUS                       Status;\r
+  EFI_IP4_CONFIG2_PROTOCOL         *Ip4Cfg2;\r
+  EFI_IP4_CONFIG2_INTERFACE_INFO   *IfInfo;\r
+  UINTN                            BufSize;\r
+  EFI_IP6_MODE_DATA                Ip6ModeData;\r
+  EFI_UDP6_PROTOCOL                *Udp6;\r
 \r
   Status      = EFI_SUCCESS;\r
-  Ip4CfgData  = NULL;\r
+  IfInfo      = NULL;\r
   BufSize     = 0;\r
 \r
   //\r
@@ -236,35 +236,52 @@ IkeOpenOutputUdp (
     //\r
     Status = gBS->HandleProtocol (\r
                     UdpService->NicHandle,\r
-                    &gEfiIp4ConfigProtocolGuid,\r
-                    (VOID **) &Ip4Cfg\r
+                    &gEfiIp4Config2ProtocolGuid,\r
+                    (VOID **) &Ip4Cfg2\r
                     );\r
 \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
 \r
-    Status = Ip4Cfg->GetData (Ip4Cfg, &BufSize, NULL);\r
+    //\r
+    // Get the interface information size.\r
+    //\r
+    Status = Ip4Cfg2->GetData (\r
+                       Ip4Cfg2,\r
+                       Ip4Config2DataTypeInterfaceInfo,\r
+                       &BufSize,\r
+                       NULL\r
+                       );\r
 \r
     if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {\r
       goto ON_EXIT;\r
     }\r
 \r
-    Ip4CfgData = AllocateZeroPool (BufSize);\r
+    IfInfo = AllocateZeroPool (BufSize);\r
 \r
-    if (Ip4CfgData == NULL) {\r
+    if (IfInfo == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       goto ON_EXIT;\r
     }\r
 \r
-    Status = Ip4Cfg->GetData (Ip4Cfg, &BufSize, Ip4CfgData);\r
+    //\r
+    // Get the interface info.\r
+    //\r
+    Status = Ip4Cfg2->GetData (\r
+                       Ip4Cfg2,\r
+                       Ip4Config2DataTypeInterfaceInfo,\r
+                       &BufSize,\r
+                       IfInfo\r
+                       );\r
+    \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
 \r
     CopyMem (\r
       &UdpService->DefaultAddress.v4,\r
-      &Ip4CfgData->StationAddress,\r
+      &IfInfo->StationAddress,\r
       sizeof (EFI_IPv4_ADDRESS)\r
       );\r
 \r
@@ -331,8 +348,8 @@ IkeOpenOutputUdp (
   UdpService->IsConfigured = TRUE;\r
 \r
 ON_EXIT:\r
-  if (Ip4CfgData != NULL) {\r
-    FreePool (Ip4CfgData);\r
+  if (IfInfo != NULL) {\r
+    FreePool (IfInfo);\r
   }\r
 \r
   return Status;\r