title: Using the name resolver of resolv.h with IPv6
body: <p>I write or modify programs which perform name resolution and need a
  good control of the process. So I do not use <code>getaddrinfo()</code>, I go
  deeper and use <code>res_query()</code> / <code>res_send()</code> / etc in <code>resolv.h</code>, documented
  in resolver(3). </p>
  
  <p>Although not documented, the common way to set the resolver used is to
  update <code>_res.nsaddr_list</code>. But this array, defined in resolv.h, stores
  <code>struct sockaddr_in</code>, that is IPv4 addresses only. (IPv6 addresses
  are <code>struct sockaddr_in6</code>, a family-independant system would use <code>struct sockaddr</code>.)</p>
  
  <p>I'm looking for a way (preferrably portable, at least among the
  various Unix) to tell <code>_res</code> that I want also IPv6 addresses.</p>
  
  <p>Apparently, a long time ago, there was in FreeBSD a <code>_res_ext</code> with this
  ability but I cannot find it anymore in a recent FreeBSD 7 (<code>grep
  _res_ext /usr/include/resolv.h</code> finds nothing). You can still find
  <a href="http://www.squid-cache.org/~hno/changesets/squid3/patches/5775.patch" rel="nofollow noreferrer">code which uses it</a> (try yourself <a href="http://www.google.com/codesearch?hl=en&amp;lr=&amp;q=&quot;_res_ext&quot;+&quot;nsaddr_list&quot;&amp;sbtn=Search" rel="nofollow noreferrer">with Google Codesearch</a>).</p>
  
  <p>Thanks to Alnitak, I noticed it is apparently now <code>_res._ext</code> and not <code>.res_ext</code>. I wonder where these sort of things are documented or announced... I have no idea how portable <code>_res._ext</code> is. I can find it on Debian and FreeBSD. It seems there are few programs which use it.</p>