NetworkPkg/DnsDxe: Fix zero StationIp configuration failure 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 <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
This commit is contained in:
Jiaxin Wu 2017-03-23 11:35:14 +08:00
parent 6e7ec25aaa
commit eed4585ba5
3 changed files with 18 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
The driver binding and service binding protocol for DnsDxe driver. The driver binding and service binding protocol for DnsDxe driver.
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -279,7 +279,6 @@ DnsCreateService (
// Create the timer used to time out the procedure which is used to // Create the timer used to time out the procedure which is used to
// get the default IP address. // get the default IP address.
// //
if (DnsSb->IpVersion == IP_VERSION_4) {
Status = gBS->CreateEvent ( Status = gBS->CreateEvent (
EVT_TIMER, EVT_TIMER,
TPL_CALLBACK, TPL_CALLBACK,
@ -291,7 +290,6 @@ DnsCreateService (
FreePool (DnsSb); FreePool (DnsSb);
return Status; return Status;
} }
}
// //
// Create the timer to retransmit packets. // Create the timer to retransmit packets.

View File

@ -1,7 +1,7 @@
/** @file /** @file
DnsDxe support functions implementation. DnsDxe support functions implementation.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -643,9 +643,11 @@ Dns6GetMapping (
FreePool (Ip6Mode.IcmpTypeList); FreePool (Ip6Mode.IcmpTypeList);
} }
if (Ip6Mode.IsConfigured) { if (!Ip6Mode.IsStarted || Ip6Mode.IsConfigured) {
Udp->Configure (Udp, NULL); Udp->Configure (Udp, NULL);
return (BOOLEAN) (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS); if (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS) {
return TRUE;
}
} }
} }
} }

View File

@ -1106,7 +1106,9 @@ Dns6Configure (
// //
// Config UDP // Config UDP
// //
gBS->RestoreTPL (OldTpl);
Status = Dns6ConfigUdp (Instance, Instance->UdpIo); Status = Dns6ConfigUdp (Instance, Instance->UdpIo);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Instance->Dns6CfgData.DnsServerList != NULL) { if (Instance->Dns6CfgData.DnsServerList != NULL) {
FreePool (Instance->Dns6CfgData.DnsServerList); FreePool (Instance->Dns6CfgData.DnsServerList);