From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 244D4803A6 for ; Mon, 13 Mar 2017 00:44:27 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2017 00:44:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,157,1486454400"; d="scan'208";a="1141405173" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 13 Mar 2017 00:44:19 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Mar 2017 00:44:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by shsmsx102.ccr.corp.intel.com ([169.254.2.88]) with mapi id 14.03.0248.002; Mon, 13 Mar 2017 15:44:15 +0800 From: "Wu, Jiaxin" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" Thread-Topic: [patch] NetworkPkg: Fix potential bug if the iSCSI use dns protocol. Thread-Index: AQHSmK22V5rl/wNDtEeICvV2w2spAqGSac1A Date: Mon, 13 Mar 2017 07:44:14 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274162A1BC6@SHSMSX103.ccr.corp.intel.com> References: <1489047476-14804-1-git-send-email-lubo.zhang@intel.com> In-Reply-To: <1489047476-14804-1-git-send-email-lubo.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWRiMjY1M2QtOGUyYi00ZGUzLWI5NDUtY2JiNTU2YWU1MjlhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjU2YVFCOWU5QzlWV0EzVlJMT3FxTlhHOUFRMWhUZVlCMld3dDBMaWR0Z1k9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Mon, 13 Mar 2017 07:44:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Zhang, Lubo > Sent: Thursday, March 9, 2017 4:18 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Fu, Siyuan ; Wu, > Jiaxin > Subject: [patch] NetworkPkg: Fix potential bug if the iSCSI use dns proto= col. >=20 > Since we use the Attempt and index as the attempt variable name instead o= f > the MAC address plus index, we need to update this to check the whether > the Controller handle is configured to use DNS protocol >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo > Cc: Ye Ting > Cc: Fu Siyuan > Cc: Wu Jiaxin > --- > NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) >=20 > 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; > } >=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= 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]; >=20 > AttemptConfigOrder =3D IScsiGetVariableAndSize ( > L"AttemptOrder", > @@ -1826,14 +1827,14 @@ IScsiDnsIsConfigured ( >=20 > for (Index =3D 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Ind= ex++) { > 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- > >AttemptConfigIndex); >=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 || > StrCmp (MacString, AttemptMacString)) { > FreePool (AttemptTmp); > continue; > } >=20 > if (AttemptTmp->SessionConfigData.DnsMode) { > -- > 1.9.5.msysgit.1