NetworkPkg/HttpBootDxe: Fix the incorrect error message output.

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>
This commit is contained in:
Jiaxin Wu
2018-03-01 12:59:57 +08:00
parent 951c6e63f8
commit f33d39949b
2 changed files with 21 additions and 17 deletions

View File

@ -474,6 +474,7 @@ HttpBootDhcp6ExtractUriInfo (
Status = HttpBootDns (Private, HostNameStr, &IpAddr); Status = HttpBootDns (Private, HostNameStr, &IpAddr);
FreePool (HostNameStr); FreePool (HostNameStr);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
AsciiPrint ("\n Error: Could not retrieve the host address from DNS server.\n");
goto Error; goto Error;
} }
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot. The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials are licensed and made available under This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution. the terms and conditions of the BSD License that accompanies this distribution.
@ -331,7 +331,7 @@ HttpBootLoadFile (
// //
Status = HttpBootDiscoverBootInfo (Private); Status = HttpBootDiscoverBootInfo (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
AsciiPrint ("\n Error: Could not discover the boot information for DHCP server.\n"); AsciiPrint ("\n Error: Could not retrieve NBP file size from HTTP server.\n");
goto ON_EXIT; goto ON_EXIT;
} }
} }
@ -400,22 +400,25 @@ HttpBootLoadFile (
ON_EXIT: ON_EXIT:
HttpBootUninstallCallback (Private); HttpBootUninstallCallback (Private);
if (Status == EFI_ACCESS_DENIED) { if (EFI_ERROR (Status)) {
AsciiPrint ("\n Error: Could not establish connection with HTTP server.\n"); if (Status == EFI_ACCESS_DENIED) {
} else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) { AsciiPrint ("\n Error: Could not establish connection with HTTP server.\n");
AsciiPrint ("\n Error: Buffer size is smaller than the requested file.\n"); } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
} else if (Status == EFI_OUT_OF_RESOURCES) { AsciiPrint ("\n Error: Buffer size is smaller than the requested file.\n");
AsciiPrint ("\n Error: Could not allocate I/O buffers.\n"); } else if (Status == EFI_OUT_OF_RESOURCES) {
} else if (Status == EFI_DEVICE_ERROR) { AsciiPrint ("\n Error: Could not allocate I/O buffers.\n");
AsciiPrint ("\n Error: Network device error.\n"); } else if (Status == EFI_DEVICE_ERROR) {
} else if (Status == EFI_TIMEOUT) { AsciiPrint ("\n Error: Network device error.\n");
AsciiPrint ("\n Error: Server response timeout.\n"); } else if (Status == EFI_TIMEOUT) {
} else if (Status == EFI_ABORTED) { AsciiPrint ("\n Error: Server response timeout.\n");
AsciiPrint ("\n Error: Remote boot cancelled.\n"); } else if (Status == EFI_ABORTED) {
} else if (Status != EFI_BUFFER_TOO_SMALL) { AsciiPrint ("\n Error: Remote boot cancelled.\n");
AsciiPrint ("\n Error: Unexpected network error.\n"); } else if (Status != EFI_BUFFER_TOO_SMALL) {
AsciiPrint ("\n Error: Unexpected network error.\n");
}
} }
return Status; return Status;
} }