Resolves: #691902
This commit is contained in:
parent
1a34d73eb1
commit
7cb7aa8e7a
122
iscsi-initiator-utils-node-hostname.patch
Normal file
122
iscsi-initiator-utils-node-hostname.patch
Normal file
@ -0,0 +1,122 @@
|
||||
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-872-rc4-bnx2i.work/doc/iscsiadm.8
|
||||
--- open-iscsi-2.0-872-rc4-bnx2i/doc/iscsiadm.8 2011-04-05 14:41:11.804173341 -0500
|
||||
+++ open-iscsi-2.0-872-rc4-bnx2i.work/doc/iscsiadm.8 2011-04-05 14:41:27.335321234 -0500
|
||||
@@ -171,8 +171,14 @@ sid is passed in.
|
||||
|
||||
.TP
|
||||
\fB\-p\fR, \fB\-\-portal=\fIip[:port]\fR
|
||||
-Use target portal with ip-address \fIip\fR and \fIport\fR, the default
|
||||
-\fIport\fR value is 3260.
|
||||
+Use target portal with ip-address \fIip\fR and \fIport\fR. If port is not passed
|
||||
+in the default \fIport\fR value is 3260.
|
||||
+.IP
|
||||
+IPv6 addresses can bs specified as [ddd.ddd.ddd.ddd]:port or
|
||||
+ddd.ddd.ddd.ddd.
|
||||
+.IP
|
||||
+Hostnames can also be used for the ip argument.
|
||||
+
|
||||
.IP
|
||||
This option is only valid for discovery, or for node operations with
|
||||
the \fInew\fR operator.
|
||||
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/README open-iscsi-2.0-872-rc4-bnx2i.work/README
|
||||
--- open-iscsi-2.0-872-rc4-bnx2i/README 2011-04-05 14:41:11.802173577 -0500
|
||||
+++ open-iscsi-2.0-872-rc4-bnx2i.work/README 2011-04-05 14:43:04.752687316 -0500
|
||||
@@ -646,6 +646,9 @@ To now log into targets it is the same a
|
||||
If a record does not exist, it will be created using the iscsid.conf
|
||||
discovery settings.
|
||||
|
||||
+ The argument to -p may also be a hostname instead of an address.
|
||||
+ ./iscsiadm -m discoverydb -t st -p smoehost --discover
|
||||
+
|
||||
For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
|
||||
interfaces using software iscsi. If any are found then nodes found
|
||||
during discovery will be setup so that they can logged in through
|
||||
@@ -770,6 +773,10 @@ To now log into targets it is the same a
|
||||
./iscsiadm -m node -T iqn.2005-03.com.max \
|
||||
-p [2001:c90::211:9ff:feb8:a9e9]:3260 -l
|
||||
|
||||
+ To specify a hostname the following can be used:
|
||||
+
|
||||
+ ./iscsiadm -m node -T iqn.2005-03.com.max -p somehost -l
|
||||
+
|
||||
- iSCSI Login to a specific portal through the NIC setup as iface0:
|
||||
|
||||
./iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 \
|
||||
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_util.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_util.c
|
||||
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_util.c 2011-04-05 14:41:11.817171790 -0500
|
||||
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_util.c 2011-04-05 14:41:27.337320997 -0500
|
||||
@@ -217,6 +217,64 @@ char *cfg_get_string_param(char *pathnam
|
||||
return value;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * iscsi_addr_match - check if the addrs are to the same ip
|
||||
+ * @address1: pattern
|
||||
+ * @address2: address to check
|
||||
+ *
|
||||
+ * If address1 is blank then it matches any string passed in.
|
||||
+ */
|
||||
+static int iscsi_addr_match(char *address1, char *address2)
|
||||
+{
|
||||
+ struct addrinfo hints1, hints2, *res1, *res2;
|
||||
+ int rc;
|
||||
+
|
||||
+ if (!strlen(address1))
|
||||
+ return 1;
|
||||
+
|
||||
+ if (!strcmp(address1, address2))
|
||||
+ return 1;
|
||||
+
|
||||
+ memset(&hints1, 0, sizeof(struct addrinfo));
|
||||
+ hints1.ai_family = AF_UNSPEC;
|
||||
+ hints1.ai_socktype = SOCK_STREAM;
|
||||
+
|
||||
+ memset(&hints2, 0, sizeof(struct addrinfo));
|
||||
+ hints2.ai_family = AF_UNSPEC;
|
||||
+ hints2.ai_socktype = SOCK_STREAM;
|
||||
+
|
||||
+ /*
|
||||
+ * didn't match so we have to resolve to see if one is a dnsname
|
||||
+ * that matches a ip address.
|
||||
+ */
|
||||
+ rc = getaddrinfo(address1, NULL, &hints1, &res1);
|
||||
+ if (rc) {
|
||||
+ log_debug(1, "Match error. Could not resolve %s: %s", address1,
|
||||
+ gai_strerror(rc));
|
||||
+ return 0;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ rc = getaddrinfo(address2, NULL, &hints2, &res2);
|
||||
+ if (rc) {
|
||||
+ log_debug(1, "Match error. Could not resolve %s: %s", address2,
|
||||
+ gai_strerror(rc));
|
||||
+ rc = 0;
|
||||
+ goto free_res1;
|
||||
+ }
|
||||
+
|
||||
+ if ((res1->ai_addrlen != res2->ai_addrlen) ||
|
||||
+ memcmp(res1->ai_addr, res2->ai_addr, res2->ai_addrlen))
|
||||
+ rc = 0;
|
||||
+ else
|
||||
+ rc = 1;
|
||||
+
|
||||
+ freeaddrinfo(res2);
|
||||
+free_res1:
|
||||
+ freeaddrinfo(res1);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
int __iscsi_match_session(node_rec_t *rec, char *targetname,
|
||||
char *address, int port, struct iface_rec *iface)
|
||||
{
|
||||
@@ -240,8 +298,7 @@ int __iscsi_match_session(node_rec_t *re
|
||||
if (strlen(rec->name) && strcmp(rec->name, targetname))
|
||||
return 0;
|
||||
|
||||
- if (strlen(rec->conn[0].address) &&
|
||||
- strcmp(rec->conn[0].address, address))
|
||||
+ if (!iscsi_addr_match(rec->conn[0].address, address))
|
||||
return 0;
|
||||
|
||||
if (rec->conn[0].port != -1 && port != rec->conn[0].port)
|
Loading…
Reference in New Issue
Block a user