Skip to contentSkip to conversation

iser: Fix discovery over iser on non default port

PATCH Applied Roi Dayan 2 participants 2 messages Feb 3, 2014 Kbuild

lore
Share & tools
lore

Roi Dayan

author
#0 lore raw

PATCH 1/1 iser: Fix discovery over iser on non default port

Build the target list with the socket port instead of using ISCSI_LISTEN_PORT.

---
 usr/iscsi/iser_text.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
usr/iscsi/iser_text.c +9 -1
index 08cdfe5..16520cb 100644
@@ -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
Signature · 1 line
1.7.8.2
#1 lore raw
Quoted 7 lines · On Mon, 3 Feb 2014 17:57:37 +0200 Roi Dayan <[email protected]> wrote:

Build the target list with the socket port instead of using ISCSI_LISTEN_PORT.

---
 usr/iscsi/iser_text.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Applied, thanks.