1 .\" Copyright (c) 1985, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)resolver.3 8.1 (Berkeley) 6/4/93
57 .Fa "const char *dname"
65 .Fa "const char *dname"
74 .Fa "const char *dname"
77 .Fa "const u_char *data"
79 .Fa "const u_char *newrr_in"
85 .Fa "const u_char *msg"
94 .Fa "const char *exp_dn"
98 .Fa "u_char **lastdnptr"
102 .Fa "const u_char *msg"
103 .Fa "const u_char *eomorig"
104 .Fa "const u_char *comp_dn"
109 .Fn dn_skipname "const u_char *comp_dn" "const u_char *eom"
111 .Fn ns_get16 "const u_char *src"
113 .Fn ns_get32 "const u_char *src"
115 .Fn ns_put16 "u_int src" "u_char *dst"
117 .Fn ns_put32 "u_long src" "u_char *dst"
119 These routines are used for making, sending and interpreting
120 query and reply messages with Internet domain name servers.
122 Global configuration and state information that is used by the
123 resolver routines is kept in the structure
125 Most of the values have reasonable defaults and can be ignored.
132 Options are stored as a simple bit mask containing the bitwise ``or''
133 of the options enabled.
134 .Bl -tag -width RES_USE_INET6
136 True if the initial name server address and default domain name are
141 Print debugging messages.
143 Accept authoritative answers only.
146 should continue until it finds an authoritative answer or finds an error.
147 Currently this is not implemented.
151 connections for queries instead of
159 connection open between
161 This is useful only in programs that regularly do many queries.
163 should be the normal mode used.
165 Unused currently (ignore truncation errors, i.e., do not retry with
168 Set the recursion-desired bit in queries.
171 does not do iterative queries and expects the name server
172 to handle recursion.)
176 will append the default domain name to single-component names
177 (those that do not contain a dot).
178 This option is enabled by default.
180 If this option is set,
182 will search for host names in the current domain and in parent domains; see
184 This is used by the standard host lookup routine
185 .Xr gethostbyname 3 .
186 This option is enabled by default.
188 This option turns off the user level aliasing feature controlled by the
190 environment variable.
191 Network daemons should set this option.
193 Enables support for IPv6-only applications.
194 This causes IPv4 addresses to be returned as an IPv4 mapped address.
198 .Li ::ffff:10.1.1.1 .
199 The option is meaningful with certain kernel configuration only.
201 Enables support for OPT pseudo-RR for EDNS0 extension.
202 With the option, resolver code will attach OPT pseudo-RR into DNS queries,
203 to inform of our receive buffer size.
204 The option will allow DNS servers to take advantage of non-default receive
205 buffer size, and to send larger replies.
206 DNS query packets with EDNS0 extension is not compatible with
207 non-EDNS0 DNS servers.
213 reads the configuration file (if any; see
215 to get the default domain name,
217 the Internet address of the local name server(s).
218 If no server is configured, the host running
219 the resolver is tried.
220 The current domain name is defined by the hostname
221 if not specified in the configuration file;
222 it can be overridden by the environment variable
224 This environment variable may contain several blank-separated
225 tokens if you wish to override the
227 on a per-process basis.
228 This is similar to the
230 command in the configuration file.
231 Another environment variable
234 override certain internal resolver options which are otherwise
235 set by changing fields in the
237 structure or are inherited from the configuration file's
242 environment variable is explained in
244 Initialization normally occurs on the first call
245 to one of the following routines.
249 function provides an interface to the server query mechanism.
250 It constructs a query, sends it to the local server,
251 awaits a response, and makes preliminary checks on the reply.
252 The query requests information of the specified
256 for the specified fully-qualified domain name
258 The reply message is left in the
262 supplied by the caller.
266 routine makes a query and awaits a response like
268 but in addition, it implements the default and search rules
274 It returns the first successful reply.
276 The remaining routines are lower-level routines used by
281 constructs a standard query message and places it in
283 It returns the size of the query, or \-1 if the query is
290 but can be any of the query types defined in
292 The domain name for the query is given by
297 is currently unused but is intended for making update messages.
302 sends a pre-formatted query and returns an answer.
307 is not set, send the query to the local name server, and
308 handle timeouts and retries.
309 The length of the reply message is returned, or
310 \-1 if there were errors.
315 compresses the domain name
319 The size of the compressed name is returned or \-1 if there were errors.
320 The size of the array pointed to by
327 to previously-compressed names in the current message.
328 The first pointer points to
329 the beginning of the message and the list ends with
331 The limit to the array is specified by
335 is to update the list of pointers for
336 labels inserted into the message
337 as the name is compressed.
342 names are not compressed.
347 the list of labels is not updated.
352 expands the compressed domain name
354 to a full domain name
355 The compressed name is contained in a query or reply message;
357 is a pointer to the beginning of the message.
358 The uncompressed name is placed in the buffer indicated by
362 The size of compressed name is returned or \-1 if there was an error.
366 function skips over a compressed domain name, which starts at a location
369 The compressed name is contained in a query or reply message;
371 is a pointer to the end of the message.
372 The size of compressed name is returned or \-1 if there was
377 function gets a 16-bit quantity from a buffer pointed to by
382 function gets a 32-bit quantity from a buffer pointed to by
387 function puts a 16-bit quantity
389 to a buffer pointed to by
394 function puts a 32-bit quantity
396 to a buffer pointed to by
398 .Sh IMPLEMENTATION NOTES
399 This implementation of the resolver is thread-safe, but it will not
400 function properly if the programmer attempts to declare his or her own
402 structure in an attempt to replace the per-thread version referred to
407 function will return 0 on success, or \-1 in a threaded program if
408 per-thread storage could not be allocated.
415 functions return the size of the response on success, or \-1 if an
419 may be checked to determine the reason for error.
422 for more information.
424 .Bl -tag -width /etc/resolv.conf
425 .It Pa /etc/resolv.conf
426 The configuration file,
431 .Xr gethostbyname 3 ,
442 .%T "Name Server Operations Guide for BIND"