NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: iscsid - lfs and ipv6 issues



    Date:        Sat, 18 Nov 2023 10:46:18 -0000 (UTC)
    From:        mlelstv%serpens.de@localhost (Michael van Elst)
    Message-ID:  <uja4le$1m3$1%serpens.de@localhost>

And wrt this part:

  | The address string is later used in iscsid_driverif.c, a name
  | is resolved with gethostbyname(), so while an ipv6 address might
  | be accepted, the code lacks ipv6 support.

That's probably correct by default, but it looks to me that if you have
"options: inet6" in /etc/resolv.conf then gethostbyname_r (which gethostbyname
calls to do all of the work) does ...

       if (res->options & RES_USE_INET6) {
                struct hostent *nhp = gethostbyname_internal(name, AF_INET6,
                    res, hp, buf, buflen, he);
                if (nhp) {
                        __res_put_state(res);
                        return nhp;
                }
        }
        hp = gethostbyname_internal(name, AF_INET, res, hp, buf, buflen, he);
        __res_put_state(res);

"options: inet6" sets RES_USE_INET6 in res->options.

gethostbyname_internal() does all the real work of gethostbyname(), looking
up "name" for an address in the AF given by the 2nd param.

ie: if the inet6 option is set, then gethostbyname() will first look for
an IPv6 address (or addresses) and if found, return those.  If there are
none (or if inet6 is not set in the options) then it will look for an IPv4
address (AF_INET).

So, it might be possible to use iscsi with IPv6 without further changes.
Doing it that way would cause other gethostbyname() users to also get
given v6 addresses, which their code might not be expecting, so YMMV.
(ie: caveat emptor).

Using getaddrinfo() would be much better of course.

kre




Home | Main Index | Thread Index | Old Index