From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 85251220F3C5A for ; Fri, 1 Dec 2017 00:34:30 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2017 00:38:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,344,1508828400"; d="scan'208";a="182334453" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.162]) by fmsmga005.fm.intel.com with ESMTP; 01 Dec 2017 00:38:49 -0800 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Karunakar P , Wu Jiaxin Date: Fri, 1 Dec 2017 16:38:45 +0800 Message-Id: <1512117526-11308-2-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1512117526-11308-1-git-send-email-jiaxin.wu@intel.com> References: <1512117526-11308-1-git-send-email-jiaxin.wu@intel.com> Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 08:34:30 -0000 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Karunakar P Signed-off-by: Wu Jiaxin --- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index 1db4c66..8780414 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c @@ -1,9 +1,9 @@ /** @file This file implement the EFI_DHCP4_PROTOCOL interface. -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -778,10 +778,11 @@ EfiDhcp4Start ( IN EFI_EVENT CompletionEvent OPTIONAL ) { DHCP_PROTOCOL *Instance; DHCP_SERVICE *DhcpSb; + BOOLEAN MediaPresent; EFI_STATUS Status; EFI_TPL OldTpl; // // First validate the parameters @@ -807,10 +808,20 @@ EfiDhcp4Start ( if ((DhcpSb->DhcpState != Dhcp4Init) && (DhcpSb->DhcpState != Dhcp4InitReboot)) { Status = EFI_ALREADY_STARTED; goto ON_ERROR; } + // + // Check Media Satus. + // + MediaPresent = TRUE; + NetLibDetectMedia (DhcpSb->Controller, &MediaPresent); + if (!MediaPresent) { + Status = EFI_NO_MEDIA; + goto ON_ERROR; + } + DhcpSb->IoStatus = EFI_ALREADY_STARTED; if (EFI_ERROR (Status = DhcpInitRequest (DhcpSb))) { goto ON_ERROR; } -- 1.9.5.msysgit.1