mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: IPv4 and IPv6 addresses in resolv.conf
Date: Sat, 30 Nov 2013 12:42:58 -0500	[thread overview]
Message-ID: <20131130174258.GT24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <alpine.DEB.2.02.1311301730150.19371@jeffraw>

On Sat, Nov 30, 2013 at 05:33:35PM +0000, Rob wrote:
> Rich Felker, Sat, 30 Nov 2013:
> >>
> >>It is EAFNOSUPPORT if no kernel support at all.
> >>
> >>Actually I don't think there can be any cases where sending to the
> >>v4-mapped address (ie ::ffff:1.2.3.4) can fail where an ipv4 socket
> >>will succeed because those are basically ipv4 sockets with just ipv6
> >>notation, those addresses can't be routed by the ipv6 stack. So it
> >
> >One thing I'm confused about is the addresses on the actual packets.
> >If we've already called bind for address :: and gotten assigned port
> >N, does this also reserve port N on 0.0.0.0, which will be needed when
> >sending from (and receiving back) IPv4 packets? Also, is there some
> >kernel option we might need to worry about that prevents :: from
> >receiving packets sent to IPv4 addresses, or does that only apply to
> >TCP, not UDP?
> 
> I've been seeing this output consistently from mpd at startup:
> 
> 	listen: bind to '0.0.0.0:6600' failed: Address already in use
> 	(continuing anyway, because binding to '[::]:6600' succeeded)
> 
> mpd is the only program on my machine that binds to 6600 so it would
> appear that :: port bindings reserve the ipv4 port too. Could be a
> kernel configuration option though...

It looks like this depends on the value of the socket option
IPV6_V6ONLY, which on Linux gets its default from
/proc/sys/net/ipv6/bindv6only, which in turn is 0 (off) by default. So
on systems with non-default configuration, the proposed musl strategy
could badly break use of v4 nameservers (in a mixed environment).

I think manually setting IPV6_V6ONLY to 0 with setsockopt before the
bind should make it possible to reliably get the behavior you
described (and which we want).

Rich


  reply	other threads:[~2013-11-30 17:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 10:09 orc
2013-11-29 17:44 ` Rich Felker
2013-11-30  0:37   ` Rich Felker
2013-11-30  1:18     ` Strake
2013-11-30  3:17       ` Rich Felker
2013-11-30  3:45         ` Strake
2013-11-30  3:51           ` Rich Felker
2013-11-30  3:59             ` Rich Felker
2013-11-30  9:16               ` Justin Cormack
2013-11-30 17:01                 ` Rich Felker
2013-11-30 17:23                   ` Justin Cormack
2013-11-30 17:30                     ` Rich Felker
2013-11-30 17:33                       ` Rob
2013-11-30 17:42                         ` Rich Felker [this message]
2013-11-30 17:43                         ` Justin Cormack
2013-11-30 18:52                           ` Rich Felker
2013-11-30  9:13             ` Laurent Bercot
2013-11-30 10:18               ` John Spencer
2013-11-30 16:53               ` Rich Felker
2013-11-30 15:27     ` orc
2013-12-03  2:11       ` Rich Felker

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=20131130174258.GT24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).