When http boot download the second time without return to the boot manager, the DHCP process will start twice wiht the same Boot file uri and print the information twice which we not expected. This is caused by wrong logic of handling the device path of the boot file when loading it.
Cc: Fu Siyuan <[email protected]> Cc: Ye Ting <[email protected]> Cc: Wu Jiaxin <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <[email protected]> --- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index 3adb08d..487a01e 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -385,10 +385,11 @@ HttpBootDxeLoadFile ( { HTTP_BOOT_PRIVATE_DATA *Private; HTTP_BOOT_VIRTUAL_NIC *VirtualNic; BOOLEAN MediaPresent; BOOLEAN UsingIpv6; + BOOLEAN IsFilePathUriEqual; EFI_STATUS Status; if (This == NULL || BufferSize == NULL || FilePath == NULL) { return EFI_INVALID_PARAMETER; } @@ -428,12 +429,18 @@ HttpBootDxeLoadFile ( // // Restart the HTTP boot driver in 2 cases: // 1. Http boot Driver has already been started but not on the required IP version. // 2. The required boot FilePath is different with the one we produced in the device path // protocol. - // - if ((UsingIpv6 != Private->UsingIpv6) || !IsDevicePathEnd(FilePath)) { + IsFilePathUriEqual = FALSE; + if (!IsDevicePathEnd (FilePath)) { + if ((Private->FilePathUri != NULL) && (AsciiStrCmp (Private->BootFileUri, Private->FilePathUri) == 0)) { + IsFilePathUriEqual =TRUE; + } + } + + if ((UsingIpv6 != Private->UsingIpv6) || ((Private->FilePathUri != NULL) && !IsFilePathUriEqual)) { Status = HttpBootStop (Private); if (!EFI_ERROR (Status)) { Status = HttpBootStart (Private, UsingIpv6, FilePath); } } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

