From nobody Thu May 2 02:09:54 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489047482402724.3848526128083; Thu, 9 Mar 2017 00:18:02 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 303FE8038A; Thu, 9 Mar 2017 00:18:01 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7474E802AE for ; Thu, 9 Mar 2017 00:17:59 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2017 00:17:59 -0800 Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.8]) by fmsmga006.fm.intel.com with ESMTP; 09 Mar 2017 00:17:57 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,267,1486454400"; d="scan'208";a="74591389" From: Zhang Lubo To: edk2-devel@lists.01.org Date: Thu, 9 Mar 2017 16:17:56 +0800 Message-Id: <1489047476-14804-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Reviewed-by: Wu Jiaxin --- NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMis= c.c index 7b4044f..2c93590 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1776,11 +1776,11 @@ IScsiDhcpIsConfigured ( FreePool (AttemptConfigOrder); return FALSE; } =20 /** - Check wheather the Controller handle is configured to use DNS protocol. + Check whether the Controller handle is configured to use DNS protocol. =20 @param[in] Controller The handle of the controller. =20 @retval TRUE The handle of the controller need the D= ns protocol. @retval FALSE The handle of the controller does not n= eed 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]; =20 AttemptConfigOrder =3D IScsiGetVariableAndSize ( L"AttemptOrder", @@ -1826,14 +1827,14 @@ IScsiDnsIsConfigured ( =20 for (Index =3D 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index= ++) { UnicodeSPrint ( AttemptName, (UINTN) 128, - L"%s%d", - MacString, + L"Attempt %d", (UINTN) AttemptConfigOrder[Index] ); + Status =3D GetVariable2 ( AttemptName, &gEfiIScsiInitiatorNameProtocolGuid, (VOID**)&AttemptTmp, NULL @@ -1842,11 +1843,13 @@ IScsiDnsIsConfigured ( continue; } =20 ASSERT (AttemptConfigOrder[Index] =3D=3D AttemptTmp->AttemptConfigInde= x); =20 - if (AttemptTmp->SessionConfigData.Enabled =3D=3D ISCSI_DISABLED) { + AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof= (AttemptMacString) / sizeof (AttemptMacString[0])); + + if (AttemptTmp->SessionConfigData.Enabled =3D=3D ISCSI_DISABLED || Str= Cmp (MacString, AttemptMacString)) { FreePool (AttemptTmp); continue; } =20 if (AttemptTmp->SessionConfigData.DnsMode) { --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel