]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.
authorJiaxin Wu <jiaxin.wu@intel.com>
Wed, 29 Nov 2017 06:34:26 +0000 (14:34 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 13 Dec 2017 08:25:44 +0000 (16:25 +0800)
This patch is to resolve the issue reported @
https://bugzilla.tianocore.org/show_bug.cgi?id=804.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
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