]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Impl.c
index 1db4c667d7cce721048ba2f02fb1a395e2e43f98..87804145f4f6c4774e4d72a4a0862e239b9ec708 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This file implement the EFI_DHCP4_PROTOCOL interface.\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, 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
@@ -780,6 +780,7 @@ EfiDhcp4Start (
 {\r
   DHCP_PROTOCOL             *Instance;\r
   DHCP_SERVICE              *DhcpSb;\r
+  BOOLEAN                   MediaPresent;\r
   EFI_STATUS                Status;\r
   EFI_TPL                   OldTpl;\r
 \r
@@ -809,6 +810,16 @@ EfiDhcp4Start (
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // Check Media Satus.\r
+  //\r
+  MediaPresent = TRUE;\r
+  NetLibDetectMedia (DhcpSb->Controller, &MediaPresent);\r
+  if (!MediaPresent) {\r
+    Status = EFI_NO_MEDIA;\r
+    goto ON_ERROR;\r
+  }\r
+\r
   DhcpSb->IoStatus = EFI_ALREADY_STARTED;\r
 \r
   if (EFI_ERROR (Status = DhcpInitRequest (DhcpSb))) {\r