Allow iser:// style URLs
Let user specify iSER support by the protocol part of the URL. I.e. support both iser://127.0.0.1/iqn.ronnie.test/1 iscsi://127.0.0.1/iqn.ronnie.test/1?iser Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
2
README
2
README
@@ -34,6 +34,8 @@ iSCSI URL Format
|
|||||||
================
|
================
|
||||||
iSCSI devices are specified by a URL format of the following form :
|
iSCSI devices are specified by a URL format of the following form :
|
||||||
iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>[?<argument>[&<argument>]*]
|
iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>[?<argument>[&<argument>]*]
|
||||||
|
or
|
||||||
|
iser://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>[?<argument>[&<argument>]*]
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
Username and password for bidirectional CHAP authentication:
|
Username and password for bidirectional CHAP authentication:
|
||||||
|
|||||||
16
lib/init.c
16
lib/init.c
@@ -520,7 +520,11 @@ iscsi_parse_url(struct iscsi_context *iscsi, const char *url, int full)
|
|||||||
int is_iser = 0;
|
int is_iser = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strncmp(url, "iscsi://", 8)) {
|
if (strncmp(url, "iscsi://", 8)
|
||||||
|
#ifdef HAVE_LINUX_ISER
|
||||||
|
&& strncmp(url, "iser://", 7)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
if (full) {
|
if (full) {
|
||||||
iscsi_set_error(iscsi, "Invalid URL %s\niSCSI URL must "
|
iscsi_set_error(iscsi, "Invalid URL %s\niSCSI URL must "
|
||||||
"be of the form: %s",
|
"be of the form: %s",
|
||||||
@@ -533,7 +537,15 @@ iscsi_parse_url(struct iscsi_context *iscsi, const char *url, int full)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(str,url + 8, MAX_STRING_SIZE);
|
#ifdef HAVE_LINUX_ISER
|
||||||
|
if (!strncmp(url, "iser://", 7)) {
|
||||||
|
is_iser = 1;
|
||||||
|
strncpy(str, url + 7, MAX_STRING_SIZE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!strncmp(url, "iscsi://", 8)) {
|
||||||
|
strncpy(str, url + 8, MAX_STRING_SIZE);
|
||||||
|
}
|
||||||
portal = str;
|
portal = str;
|
||||||
|
|
||||||
user = getenv("LIBISCSI_CHAP_USERNAME");
|
user = getenv("LIBISCSI_CHAP_USERNAME");
|
||||||
|
|||||||
Reference in New Issue
Block a user