Mailing List Archive

question about IPv6-DNS-nameserver link-local (with Interface-name)
Hi,

In my test environment some soho/mobile routers propagate
IPv6-link-local-adresses to the client(DNS).

In general there is no problem.

Opensuse/NetworkManager writes to /etc/resolv.conf

nameserver fe80::d27a:b5ff:fe7b:e152%wlan0

(Win7, win8, looks similar with its interface-ID)

Ubuntu configures dnsmasq to use this address.

So far so good.
But not all applications accept this DNS-Resolver.

"host" and "dig" make problems.

I described the Situation here in more details.

https://bugzilla.novell.com/show_bug.cgi?id=885053


But I am not sure, where is the bug?
Is it ok, to assign link-local-addresses in /etc/resolv.conf?
or
Are "host", "dig" and maybe other apps buggy?
(confused by IP-addresses with interface extension)
If you try to reproduce my problem - switch off ipv4.

Regards,

Thomas



--

There’s no place like ::1

Thomas Schäfer (Systemverwaltung)
Ludwig-Maximilians-Universität
Centrum für Informations- und Sprachverarbeitung
Oettingenstraße 67 Raum C109
80538 München ☎ +49/89/2180-9706 ℻ +49/89/2180-9701
Re: question about IPv6-DNS-nameserver link-local (with Interface-name) [ In reply to ]
Hi Thomas,

On 01.07.2014 17:20, Thomas Schäfer wrote:
> (Win7, win8, looks similar with its interface-ID)
Does it also work when the Windows boxes are connected to multiple IPv6
networks? Windows does some kind of default routing for link-local
addresses when there is only one link up and running.


> But not all applications accept this DNS-Resolver.
Been there.

According to my research, this is not a bug but a "missing feature" in
some userland tools.
A link-local address requires a zone (e.g. %eth0) to work. This
information has to be provided when the software opens a socket and
connects or binds to an address. There are two commonly used ways to do
this in C/C++.

1)
In Linux via struct sockaddr_in6 casted to struct sockaddr with the
filed sin6_scope_id containing the interface index. I don't know if this
is also BSD comptabile. BSD and how it leaks to userspace scope_id would
be worth a rant anyways ;)

Example:
struct sockaddr_in6 {
[...]
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* Scope ID (new in 2.4) */
};

if (connect(sd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
return EXIT_FAILURE;
}

Source:
https://github.com/danrl/sixsockets/blob/master/oracle6.c#L71
http://linux.die.net/man/7/ipv6


2)
Via control message data that follows a control message header.
This is cross-platform IRRC (BSD-Guru Benedikt knows better!)

Example:
ipi = (struct in6_pktinfo *) CMSG_DATA(cmsghdr);
ipi->ipi_ifindex = ps->ps_ifindex;

Source:

https://github.com/danrl/ratools/blob/master/src/packetset.c#L379


I tried to find the right spot in the dig and host source code files,
but I ran out of time. My guess is, the interface index is not provided
when opening the socket. Either because it is not implement or because
the zone was not correctly parsed by or passed to the application.


Cheers


Dan

--
Dan Lüdtke
https://www.danrl.de/
Re: question about IPv6-DNS-nameserver link-local (with Interface-name) [ In reply to ]
Thomas Schäfer <thomas@cis.uni-muenchen.de> wrote:
>
> Opensuse/NetworkManager writes to /etc/resolv.conf
>
> nameserver fe80::d27a:b5ff:fe7b:e152%wlan0
>
> So far so good.
> But not all applications accept this DNS-Resolver.
>
> "host" and "dig" make problems.
>
> But I am not sure, where is the bug?

I think the bug is that host and dig fail to read the scope on the
link-local address. (This is a bug in the BIND lwres resolv.conf
parser which dig and host use.)

> Is it ok, to assign link-local-addresses in /etc/resolv.conf?

I think most libc resolvers handle them correctly. Your milage will
obviously vary with other code. For example, ldns also fails to handle
scoped IPv6 addresses.

Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Tyne, West Dogger: Variable 3 or 4, becoming southerly 4 or 5 later. Slight.
Fair. Good.