]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
NetworkPkg: Add assert for buffer pointer from DHCP driver.
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcBoot.c
index 84031e40e05f65c24a3c03855dd443a8a1004f98..1f8895fdaa68480046a972169a78084004603eb0 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Boot functions implementation for UefiPxeBc Driver.\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -144,7 +145,7 @@ PxeBcSelectBootPrompt (
   Status = gBS->SetTimer (\r
                   TimeoutEvent,\r
                   TimerRelative,\r
-                  Timeout * TICKS_PER_SECOND\r
+                  MultU64x32 (Timeout, TICKS_PER_SECOND)\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     goto ON_EXIT;\r
@@ -619,10 +620,20 @@ PxeBcDhcp6BootInfo (
 \r
   ASSERT (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL);\r
 \r
+  //\r
+  // Set the station address to IP layer.\r
+  //\r
+  Status = PxeBcSetIp6Address (Private);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+\r
   //\r
   // Parse (m)tftp server ip address and bootfile name.\r
   //\r
   Status = PxeBcExtractBootFileUrl (\r
+             Private,\r
              &Private->BootFileName,\r
              &Private->ServerIp.v6,\r
              (CHAR8 *) (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->Data),\r
@@ -983,7 +994,7 @@ PxeBcInstallCallback (
   //\r
   PxeBc  = &Private->PxeBc;\r
   Status = gBS->HandleProtocol (\r
-                  Private->Controller,\r
+                  Private->Mode.UsingIpv6 ? Private->Ip6Nic->Controller : Private->Ip4Nic->Controller,\r
                   &gEfiPxeBaseCodeCallbackProtocolGuid,\r
                   (VOID **) &Private->PxeBcCallback\r
                   );\r
@@ -999,7 +1010,7 @@ PxeBcInstallCallback (
     // Install a default callback if user didn't offer one.\r
     //\r
     Status = gBS->InstallProtocolInterface (\r
-                    &Private->Controller,\r
+                    Private->Mode.UsingIpv6 ? &Private->Ip6Nic->Controller : &Private->Ip4Nic->Controller,\r
                     &gEfiPxeBaseCodeCallbackProtocolGuid,\r
                     EFI_NATIVE_INTERFACE,\r
                     &Private->LoadFileCallback\r
@@ -1043,7 +1054,7 @@ PxeBcUninstallCallback (
     PxeBc->SetParameters (PxeBc, NULL, NULL, NULL, NULL, &NewMakeCallback);\r
 \r
     gBS->UninstallProtocolInterface (\r
-          Private->Controller,\r
+          Private->Mode.UsingIpv6 ? Private->Ip6Nic->Controller : Private->Ip4Nic->Controller,\r
           &gEfiPxeBaseCodeCallbackProtocolGuid,\r
           &Private->LoadFileCallback\r
           );\r
@@ -1220,7 +1231,7 @@ ON_EXIT:
   PxeBcUninstallCallback(Private, NewMakeCallback);\r
 \r
   if (Status == EFI_SUCCESS) {\r
-    AsciiPrint ("\n  Succeed to download NBP file.\n");\r
+    AsciiPrint ("\n  NBP file downloaded successfully.\n");\r
     return EFI_SUCCESS;\r
   } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {\r
     AsciiPrint ("\n  PXE-E05: Buffer size is smaller than the requested file.\n");\r
@@ -1231,7 +1242,7 @@ ON_EXIT:
   } else if (Status == EFI_NO_MEDIA) {\r
     AsciiPrint ("\n  PXE-E12: Could not detect network connection.\n");\r
   } else if (Status == EFI_NO_RESPONSE) {\r
-    AsciiPrint ("\n  PXE-E16: No offer received.\n");\r
+    AsciiPrint ("\n  PXE-E16: No valid offer received.\n");\r
   } else if (Status == EFI_TIMEOUT) {\r
     AsciiPrint ("\n  PXE-E18: Server response timeout.\n");\r
   } else if (Status == EFI_ABORTED) {\r