]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootDhcp6.c
NetworkPkg: Use UefiBootManagerLib API to create load option.
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootDhcp6.c
index e5cf894714e1a75dd501e9c769748f297b91546b..0157095edf821c4b89cd94a1edc205d18ebb5651 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Functions implementation related with DHCPv6 for HTTP boot driver.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -251,8 +251,8 @@ HttpBootParseDhcp6Packet (
   Option = Options[HTTP_BOOT_DHCP6_IDX_VENDOR_CLASS];\r
 \r
   if (Option != NULL &&\r
-      NTOHS(Option->OpLen) >= 10 &&\r
-      CompareMem (Option->Data, DEFAULT_CLASS_ID_DATA, 10) == 0) {\r
+      NTOHS(Option->OpLen) >= 16 &&\r
+      CompareMem ((Option->Data + 6), DEFAULT_CLASS_ID_DATA, 10) == 0) {\r
       IsHttpOffer = TRUE;\r
   }\r
 \r
@@ -298,7 +298,11 @@ HttpBootParseDhcp6Packet (
   //\r
   if (IsHttpOffer) {\r
     if (IpExpressedUri) {\r
-      OfferType = IsProxyOffer ? HttpOfferTypeProxyIpUri : HttpOfferTypeDhcpIpUri;\r
+      if (IsProxyOffer) {\r
+        OfferType = HttpOfferTypeProxyIpUri;\r
+      } else {\r
+        OfferType = IsDnsOffer ? HttpOfferTypeDhcpIpUriDns : HttpOfferTypeDhcpIpUri;\r
+      }\r
     } else {\r
       if (!IsProxyOffer) {\r
         OfferType = IsDnsOffer ? HttpOfferTypeDhcpNameUriDns : HttpOfferTypeDhcpNameUri;\r
@@ -974,8 +978,13 @@ ON_EXIT:
     Dhcp6->Configure (Dhcp6, NULL);\r
   } else {\r
     ZeroMem (&Config, sizeof (EFI_DHCP6_CONFIG_DATA));\r
-    ZeroMem (&Mode, sizeof (EFI_DHCP6_MODE_DATA));\r
     Dhcp6->Configure (Dhcp6, &Config);\r
+    if (Mode.ClientId != NULL) {\r
+      FreePool (Mode.ClientId);\r
+    }\r
+    if (Mode.Ia != NULL) {\r
+      FreePool (Mode.Ia);\r
+    }\r
   }\r
 \r
   return Status; \r