From: "Fu, Siyuan" <siyuan.fu@intel.com>
To: "Zhang, Lubo" <lubo.zhang@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>, "Wu, Jiaxin" <jiaxin.wu@intel.com>
Subject: Re: [patch] NetworkPkg: Support bracketed IPv6 address during a redirection in iSCSI
Date: Mon, 17 Oct 2016 09:17:38 +0000 [thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58A82DBB8@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1476427478-10084-1-git-send-email-lubo.zhang@intel.com>
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 <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [patch] NetworkPkg: Support bracketed IPv6 address during a
> redirection in iSCSI
>
> 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.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
> NetworkPkg/IScsiDxe/IScsiProto.c | 51 ++++++++++++++++++++++++++++++-----
> -----
> NetworkPkg/IScsiDxe/IScsiProto.h | 5 +++-
> 2 files changed, 43 insertions(+), 13 deletions(-)
>
> 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 = IScsiGetValueByKeyFromList (KeyValueList,
> ISCSI_KEY_TARGET_ADDRESS);
> if (TargetAddress == NULL) {
> break;
> }
>
> - if (!NET_IS_DIGIT (TargetAddress[0])) {
> + //
> + // RFC 3720 defines format of the
> TargetAddress=domainname[: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. Only
> accept dotted
> - // IPv4 address.
> + // The domainname of the target is presented in a dotted-decimal
> IPv4 address format.
> //
> - continue;
> - }
> -
> - IpStr = TargetAddress;
> + IpStr = TargetAddress;
>
> - while ((*TargetAddress != 0) && (*TargetAddress != ':') &&
> (*TargetAddress != ',')) {
> + while ((*TargetAddress != '\0') && (*TargetAddress != ':') &&
> (*TargetAddress != ',')) {
> + //
> + // NULL, ':', or ',' ends the IPv4 string.
> + //
> + TargetAddress++;
> + }
> +
> + } else if (*TargetAddress == 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 = TargetAddress;
> + while ((*TargetAddress != '\0') && (*TargetAddress !=
> ISCSI_REDIRECT_ADDR_END_DELIMITER)) {
> + //
> + // ']' ends the IPv6 string.
> + //
> + TargetAddress++;
> + }
> +
> + if (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER) {
> + continue;
> + }
> +
> + *TargetAddress = '\0';
> + TargetAddress ++;
> +
> + } else {
> + //
> + // The domainname of the target is presented in the format of a DNS
> host name.
> + // Temporary not supported.
> + continue;
> }
>
> if (*TargetAddress == ',') {
> //
> // Comma and the portal group tag MUST be ommitted if the
> TargetAddress is sent
> @@ -1124,11 +1151,11 @@ IScsiUpdateTargetAddress (
> } else {
> Session->ConfigData->SessionConfigData.TargetPort = (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 =
> 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.
>
> -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> http://opensource.org/licenses/bsd-license.php
>
> @@ -38,10 +38,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
> #define DEFAULT_MAX_OUTSTANDING_R2T 1
>
> #define ISCSI_VERSION_MAX 0x00
> #define ISCSI_VERSION_MIN 0x00
>
> +#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
prev parent reply other threads:[~2016-10-17 9:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 6:44 [patch] NetworkPkg: Support bracketed IPv6 address during a redirection in iSCSI Zhang Lubo
2016-10-17 9:17 ` Fu, Siyuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B1FF2E9001CE9041BD10B825821D5BC58A82DBB8@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox