diff options
author | deraadt <> | 2019-08-30 18:33:17 +0000 |
---|---|---|
committer | deraadt <> | 2019-08-30 18:33:17 +0000 |
commit | 8246156efcf91d8f31624e8dd455eee553240f60 (patch) | |
tree | 538e1664547aeefad8ffe457703c860ce752d069 /src/lib/libc/net/res_init.3 | |
parent | 72036bf4bbef02536427f2044486d9b6d6e2e355 (diff) | |
download | openbsd-8246156efcf91d8f31624e8dd455eee553240f60.tar.gz openbsd-8246156efcf91d8f31624e8dd455eee553240f60.tar.bz2 openbsd-8246156efcf91d8f31624e8dd455eee553240f60.zip |
Move 4 manual pages from not-a-function filenames to a correct filename,
and correct Xr.
ok jmc
Diffstat (limited to 'src/lib/libc/net/res_init.3')
-rw-r--r-- | src/lib/libc/net/res_init.3 | 410 |
1 files changed, 410 insertions, 0 deletions
diff --git a/src/lib/libc/net/res_init.3 b/src/lib/libc/net/res_init.3 new file mode 100644 index 0000000000..01a6b8e0b3 --- /dev/null +++ b/src/lib/libc/net/res_init.3 | |||
@@ -0,0 +1,410 @@ | |||
1 | .\" $OpenBSD: res_init.3,v 1.1 2019/08/30 18:33:17 deraadt Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 1985, 1991, 1993 | ||
4 | .\" The Regents of the University of California. All rights reserved. | ||
5 | .\" | ||
6 | .\" Redistribution and use in source and binary forms, with or without | ||
7 | .\" modification, are permitted provided that the following conditions | ||
8 | .\" are met: | ||
9 | .\" 1. Redistributions of source code must retain the above copyright | ||
10 | .\" notice, this list of conditions and the following disclaimer. | ||
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer in the | ||
13 | .\" documentation and/or other materials provided with the distribution. | ||
14 | .\" 3. Neither the name of the University nor the names of its contributors | ||
15 | .\" may be used to endorse or promote products derived from this software | ||
16 | .\" without specific prior written permission. | ||
17 | .\" | ||
18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
28 | .\" SUCH DAMAGE. | ||
29 | .\" | ||
30 | .Dd $Mdocdate: August 30 2019 $ | ||
31 | .Dt RES_INIT 3 | ||
32 | .Os | ||
33 | .Sh NAME | ||
34 | .Nm res_query , | ||
35 | .Nm res_search , | ||
36 | .Nm res_mkquery , | ||
37 | .Nm res_send , | ||
38 | .Nm res_init , | ||
39 | .Nm dn_comp , | ||
40 | .Nm dn_expand | ||
41 | .Nd resolver routines | ||
42 | .Sh SYNOPSIS | ||
43 | .In sys/types.h | ||
44 | .In netinet/in.h | ||
45 | .In arpa/nameser.h | ||
46 | .In resolv.h | ||
47 | .Ft int | ||
48 | .Fo res_query | ||
49 | .Fa "const char *dname" | ||
50 | .Fa "int class" | ||
51 | .Fa "int type" | ||
52 | .Fa "unsigned char *answer" | ||
53 | .Fa "int anslen" | ||
54 | .Fc | ||
55 | .Ft int | ||
56 | .Fo res_search | ||
57 | .Fa "const char *dname" | ||
58 | .Fa "int class" | ||
59 | .Fa "int type" | ||
60 | .Fa "unsigned char *answer" | ||
61 | .Fa "int anslen" | ||
62 | .Fc | ||
63 | .Ft int | ||
64 | .Fo res_mkquery | ||
65 | .Fa "int op" | ||
66 | .Fa "const char *dname" | ||
67 | .Fa "int class" | ||
68 | .Fa "int type" | ||
69 | .Fa "const unsigned char *data" | ||
70 | .Fa "int datalen" | ||
71 | .Fa "const unsigned char *newrr" | ||
72 | .Fa "unsigned char *buf" | ||
73 | .Fa "int buflen" | ||
74 | .Fc | ||
75 | .Ft int | ||
76 | .Fo res_send | ||
77 | .Fa "const unsigned char *msg" | ||
78 | .Fa "int msglen" | ||
79 | .Fa "unsigned char *answer" | ||
80 | .Fa "int anslen" | ||
81 | .Fc | ||
82 | .Ft int | ||
83 | .Fn res_init "void" | ||
84 | .Ft int | ||
85 | .Fo dn_comp | ||
86 | .Fa "const char *exp_dn" | ||
87 | .Fa "unsigned char *comp_dn" | ||
88 | .Fa "int length" | ||
89 | .Fa "unsigned char **dnptrs" | ||
90 | .Fa "unsigned char **lastdnptr" | ||
91 | .Fc | ||
92 | .Ft int | ||
93 | .Fo dn_expand | ||
94 | .Fa "const unsigned char *msg" | ||
95 | .Fa "const unsigned char *eomorig" | ||
96 | .Fa "const unsigned char *comp_dn" | ||
97 | .Fa "char *exp_dn" | ||
98 | .Fa "int length" | ||
99 | .Fc | ||
100 | .Sh DESCRIPTION | ||
101 | These routines are used for making, sending, and interpreting | ||
102 | query and reply messages with Internet domain name servers. | ||
103 | .Pp | ||
104 | Global configuration and state information that is used by the | ||
105 | resolver routines is kept in the structure | ||
106 | .Va _res . | ||
107 | Most of the values have reasonable defaults and can be ignored. | ||
108 | Options stored in | ||
109 | .Va _res.options | ||
110 | are defined in | ||
111 | .In resolv.h | ||
112 | and are as follows. | ||
113 | Options are stored as a simple bit mask containing the bitwise OR | ||
114 | of the options enabled. | ||
115 | .Bl -tag -width RES_USE_DNSSEC | ||
116 | .It Dv RES_INIT | ||
117 | True if the initial name server address and default domain name are | ||
118 | initialized (i.e.\& | ||
119 | .Fn res_init | ||
120 | has been called). | ||
121 | .It Dv RES_DEBUG | ||
122 | Print debugging messages, | ||
123 | if libc is compiled with | ||
124 | .Dv DEBUG . | ||
125 | By default on | ||
126 | .Ox | ||
127 | this option does nothing. | ||
128 | .It Dv RES_AAONLY | ||
129 | Accept authoritative answers only. | ||
130 | With this option, | ||
131 | .Fn res_send | ||
132 | should continue until it finds an authoritative answer or finds an error. | ||
133 | On | ||
134 | .Ox | ||
135 | this option does nothing. | ||
136 | .It Dv RES_USEVC | ||
137 | Use TCP connections for queries instead of UDP datagrams. | ||
138 | .It Dv RES_PRIMARY | ||
139 | Query the primary name server only. | ||
140 | On | ||
141 | .Ox | ||
142 | this option does nothing. | ||
143 | .It Dv RES_IGNTC | ||
144 | Ignore truncation errors, i.e. don't retry with TCP. | ||
145 | .It Dv RES_RECURSE | ||
146 | Set the recursion-desired bit in queries. | ||
147 | .Pf ( Fn res_send | ||
148 | does not do iterative queries and expects the name server | ||
149 | to handle recursion.) | ||
150 | This option is enabled by default. | ||
151 | .It Dv RES_DEFNAMES | ||
152 | If set, | ||
153 | .Fn res_search | ||
154 | will append the default domain name to single-component names | ||
155 | (those that do not contain a dot). | ||
156 | This option is enabled by default. | ||
157 | .It Dv RES_STAYOPEN | ||
158 | Used with | ||
159 | .Dv RES_USEVC | ||
160 | to keep the TCP connection open between queries. | ||
161 | This is useful only in programs that regularly do many queries. | ||
162 | UDP should be the normal mode used. | ||
163 | .It Dv RES_DNSRCH | ||
164 | If this option is set, | ||
165 | .Fn res_search | ||
166 | will search for host names in the current domain and in parent domains; see | ||
167 | .Xr hostname 7 . | ||
168 | This is used by the standard host lookup routine | ||
169 | .Xr gethostbyname 3 . | ||
170 | This option is enabled by default. | ||
171 | .It Dv RES_INSECURE_1 | ||
172 | Do not require the IP source address on the reply packet | ||
173 | to be equal to the server's address. | ||
174 | .It Dv RES_INSECURE_2 | ||
175 | Do not check if the query section of the reply packet | ||
176 | is equal to that of the query packet. | ||
177 | .It Dv RES_NOALIASES | ||
178 | This option has no effect. | ||
179 | In the past, it turned off the legacy | ||
180 | .Ev HOSTALIASES | ||
181 | feature. | ||
182 | .It Dv RES_USE_INET6 | ||
183 | Enables support for IPv6-only applications. | ||
184 | This causes IPv4 addresses to be returned as an IPv4 mapped address. | ||
185 | For example, 10.1.1.1 will be returned as ::ffff:10.1.1.1. | ||
186 | On | ||
187 | .Ox | ||
188 | this option does nothing. | ||
189 | .It Dv RES_USE_EDNS0 | ||
190 | Attach an OPT pseudo-RR for the EDNS0 extension, | ||
191 | as specified in RFC 2671. | ||
192 | This informs DNS servers of a client's receive buffer size, | ||
193 | allowing them to take advantage of a non-default receive buffer size, | ||
194 | and thus to send larger replies. | ||
195 | DNS query packets with the EDNS0 extension are not compatible with | ||
196 | non-EDNS0 DNS servers. | ||
197 | .Ox | ||
198 | uses 4096 bytes as input buffer size. | ||
199 | .It Dv RES_USE_DNSSEC | ||
200 | Request that the resolver uses | ||
201 | Domain Name System Security Extensions (DNSSEC), | ||
202 | as defined in RFCs 4033, 4034, and 4035. | ||
203 | .It Dv RES_USE_CD | ||
204 | Set the Checking Disabled flag on queries. | ||
205 | .El | ||
206 | .Pp | ||
207 | The | ||
208 | .Fn res_init | ||
209 | routine reads the configuration file (if any; see | ||
210 | .Xr resolv.conf 5 ) | ||
211 | to get the default domain name, search list, and the Internet address | ||
212 | of the local name server(s). | ||
213 | If no server is configured, the host running | ||
214 | the resolver is tried. | ||
215 | The current domain name is defined by the hostname | ||
216 | if not specified in the configuration file; | ||
217 | it can be overridden by the environment variable | ||
218 | .Ev LOCALDOMAIN . | ||
219 | This environment variable may contain several blank-separated | ||
220 | tokens if you wish to override the search list on a per-process basis. | ||
221 | This is similar to the | ||
222 | .Ic search | ||
223 | command in the configuration file. | ||
224 | Another environment variable | ||
225 | .Ev RES_OPTIONS | ||
226 | can be set to override certain internal resolver options which | ||
227 | are otherwise set by changing fields in the | ||
228 | .Va _res | ||
229 | structure or are inherited from the configuration file's | ||
230 | .Ic options | ||
231 | command. | ||
232 | The syntax of the | ||
233 | .Ev RES_OPTIONS | ||
234 | environment variable is explained in | ||
235 | .Xr resolv.conf 5 . | ||
236 | Initialization normally occurs on the first call | ||
237 | to one of the following routines. | ||
238 | .Pp | ||
239 | The | ||
240 | .Fn res_query | ||
241 | function provides an interface to the server query mechanism. | ||
242 | It constructs a query, sends it to the local server, | ||
243 | awaits a response, and makes preliminary checks on the reply. | ||
244 | The query requests information of the specified | ||
245 | .Fa type | ||
246 | and | ||
247 | .Fa class | ||
248 | for the specified fully qualified domain name | ||
249 | .Fa dname . | ||
250 | The reply message is left in the | ||
251 | .Fa answer | ||
252 | buffer with length | ||
253 | .Fa anslen | ||
254 | supplied by the caller. | ||
255 | Values for the | ||
256 | .Fa class | ||
257 | and | ||
258 | .Fa type | ||
259 | fields | ||
260 | are defined in | ||
261 | .In arpa/nameser.h . | ||
262 | .Pp | ||
263 | The | ||
264 | .Fn res_search | ||
265 | routine makes a query and awaits a response like | ||
266 | .Fn res_query , | ||
267 | but in addition, it implements the default and search rules controlled by the | ||
268 | .Dv RES_DEFNAMES | ||
269 | and | ||
270 | .Dv RES_DNSRCH | ||
271 | options. | ||
272 | It returns the first successful reply. | ||
273 | .Pp | ||
274 | The remaining routines are lower-level routines used by | ||
275 | .Fn res_query . | ||
276 | The | ||
277 | .Fn res_mkquery | ||
278 | function constructs a standard query message and places it in | ||
279 | .Fa buf . | ||
280 | It returns the size of the query, or \-1 if the query is larger than | ||
281 | .Fa buflen . | ||
282 | The query type | ||
283 | .Fa op | ||
284 | is usually | ||
285 | .Dv QUERY , | ||
286 | but can be any of the query types defined in | ||
287 | .In arpa/nameser.h . | ||
288 | The domain name for the query is given by | ||
289 | .Fa dname . | ||
290 | .Fa newrr | ||
291 | is currently unused but is intended for making update messages. | ||
292 | .Pp | ||
293 | The | ||
294 | .Fn res_send | ||
295 | routine sends a pre-formatted query and returns an answer. | ||
296 | It will call | ||
297 | .Fn res_init | ||
298 | if | ||
299 | .Dv RES_INIT | ||
300 | is not set, send the query to the local name server, and | ||
301 | handle timeouts and retries. | ||
302 | The length of the reply message is returned, or \-1 if there were errors. | ||
303 | .Pp | ||
304 | The | ||
305 | .Fn dn_comp | ||
306 | function compresses the domain name | ||
307 | .Fa exp_dn | ||
308 | and stores it in | ||
309 | .Fa comp_dn . | ||
310 | The size of the compressed name is returned or \-1 if there were errors. | ||
311 | The size of the array pointed to by | ||
312 | .Fa comp_dn | ||
313 | is given by | ||
314 | .Fa length . | ||
315 | The compression uses an array of pointers | ||
316 | .Fa dnptrs | ||
317 | to previously compressed names in the current message. | ||
318 | The first pointer points | ||
319 | to the beginning of the message and the list ends with | ||
320 | .Dv NULL . | ||
321 | The limit to the array is specified by | ||
322 | .Fa lastdnptr . | ||
323 | A side effect of | ||
324 | .Fn dn_comp | ||
325 | is to update the list of pointers for labels inserted into the message | ||
326 | as the name is compressed. | ||
327 | If | ||
328 | .Fa dnptrs | ||
329 | is | ||
330 | .Dv NULL , | ||
331 | names are not compressed. | ||
332 | If | ||
333 | .Fa lastdnptr | ||
334 | is | ||
335 | .Dv NULL , | ||
336 | the list of labels is not updated. | ||
337 | .Pp | ||
338 | The | ||
339 | .Fn dn_expand | ||
340 | entry expands the compressed domain name | ||
341 | .Fa comp_dn | ||
342 | to a full domain name. | ||
343 | The compressed name is contained in a query or reply message; | ||
344 | .Fa msg | ||
345 | is a pointer to the beginning of the message. | ||
346 | The uncompressed name is placed in the buffer indicated by | ||
347 | .Fa exp_dn | ||
348 | which is of size | ||
349 | .Fa length . | ||
350 | The size of compressed name is returned or \-1 if there was an error. | ||
351 | .Sh FILES | ||
352 | .Bl -tag -width "/etc/resolv.confXX" | ||
353 | .It Pa /etc/resolv.conf | ||
354 | The configuration file. | ||
355 | .El | ||
356 | .Sh SEE ALSO | ||
357 | .Xr gethostbyname 3 , | ||
358 | .Xr resolv.conf 5 , | ||
359 | .Xr hostname 7 | ||
360 | .Sh STANDARDS | ||
361 | .Rs | ||
362 | .%A M. Stahl | ||
363 | .%D November 1987 | ||
364 | .%R RFC 1032 | ||
365 | .%T Domain Administrators Guide | ||
366 | .Re | ||
367 | .Pp | ||
368 | .Rs | ||
369 | .%A M. Lottor | ||
370 | .%D November 1987 | ||
371 | .%R RFC 1033 | ||
372 | .%T Domain Administrators Operations Guide | ||
373 | .Re | ||
374 | .Pp | ||
375 | .Rs | ||
376 | .%A P. Mockapetris | ||
377 | .%D November 1987 | ||
378 | .%R RFC 1034 | ||
379 | .%T Domain Names \(en Concepts and Facilities | ||
380 | .Re | ||
381 | .Pp | ||
382 | .Rs | ||
383 | .%A P. Mockapetris | ||
384 | .%D November 1987 | ||
385 | .%R RFC 1035 | ||
386 | .%T Domain Names \(en Implementation and Specification | ||
387 | .Re | ||
388 | .Pp | ||
389 | .Rs | ||
390 | .%A J. Klensin | ||
391 | .%D October 2008 | ||
392 | .%R RFC 5321 | ||
393 | .%T Simple Mail Transfer Protocol | ||
394 | .Re | ||
395 | .Sh HISTORY | ||
396 | The functions | ||
397 | .Fn res_mkquery , | ||
398 | .Fn res_send , | ||
399 | .Fn res_init , | ||
400 | .Fn dn_comp , | ||
401 | and | ||
402 | .Fn dn_expand | ||
403 | appeared in | ||
404 | .Bx 4.3 . | ||
405 | The functions | ||
406 | .Fn res_query | ||
407 | and | ||
408 | .Fn res_search | ||
409 | appeared in | ||
410 | .Bx 4.3 Tahoe . | ||