diff options
-rw-r--r-- | src/lib/libc/net/gethostbyname.3 | 58 | ||||
-rw-r--r-- | src/lib/libc/net/resolver.3 | 35 |
2 files changed, 57 insertions, 36 deletions
diff --git a/src/lib/libc/net/gethostbyname.3 b/src/lib/libc/net/gethostbyname.3 index 3f737b4e97..8b8dc66952 100644 --- a/src/lib/libc/net/gethostbyname.3 +++ b/src/lib/libc/net/gethostbyname.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: gethostbyname.3,v 1.31 2016/08/05 07:54:15 martijn Exp $ | 1 | .\" $OpenBSD: gethostbyname.3,v 1.32 2016/08/05 16:16:06 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1983, 1987, 1991, 1993 | 3 | .\" Copyright (c) 1983, 1987, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -68,7 +68,11 @@ The | |||
68 | and | 68 | and |
69 | .Fn gethostbyaddr | 69 | .Fn gethostbyaddr |
70 | functions each return a pointer to an object with the following structure | 70 | functions each return a pointer to an object with the following structure |
71 | describing an Internet host referenced by name or by address, respectively. | 71 | describing an Internet host referenced by |
72 | .Fa name | ||
73 | or | ||
74 | .Fa addr , | ||
75 | respectively. | ||
72 | This structure contains either information obtained from a name server, | 76 | This structure contains either information obtained from a name server, |
73 | broken-out fields from a line in | 77 | broken-out fields from a line in |
74 | .Pa /etc/hosts , | 78 | .Pa /etc/hosts , |
@@ -93,13 +97,17 @@ The members of this structure are: | |||
93 | .It Fa h_name | 97 | .It Fa h_name |
94 | Official name of the host. | 98 | Official name of the host. |
95 | .It Fa h_aliases | 99 | .It Fa h_aliases |
96 | A null-terminated array of alternate names for the host. | 100 | A |
101 | .Dv NULL Ns -terminated | ||
102 | array of alternate names for the host. | ||
97 | .It Fa h_addrtype | 103 | .It Fa h_addrtype |
98 | The type of address being returned. | 104 | The type of address being returned. |
99 | .It Fa h_length | 105 | .It Fa h_length |
100 | The length, in bytes, of the address. | 106 | The length, in bytes, of the address. |
101 | .It Fa h_addr_list | 107 | .It Fa h_addr_list |
102 | A null-terminated array of network addresses for the host. | 108 | A |
109 | .Dv NULL Ns -terminated | ||
110 | array of network addresses for the host. | ||
103 | Host addresses are returned in network byte order. | 111 | Host addresses are returned in network byte order. |
104 | .It Fa h_addr | 112 | .It Fa h_addr |
105 | The first address in | 113 | The first address in |
@@ -137,33 +145,28 @@ The only address family currently supported is | |||
137 | The | 145 | The |
138 | .Fn sethostent | 146 | .Fn sethostent |
139 | function may be used to request the use of a connected | 147 | function may be used to request the use of a connected |
140 | .Tn TCP | 148 | TCP socket for queries. |
141 | socket for queries. | ||
142 | If the | 149 | If the |
143 | .Fa stayopen | 150 | .Fa stayopen |
144 | flag is non-zero, | 151 | flag is non-zero, |
145 | this sets the option to send all queries to the name server using | 152 | this sets the option to send all queries to the name server using TCP |
146 | .Tn TCP | ||
147 | and to retain the connection after each call to | 153 | and to retain the connection after each call to |
148 | .Fn gethostbyname | 154 | .Fn gethostbyname |
149 | or | 155 | or |
150 | .Fn gethostbyaddr . | 156 | .Fn gethostbyaddr . |
151 | Otherwise, queries are performed using | 157 | Otherwise, queries are performed using UDP datagrams. |
152 | .Tn UDP | ||
153 | datagrams. | ||
154 | .Pp | 158 | .Pp |
155 | The | 159 | The |
156 | .Fn endhostent | 160 | .Fn endhostent |
157 | function closes the | 161 | function closes the TCP connection. |
158 | .Tn TCP | ||
159 | connection. | ||
160 | .Pp | 162 | .Pp |
161 | The | 163 | The |
162 | .Fn herror | 164 | .Fn herror |
163 | function prints an error message describing the failure. | 165 | function prints an error message describing the failure. |
164 | If its argument | 166 | If its argument |
165 | .Fa string | 167 | .Fa string |
166 | is non-null, | 168 | is not |
169 | .Dv NULL , | ||
167 | it is prepended to the message string and separated from it by a colon | 170 | it is prepended to the message string and separated from it by a colon |
168 | .Pq Ql \&: | 171 | .Pq Ql \&: |
169 | and a space. | 172 | and a space. |
@@ -171,10 +174,10 @@ The error message is printed with a trailing newline. | |||
171 | The contents of the error message is the same as that returned by | 174 | The contents of the error message is the same as that returned by |
172 | .Fn hstrerror | 175 | .Fn hstrerror |
173 | with argument | 176 | with argument |
174 | .Fa h_errno . | 177 | .Va h_errno . |
175 | .Sh ENVIRONMENT | 178 | .Sh ENVIRONMENT |
176 | .Bl -tag -width RES_OPTIONS | 179 | .Bl -tag -width RES_OPTIONS |
177 | .It RES_OPTIONS | 180 | .It Ev RES_OPTIONS |
178 | A list of options to override the resolver's internal defaults. | 181 | A list of options to override the resolver's internal defaults. |
179 | See | 182 | See |
180 | .Xr resolv.conf 5 | 183 | .Xr resolv.conf 5 |
@@ -191,7 +194,9 @@ Error return status from | |||
191 | .Fn gethostbyname2 , | 194 | .Fn gethostbyname2 , |
192 | and | 195 | and |
193 | .Fn gethostbyaddr | 196 | .Fn gethostbyaddr |
194 | is indicated by return of a null pointer. | 197 | is indicated by return of a |
198 | .Dv NULL | ||
199 | pointer. | ||
195 | The external integer | 200 | The external integer |
196 | .Va h_errno | 201 | .Va h_errno |
197 | may then be checked to see whether this is a temporary failure | 202 | may then be checked to see whether this is a temporary failure |
@@ -238,10 +243,6 @@ The function completed successfully. | |||
238 | .Xr hostname 7 | 243 | .Xr hostname 7 |
239 | .Sh HISTORY | 244 | .Sh HISTORY |
240 | The | 245 | The |
241 | .Fn herror | ||
242 | function appeared in | ||
243 | .Bx 4.3 . | ||
244 | The | ||
245 | .Fn endhostent , | 246 | .Fn endhostent , |
246 | .Fn gethostbyaddr , | 247 | .Fn gethostbyaddr , |
247 | .Fn gethostbyname , | 248 | .Fn gethostbyname , |
@@ -249,7 +250,18 @@ The | |||
249 | and | 250 | and |
250 | .Fn sethostent | 251 | .Fn sethostent |
251 | functions appeared in | 252 | functions appeared in |
252 | .Bx 4.2 . | 253 | .Bx 4.1c . |
254 | The function | ||
255 | .Fn herror | ||
256 | was added in | ||
257 | .Bx 4.3 Tahoe , | ||
258 | .Fn hstrerror | ||
259 | in | ||
260 | .Bx 4.4 , | ||
261 | and | ||
262 | .Fn gethostbyname2 | ||
263 | in | ||
264 | .Ox 2.1 . | ||
253 | .Sh CAVEATS | 265 | .Sh CAVEATS |
254 | If the search routines in | 266 | If the search routines in |
255 | .Xr resolv.conf 5 | 267 | .Xr resolv.conf 5 |
diff --git a/src/lib/libc/net/resolver.3 b/src/lib/libc/net/resolver.3 index 74be255189..74604b9577 100644 --- a/src/lib/libc/net/resolver.3 +++ b/src/lib/libc/net/resolver.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: resolver.3,v 1.33 2015/12/16 18:12:42 jmc Exp $ | 1 | .\" $OpenBSD: resolver.3,v 1.34 2016/08/05 16:16:06 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1985, 1991, 1993 | 3 | .\" Copyright (c) 1985, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -27,7 +27,7 @@ | |||
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
29 | .\" | 29 | .\" |
30 | .Dd $Mdocdate: December 16 2015 $ | 30 | .Dd $Mdocdate: August 5 2016 $ |
31 | .Dt RES_INIT 3 | 31 | .Dt RES_INIT 3 |
32 | .Os | 32 | .Os |
33 | .Sh NAME | 33 | .Sh NAME |
@@ -103,10 +103,10 @@ query and reply messages with Internet domain name servers. | |||
103 | .Pp | 103 | .Pp |
104 | Global configuration and state information that is used by the | 104 | Global configuration and state information that is used by the |
105 | resolver routines is kept in the structure | 105 | resolver routines is kept in the structure |
106 | .Li _res . | 106 | .Va _res . |
107 | Most of the values have reasonable defaults and can be ignored. | 107 | Most of the values have reasonable defaults and can be ignored. |
108 | Options stored in | 108 | Options stored in |
109 | .Li _res.options | 109 | .Va _res.options |
110 | are defined in | 110 | are defined in |
111 | .In resolv.h | 111 | .In resolv.h |
112 | and are as follows. | 112 | and are as follows. |
@@ -207,19 +207,17 @@ if not specified in the configuration file; | |||
207 | it can be overridden by the environment variable | 207 | it can be overridden by the environment variable |
208 | .Ev LOCALDOMAIN . | 208 | .Ev LOCALDOMAIN . |
209 | This environment variable may contain several blank-separated | 209 | This environment variable may contain several blank-separated |
210 | tokens if you wish to override the | 210 | tokens if you wish to override the search list on a per-process basis. |
211 | .Fa search list | ||
212 | on a per-process basis. | ||
213 | This is similar to the | 211 | This is similar to the |
214 | .Fa search | 212 | .Ic search |
215 | command in the configuration file. | 213 | command in the configuration file. |
216 | Another environment variable | 214 | Another environment variable |
217 | .Ev RES_OPTIONS | 215 | .Ev RES_OPTIONS |
218 | can be set to override certain internal resolver options which | 216 | can be set to override certain internal resolver options which |
219 | are otherwise set by changing fields in the | 217 | are otherwise set by changing fields in the |
220 | .Fa _res | 218 | .Va _res |
221 | structure or are inherited from the configuration file's | 219 | structure or are inherited from the configuration file's |
222 | .Fa options | 220 | .Ic options |
223 | command. | 221 | command. |
224 | The syntax of the | 222 | The syntax of the |
225 | .Ev RES_OPTIONS | 223 | .Ev RES_OPTIONS |
@@ -385,7 +383,18 @@ The configuration file. | |||
385 | .%T Simple Mail Transfer Protocol | 383 | .%T Simple Mail Transfer Protocol |
386 | .Re | 384 | .Re |
387 | .Sh HISTORY | 385 | .Sh HISTORY |
388 | The | 386 | The functions |
389 | .Nm | 387 | .Fn res_mkquery , |
390 | function appeared in | 388 | .Fn res_send , |
389 | .Fn res_init , | ||
390 | .Fn dn_comp , | ||
391 | and | ||
392 | .Fn dn_expand | ||
393 | appeared in | ||
391 | .Bx 4.3 . | 394 | .Bx 4.3 . |
395 | The functions | ||
396 | .Fn res_query | ||
397 | and | ||
398 | .Fn res_search | ||
399 | appeared in | ||
400 | .Bx 4.3 Tahoe . | ||