Subject: IPv4-mapped IPv6 IP bind()ing problems...
To: None <firstname.lastname@example.org>
From: icmps <email@example.com>
Date: 03/06/2003 16:42:20
Hey, recently I have had trouble with a simple IPv6 program
(http://220.127.116.11/test.c) to bind a local IPv4-mapped IPv6 address
(::ffff:127.0.0.1). The problem is that it returns EADDRNOTAVAIL
regardless of whether the v6only sysctl is 1 or 0 (I always change it to
0...). I tested the program on other boxes... older -current, 1.5
-current and 1.6_STABLE (mine, w/ a kernel from ~january 03 sources) and
they all exhibit the exact same behavior.
Of course, ::ffff:127.0.0.1 w/o a port (basically to use IPv4 over
AF_INET6, it works on Linux & FreeBSD so reasonably I expected it to
work on NetBSD too) would/should always be available... is this wrong?
I looked through the mailing lists and saw a similar problem @
So, curiously I checked my in6_pcb.c and found that opt_inet.h was NOT
included.... thus omitting an entire section of code which, at least,
makes connect() return EADDRNOTAVAIL, imo, erroneously. Though,
seemingly this doesn't explain the bind()... I looked in
in6_pcb.c:in6_pcbbind() and see (line 182 in -stable sources):
* since we do not check port number duplicate with IPv4
* we reject it at this moment. If we leave it, we would
* mistakenly allow normal users to hijack tcp/udp ports
* other users.
is this the source of my problems? I'm just curious as to why I cannot
bind a IPv4-mapped IPv6 IP since it works fine on other OSes... am I
doing something wrong?
By the way, for the connect() thing above, I figured it was a bug and
filed PR kern/20559 - if this is invalid, feel free to close it.