public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Zhang Lubo <lubo.zhang@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
	Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol.
Date: Thu,  9 Mar 2017 16:17:56 +0800	[thread overview]
Message-ID: <1489047476-14804-1-git-send-email-lubo.zhang@intel.com> (raw)

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



             reply	other threads:[~2017-03-09  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09  8:17 Zhang Lubo [this message]
2017-03-13  7:44 ` [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol Wu, Jiaxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489047476-14804-1-git-send-email-lubo.zhang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox