]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Fix potential bug if the iSCSI use dns protocol.
authorZhang, Lubo <lubo.zhang@intel.com>
Thu, 9 Mar 2017 08:17:56 +0000 (16:17 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 15 Mar 2017 07:02:02 +0000 (15:02 +0800)
Since we use the Attempt and index as the attempt variable name instead of
the MAC address plus index, we need to update this to check the whether
the Controller handle is configured to use DNS protocol

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
NetworkPkg/IScsiDxe/IScsiMisc.c

index 7b4044fe5ade00d6443c7e68161cb1192e936393..2c93590deb12934eadb7ca25c07f795c4af6e28d 100644 (file)
@@ -1778,7 +1778,7 @@ IScsiDhcpIsConfigured (
 }\r
 \r
 /**\r
-  Check wheather the Controller handle is configured to use DNS protocol.\r
+  Check whether the Controller handle is configured to use DNS protocol.\r
 \r
   @param[in]  Controller           The handle of the controller.\r
   \r
@@ -1799,6 +1799,7 @@ IScsiDnsIsConfigured (
   EFI_MAC_ADDRESS             MacAddr;\r
   UINTN                       HwAddressSize;\r
   UINT16                      VlanId;\r
+  CHAR16                      AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];\r
   CHAR16                      MacString[ISCSI_MAX_MAC_STRING_LEN];\r
   CHAR16                      AttemptName[ISCSI_NAME_IFR_MAX_SIZE];\r
   \r
@@ -1828,10 +1829,10 @@ IScsiDnsIsConfigured (
     UnicodeSPrint (\r
       AttemptName,\r
       (UINTN) 128,\r
-      L"%s%d",\r
-      MacString,\r
+      L"Attempt %d",\r
       (UINTN) AttemptConfigOrder[Index]\r
       );\r
+\r
     Status = GetVariable2 (\r
                AttemptName,\r
                &gEfiIScsiInitiatorNameProtocolGuid,\r
@@ -1844,7 +1845,9 @@ IScsiDnsIsConfigured (
     \r
     ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);\r
 \r
-    if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {\r
+    AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));\r
+\r
+    if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED || StrCmp (MacString, AttemptMacString)) {\r
       FreePool (AttemptTmp);\r
       continue;\r
     }\r