From: Pekka Savola <pekkas@netcore.fi>
To: netdev@vger.kernel.org
Subject: IPv6 multicast bind(), esp. v4-mapped addresses
Date: Fri, 5 Dec 2008 08:42:37 +0200 (EET) [thread overview]
Message-ID: <alpine.LRH.2.00.0812050820380.28482@netcore.fi> (raw)
Hi,
Java multicast API uses IPv6 sockets internally unless IPv6 is
disabled. In other APIs as well it might be beneficial to be able to
use IPv4 through IPv6 mapped addresses. This works fine with unicast,
but there are problems with this in multicast (I've also included
broadcast here because ipv4 side does that, I don't see the case for
it myself).
Specifically, bind() to a v6-mapped v4 multicast address fails with
EADDRNOTAVAIL:
bind(7, {sa_family=AF_INET6, sin6_port=htons(2000),
inet_pton(AF_INET6, "::ffff:233.12.174.101", &sin6_addr),
sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EADDRNOTAVAIL (Cannot
assign requested address).
Two questions:
1) should this be supported? I think we're talking about a change in
net/ipv6/af_inet6.c, replacing something like (not tested, adapted
from net/ipv4/af_inet.c):
273 if (addr_type == IPV6_ADDR_MAPPED) {
274 v4addr = addr->sin6_addr.s6_addr32[3];
275 if (inet_addr_type(net, v4addr) != RTN_LOCAL) {
276 err = -EADDRNOTAVAIL;
277 goto out;
278 }
279 } else {
with:
if (addr_type == IPV6_ADDR_MAPPED) {
v4addr = addr->sin6_addr.s6_addr32[3];
if (inet_addr_type(net, v4addr) == RTN_MULTICAST ||
inet_addr_type(net, v4addr) == RTN_BROADCAST) {
inet->saddr = 0; /* Use device */
} else {
if (inet_addr_type(net, v4addr) != RTN_LOCAL) {
err = -EADDRNOTAVAIL;
goto out;
}
}
} else {
2) it appears that ip_nonlocal_bind sysctl only supports ipv4.
Similar option or applying the same for v6 may be useful,
especially if 1) is not changed, such a toggle might be useful
with v6 as well.
You can see some specification discussion on this topic here:
http://www.mail-archive.com/ipng@sunroof.eng.sun.com/msg02134.html
--
Pekka Savola "You each name yourselves king, yet the
Netcore Oy kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
next reply other threads:[~2008-12-05 6:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 6:42 Pekka Savola [this message]
2008-12-05 7:11 ` IPv6 multicast bind(), esp. v4-mapped addresses YOSHIFUJI Hideaki / 吉藤英明
2008-12-05 7:42 ` Pekka Savola
2008-12-05 8:03 ` David Miller
2008-12-10 7:22 ` Pekka Savola
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.00.0812050820380.28482@netcore.fi \
--to=pekkas@netcore.fi \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).