From nobody Sat Apr 27 15:39:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1508482265954924.0879638831303; Thu, 19 Oct 2017 23:51:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1B62520347165; Thu, 19 Oct 2017 23:47:25 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 779A321C8EFB5 for ; Thu, 19 Oct 2017 23:47:23 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Oct 2017 23:51:01 -0700 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.187]) by orsmga003.jf.intel.com with ESMTP; 19 Oct 2017 23:51:00 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,405,1503385200"; d="scan'208";a="1027245833" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Fri, 20 Oct 2017 14:50:59 +0800 Message-Id: <1508482259-21688-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Trigger Ip4Config2 to retrieve the default address. 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: , Cc: Ye Ting , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" According the UEFI spec 2.7 A: In section 28.3.2 for the IpConfigData.UseDefaultAddress, "While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG2_PROTOCOL to retrieve the default IPv4 address if it is not available yet." In section 28.5 for the Ip4Config2PolicyDhcp, "...All of these configuratio= ns are retrieved from DHCP server or other auto-configuration mechanism." This patch is to align with the above description. When the default IPv4 address is not available and IpConfigData.UseDefaultAddress is set to TRUE, Ip4Config2 protocol will be called to retrieve the default address by setti= ng the policy to Ip4Config2PolicyDhcp. Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Fu Siyuan --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 25 +++++++++++++++++++++= ---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg= /Universal/Network/Ip4Dxe/Ip4Impl.c index 3cdf8ec..fc5812e 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c @@ -594,13 +594,17 @@ Ip4ConfigProtocol ( IP4_INTERFACE *IpIf; EFI_STATUS Status; IP4_ADDR Ip; IP4_ADDR Netmask; EFI_ARP_PROTOCOL *Arp; + EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2; + EFI_IP4_CONFIG2_POLICY Policy; =20 IpSb =3D IpInstance->Service; =20 + Ip4Config2 =3D NULL; + // // User is changing packet filters. It must be stopped // before the station address can be changed. // if (IpInstance->State =3D=3D IP4_STATE_CONFIGED) { @@ -675,14 +679,27 @@ Ip4ConfigProtocol ( } else { // // Use the default address. Check the state. // if (IpSb->State =3D=3D IP4_SERVICE_UNSTARTED) { - Status =3D Ip4StartAutoConfig (&IpSb->Ip4Config2Instance); - - if (EFI_ERROR (Status)) { - goto ON_ERROR; + // + // Trigger the EFI_IP4_CONFIG2_PROTOCOL to retrieve the=20 + // default IPv4 address if it is not available yet. + // + Policy =3D IpSb->Ip4Config2Instance.Policy; + if (Policy !=3D Ip4Config2PolicyDhcp) { + Ip4Config2 =3D &IpSb->Ip4Config2Instance.Ip4Config2; + Policy =3D Ip4Config2PolicyDhcp; + Status=3D Ip4Config2->SetData ( + Ip4Config2, + Ip4Config2DataTypePolicy, + sizeof (EFI_IP4_CONFIG2_POLICY), + &Policy + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; + } } } =20 IpIf =3D IpSb->DefaultInterface; NET_GET_REF (IpSb->DefaultInterface); --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel