| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: getaddrinfo.1,v 1.2 2013/09/30 08:13:59 wiz Exp $ | | 1 | .\" $NetBSD: getaddrinfo.1,v 1.3 2014/03/19 18:21:39 riastradh Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2013 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2013 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This documentation is derived from text contributed to The NetBSD | | 6 | .\" This documentation is derived from text contributed to The NetBSD |
7 | .\" Foundation by Taylor R. Campbell. | | 7 | .\" Foundation by Taylor R. Campbell. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -17,53 +17,58 @@ | | | @@ -17,53 +17,58 @@ |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd September 30, 2013 | | 30 | .Dd March 19, 2014 |
31 | .Dt GETADDRINFO 1 | | 31 | .Dt GETADDRINFO 1 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm getaddrinfo | | 34 | .Nm getaddrinfo |
35 | .Nd resolve names to socket addresses | | 35 | .Nd resolve names to socket addresses |
36 | .Sh SYNOPSIS | | 36 | .Sh SYNOPSIS |
37 | .Nm | | 37 | .Nm |
38 | .Op Fl cNnP | | 38 | .Op Fl cNnP |
39 | .Op Fl f Ar family | | 39 | .Op Fl f Ar family |
40 | .Op Fl p Ar protocol | | 40 | .Op Fl p Ar protocol |
41 | .Op Fl s Ar service | | 41 | .Op Fl s Ar service |
42 | .Op Fl t Ar socktype | | 42 | .Op Fl t Ar socktype |
43 | .Op Ar hostname | | 43 | .Op Ar hostname |
44 | .Sh DESCRIPTION | | 44 | .Sh DESCRIPTION |
45 | The | | 45 | The |
46 | .Nm | | 46 | .Nm |
47 | utility resolves host and service names to socket addresses as if with | | 47 | utility resolves host and service names to socket addresses as if with |
48 | the | | 48 | the |
49 | .Xr getaddrinfo 3 | | 49 | .Xr getaddrinfo 3 |
50 | routine and formats them to standard output. | | 50 | routine and formats them to standard output. |
51 | .Pp | | 51 | .Pp |
52 | The output is a sequence of lines of space-separated fields: | | 52 | The output is a sequence of lines of space-separated fields: |
| | | 53 | .Pp |
53 | .Dl socket-type address-family protocol [af-specific data ...] | | 54 | .Dl socket-type address-family protocol [af-specific data ...] |
54 | .Pp | | 55 | .Pp |
55 | For the internet family, the address-family-specific data are the | | 56 | For the |
56 | internet address and the port number. | | 57 | .Dq inet |
| | | 58 | and |
| | | 59 | .Dq inet6 |
| | | 60 | address families, the af-specific data are the IP/IPv6 address and port |
| | | 61 | number. |
57 | .Pp | | 62 | .Pp |
58 | Although the | | 63 | Although the |
59 | .Nm | | 64 | .Nm |
60 | utility may query the DNS to give answers, depending on the | | 65 | utility may query the DNS to give answers, depending on the |
61 | system's | | 66 | system's |
62 | .Xr nsswitch.conf 5 | | 67 | .Xr nsswitch.conf 5 |
63 | configuration, it is not intended to be a general-purpose utility to | | 68 | configuration, it is not intended to be a general-purpose utility to |
64 | query the DNS; use the | | 69 | query the DNS; use the |
65 | .Xr dig 1 | | 70 | .Xr dig 1 |
66 | utility for that. | | 71 | utility for that. |
67 | .Pp | | 72 | .Pp |
68 | The following options are available: | | 73 | The following options are available: |
69 | .Bl -tag -width Ds | | 74 | .Bl -tag -width Ds |
| @@ -133,27 +138,28 @@ corresponds with | | | @@ -133,27 +138,28 @@ corresponds with |
133 | .El | | 138 | .El |
134 | .Sh EXIT STATUS | | 139 | .Sh EXIT STATUS |
135 | .Ex -std getaddrinfo | | 140 | .Ex -std getaddrinfo |
136 | .Sh EXAMPLES | | 141 | .Sh EXAMPLES |
137 | Look up | | 142 | Look up |
138 | .Dq www.NetBSD.org : | | 143 | .Dq www.NetBSD.org : |
139 | .Bd -literal -offset indent | | 144 | .Bd -literal -offset indent |
140 | $ getaddrinfo www.NetBSD.org | | 145 | $ getaddrinfo www.NetBSD.org |
141 | dgram inet6 udp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | | 146 | dgram inet6 udp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 |
142 | dgram inet udp 149.20.53.67 0 | | 147 | dgram inet udp 149.20.53.67 0 |
143 | stream inet6 tcp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 | | 148 | stream inet6 tcp 2001:4f8:3:7:2e0:81ff:fe52:9ab6 0 |
144 | stream inet tcp 149.20.53.67 0 | | 149 | stream inet tcp 149.20.53.67 0 |
145 | .Ed | | 150 | .Ed |
146 | The unspecified service manifested as a port number of zero. | | 151 | .Pp |
| | | 152 | The port number here is zero because no service was specified. |
147 | .Pp | | 153 | .Pp |
148 | Look up | | 154 | Look up |
149 | .Dq morden.NetBSD.org | | 155 | .Dq morden.NetBSD.org |
150 | for stream sockets on port 80, and show the canonical name: | | 156 | for stream sockets on port 80, and show the canonical name: |
151 | .Bd -literal -offset indent | | 157 | .Bd -literal -offset indent |
152 | $ getaddrinfo -c -t stream -s 80 morden.NetBSD.org | | 158 | $ getaddrinfo -c -t stream -s 80 morden.NetBSD.org |
153 | canonname ftp.NetBSD.org | | 159 | canonname ftp.NetBSD.org |
154 | stream inet6 tcp 2001:470:1f05:3d::21 80 | | 160 | stream inet6 tcp 2001:470:1f05:3d::21 80 |
155 | stream inet tcp 199.233.217.249 80 | | 161 | stream inet tcp 199.233.217.249 80 |
156 | .Ed | | 162 | .Ed |
157 | .Sh SEE ALSO | | 163 | .Sh SEE ALSO |
158 | .Xr dig 1 , | | 164 | .Xr dig 1 , |
159 | .Xr getent 1 , | | 165 | .Xr getent 1 , |