question about IPv6-DNS-nameserver link-local (with Interface-name)
Dan Lüdtke
mail at danrl.de
Tue Jul 1 18:53:47 CEST 2014
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/
More information about the ipv6-ops
mailing list