]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/HttpBootDxe: Fix the incorrect error message output.
authorJiaxin Wu <jiaxin.wu@intel.com>
Thu, 1 Mar 2018 04:59:57 +0000 (12:59 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Fri, 2 Mar 2018 03:15:14 +0000 (11:15 +0800)
For IPv6 case, if one invalid URL returned from DHCP server, HttpBootDxe
driver could not retrieve the URL host address from DNS server. In such a
case, the error message should be printed as:
  Error: Could not retrieve the host address from DNS server.
Instead of:
  Error: Could not discover the boot information for DHCP server.
Then, we can still output as following:
  Error: Could not retrieve NBP file size from HTTP server.

Besides, currently implementation in HttpBootLoadFile will always output
error message even the HTTP process is correct.

This patch is to fix above issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
NetworkPkg/HttpBootDxe/HttpBootClient.c
NetworkPkg/HttpBootDxe/HttpBootImpl.c

index b93e63bb2f0097ea5d518dd41b30f3435b553466..1d1e47008da23ee1fb8c9ba2037c1ed3b407c9f0 100644 (file)
@@ -474,6 +474,7 @@ HttpBootDhcp6ExtractUriInfo (
     Status = HttpBootDns (Private, HostNameStr, &IpAddr);\r
     FreePool (HostNameStr);\r
     if (EFI_ERROR (Status)) {\r
+      AsciiPrint ("\n  Error: Could not retrieve the host address from DNS server.\n");\r
       goto Error;\r
     }  \r
   } \r
index 16c1207bf8b1ab52c50f261c60e0963ac742fadb..a0fd934ec4c7bf6794a5a15e2d90e2d5c76d85fd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.\r
 \r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -331,7 +331,7 @@ HttpBootLoadFile (
     //\r
     Status = HttpBootDiscoverBootInfo (Private);\r
     if (EFI_ERROR (Status)) {\r
-      AsciiPrint ("\n  Error: Could not discover the boot information for DHCP server.\n");\r
+      AsciiPrint ("\n  Error: Could not retrieve NBP file size from HTTP server.\n");\r
       goto ON_EXIT;\r
     }\r
   }\r
@@ -400,22 +400,25 @@ HttpBootLoadFile (
   \r
 ON_EXIT:\r
   HttpBootUninstallCallback (Private);\r
-\r
-  if (Status == EFI_ACCESS_DENIED) {\r
-    AsciiPrint ("\n  Error: Could not establish connection with HTTP server.\n");\r
-  } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {\r
-    AsciiPrint ("\n  Error: Buffer size is smaller than the requested file.\n");\r
-  } else if (Status == EFI_OUT_OF_RESOURCES) {\r
-    AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");\r
-  } else if (Status == EFI_DEVICE_ERROR) {\r
-    AsciiPrint ("\n  Error: Network device error.\n");\r
-  } else if (Status == EFI_TIMEOUT) {\r
-    AsciiPrint ("\n  Error: Server response timeout.\n");\r
-  } else if (Status == EFI_ABORTED) {\r
-    AsciiPrint ("\n  Error: Remote boot cancelled.\n");\r
-  } else if (Status != EFI_BUFFER_TOO_SMALL) {\r
-    AsciiPrint ("\n  Error: Unexpected network error.\n");\r
+  \r
+  if (EFI_ERROR (Status)) {\r
+    if (Status == EFI_ACCESS_DENIED) {\r
+      AsciiPrint ("\n  Error: Could not establish connection with HTTP server.\n");\r
+    } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {\r
+      AsciiPrint ("\n  Error: Buffer size is smaller than the requested file.\n");\r
+    } else if (Status == EFI_OUT_OF_RESOURCES) {\r
+      AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");\r
+    } else if (Status == EFI_DEVICE_ERROR) {\r
+      AsciiPrint ("\n  Error: Network device error.\n");\r
+    } else if (Status == EFI_TIMEOUT) {\r
+      AsciiPrint ("\n  Error: Server response timeout.\n");\r
+    } else if (Status == EFI_ABORTED) {\r
+      AsciiPrint ("\n  Error: Remote boot cancelled.\n");\r
+    } else if (Status != EFI_BUFFER_TOO_SMALL) {\r
+      AsciiPrint ("\n  Error: Unexpected network error.\n");\r
+    }\r
   }\r
+  \r
   return Status;\r
 }\r
 \r