From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B59A021DFA8E1 for ; Wed, 29 Mar 2017 18:28:12 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 29 Mar 2017 18:28:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,244,1486454400"; d="scan'208";a="82525948" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 29 Mar 2017 18:28:12 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 29 Mar 2017 18:28:11 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 29 Mar 2017 18:28:11 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.212]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.82]) with mapi id 14.03.0248.002; Thu, 30 Mar 2017 09:28:09 +0800 From: "Zhang, Lubo" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" Thread-Topic: [Patch] NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6 Thread-Index: AQHSpGPlo7iPRJKajUqr80uQlp91i6GsoMlQ Date: Thu, 30 Mar 2017 01:28:08 +0000 Message-ID: <7619447B08B8F74DA4FF2A813B79803B39B13DEA@shsmsx102.ccr.corp.intel.com> References: <1490335201-11376-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1490335201-11376-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6 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: Thu, 30 Mar 2017 01:28:12 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhang Lubo -----Original Message----- From: Wu, Jiaxin=20 Sent: Friday, March 24, 2017 2:00 PM To: edk2-devel@lists.01.org Cc: Zhang, Lubo ; Ye, Ting ; Fu, S= iyuan ; Wu, Jiaxin Subject: [Patch] NetworkPkg/DnsDxe: Fix zero StationIp configuration failur= e of DNSv6 According UEFI Spec, set to zero StationIp means to let the underlying IPv6 driver choose a source address. But currently, DNSv6 always return EFI= _NO_MAPPING. The issue is caused by below bugs in DnsDxe: * Incorrect TPL(TPL_CALLBACK) usage during UDP configuration. * Failed to create the timer used to get IPv6 mapping * Doesn't check the Ip6Mode.IsStarted flag. Cc: Zhang Lubo Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/DnsDxe/DnsDriver.c | 24 +++++++++++------------- NetworkPkg/DnsDxe/DnsImpl.c | 8 +++++--- NetworkPkg/DnsDxe/DnsProtocol.c | 2 ++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c = index c000b5f..5dc9afe 100644 --- a/NetworkPkg/DnsDxe/DnsDriver.c +++ b/NetworkPkg/DnsDxe/DnsDriver.c @@ -1,9 +1,9 @@ /** @file The driver binding and service binding protocol for DnsDxe driver. =20 -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 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 @@ -277,22 +277,20 @@ DnsCreateService ( =20 // // Create the timer used to time out the procedure which is used to // get the default IP address. // - if (DnsSb->IpVersion =3D=3D IP_VERSION_4) { - Status =3D gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &DnsSb->TimerToGetMap - ); - if (EFI_ERROR (Status)) { - FreePool (DnsSb); - return Status; - } + Status =3D gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &DnsSb->TimerToGetMap + ); + if (EFI_ERROR (Status)) { + FreePool (DnsSb); + return Status; } =20 // // Create the timer to retransmit packets. // diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c inde= x 794df1d..ea3d27d 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1,9 +1,9 @@ /** @file DnsDxe support functions implementation. =20 -Copyright (c) 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 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 @@ -641,13 +641,15 @@ Dns6GetMapping ( =20 if (Ip6Mode.IcmpTypeList !=3D NULL) { FreePool (Ip6Mode.IcmpTypeList); } =20 - if (Ip6Mode.IsConfigured) { + if (!Ip6Mode.IsStarted || Ip6Mode.IsConfigured) { Udp->Configure (Udp, NULL); - return (BOOLEAN) (Udp->Configure (Udp, UdpCfgData) =3D=3D EFI_SUCC= ESS); + if (Udp->Configure (Udp, UdpCfgData) =3D=3D EFI_SUCCESS) { + return TRUE; + } } } } =20 return FALSE; diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtoco= l.c index 0e7ed34..bd189ae 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -1104,11 +1104,13 @@ Dns6Configure ( } =20 // // Config UDP // + gBS->RestoreTPL (OldTpl); Status =3D Dns6ConfigUdp (Instance, Instance->UdpIo); + OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); if (EFI_ERROR (Status)) { if (Instance->Dns6CfgData.DnsServerList !=3D NULL) { FreePool (Instance->Dns6CfgData.DnsServerList); Instance->Dns6CfgData.DnsServerList =3D NULL; } -- 1.9.5.msysgit.1