[stgt] [PATCH] iser: Fix discovery over iser on non default port
Roi Dayan
roid at mellanox.com
Mon Feb 3 16:57:37 CET 2014
Build the target list with the socket port instead of
using ISCSI_LISTEN_PORT.
Signed-off-by: Roi Dayan <roid at mellanox.com>
---
usr/iscsi/iser_text.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/usr/iscsi/iser_text.c b/usr/iscsi/iser_text.c
index 08cdfe5..16520cb 100644
--- a/usr/iscsi/iser_text.c
+++ b/usr/iscsi/iser_text.c
@@ -832,6 +832,7 @@ static void iser_text_scan(struct iscsi_connection *iscsi_conn,
struct sockaddr_storage ss;
socklen_t slen, blen;
char *p, buf[NI_MAXHOST + 128];
+ int port;
if (value[0] == 0)
continue;
@@ -857,7 +858,14 @@ static void iser_text_scan(struct iscsi_connection *iscsi_conn,
if (ss.ss_family == AF_INET6)
*p++ = ']';
- sprintf(p, ":%d,1", ISCSI_LISTEN_PORT);
+ if (ss.ss_family == AF_INET6)
+ port = ntohs(((struct sockaddr_in6 *)
+ &ss)->sin6_port);
+ else
+ port = ntohs(((struct sockaddr_in *)
+ &ss)->sin_port);
+
+ sprintf(p, ":%d,1", port);
iser_target_list_build(iscsi_conn, tx_pdu, buf,
strcmp(value, "All") ? value : NULL);
} else
--
1.7.8.2
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list