This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/19582] Deprecate RES_USE_INET6


https://sourceware.org/bugzilla/show_bug.cgi?id=19582

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
In glibc, RES_USE_INET6 indicates that IPv4 addresses should be returned for
IPv6 lookups, as can be seen in resolv/nss_dns/dns-host.c:

      /* If we are looking for an IPv6 address and mapping is enabled
         by having the RES_USE_INET6 bit in _res.options set, we try
         another lookup.  */
      if (af == AF_INET6 && (_res.options & RES_USE_INET6))
        n = __libc_res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf->buf,
                                host_buffer.buf != orig_host_buffer
                                ? MAXPACKET : 1024, &host_buffer.ptr,
                                NULL, NULL, NULL, NULL);

There is code for switching to AF_INET6 with RES_USE_INET6:

enum nss_status
_nss_dns_gethostbyname_r (const char *name, struct hostent *result,
                          char *buffer, size_t buflen, int *errnop,
                          int *h_errnop)
{
  enum nss_status status = NSS_STATUS_NOTFOUND;

  if (_res.options & RES_USE_INET6)
    status = _nss_dns_gethostbyname3_r (name, AF_INET6, result, buffer,
                                        buflen, errnop, h_errnop, NULL, NULL);
  if (status == NSS_STATUS_NOTFOUND)
    status = _nss_dns_gethostbyname3_r (name, AF_INET, result, buffer,
                                        buflen, errnop, h_errnop, NULL, NULL);

  return status;
}

But this code is essentially dead.  gethostbyname calls are mapped to the
gethostbyname2 service module functions internally, and gethostbyname2 (via
gethostbyname3) always use AF_INET if AF_INET is requested, ignoring
RES_USE_INET6.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]