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

Dan Lüdtke mail at
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++.

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

         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;


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

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


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.



Dan Lüdtke

More information about the ipv6-ops mailing list