From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=ting.ye@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 03406220EE108 for ; Tue, 12 Dec 2017 19:28:20 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2017 19:32:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,396,1508828400"; d="scan'208";a="15531385" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 12 Dec 2017 19:32:59 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Dec 2017 19:32:58 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Dec 2017 19:32:58 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Wed, 13 Dec 2017 11:32:56 +0800 From: "Ye, Ting" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , Karunakar P Thread-Topic: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process. Thread-Index: AQHTan/dwm2TUsWlqUGQsGbkg8LtqqNAr+GA Date: Wed, 13 Dec 2017 03:32:56 +0000 Message-ID: References: <1512117526-11308-1-git-send-email-jiaxin.wu@intel.com> <1512117526-11308-2-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1512117526-11308-2-git-send-email-jiaxin.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Wed, 13 Dec 2017 03:28:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jiaxin, I think the patch need be revised since it does not check the returned stat= us of NetLibDetectMedia. If NetLibDetectMedia failed to detect the media s= tatus due to some error conditions, MediaPresent is still TRUE and DHCP wil= l be trigged later even no media is available. Thanks, Ting -----Original Message----- From: Wu, Jiaxin=20 Sent: Friday, December 1, 2017 4:39 PM To: edk2-devel@lists.01.org Cc: Ye, Ting ; Fu, Siyuan ; Karunak= ar P ; Wu, Jiaxin Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before start= ing DHCP process. 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/MdeModul= ePkg/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. =20 -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 availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at http://opens= ource.org/licenses/bsd-license.php =20 @@ -778,10 +778,11 @@ EfiDhcp4Start ( IN EFI_EVENT CompletionEvent OPTIONAL ) { DHCP_PROTOCOL *Instance; DHCP_SERVICE *DhcpSb; + BOOLEAN MediaPresent; EFI_STATUS Status; EFI_TPL OldTpl; =20 // // First validate the parameters @@ -807,10 +808,20 @@ EfiDhcp4Start ( if ((DhcpSb->DhcpState !=3D Dhcp4Init) && (DhcpSb->DhcpState !=3D Dhcp4I= nitReboot)) { Status =3D EFI_ALREADY_STARTED; goto ON_ERROR; } =20 + // + // Check Media Satus. + // + MediaPresent =3D TRUE; + NetLibDetectMedia (DhcpSb->Controller, &MediaPresent); if=20 + (!MediaPresent) { + Status =3D EFI_NO_MEDIA; + goto ON_ERROR; + } + DhcpSb->IoStatus =3D EFI_ALREADY_STARTED; =20 if (EFI_ERROR (Status =3D DhcpInitRequest (DhcpSb))) { goto ON_ERROR; } -- 1.9.5.msysgit.1