Tomo, list, igor Please find attached a patch that allows tgtd to start even if it can not bind to the default IPv6 wildcard. By default, if no portal is specified, tgtd will try to bind to both IPv6 and IPv4 wildcard. This caused the start to fail with an error on systems with no IPv6 available. Note that even on those systrems that lack IPv6 support, tgtd can be used and start, just that it must be started with deliberate non-support for IPv6 by ONLY specifying an IPv4 portal, example tgtd --iscsi portal=0.0.0.0:3260 This allows tgtd to run on those systems that are non-IPv6 aware even without this patch. Since being from AsiaPac, where ARIN did run out of IPv4 addresses a while back, I dont know if I want this patch applied. My portal stuff did cause a regression, but on the other hand I see good reason too why forcing IPv4 users to become aware. And they can use a manual override, like specifying IPv4 portal manually on the command line. Tomo, use your judgement. The patch is applied, to fix a regression. I can easily see reasons both why to apply it and also why not to apply it. I think it is about time that all software became IPv6 mandatory by default, so maybe this bug I introduced was subconciously deliberate. :-) regards ronnie sahlberg On Wed, May 11, 2011 at 7:30 AM, ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote: > My bad. > > Ill provide a patch later today. > > > regards > ronnie sahlberg > > > On Tue, May 10, 2011 at 10:34 PM, Novgorodov Igor <igor@xxxxxxxx> wrote: >> I have a gentoo server working as a target, and latest 1.0.16 / GIT tgtd >> gives me "No available low level driver", >> while 1.0.15 works fine. After some tracing i've found out that by default >> it creates "0::0" ipv6 portal along with >> default 0.0.0.0, and when it fails to bind to v6 socket, it dies. >> >> So, for now i've just removed the v6 wildcard portal, but we should have >> some checks that the current kernel >> actually was built with ipv6 before attempting to try it... >> >> # diff -c iscsi_tcp.c.orig iscsi_tcp.c >> *** iscsi_tcp.c.orig Tue May 10 16:21:39 2011 >> --- iscsi_tcp.c Tue May 10 16:21:43 2011 >> *************** >> *** 306,312 **** >> for ipv4 and ipv6 >> */ >> if (list_empty(&iscsi_portals_list)) { >> ! iscsi_add_portal("0::0", 0, 1, 0); >> iscsi_add_portal("0.0.0.0", 0, 1, 0); >> } >> >> --- 306,312 ---- >> for ipv4 and ipv6 >> */ >> if (list_empty(&iscsi_portals_list)) { >> ! // iscsi_add_portal("0::0", 0, 1, 0); >> iscsi_add_portal("0.0.0.0", 0, 1, 0); >> } >> >> -- >> To unsubscribe from this list: send the line "unsubscribe stgt" in >> the body of a message to majordomo@xxxxxxxxxxxxxxx >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> >
From 80954629fd16931304490be85b6e4e270ed4eab1 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> Date: Wed, 11 May 2011 16:54:54 +1000 Subject: [PATCH] Allow TGTD to start even if it can not bind to IPv6 default wildcard portal. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/iscsi/iscsi_tcp.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c index e87bbf1..27f7301 100644 --- a/usr/iscsi/iscsi_tcp.c +++ b/usr/iscsi/iscsi_tcp.c @@ -249,6 +249,22 @@ static int iscsi_tcp_init_portal(struct iscsi_portal *portal) int iscsi_add_portal(char *addr, int port, int tpgt, int do_create) { struct iscsi_portal *new_portal; + struct addrinfo hints, *res, *res0; + char svcname[64]; + + memset(svcname, 0, sizeof(svcname)); + snprintf(svcname, sizeof(svcname), "%d", port); + + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + + if (getaddrinfo(addr, svcname, &hints, &res0)) { + eprintf("unable to get address info for portal %s, %m\n" + "ignoring this portal\n", + addr); + return -1; + } list_for_each_entry(new_portal, &iscsi_portals_list, iscsi_portal_siblings) { -- 1.7.3.1
Attachment:
0001-Allow-TGTD-to-start-even-if-it-can-not-bind-to-IPv6-.patch.gz
Description: GNU Zip compressed data