使用了IPv6 resolv.h的名称解析 [英] Using the name resolver of resolv.h with IPv6
问题描述
我写或修改其执行名称解析,需要一个程序
良好的控制过程。所以,我不使用的getaddrinfo()
,我走了
更深,使用 res_query()的
/ res_send()
的/ etc中的 resolv.h
,记录
在解析(3)。
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_query()
/ res_send()
/ etc in resolv.h
, documented
in resolver(3).
虽然没有记录,以设置所使用的解析器的常用的方法是
更新 _res.nsaddr_list
。但是,这阵,在resolv.h定义,专卖店结构SOCKADDR_IN
,那就是IPv4的地址只。 (IPv6地址
是结构体sockaddr_in6
,一个家庭,独立的系统将使用结构sockaddr
)
Although not documented, the common way to set the resolver used is to
update _res.nsaddr_list
. But this array, defined in resolv.h, stores
struct sockaddr_in
, that is IPv4 addresses only. (IPv6 addresses
are struct sockaddr_in6
, a family-independant system would use struct sockaddr
.)
我在寻找一种方式(preferrably便携,最起码在
各种Unix)来告诉 _res
,我也想IPv6地址。
I'm looking for a way (preferrably portable, at least among the
various Unix) to tell _res
that I want also IPv6 addresses.
显然,在很久以前,有在FreeBSD下一个 _res_ext
与此
能力,但我不能在最近的FreeBSD 7再找到它(的grep
觉得没有什么)。你仍然可以找到
_res_ext /usr/include/resolv.h
code,它使用它(自己尝试与谷歌codesearch )。
Apparently, a long time ago, there was in FreeBSD a _res_ext
with this
ability but I cannot find it anymore in a recent FreeBSD 7 (grep
_res_ext /usr/include/resolv.h
finds nothing). You can still find
code which uses it (try yourself with Google Codesearch).
由于参宿一,我注意到它显然是现在 _res._ext
,而不是 .res_ext
。我不知道这样的事情都记录或宣布...我不知道如何移动 _res._ext
是。我能找到它在Debian和FreeBSD。它似乎有其使用一些程序。
Thanks to Alnitak, I noticed it is apparently now _res._ext
and not .res_ext
. I wonder where these sort of things are documented or announced... I have no idea how portable _res._ext
is. I can find it on Debian and FreeBSD. It seems there are few programs which use it.
推荐答案
斯特凡 - 如果你的 resolv.h
不包括任何支持体sockaddr_in6
那么这表明,在特定的O / S的解析器本身并不支持IPv6传输。
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 - 支持BIND 9库,它有一个
res_setservers()
函数的可以的采取IPv6地址,没有_res._ext
扩展。
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 - 有 _res._ext
扩展,尽管有手册页没有IPv6的提及为的resolv.conf
除了有一个设置来告诉解析器寻找一个记录的gethostbyname()
。
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()
.
编辑 - 此外, CVS仓库 FreeBSD的建议的FreeBSD 7.0(见标记 FREEBSD_7_0_0_RELEASE
)不还支持 res_setservers()
从BIND 9。
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.
这篇关于使用了IPv6 resolv.h的名称解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!