From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6B4181A1E10 for ; Mon, 17 Oct 2016 02:17:42 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 17 Oct 2016 02:17:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,357,1473145200"; d="scan'208";a="890716580" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 17 Oct 2016 02:17:41 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 02:17:41 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 02:17:40 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.2]) with mapi id 14.03.0248.002; Mon, 17 Oct 2016 17:17:38 +0800 From: "Fu, Siyuan" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" Thread-Topic: [patch] NetworkPkg: Support bracketed IPv6 address during a redirection in iSCSI Thread-Index: AQHSJeaaN7OQe0kbp0+Pm3kNAe85F6CsYsSw Date: Mon, 17 Oct 2016 09:17:38 +0000 Message-ID: References: <1476427478-10084-1-git-send-email-lubo.zhang@intel.com> In-Reply-To: <1476427478-10084-1-git-send-email-lubo.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDg4NmVmY2EtZGFlNy00NTIyLWE2ODMtMWQwYTEyNzFmZWIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Im9KdlkxZk1sTGVlVkJJUXJSeFo3eGliR2srd0kwazRlWGxlWkh6c0xWcTg9In0= x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] NetworkPkg: Support bracketed IPv6 address during a redirection in iSCSI 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, 17 Oct 2016 09:17:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan siyuan.fu@intel.com > -----Original Message----- > From: Zhang, Lubo > Sent: Friday, October 14, 2016 2:45 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Fu, Siyuan ; Wu, > Jiaxin > Subject: [patch] NetworkPkg: Support bracketed IPv6 address during a > redirection in iSCSI >=20 > According to RFC 3720, the TargetAddress provided in a redirection > might be a DNS host name, a dotted-decimal IPv4 address, or a > bracketed IPv6 address. Current ISCSI driver in Networkpkg only > supports dotted-decimal IPv4 address, so we need add IPv6 address > support since it is a combo driver supporting dual stack. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo > Cc: Ye Ting > Cc: Fu Siyuan > Cc: Wu Jiaxin > --- > NetworkPkg/IScsiDxe/IScsiProto.c | 51 ++++++++++++++++++++++++++++++----= - > ----- > NetworkPkg/IScsiDxe/IScsiProto.h | 5 +++- > 2 files changed, 43 insertions(+), 13 deletions(-) >=20 > diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c > b/NetworkPkg/IScsiDxe/IScsiProto.c > index 5092365..a9bf491 100644 > --- a/NetworkPkg/IScsiDxe/IScsiProto.c > +++ b/NetworkPkg/IScsiDxe/IScsiProto.c > @@ -1087,26 +1087,53 @@ IScsiUpdateTargetAddress ( > TargetAddress =3D IScsiGetValueByKeyFromList (KeyValueList, > ISCSI_KEY_TARGET_ADDRESS); > if (TargetAddress =3D=3D NULL) { > break; > } >=20 > - if (!NET_IS_DIGIT (TargetAddress[0])) { > + // > + // RFC 3720 defines format of the > TargetAddress=3Ddomainname[:port][,portal-group-tag] > + // The domainname can be specified as either a DNS host name, > adotted-decimal IPv4 address, > + // or a bracketed IPv6 address as specified in [RFC2732]. > + // > + if (NET_IS_DIGIT (TargetAddress[0])) { > // > - // The domainname of the target may be presented in three formats: > a DNS host name, > - // a dotted-decimal IPv4 address, or a bracketed IPv6 address. Onl= y > accept dotted > - // IPv4 address. > + // The domainname of the target is presented in a dotted-decimal > IPv4 address format. > // > - continue; > - } > - > - IpStr =3D TargetAddress; > + IpStr =3D TargetAddress; >=20 > - while ((*TargetAddress !=3D 0) && (*TargetAddress !=3D ':') && > (*TargetAddress !=3D ',')) { > + while ((*TargetAddress !=3D '\0') && (*TargetAddress !=3D ':') && > (*TargetAddress !=3D ',')) { > + // > + // NULL, ':', or ',' ends the IPv4 string. > + // > + TargetAddress++; > + } > + > + } else if (*TargetAddress =3D=3D ISCSI_REDIRECT_ADDR_START_DELIMITER= ){ > // > - // NULL, ':', or ',' ends the IPv4 string. > + // The domainname of the target is presented in a bracketed IPv6 > address format. > // > - TargetAddress++; > + TargetAddress ++; > + IpStr =3D TargetAddress; > + while ((*TargetAddress !=3D '\0') && (*TargetAddress !=3D > ISCSI_REDIRECT_ADDR_END_DELIMITER)) { > + // > + // ']' ends the IPv6 string. > + // > + TargetAddress++; > + } > + > + if (*TargetAddress !=3D ISCSI_REDIRECT_ADDR_END_DELIMITER) { > + continue; > + } > + > + *TargetAddress =3D '\0'; > + TargetAddress ++; > + > + } else { > + // > + // The domainname of the target is presented in the format of a DN= S > host name. > + // Temporary not supported. > + continue; > } >=20 > if (*TargetAddress =3D=3D ',') { > // > // Comma and the portal group tag MUST be ommitted if the > TargetAddress is sent > @@ -1124,11 +1151,11 @@ IScsiUpdateTargetAddress ( > } else { > Session->ConfigData->SessionConfigData.TargetPort =3D (UINT16) > Number; > } > } else { > // > - // The string only contains the IPv4 address. Use the well-known > port. > + // The string only contains the Target address. Use the well-known > port. > // > Session->ConfigData->SessionConfigData.TargetPort =3D > ISCSI_WELL_KNOWN_PORT; > } > // > // Update the target IP address. > diff --git a/NetworkPkg/IScsiDxe/IScsiProto.h > b/NetworkPkg/IScsiDxe/IScsiProto.h > index 8099f34..367914d 100644 > --- a/NetworkPkg/IScsiDxe/IScsiProto.h > +++ b/NetworkPkg/IScsiDxe/IScsiProto.h > @@ -1,9 +1,9 @@ > /** @file > The header file of iSCSI Protocol that defines many specific data > structures. >=20 > -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -38,10 +38,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > #define DEFAULT_MAX_OUTSTANDING_R2T 1 >=20 > #define ISCSI_VERSION_MAX 0x00 > #define ISCSI_VERSION_MIN 0x00 >=20 > +#define ISCSI_REDIRECT_ADDR_START_DELIMITER '[' > +#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']' > + > #define ISCSI_KEY_AUTH_METHOD "AuthMethod" > #define ISCSI_KEY_HEADER_DIGEST "HeaderDigest" > #define ISCSI_KEY_DATA_DIGEST "DataDigest" > #define ISCSI_KEY_MAX_CONNECTIONS "MaxConnections" > #define ISCSI_KEY_TARGET_NAME "TargetName" > -- > 1.9.5.msysgit.1