public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol.
@ 2017-03-09  8:17 Zhang Lubo
  2017-03-13  7:44 ` Wu, Jiaxin
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Lubo @ 2017-03-09  8:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Wu Jiaxin

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>
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 7b4044f..2c93590 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1776,11 +1776,11 @@ IScsiDhcpIsConfigured (
   FreePool (AttemptConfigOrder);
   return FALSE;
 }
 
 /**
-  Check wheather the Controller handle is configured to use DNS protocol.
+  Check whether the Controller handle is configured to use DNS protocol.
 
   @param[in]  Controller           The handle of the controller.
   
   @retval TRUE                     The handle of the controller need the Dns protocol.
   @retval FALSE                    The handle of the controller does not need the Dns protocol.
@@ -1797,10 +1797,11 @@ IScsiDnsIsConfigured (
   UINTN                       Index;
   EFI_STATUS                  Status;
   EFI_MAC_ADDRESS             MacAddr;
   UINTN                       HwAddressSize;
   UINT16                      VlanId;
+  CHAR16                      AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];
   CHAR16                      MacString[ISCSI_MAX_MAC_STRING_LEN];
   CHAR16                      AttemptName[ISCSI_NAME_IFR_MAX_SIZE];
   
   AttemptConfigOrder = IScsiGetVariableAndSize (
                          L"AttemptOrder",
@@ -1826,14 +1827,14 @@ IScsiDnsIsConfigured (
   
   for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
     UnicodeSPrint (
       AttemptName,
       (UINTN) 128,
-      L"%s%d",
-      MacString,
+      L"Attempt %d",
       (UINTN) AttemptConfigOrder[Index]
       );
+
     Status = GetVariable2 (
                AttemptName,
                &gEfiIScsiInitiatorNameProtocolGuid,
                (VOID**)&AttemptTmp,
                NULL
@@ -1842,11 +1843,13 @@ IScsiDnsIsConfigured (
       continue;
     }
     
     ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);
 
-    if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {
+    AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
+
+    if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED || StrCmp (MacString, AttemptMacString)) {
       FreePool (AttemptTmp);
       continue;
     }
     
     if (AttemptTmp->SessionConfigData.DnsMode) {
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-13  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-09  8:17 [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol Zhang Lubo
2017-03-13  7:44 ` Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox