Using the name resolver of resolv.h with IPv6

后端 未结 2 1287
你的背包
你的背包 2020-12-21 06:57

I write or modify programs which perform name resolution and need a good control of the process. So I do not use getaddrinfo(), I go deeper and use res_qu

相关标签:
2条回答
  • 2020-12-21 07:37

    Stéphane - if your resolv.h doesn't include any support for sockaddr_in6 then that suggests that on your particular O/S the resolver does not itself support IPv6 transport.

    I've checked some of my systems here:

    • MacOS X 10.5.6 - supports the BIND 9 library, which has a res_setservers() function which can take IPv6 addresses, no _res._ext extension.

    • CentOS 5.2 - has the _res._ext extension, although there's no mention of IPv6 in the man page for resolv.conf except that there's a setting to tell the resolver to return AAAA records before looking for A records for gethostbyname().

    EDIT - also, the CVS repository for FreeBSD suggests that FreeBSD 7.0 (see tag FREEBSD_7_0_0_RELEASE) does also support res_setservers() from Bind 9.

    0 讨论(0)
  • 2020-12-21 07:43

    glibc:

    res_setservers: no
    __res_state._u._ext.nsaddrs
    __res_state._u._ext.nsmap
    

    set the latter to MAXNS+1 according to:

    http://sourceware.org/ml/libc-hacker/2002-05/msg00035.html

    BSD-libc:

    res_setservers: yes
    __res_state._u._ext.__res_state_ext
    

    Seems messy to me and you'll probably need autoconf.

    0 讨论(0)
提交回复
热议问题