Timshel Knoll <[EMAIL PROTECTED]> writes:
> ----- Forwarded message from "Roland E. Lipovits" <[EMAIL PROTECTED]> -----
>
> On a system without IPv6 support lshd fails.
> |# lshd -p 2222
> |lshd: exception: Address family not supported by protocol
That's definitely a bug.
Some information that would be helpful:
The values of HAVE_GETADDRINFO, HAVE_GAI_STRERROR and
HAVE_AI_NUMERICHOST in config.h (these determine if getaddrinfo is
used).
Output of lshd -p 2222 -v -trace, and strace (for figuring out what
operation it really is that fails). Stepping through
address_info2sockaddr figuring out what getaddrinfo returns.
A guess for what happens: getaddrinfo(NULL, ...) is called to get the
unspecified address to bind to. getaddrinfo returns both the ipv4
address 0.0.0.0 and the ipv6 unspecified address (don't remember what
it looks like). Then the ipv6 address is selected (on the theory that
if getaddrinfo shouldn't be returning addresses that won't work). But
passing the address to bind() fails.
The right thing to do is probably to try listening on all interfaces
returned by getaddrinfo, and consider the operation to be successful
if at least one listen succeeds.
Can you confirm this theory, or figure out what it is that is going on?
Adding the below patch to io.c and running lshd with --debug should
tell you which address type is used (but just using strace may be
easier, as you don't need to recompile).
> I am building lsh with ipv6 support. Is it possible to have lshd
> gracefully accept that there is no ipv6 support on systems without ipv6?
It definitely should work that way.
Is there any easy fix, besides fixing lshd to listen on several
interfaces? I'd prefer not making any radical changes to 1.2.x.
Hmm, the reason that it works for me is that configure.in contains a
check for socket(AF_INET6, SOCK_STREAM, 0), which disables IPv6 for me
at compile time. Perhaps it's better to do a similar test at run-time.
> I'd really like to have the default Debian lsh-server package supporting
> ipv6, but if that's not possible I'll have to split it into two packages
> (one with ipv6 support, one without), which I'd rather not have to do ...
I fully understand that.
> AFAIK, lsh 1.0.x didn't have this problem (at least it was never reported
> to me if it did ... and all Debian lsh-server packages have been built with
> ipv6 support)
Do you remember what 1.0.x it was? From the ChangeLog, it seems the
first IPv6 support was introduced 2000-04-19.
/Niels