]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - share/man/man4/inet.4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / share / man / man4 / inet.4
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     From: @(#)inet.4        8.1 (Berkeley) 6/5/93
33 .\" $FreeBSD$
34 .\"
35 .Dd January 26, 2012
36 .Dt INET 4
37 .Os
38 .Sh NAME
39 .Nm inet
40 .Nd Internet protocol family
41 .Sh SYNOPSIS
42 .In sys/types.h
43 .In netinet/in.h
44 .Sh DESCRIPTION
45 The Internet protocol family is a collection of protocols
46 layered atop the
47 .Em Internet Protocol
48 .Pq Tn IP
49 transport layer, and utilizing the Internet address format.
50 The Internet family provides protocol support for the
51 .Dv SOCK_STREAM , SOCK_DGRAM ,
52 and
53 .Dv SOCK_RAW
54 socket types; the
55 .Dv SOCK_RAW
56 interface provides access to the
57 .Tn IP
58 protocol.
59 .Sh ADDRESSING
60 Internet addresses are four byte quantities, stored in
61 network standard format (on little endian machines, such as the
62 .Tn alpha ,
63 .Tn amd64 ,
64 .Tn i386
65 and
66 .Tn ia64
67 these are word and byte reversed).
68 The include file
69 .In netinet/in.h
70 defines this address
71 as a discriminated union.
72 .Pp
73 Sockets bound to the Internet protocol family utilize
74 the following addressing structure,
75 .Bd -literal -offset indent
76 struct sockaddr_in {
77         uint8_t         sin_len;
78         sa_family_t     sin_family;
79         in_port_t       sin_port;
80         struct in_addr  sin_addr;
81         char            sin_zero[8];
82 };
83 .Ed
84 .Pp
85 Sockets may be created with the local address
86 .Dv INADDR_ANY
87 to affect
88 .Dq wildcard
89 matching on incoming messages.
90 The address in a
91 .Xr connect 2
92 or
93 .Xr sendto 2
94 call may be given as
95 .Dv INADDR_ANY
96 to mean
97 .Dq this host .
98 The distinguished address
99 .Dv INADDR_BROADCAST
100 is allowed as a shorthand for the broadcast address on the primary
101 network if the first network configured supports broadcast.
102 .Sh PROTOCOLS
103 The Internet protocol family is comprised of
104 the
105 .Tn IP
106 network protocol, Internet Control
107 Message Protocol
108 .Pq Tn ICMP ,
109 Internet Group Management Protocol
110 .Pq Tn IGMP ,
111 Transmission Control
112 Protocol
113 .Pq Tn TCP ,
114 and User Datagram Protocol
115 .Pq Tn UDP .
116 .Tn TCP
117 is used to support the
118 .Dv SOCK_STREAM
119 abstraction while
120 .Tn UDP
121 is used to support the
122 .Dv SOCK_DGRAM
123 abstraction.
124 A raw interface to
125 .Tn IP
126 is available
127 by creating an Internet socket of type
128 .Dv SOCK_RAW .
129 The
130 .Tn ICMP
131 message protocol is accessible from a raw socket.
132 .Pp
133 The
134 .Nm
135 address on an interface consist of the address itself, the
136 netmask, either broadcast address in case of a broadcast
137 interface or peers address in case of point-to-point interface.
138 The following
139 .Xr ioctl 2
140 commands are provided for a datagram socket in the Internet domain:
141 .Pp
142 .Bl -tag -width ".Dv SIOCGIFBRDADDR" -offset indent -compact   
143 .It Dv SIOCAIFADDR
144 Add address to an interface.
145 The command requires
146 .Ft struct in_aliasreq
147 as argument.
148 .It Dv SIOCDIFADDR
149 Delete address from an interface.
150 The command requires
151 .Ft struct ifreq
152 as argument.
153 .It Dv SIOCGIFADDR
154 .It Dv SIOCGIFBRDADDR
155 .It Dv SIOCGIFDSTADDR
156 .It Dv SIOCGIFNETMASK
157 Return address information from interface. The returned value
158 is in
159 .Ft struct ifreq .
160 This way of address information retrieval is obsoleted, a
161 preferred way is to use
162 .Xr getifaddrs 3
163 API.
164 .El
165 .Ss MIB Variables
166 A number of variables are implemented in the net.inet branch of the
167 .Xr sysctl 3
168 MIB.
169 In addition to the variables supported by the transport protocols
170 (for which the respective manual pages may be consulted),
171 the following general variables are defined:
172 .Bl -tag -width IPCTL_FASTFORWARDING
173 .It Dv IPCTL_FORWARDING
174 .Pq ip.forwarding
175 Boolean: enable/disable forwarding of IP packets.
176 Defaults to off.
177 .It Dv IPCTL_FASTFORWARDING
178 .Pq ip.fastforwarding
179 Boolean: enable/disable the use of
180 .Tn fast IP forwarding
181 code.
182 Defaults to off.
183 When
184 .Tn fast IP forwarding
185 is enabled, IP packets are forwarded directly to the appropriate network
186 interface with direct processing to completion, which greatly improves
187 the throughput.
188 All packets for local IP addresses, non-unicast, or with IP options are
189 handled by the normal IP input processing path.
190 All features of the normal (slow) IP forwarding path are supported
191 including firewall (through
192 .Xr pfil 9
193 hooks) checking, except
194 .Xr ipsec 4
195 tunnel brokering.
196 The
197 .Tn IP fastforwarding
198 path does not generate ICMP redirect or source quench messages.
199 .It Dv IPCTL_SENDREDIRECTS
200 .Pq ip.redirect
201 Boolean: enable/disable sending of ICMP redirects in response to
202 .Tn IP
203 packets for which a better, and for the sender directly reachable, route
204 and next hop is known.
205 Defaults to on.
206 .It Dv IPCTL_DEFTTL
207 .Pq ip.ttl
208 Integer: default time-to-live
209 .Pq Dq TTL
210 to use for outgoing
211 .Tn IP
212 packets.
213 .It Dv IPCTL_ACCEPTSOURCEROUTE
214 .Pq ip.accept_sourceroute
215 Boolean: enable/disable accepting of source-routed IP packets (default false).
216 .It Dv IPCTL_SOURCEROUTE
217 .Pq ip.sourceroute
218 Boolean: enable/disable forwarding of source-routed IP packets (default false).
219 .It Dv IPCTL_RTEXPIRE
220 .Pq ip.rtexpire
221 Integer: lifetime in seconds of protocol-cloned
222 .Tn IP
223 routes after the last reference drops (default one hour).
224 This value varies dynamically as described above.
225 .It Dv IPCTL_RTMINEXPIRE
226 .Pq ip.rtminexpire
227 Integer: minimum value of ip.rtexpire (default ten seconds).
228 This value has no effect on user modifications, but restricts the dynamic
229 adaptation described above.
230 .It Dv IPCTL_RTMAXCACHE
231 .Pq ip.rtmaxcache
232 Integer: trigger level of cached, unreferenced, protocol-cloned routes
233 which initiates dynamic adaptation (default 128).
234 .It Va ip.process_options
235 Integer: control IP options processing.
236 By setting this variable to 0, all IP options in the incoming packets
237 will be ignored, and the packets will be passed unmodified.
238 By setting to 1, IP options in the incoming packets will be processed
239 accordingly.
240 By setting to 2, an
241 .Tn ICMP
242 .Dq "prohibited by filter"
243 message will be sent back in response to incoming packets with IP options.
244 Default is 1.
245 This
246 .Xr sysctl 8
247 variable affects packets destined for a local host as well as packets
248 forwarded to some other host.
249 .It Va ip.random_id
250 Boolean: control IP IDs generation behaviour.
251 Setting this
252 .Xr sysctl 8
253 to non-zero causes the ID field in IP packets to be randomized instead of
254 incremented by 1 with each packet generated.
255 This closes a minor information leak which allows remote observers to
256 determine the rate of packet generation on the machine by watching the
257 counter.
258 In the same time, on high-speed links, it can decrease the ID reuse
259 cycle greatly.
260 Default is 0 (sequential IP IDs).
261 IPv6 flow IDs and fragment IDs are always random.
262 .It Va ip.maxfragpackets
263 Integer: maximum number of fragmented packets the host will accept and hold
264 in the reassembling queue simultaneously.
265 0 means that the host will not accept any fragmented packets.
266 \-1 means that the host will accept as many fragmented packets as it receives.
267 .It Va ip.maxfragsperpacket
268 Integer: maximum number of fragments the host will accept and hold
269 in the reassembling queue for a packet.
270 0 means that the host will not accept any fragmented packets.
271 .El
272 .Sh SEE ALSO
273 .Xr ioctl 2 ,
274 .Xr socket 2 ,
275 .Xr getifaddrs 3 ,
276 .Xr sysctl 3 ,
277 .Xr icmp 4 ,
278 .Xr intro 4 ,
279 .Xr ip 4 ,
280 .Xr ipfirewall 4 ,
281 .Xr route 4 ,
282 .Xr tcp 4 ,
283 .Xr udp 4 ,
284 .Xr pfil 9
285 .Rs
286 .%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
287 .%B PS1
288 .%N 7
289 .Re
290 .Rs
291 .%T "An Advanced 4.3 BSD Interprocess Communication Tutorial"
292 .%B PS1
293 .%N 8
294 .Re
295 .Sh HISTORY
296 The
297 .Nm
298 protocol interface appeared in
299 .Bx 4.2 .
300 The
301 .Dq protocol cloning
302 code appeared in
303 .Fx 2.1 .
304 .Sh CAVEATS
305 The Internet protocol support is subject to change as
306 the Internet protocols develop.
307 Users should not depend
308 on details of the current implementation, but rather
309 the services exported.