]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6
authorJiaxin Wu <jiaxin.wu@intel.com>
Thu, 23 Mar 2017 03:35:14 +0000 (11:35 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Thu, 30 Mar 2017 03:31:47 +0000 (11:31 +0800)
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>
NetworkPkg/DnsDxe/DnsDriver.c
NetworkPkg/DnsDxe/DnsImpl.c
NetworkPkg/DnsDxe/DnsProtocol.c

index c000b5f5a5ede9e47dd3e87adced8772fd10be0c..5dc9afe4489175eb7947441c604a9a47518c8377 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 The driver binding and service binding protocol for DnsDxe driver.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -279,18 +279,16 @@ DnsCreateService (
   // Create the timer used to time out the procedure which is used to\r
   // get the default IP address.\r
   //\r
-  if (DnsSb->IpVersion == IP_VERSION_4) {\r
-    Status = gBS->CreateEvent (\r
-                    EVT_TIMER,\r
-                    TPL_CALLBACK,\r
-                    NULL,\r
-                    NULL,\r
-                    &DnsSb->TimerToGetMap\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      FreePool (DnsSb);\r
-      return Status;\r
-    }\r
+  Status = gBS->CreateEvent (\r
+                  EVT_TIMER,\r
+                  TPL_CALLBACK,\r
+                  NULL,\r
+                  NULL,\r
+                  &DnsSb->TimerToGetMap\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (DnsSb);\r
+    return Status;\r
   }\r
   \r
   //\r
index 794df1d728f255c4ddb6c21741381aa0e73f4e5e..ea3d27da52858180da391d8a60585b262463c66d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 DnsDxe support functions implementation.\r
   \r
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -643,9 +643,11 @@ Dns6GetMapping (
         FreePool (Ip6Mode.IcmpTypeList);\r
       }\r
 \r
-      if (Ip6Mode.IsConfigured) {\r
+      if (!Ip6Mode.IsStarted || Ip6Mode.IsConfigured) {\r
         Udp->Configure (Udp, NULL);\r
-        return (BOOLEAN) (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS);\r
+        if (Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS) {\r
+          return TRUE;\r
+        }\r
       }\r
     }\r
   }\r
index 0e7ed34b4e0c73e9d9691f90aa200b2053d36f33..bd189aebbe1c2b02f21417281bebcf6ee8c3c3ca 100644 (file)
@@ -1106,7 +1106,9 @@ Dns6Configure (
     //\r
     // Config UDP\r
     //\r
+    gBS->RestoreTPL (OldTpl);\r
     Status = Dns6ConfigUdp (Instance, Instance->UdpIo);\r
+    OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
     if (EFI_ERROR (Status)) {\r
       if (Instance->Dns6CfgData.DnsServerList != NULL) {\r
         FreePool (Instance->Dns6CfgData.DnsServerList);\r