break;\r
}\r
\r
- if (!NET_IS_DIGIT (TargetAddress[0])) {\r
+ //\r
+ // RFC 3720 defines format of the TargetAddress=domainname[:port][,portal-group-tag]\r
+ // The domainname can be specified as either a DNS host name, adotted-decimal IPv4 address,\r
+ // or a bracketed IPv6 address as specified in [RFC2732].\r
+ //\r
+ if (NET_IS_DIGIT (TargetAddress[0])) {\r
+ //\r
+ // The domainname of the target is presented in a dotted-decimal IPv4 address format.\r
+ //\r
+ IpStr = TargetAddress;\r
+\r
+ while ((*TargetAddress != '\0') && (*TargetAddress != ':') && (*TargetAddress != ',')) {\r
+ //\r
+ // NULL, ':', or ',' ends the IPv4 string.\r
+ //\r
+ TargetAddress++;\r
+ }\r
+ } else if (*TargetAddress == ISCSI_REDIRECT_ADDR_START_DELIMITER){\r
//\r
- // The domainname of the target may be presented in three formats: a DNS host name,\r
- // a dotted-decimal IPv4 address, or a bracketed IPv6 address. Only accept dotted\r
- // IPv4 address.\r
+ // The domainname of the target is presented in a bracketed IPv6 address format.\r
//\r
+ TargetAddress ++;\r
+ IpStr = TargetAddress;\r
+ while ((*TargetAddress != '\0') && (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER)) {\r
+ //\r
+ // ']' ends the IPv6 string.\r
+ //\r
+ TargetAddress++;\r
+ }\r
+\r
+ if (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER) {\r
+ continue;\r
+ }\r
+\r
+ *TargetAddress = '\0';\r
+ TargetAddress ++;\r
+\r
+ } else {\r
+ //\r
+ // The domainname of the target is presented in the format of a DNS host name.\r
+ // Temporary not supported.\r
continue;\r
}\r
\r
//\r
NvData->OriginalTargetPort = NvData->TargetPort;\r
\r
- IpStr = TargetAddress;\r
-\r
- while ((*TargetAddress != 0) && (*TargetAddress != ':') && (*TargetAddress != ',')) {\r
- //\r
- // NULL, ':', or ',' ends the IPv4 string.\r
- //\r
- TargetAddress++;\r
- }\r
-\r
if (*TargetAddress == ',') {\r
//\r
// Comma and the portal group tag MUST be ommitted if the TargetAddress is sent\r
}\r
} else {\r
//\r
- // The string only contains the IPv4 address. Use the well-known port.\r
+ // The string only contains the Target address. Use the well-known port.\r
//\r
NvData->TargetPort = ISCSI_WELL_KNOWN_PORT;\r
}\r
/** @file\r
The header file of iSCSI Protocol that defines many specific data structures.\r
\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#define ISCSI_VERSION_MAX 0x00\r
#define ISCSI_VERSION_MIN 0x00\r
\r
+#define ISCSI_REDIRECT_ADDR_START_DELIMITER '['\r
+#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']'\r
+\r
#define ISCSI_KEY_AUTH_METHOD "AuthMethod"\r
#define ISCSI_KEY_HEADER_DIGEST "HeaderDigest"\r
#define ISCSI_KEY_DATA_DIGEST "DataDigest"\r