HttpBootDxe need to stop and release the DHCP4 child when it's
not used so the NBP could create new DHCP4 child and use it.

Cc: Ye Ting <ting...@intel.com>
Cc: Zhang Lubo <lubo.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 711cc3c..920761e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -242,10 +242,16 @@ HttpBootStop (
   Private->BootFileSize = 0;
   Private->SelectIndex = 0;
   Private->SelectProxyType = HttpOfferTypeMax;
 
   if (!Private->UsingIpv6) {
+    //
+    // Stop and release the DHCP4 child.
+    //
+    Private->Dhcp4->Stop (Private->Dhcp4);
+    Private->Dhcp4->Configure (Private->Dhcp4, NULL);
+
     for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) {
       if (Private->OfferBuffer[Index].Dhcp4.UriParser) {
         HttpUrlFreeParser (Private->OfferBuffer[Index].Dhcp4.UriParser);
       }
     }
@@ -336,10 +342,16 @@ HttpBootDxeLoadFile (
     Status = HttpBootLoadFile (Private, BufferSize, Buffer);
   }
 
   if (Status != EFI_SUCCESS && Status != EFI_BUFFER_TOO_SMALL) {
     HttpBootStop (Private);
+  } else {
+    //
+    // Stop and release the DHCP4 child.
+    //
+    Private->Dhcp4->Stop (Private->Dhcp4);
+    Private->Dhcp4->Configure (Private->Dhcp4, NULL);
   }
 
   return Status;
 }
 
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to