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:01:12 -0500	[thread overview]
Message-ID: <20131130170112.GR24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAK4o1Wz59aaygTo3hnKBq_7GK8SZUQ5CCLrrhT5ifZs4uXGihA@mail.gmail.com>

On Sat, Nov 30, 2013 at 09:16:54AM +0000, Justin Cormack wrote:
> On 30 Nov 2013 03:59, "Rich Felker" <dalias@aerifal.cx> wrote:
> >
> > On Fri, Nov 29, 2013 at 10:51:16PM -0500, Rich Felker wrote:
> > > On Fri, Nov 29, 2013 at 10:45:26PM -0500, Strake wrote:
> > > > On 29/11/2013, Rich Felker <dalias@aerifal.cx> wrote:
> > > > > But that would mean complete unconditional DNS failure on systems
> > > > > lacking IPv6.
> > > >
> > > > We could do so iff system has IPv6. Switching on whether system has
> > > > IPv6 rather than whether resolv.conf has any IPv6 nameservers means
> > > > * no check whether resolv.conf includes v6 server
> > > > * that adding a v6 server to resolv.conf can not break DNS even on
> > > > systems lacking v6
> > > > which seems saner.
> > >
> > > OK, so how do we detect if the system "has IPv6"? I don't think it's
> >
> > BTW, short of an answer to this question, I think the approach I
> > already suggested is rather safe. I can't imagine how an IPv6
> > nameserver address would end up in resolv.conf on a system completely
> > lacking IPv6 support at the kernel level.
> 
> I can imagine how it got there eg if you have a standard config or you
> compile a new kernel and omit ipv6...

Indeed, this is conceivable. However, if the system is intended to be
used on an IPv6 network and you compile without IPv6 in the kernel,
lots of things will break and you probably just need to fix the
kernel. Still I'd like to avoid more breakage here than necessary.

Can you (or anyone) fill me in on how things fail on a system built
without IPv6 support or with broken IPv6 configuration? I assume the
original socket() call will fail (with what errno?) if IPv6 support is
not even compiled into the kernel, but are there other cases where
socket() might succeed but then sending to a v4-mapped address would
fail (where sending to the same v4 address with a v4 socket would
work)?

The fallback scheme I'm thinking of using is something like:

	if (have_any_v6_nameservers) {
		if (socket(PF_INET6, ...) && errno=EAFNOSUPPORT) {
			disable any v6 nameservers
			open and use v4 socket
		}
		v4-map all v4 nameservers
		use v6 socket
	} else {
		open and use v4 socket
	}

Does this look reasonable?

Rich


  reply	other threads:[~2013-11-30 17:01 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 [this message]
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
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=20131130170112.GR24286@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).