[PATCH] [LIO-Target/ConfigFS]: Fixed breakage with IPv6 network portals

23 views
Skip to first unread message

Nicholas A. Bellinger

unread,
Nov 2, 2008, 7:44:56 PM11/2/08
to Linux-iSCSI.org Target Dev
>From 4e82f613001fbd38cedfa4586853af14f7ae4722 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <n...@linux-iscsi.org>
Date: Sun, 2 Nov 2008 16:37:10 -0800
Subject: [PATCH] [LIO-Target/ConfigFS]: Fixed breakage with IPv6 network portals

IPv6 network portal creation had been failing in:

/sys/kernel/config/target/iscsi/$IQN/$TPGT/np/[ipv6]:port

because lio_target_call_addnptotpg() was not properly stripping off
the "[" and "]" for the IPv6 address. This patch allows IPv6 network
portals to be successfully created, as well as enabling SCTP IPv6 when
using the sctp flag:

echo 1 > /sys/kernel/config/target/iscsi/$IQN/$TPGT/np/[ipv6]:port/sctp

Signed-off-by: Nicholas A. Bellinger <n...@linux-iscsi.org>
---
drivers/lio-core/iscsi_target_configfs.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/lio-core/iscsi_target_configfs.c b/drivers/lio-core/iscsi_target_configfs.c
index 71e8d2a..0a9b902 100644
--- a/drivers/lio-core/iscsi_target_configfs.c
+++ b/drivers/lio-core/iscsi_target_configfs.c
@@ -273,11 +273,19 @@ static struct config_group *lio_target_call_addnptotpg (
" in IPv6 iSCSI network portal address\n");
return(ERR_PTR(-EINVAL));
}
- str2 += 1; /* Skip over the "]" */
+ str++; /* Skip over leading "[" */
*str2 = '\0'; /* Terminate the IPv6 address */
- str2 += 1; /* Set str2 to port */
- np_addr.np_port = simple_strtoul(str2, &end_ptr, 0);
- snprintf(np_addr.np_ipv6, IPV6_ADDRESS_SPACE, "%s\n", str);
+ str2 += 1; /* Skip over the "]" */
+ if (!(port_str = strstr(str2, ":"))) {
+ printk(KERN_ERR "Unable to locate \":port\""
+ " in IPv6 iSCSI network portal address\n");
+ return(ERR_PTR(-EINVAL));
+ }
+ *port_str = '\0'; /* Terminate string for IP */
+ port_str += 1; /* Skip over ":" */
+ np_addr.np_port = simple_strtoul(port_str, &end_ptr, 0);
+
+ snprintf(np_addr.np_ipv6, IPV6_ADDRESS_SPACE, "%s", str);
np_addr.np_flags |= NPF_NET_IPV6;
} else {
ip_str = &buf[0];
--
1.5.4.1

Reply all
Reply to author
Forward
0 new messages