From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 4AE1B8044A for ; Thu, 23 Mar 2017 23:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490335204; x=1521871204; h=from:to:cc:subject:date:message-id; bh=27RFoONXlNoPrbWqL/WYywQCjJhSA4T+e1sE8BsnyFM=; b=PzAadGODSjOvXHzs4kwY35rcn12OfbknvK4o0NUqSBYBD7VFAqHKGCeF ut3qBk72fIn/NHF6Kt597q75dOGojw==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2017 23:00:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,213,1486454400"; d="scan'208";a="70220233" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.108]) by orsmga004.jf.intel.com with ESMTP; 23 Mar 2017 23:00:02 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Zhang Lubo , Ye Ting , Fu Siyuan , Wu Jiaxin Date: Fri, 24 Mar 2017 14:00:01 +0800 Message-Id: <1490335201-11376-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [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: Fri, 24 Mar 2017 06:00:04 -0000 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. -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 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 @@ -277,22 +277,20 @@ DnsCreateService ( // // Create the timer used to time out the procedure which is used to // get the default IP address. // - if (DnsSb->IpVersion == IP_VERSION_4) { - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &DnsSb->TimerToGetMap - ); - if (EFI_ERROR (Status)) { - FreePool (DnsSb); - return Status; - } + Status = gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &DnsSb->TimerToGetMap + ); + if (EFI_ERROR (Status)) { + FreePool (DnsSb); + return Status; } // // Create the timer to retransmit packets. // diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index 794df1d..ea3d27d 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1,9 +1,9 @@ /** @file DnsDxe support functions implementation. -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 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 @@ -641,13 +641,15 @@ Dns6GetMapping ( if (Ip6Mode.IcmpTypeList != NULL) { FreePool (Ip6Mode.IcmpTypeList); } - if (Ip6Mode.IsConfigured) { + if (!Ip6Mode.IsStarted || Ip6Mode.IsConfigured) { Udp->Configure (Udp, NULL); - return (BOOLEAN) (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS); + if (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS) { + return TRUE; + } } } } return FALSE; diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index 0e7ed34..bd189ae 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -1104,11 +1104,13 @@ Dns6Configure ( } // // Config UDP // + gBS->RestoreTPL (OldTpl); Status = Dns6ConfigUdp (Instance, Instance->UdpIo); + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); if (EFI_ERROR (Status)) { if (Instance->Dns6CfgData.DnsServerList != NULL) { FreePool (Instance->Dns6CfgData.DnsServerList); Instance->Dns6CfgData.DnsServerList = NULL; } -- 1.9.5.msysgit.1