From nobody Sat Nov 2 08:24:17 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 1493361637151643.8466698298585; Thu, 27 Apr 2017 23:40:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EC30C21951CAC; Thu, 27 Apr 2017 23:40:34 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 5E4D82195406F for ; Thu, 27 Apr 2017 23:40:33 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 27 Apr 2017 23:40:33 -0700 Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.5]) by orsmga004.jf.intel.com with ESMTP; 27 Apr 2017 23:40:31 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="81666241" From: Zhang Lubo To: edk2-devel@lists.01.org Date: Fri, 28 Apr 2017 14:40:22 +0800 Message-Id: <1493361622-7604-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [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: , 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" 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 as a dns name. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Cc: Wu Jiaxin Cc: Ye Ting Cc: Fu Siyuan Reviewed-by: Wu Jiaxin Reviewed-by: Ye Ting =20 --- 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'; --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel