[ds6-devel] BUGS (was Re: [nc6-commit] nc6 BUGS,1.3,1.4)
Chris Leishman
chris at leishman.org
Tue Jan 21 00:11:55 CET 2003
About the BUGS I just added....
On Tuesday, January 21, 2003, at 12:01 AM, chris at deepspace6.net wrote:
>
> +On some linux systems (and perhaps others), a nc6 listening on all
> local
> +addresses, but using IPv6 only (with the -6 option) will still accept
> +connections from clients using IPv4. This is because these systems
> don't have
> +a separate stack for IPv6 and IPv4 - instead simply treating all IPv4
> as being
> +encapsulated within IPv6 - and don't have a way to instruct the
> kernel to only
> +accept true IPv6 connections.
> +
> +<client>
> +$ ./nc6 -4 -v localhost 9876
> +nc6: localhost (127.0.0.1) 9876 [9876] open
> +
> +<server>
> +$ ./nc6 -6 -v -l -p 9876
> +nc6: listening on :: 8765 ...
> +nc6: connect to ::ffff:127.0.0.1 8765 from localhost
> (::ffff:127.0.0.1) 37654
> +[37654]
We all know this is a stupid "problem" (feature?) of the kernel. About
the only solution I can think of is to drop all clients that have IPv4
mapped addresses when we are in IPv6 only mode. This isn't ideal,
because really we should never have accepted them in the first place,
but it's all we can do. But really, I don't think it's worth worrying
about for this release (if at all?).
> +On the same linux systems (and perhaps others), a nc6 listening on
> both IPv6
> +and IPv4 will report IPv4 client connections using IPv4 mapped IPv6
> addresses,
> +rather than just IPv4.
> +
> +<client>
> +$ ./nc6 -4 -v localhost 9876
> +nc6: localhost (127.0.0.1) 9876 [9876] open
> +
> +<server>
> +$ ./nc6 -v -l -p 9876
> +nc6: listening on :: 8765 ...
> +nc6: listening on 0.0.0.0 8765 ...
> +nc6: connect to ::ffff:127.0.0.1 8765 from localhost
> (::ffff:127.0.0.1) 37654
> +[37654]
This is the same kernel "problem" manifesting itself in a different
way. I've already talked with Mauro regarding this one, but basically
the only solution would be to detect clients that have an IPv4 mapped
address and convert it to a plain IPv4 address (along with the local
socket address too).
To implement both solutions, the algorithm would be:
got client connection
get socket address of client and local interface (getsockname)
if client address is IPv4 mapped {
if only accepting IPv6 {
drop client and wait for another
}
convert client address to a IPv4 sockaddr (sockaddr_in)
convert local address to a IPv4 sockaddr (sockaddr_in) }
But as I said, I don't think it's worth worrying for now.
Regards,
Chris
More information about the ds6-devel
mailing list