Testing IPv6 support and dualstack networking can be very tricky. The purpose of this document is to provide a live resource on testing situations arising from existance and usage of two network layer protocols.
Configuration
Base system components related to IPv6 and dual-stack operation:
- kernel
- glibc
Name resolution
Name resolution features are provided by the GNU C Library (glibc) which is not yet ready for proper IPv6 and dual-stack operation as you can see when performing your tests. The C library comes with its own testing tool getent
that has a special database called ahosts
that runs getaddrinfo()
, the library function that translates names to objects with addressing information. For your testing it is best used together with tools like strace
, ltrace
or even gdb
so that you know exactly what is happening behind the scenes.
$ getent ahosts www.fedoraproject.org raw 2604:1580:fe00:0:5054:ff:feae:702c STREAM wildcard.fedoraproject.org 2604:1580:fe00:0:5054:ff:feae:702c DGRAM 2604:1580:fe00:0:5054:ff:feae:702c RAW 2607:f188::dead:beef:cafe:fed1 STREAM 2607:f188::dead:beef:cafe:fed1 DGRAM 2607:f188::dead:beef:cafe:fed1 RAW 2001:4178:2:1269::fed2 STREAM 2001:4178:2:1269::fed2 DGRAM 2001:4178:2:1269::fed2 RAW 2610:28:3090:3001:dead:beef:cafe:fed3 STREAM 2610:28:3090:3001:dead:beef:cafe:fed3 DGRAM 2610:28:3090:3001:dead:beef:cafe:fed3 RAW 66.35.62.162 STREAM 66.35.62.162 DGRAM 66.35.62.162 RAW 140.211.169.196 STREAM 140.211.169.196 DGRAM 140.211.169.196 RAW 209.132.181.15 STREAM 209.132.181.15 DGRAM 209.132.181.15 RAW 152.19.134.142 STREAM 152.19.134.142 DGRAM 152.19.134.142 RAW 67.219.144.68 STREAM 67.219.144.68 DGRAM 67.219.144.68 RAW 67.203.2.67 STREAM 67.203.2.67 DGRAM 67.203.2.67 RAW 209.132.181.16 STREAM 209.132.181.16 DGRAM 209.132.181.16 RAW
Even in the simple example above you can see that the name resolution topic won't be as simple as one would guess.
Name resolution input
When application requests addressing information for a hostname with an optional service name, the library returns a list of addressing information objects. The order of objects in the list is significant and depends on operating system configuration and connectivity.
Input from the application
- nodename
- servname
- protocol
- socktype
- flags
AI_CANONNAME
- ...
Input from the local configuration
- To what extend is IPv4 and IPv6 available
Input from the outside world
- DNS information
- Multicast DNS information
- LDAP information
Name resolution processing
What is requested
Not all information is requested at all times. Some information like canonical name must be explicitly requested by the application via AI_CANONNAME
flag. It may be desirable to suppress other requests by local configuration or connectivity checks, a notable example being suppression of DNS AAAA queries on hosts without global connectivity.
What is passed to the application
Not all information that is learnt via requests is presented to the application. It is typically filtered according to input from the application. It is sometimes also filtered according to connectivity checks but that has caused more problems than improvements.
How it is sorted
There are rules for sorting addressing information returned by getaddrinfo()
. One of the basic features is to return global IPv6 destinations before global IPv4 destinations. But when the library detects that IPv6 connectivity is not available, the reverse applies.