• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

arpa/29-Jul-2022-681489

bits/types/29-Jul-2022-6252

nss_dns/29-Jul-2022-2,1041,501

sys/29-Jul-2022-41

tst-leaks2.root/etc/29-Jul-2022-42

DependD29-Jul-20229 32

MakefileD29-Jul-20228.4 KiB288208

READMED29-Jul-20225.3 KiB152118

VersionsD29-Jul-20224.2 KiB244240

base64.cD29-Jul-202210.1 KiB311152

compat-gethnamaddr.cD29-Jul-202221.7 KiB919753

compat-hooks.cD29-Jul-20222.1 KiB5716

dn_comp.cD29-Jul-20224.9 KiB10414

dn_expand.cD29-Jul-20225.3 KiB11321

dn_skipname.cD29-Jul-20224.9 KiB10417

gai_cancel.cD29-Jul-20221.6 KiB5628

gai_error.cD29-Jul-20221.2 KiB3616

gai_misc.cD29-Jul-202211.1 KiB446278

gai_misc.hD29-Jul-20222.9 KiB10146

gai_notify.cD29-Jul-20223.8 KiB13988

gai_sigqueue.cD29-Jul-20221 KiB3212

gai_suspend.cD29-Jul-20225.6 KiB191131

getaddrinfo_a.cD29-Jul-20225.1 KiB191127

herror.cD29-Jul-20223.7 KiB10846

inet_addr.cD29-Jul-20227.1 KiB21899

inet_net_ntop.cD29-Jul-20223.1 KiB12874

inet_net_pton.cD29-Jul-20225.2 KiB199133

inet_neta.cD29-Jul-20221.9 KiB7742

inet_ntop.cD29-Jul-20224.9 KiB186104

inet_pton.cD29-Jul-20226.2 KiB235173

libanl-compat.cD29-Jul-20221.2 KiB3612

mapv4v6addr.hD29-Jul-20223 KiB7013

mapv4v6hostent.hD29-Jul-20223.3 KiB8528

netdb.hD29-Jul-202227.8 KiB725304

ns_date.cD29-Jul-20223.5 KiB11862

ns_makecanon.cD29-Jul-20221.7 KiB5124

ns_name.cD29-Jul-20222.6 KiB12270

ns_name_compress.cD29-Jul-20222.2 KiB5119

ns_name_ntop.cD29-Jul-20223.8 KiB146112

ns_name_pack.cD29-Jul-20225.8 KiB203145

ns_name_pton.cD29-Jul-20224.3 KiB158131

ns_name_skip.cD29-Jul-20222.3 KiB7143

ns_name_uncompress.cD29-Jul-20221.9 KiB4623

ns_name_unpack.cD29-Jul-20223.5 KiB11683

ns_netint.cD29-Jul-20221.4 KiB5828

ns_parse.cD29-Jul-20225.1 KiB203149

ns_print.cD29-Jul-202217.9 KiB770560

ns_samedomain.cD29-Jul-20223.6 KiB14868

ns_samename.cD29-Jul-20221.4 KiB3915

ns_ttl.cD29-Jul-20223.3 KiB163111

nsap_addr.cD29-Jul-20222.1 KiB9366

nss_dns_functions.cD29-Jul-20221.5 KiB4120

res-close.cD29-Jul-20225.8 KiB14548

res-name-checking.cD29-Jul-20228.1 KiB221109

res-noaaaa.cD29-Jul-20225.1 KiB14474

res-putget.cD29-Jul-20224.6 KiB11324

res-state.cD29-Jul-2022920 288

res_context_hostalias.cD29-Jul-20225.4 KiB13346

res_data.cD29-Jul-20222.3 KiB558

res_debug.cD29-Jul-202229.7 KiB1,098776

res_enable_icmp.cD29-Jul-20221.2 KiB3818

res_get_nsaddr.cD29-Jul-20221.5 KiB4014

res_hconf.cD29-Jul-202213.9 KiB572364

res_hconf.hD29-Jul-20222.1 KiB5422

res_hostalias.cD29-Jul-20221.7 KiB5229

res_init.cD29-Jul-202224 KiB728527

res_isourserver.cD29-Jul-20225.7 KiB13544

res_libc.cD29-Jul-20224.4 KiB11340

res_mkquery.cD29-Jul-202211 KiB301159

res_nameinquery.cD29-Jul-20225 KiB11627

res_queriesmatch.cD29-Jul-20225.5 KiB13033

res_query.cD29-Jul-202221.4 KiB688478

res_randomid.cD29-Jul-20224.4 KiB948

res_send.cD29-Jul-202240.8 KiB1,323833

resolv-deprecated.cD29-Jul-20222 KiB5724

resolv-internal.hD29-Jul-20225.5 KiB13152

resolv.hD29-Jul-202212 KiB310213

resolv_conf.cD29-Jul-202222.3 KiB681471

resolv_conf.hD29-Jul-20224.1 KiB10839

resolv_context.cD29-Jul-20227.6 KiB253152

resolv_context.hD29-Jul-20226.5 KiB18092

tst-aton.cD29-Jul-20222.7 KiB10175

tst-bug18665-tcp.cD29-Jul-20226.9 KiB231174

tst-bug18665.cD29-Jul-20223.7 KiB13999

tst-inet_aton_exact.cD29-Jul-20221.8 KiB4822

tst-inet_ntop.cD29-Jul-20222.5 KiB115102

tst-inet_pton.cD29-Jul-202213.8 KiB493449

tst-leaks.cD29-Jul-20221.3 KiB4415

tst-leaks2.cD29-Jul-20221.3 KiB4320

tst-no-libidn2.cD29-Jul-2022105 30

tst-ns_name.cD29-Jul-202213.6 KiB439368

tst-ns_name.dataD29-Jul-2022195.7 KiB549544

tst-ns_name_compress.cD29-Jul-20222.5 KiB7753

tst-ns_name_pton.cD29-Jul-20226.9 KiB211164

tst-p_secstodate.cD29-Jul-20222 KiB7346

tst-res_hconf_reorder.cD29-Jul-20222.6 KiB11471

tst-res_hnok.cD29-Jul-20225.3 KiB170128

tst-resolv-ai_idn-common.cD29-Jul-202221.4 KiB572464

tst-resolv-ai_idn-latin1.cD29-Jul-20221.7 KiB5629

tst-resolv-ai_idn-nolibidn2.cD29-Jul-20225.4 KiB152105

tst-resolv-ai_idn.cD29-Jul-20221.7 KiB5529

tst-resolv-basic.cD29-Jul-202218 KiB504443

tst-resolv-binary.cD29-Jul-20224 KiB12177

tst-resolv-canonname.cD29-Jul-202210.5 KiB314268

tst-resolv-edns.cD29-Jul-202215.5 KiB533431

tst-resolv-network.cD29-Jul-202210.6 KiB310257

tst-resolv-noaaaa.cD29-Jul-202217.6 KiB538457

tst-resolv-nondecimal.cD29-Jul-20224.3 KiB14098

tst-resolv-qtypes.cD29-Jul-20225.9 KiB186140

tst-resolv-res_init-multi.cD29-Jul-20222.5 KiB9058

tst-resolv-res_init-skeleton.cD29-Jul-202235.4 KiB1,115929

tst-resolv-res_init-thread.cD29-Jul-2022910 212

tst-resolv-res_init.cD29-Jul-2022914 212

tst-resolv-res_ninit.cD29-Jul-20222.5 KiB7647

tst-resolv-rotate.cD29-Jul-20228.3 KiB264215

tst-resolv-search.cD29-Jul-20229.7 KiB345280

tst-resolv-threads.cD29-Jul-202211.9 KiB426346

tst-resolv-trailing.cD29-Jul-20224.1 KiB137104

tst-resolv-trustad.cD29-Jul-20226.5 KiB201146

tst-resolv-txnid-collision.cD29-Jul-202210.1 KiB335238

README

1The resolver in the GNU C Library
2*********************************
3
4Starting with version 2.2, the resolver in the GNU C Library comes
5from BIND 8.  Only a subset of the src/lib/resolv part of libbind is
6included here; basically the parts that are needed to provide the
7functionality present in the resolver from BIND 4.9.7 that was
8included in the previous release of the GNU C Library, augmented by
9the parts needed to provide thread-safety.  This means that support
10for things as dynamic DNS updates and TSIG keys isn't included.  If
11you need those facilities, please take a look at the full BIND
12distribution.
13
14
15Differences
16===========
17
18The resolver in the GNU C Library still differs from what's in BIND
198.2.3-T5B:
20
21* The RES_DEBUG option (`options debug' in /etc/resolv.conf) has been
22  disabled.
23
24* The resolver in glibc allows underscores in domain names.
25
26* The <resolv.h> header in glibc includes <netinet/in.h> and
27  <arpa/nameser.h> to make it self-contained.
28
29* The `res_close' function in glibc only tries to close open files
30  referenced through `_res' if the RES_INIT bit is set in
31  `_res.options'.  This fixes a potential security bug with programs
32  that bogusly call `res_close' without initialising the resolver
33  state first.  Note that the thread-safe `res_nclose' still doesn't
34  check the RES_INIT bit.  By the way, you're not really supposed to
35  call `res_close/res_nclose' directly.
36
37* The resolver in glibc can connect to a nameserver over IPv6.  Just
38  specify the IPv6 address in /etc/resolv.conf.  You cannot change the
39  address of an IPv6 nameserver dynamically in your program though.
40
41
42Using the resolver in multi-threaded code
43=========================================
44
45The traditional resolver interfaces `res_query', `res_search',
46`res_mkquery', `res_send' and `res_init', used a static (global)
47resolver state stored in the `_res' structure.  Therefore, these
48interfaces are not thread-safe.  Therefore, BIND 8.2 introduced a set
49of "new" interfaces `res_nquery', `res_nsearch', `res_nmkquery',
50`res_nsend' and `res_ninit' that take a `res_state' as their first
51argument, so you can use a per-thread resolver state.  In glibc, when
52you link with -lpthread, such a per-thread resolver state is already
53present.  It can be accessed using `_res', which has been redefined as
54a macro, in a similar way to what has been done for the `errno' and
55`h_errno' variables.  This per-thread resolver state is also used for
56the `gethostby*' family of functions, which means that for example
57`gethostbyname_r' is now fully thread-safe and re-entrant.  The
58traditional resolver interfaces however, continue to use a single
59resolver state and are therefore still thread-unsafe.  The resolver
60state is the same resolver state that is used for the initial ("main")
61thread.
62
63This has the following consequences for existing binaries and source
64code:
65
66* Single-threaded programs will continue to work.  There should be no
67  user-visible changes when you recompile them.
68
69* Multi-threaded programs that use the traditional resolver interfaces
70  in the "main" thread should continue to work, except that they no
71  longer see any changes in the global resolver state caused by calls
72  to, for example, `gethostbyname' in other threads.  Again there
73  should be no user-visible changes when you recompile these programs.
74
75* Multi-threaded programs that use the traditional resolver interfaces
76  in more than one thread should be just as buggy as before (there are
77  no problems if you use proper locking of course).  If you recompile
78  these programs, manipulating the _res structure in threads other
79  than the "main" thread will seem to have no effect though.
80
81* In Multi-threaded that manipulate the _res structure, calls to
82  functions like `gethostbyname' in threads other than the "main"
83  thread won't be influenced by the those changes anymore.
84
85We recommend to use the new thread-safe interfaces in new code, since
86the traditional interfaces have been deprecated by the BIND folks.
87For compatibility with other (older) systems you might want to
88continue to use those interfaces though.
89
90
91Using the resolver in C++ code
92==============================
93
94There resolver contains some hooks which will allow the user to
95install some callback functions that make it possible to filter DNS
96requests and responses.  Although we do not encourage you to make use
97of this facility at all, C++ developers should realise that it isn't
98safe to throw exceptions from such callback functions.
99
100
101Source code
102===========
103
104The following files come from the BIND distribution (currently version
1058.2.3-T5B):
106
107src/include/
108  arpa/nameser.h
109  arpa/nameser_compat.h
110  resolv.h
111
112src/lib/resolv/
113  herror.c
114  res_comp.c
115  res_data.c
116  res_debug.c
117  res_init.c
118  res_mkquery.c
119  res_query.c
120  res_send.c
121
122src/lib/nameser/
123  ns_name.c
124  ns_netint.c
125  ns_parse.c
126  ns_print.c
127  ns_samedomain.c
128  ns_ttl.c
129
130src/lib/inet/
131  inet_addr.c
132  inet_net_ntop.c
133  inet_net_pton.c
134  inet_neta.c
135  inet_ntop.c
136  inet_pton.c
137  nsap_addr.c
138
139src/lib/isc/
140  base64.c
141
142Some of these files have been optimised a bit, and adaptations have
143been made to make them fit in with the rest of glibc.
144
145res_libc.c is home-brewn, although parts of it are taken from res_data.c.
146
147res_hconf.c and res_hconf.h were contributed by David Mosberger, and
148do not come from BIND.
149
150The files gethnamaddr.c, mapv4v6addr.h and mapv4v6hostent.h are
151leftovers from BIND 4.9.7.
152