]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c
MdeModulePkg/Ip4Dxe: Add Ip/Netmask pair check for Ip4Config2
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcDriver.c
index 03bde34116d68b245c0d02badf99e0b862d6f779..76c140d8e3ff39e4b1d9ecdc6601fc11cc5e5028 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The driver binding for UEFI PXEBC protocol.\r
 \r
-Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -254,15 +254,15 @@ PxeBcDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
-
-  //
+\r
+  //\r
   // Get max packet size from Ip4 to calculate block size for Tftp later.\r
-  //
-  Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL);
-  if (EFI_ERROR (Status)) {
-    goto ON_ERROR;
-  }
-
+  //\r
+  Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL);\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
   Private->Ip4MaxPacketSize = Ip4ModeData.MaxPacketSize;\r
 \r
   Status = NetLibCreateServiceChild (\r
@@ -341,7 +341,7 @@ PxeBcDriverBindingStart (
     goto ON_ERROR;\r
   }\r
   ZeroMem (&Private->Udp4CfgData, sizeof (EFI_UDP4_CONFIG_DATA));\r
-  Private->Udp4CfgData.AcceptBroadcast    = TRUE;\r
+  Private->Udp4CfgData.AcceptBroadcast    = FALSE;\r
   Private->Udp4CfgData.AcceptPromiscuous  = FALSE;\r
   Private->Udp4CfgData.AcceptAnyPort      = TRUE;\r
   Private->Udp4CfgData.AllowDuplicatePort = TRUE;\r
@@ -375,6 +375,17 @@ PxeBcDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
+  //\r
+  // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.\r
+  //\r
+  Status = gBS->HandleProtocol (\r
+                  ControllerHandle,\r
+                  &gEfiIp4Config2ProtocolGuid,\r
+                  (VOID **) &Private->Ip4Config2\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
 \r
   return EFI_SUCCESS;\r
 \r
@@ -526,7 +537,7 @@ PxeBcDriverBindingStop (
           NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);\r
 \r
           if (NicHandle == NULL) {\r
-            return EFI_DEVICE_ERROR;\r
+            return EFI_SUCCESS;\r
           }\r
         }\r
       }\r