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 E20C1220D4C1E 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:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,344,1508828400"; d="scan'208";a="182334458" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.162]) by fmsmga005.fm.intel.com with ESMTP; 01 Dec 2017 00:38:55 -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:46 +0800 Message-Id: <1512117526-11308-3-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 2/2] NetworkPkg/Dhcp6Dxe: 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:31 -0000 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Karunakar P Signed-off-by: Wu Jiaxin --- NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c index d8c0ad0..1107865 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c @@ -1,9 +1,9 @@ /** @file This EFI_DHCP6_PROTOCOL interface implementation. - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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. @@ -74,10 +74,11 @@ EfiDhcp6Start ( { EFI_STATUS Status; EFI_TPL OldTpl; DHCP6_INSTANCE *Instance; DHCP6_SERVICE *Service; + BOOLEAN MediaPresent; if (This == NULL) { return EFI_INVALID_PARAMETER; } @@ -99,10 +100,21 @@ EfiDhcp6Start ( if (Instance->IaCb.Ia->State != Dhcp6Init) { return EFI_ALREADY_STARTED; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + + // + // Check Media Satus. + // + MediaPresent = TRUE; + NetLibDetectMedia (Service->Controller, &MediaPresent); + if (!MediaPresent) { + Status = EFI_NO_MEDIA; + goto ON_ERROR; + } + Instance->UdpSts = EFI_ALREADY_STARTED; // // Send the solicit message to start S.A.R.R process. // -- 1.9.5.msysgit.1