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.100; helo=mga07.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 C6EC321CEB159 for ; Wed, 25 Oct 2017 02:03:47 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 25 Oct 2017 02:07:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,431,1503385200"; d="scan'208";a="167320715" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 25 Oct 2017 02:07:32 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Oct 2017 02:07:31 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Oct 2017 02:07:31 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Wed, 25 Oct 2017 17:07:29 +0800 From: "Fu, Siyuan" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" Thread-Topic: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Trigger Ip4Config2 to retrieve the default address. Thread-Index: AQHTSW/Smnzs1mgxnUKT9APx8bVAsaL0Tm4g Date: Wed, 25 Oct 2017 09:07:29 +0000 Message-ID: References: <1508482259-21688-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1508482259-21688-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDhkYzI4YjItMjYzNy00MWQ2LTliM2MtZjY5Nzk0ODI5OGQ5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJnMCtTWStkTExVYkZwVjlvTjI5d0NzSHhENjJcLzJRNXNcL0ZHdllkYXBOV1BwUHpKdXNjcVdpMCtraHI5VkladnYifQ== dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Wed, 25 Oct 2017 09:03:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Friday, October 20, 2017 2:51 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Fu, Siyuan ; Wu, > Jiaxin > Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Trigger Ip4Config2 to > retrieve the default address. >=20 > 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 > configurations > are retrieved from DHCP server or other auto-configuration mechanism." >=20 > This patch is to align with the above description. When the default IPv4 > address is not available and IpConfigData.UseDefaultAddress is set to TRU= E, > Ip4Config2 protocol will be called to retrieve the default address by > setting > the policy to Ip4Config2PolicyDhcp. >=20 > Cc: Ye Ting > Cc: Fu Siyuan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wu Jiaxin > --- > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 25 > +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) >=20 > 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 > + // 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); > -- > 1.9.5.msysgit.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel