Users of IPv6 certainly want too keep the same level of connectivity to the Internet they used to have without IPv6. The application programmer can ensure, by means of the getaddrinfo() and AI_V4MAPPED flag, that a DNS name resolves at least into an A record if no AAAA records are available. An IPv6 application can also initiate the communication with an IPv4 node by using an IPv4-mapped IPv6 address in the sockaddr_in6 structure. The library implementing BSD Sockets API must then translate on the fly between IPv4 and IPv6 so that the IPv4 node receives only IPv4 datagrams and, conversely, translate the IPv4 datagrams coming from the IPv4 node into the IPv4- mapped IPv6 addresses.
As a result, applications utilising IPv6 sockets usually do not have to distinguish between native and IPv4-mapped IPv6 addresses. For those that do, the IN6_IS_ADDR_V4MAPPED macro is defined in
