From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 7ADC621A134A3 for ; Tue, 2 May 2017 19:52:36 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2017 19:52:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,282,1491289200"; d="scan'208";a="96543201" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 02 May 2017 19:52:36 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 2 May 2017 19:52:36 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 2 May 2017 19:52:35 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.193]) with mapi id 14.03.0319.002; Wed, 3 May 2017 10:52:33 +0800 From: "Ye, Ting" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , "Fu, Siyuan" Thread-Topic: [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP. Thread-Index: AQHSv+pbPm79XQDXhE2ArXOgLQgCHaHh8Ljw Date: Wed, 3 May 2017 02:52:33 +0000 Message-ID: References: <1493361622-7604-1-git-send-email-lubo.zhang@intel.com> In-Reply-To: <1493361622-7604-1-git-send-email-lubo.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 02:52:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Zhang, Lubo=20 Sent: Friday, April 28, 2017 2:40 PM To: edk2-devel@lists.01.org Cc: Wu, Jiaxin ; Ye, Ting ; Fu, Siy= uan Subject: [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling targe= t DHCP. if the server name expressed as a site local address begain with FEC0 when = retrieving from dhcpv6 option 59 boot file url, it incorrectly process it a= s a dns name. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Cc: Wu Jiaxin Cc: Ye Ting Cc: Fu Siyuan --- NetworkPkg/IScsiDxe/IScsiDhcp6.c | 38 +++++++++++++++++++++++++-----------= -- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDh= cp6.c index d3535d5..06c634c 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c @@ -48,11 +48,11 @@ IScsiDhcp6ExtractRootPath ( ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData; EFI_IP_ADDRESS Ip; UINT8 IpMode; =20 =20 ConfigNvData =3D &ConfigData->SessionConfigData; - + ConfigNvData->DnsMode =3D FALSE; // // "iscsi:"":"":"":"":" // IScsiRootPathIdLen =3D (UINT16) AsciiStrLen (ISCSI_ROOT_PATH_ID); =20 @@ -80,27 +80,40 @@ IScsiDhcp6ExtractRootPath ( =20 // // Extract SERVERNAME field in the Root Path option. // if (TmpStr[Index] !=3D ISCSI_ROOT_PATH_ADDR_START_DELIMITER) { - Status =3D EFI_INVALID_PARAMETER; - goto ON_EXIT; + // + // The servername is expressed as domain name. + // + ConfigNvData->DnsMode =3D TRUE; } else { Index++; } =20 Fields[RP_FIELD_IDX_SERVERNAME].Str =3D &TmpStr[Index]; =20 - while ((TmpStr[Index] !=3D ISCSI_ROOT_PATH_ADDR_END_DELIMITER) && (Index= < Length)) { - Index++; - } + if (!ConfigNvData->DnsMode) { + while ((TmpStr[Index] !=3D ISCSI_ROOT_PATH_ADDR_END_DELIMITER)&& (Inde= x < Length)) { + Index++; + } =20 - // - // Skip ']' and ':'. - // - TmpStr[Index] =3D '\0'; - Index +=3D 2; + // + // Skip ']' and ':'. + // + TmpStr[Index] =3D '\0'; + Index +=3D 2; + } else { + while ((TmpStr[Index] !=3D ISCSI_ROOT_PATH_FIELD_DELIMITER) && (Index = < Length)) { + Index++; + } + // + // Skip ':'. + // + TmpStr[Index] =3D '\0'; + Index +=3D 1; + } =20 Fields[RP_FIELD_IDX_SERVERNAME].Len =3D (UINT8) AsciiStrLen (Fields[RP_F= IELD_IDX_SERVERNAME].Str); =20 // // Extract others fields in the Root Path option string. @@ -151,12 +164,11 @@ IScsiDhcp6ExtractRootPath ( } =20 // // Server name is expressed as domain name, just save it. // - if ((!NET_IS_DIGIT (*(Field->Str))) && (*(Field->Str) !=3D '[')) { - ConfigNvData->DnsMode =3D TRUE; + if (ConfigNvData->DnsMode) { if (Field->Len > sizeof (ConfigNvData->TargetUrl)) { return EFI_INVALID_PARAMETER; } CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len); ConfigNvData->TargetUrl[Field->Len + 1] =3D '\0'; -- 1.9.5.msysgit.1