1 .\" Copyright (c) 1983, 1990, 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 .\" 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.
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
32 .\" @(#)netintro.4 8.2 (Berkeley) 11/30/93
33 .\" $FreeBSD: src/share/man/man4/netintro.4,v 1.10.2.6 2002/08/30 14:23:38 sobomax Exp $
34 .\" $DragonFly: src/share/man/man4/netintro.4,v 1.4 2008/05/02 02:05:05 swildner Exp $
41 .Nd introduction to networking facilities
49 This section is a general introduction to the networking facilities
50 available in the system.
51 Documentation in this part of section
52 4 is broken up into three areas:
57 .Em network interfaces .
59 All network protocols are associated with a specific
61 A protocol family provides basic services to the protocol
62 implementation to allow it to function within a specific
63 network environment. These services may include
64 packet fragmentation and reassembly, routing, addressing, and
65 basic transport. A protocol family may support multiple
66 methods of addressing, though the current protocol implementations
67 do not. A protocol family is normally comprised of a number
70 type. It is not required that a protocol family support
71 all socket types. A protocol family may contain multiple
72 protocols supporting the same socket abstraction.
74 A protocol supports one of the socket abstractions detailed in
76 A specific protocol may be accessed either by creating a
77 socket of the appropriate type and protocol family, or
78 by requesting the protocol explicitly when creating a socket.
79 Protocols normally accept only one type of address format,
80 usually determined by the addressing structure inherent in
81 the design of the protocol family/network architecture.
82 Certain semantics of the basic socket abstractions are
83 protocol specific. All protocols are expected to support
84 the basic model for their particular socket type, but may,
85 in addition, provide non-standard facilities or extensions
86 to a mechanism. For example, a protocol supporting the
88 abstraction may allow more than one byte of out-of-band
89 data to be transmitted per out-of-band message.
91 A network interface is similar to a device interface.
92 Network interfaces comprise the lowest layer of the
93 networking subsystem, interacting with the actual transport
94 hardware. An interface may support one or more protocol
95 families and/or address formats.
96 The SYNOPSIS section of each network interface
97 entry gives a sample specification
98 of the related drivers for use in providing
99 a system description to the
102 The DIAGNOSTICS section lists messages which may appear on the console
103 and/or in the system error log,
104 .Pa /var/log/messages
107 due to errors in device operation.
109 The system currently supports the
111 protocols, the Xerox Network Systems(tm) protocols,
115 Raw socket interfaces are provided to the
123 Consult the appropriate manual pages in this section for more
124 information regarding the support for each protocol family.
126 Associated with each protocol family is an address
127 format. All network address adhere to a general structure,
128 called a sockaddr, described below.
129 However, each protocol
130 imposes finer and more specific structure, generally renaming
131 the variant, which is discussed in the protocol family manual
132 page alluded to above.
133 .Bd -literal -offset indent
143 contains the total length of the structure,
144 which may exceed 16 bytes.
145 The following address values for
147 are known to the system
148 (and additional formats are defined for possible future implementation):
150 #define AF_UNIX 1 /* local to host (pipes, portals) */
151 #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
152 #define AF_NS 6 /* Xerox NS protocols */
153 #define AF_CCITT 10 /* CCITT protocols, X.25 etc */
154 #define AF_HYLINK 15 /* NSC Hyperchannel */
155 #define AF_ISO 18 /* ISO protocols */
159 provides some packet routing facilities.
160 The kernel maintains a routing information database, which
161 is used in selecting the appropriate network interface when
162 transmitting packets.
164 A user process (or possibly multiple co-operating processes)
165 maintains this database by sending messages over a special kind
167 This supplants fixed size
169 used in earlier releases.
171 This facility is described in
174 Each network interface in a system corresponds to a
175 path through which messages may be sent and received. A network
176 interface usually has a hardware device associated with it, though
177 certain interfaces such as the loopback interface,
183 calls may be used to manipulate network interfaces.
186 is made on a socket (typically of type
188 in the desired domain.
189 Most of the requests supported in earlier releases
192 structure as its parameter. This structure has the form
196 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
198 struct sockaddr ifru_addr;
199 struct sockaddr ifru_dstaddr;
200 struct sockaddr ifru_broadaddr;
207 #define ifr_addr ifr_ifru.ifru_addr /* address */
208 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
209 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
210 #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
211 #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
212 #define ifr_metric ifr_ifru.ifru_metric /* metric */
213 #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
214 #define ifr_phys ifr_ifru.ifru_phys /* physical wire */
215 #define ifr_data ifr_ifru.ifru_data /* for use by interface */
219 Calls which are now deprecated are:
220 .Bl -tag -width ".Dv SIOCGIFBRDADDR"
222 Set interface address for protocol family. Following the address
223 assignment, the ``initialization'' routine for
224 the interface is called.
225 .It Dv SIOCSIFDSTADDR
226 Set point to point address for protocol family and interface.
227 .It Dv SIOCSIFBRDADDR
228 Set broadcast address for protocol family and interface.
232 requests to obtain addresses and requests both to set and
233 retrieve other data are still fully supported
237 .Bl -tag -width ".Dv SIOCGIFBRDADDR"
239 Get interface address for protocol family.
240 .It Dv SIOCGIFDSTADDR
241 Get point to point address for protocol family and interface.
242 .It Dv SIOCGIFBRDADDR
243 Get broadcast address for protocol family and interface.
245 Set interface flags field. If the interface is marked down,
246 any processes currently routing packets through the interface
248 some interfaces may be reset so that incoming packets are no longer received.
249 When marked up again, the interface is reinitialized.
253 Set interface routing metric.
254 The metric is used only by user-level routers.
256 Get interface metric.
258 Attempt to create the specified interface.
259 If the interface name is given without a unit number the system
260 will attempt to create a new interface with an arbitrary unit number.
261 On successful return the
263 field will contain the new interface name.
265 Attempt to destroy the specified interface.
268 There are two requests that make use of a new structure:
269 .Bl -tag -width ".Dv SIOCGIFBRDADDR"
271 An interface may have more than one address associated with it
272 in some protocols. This request provides a means to
273 add additional addresses (or modify characteristics of the
274 primary address if the default address for the address family
275 is specified). Rather than making separate calls to
276 set destination or broadcast addresses, or network masks
277 (now an integral feature of multiple protocols)
278 a separate structure is used to specify all three facets simultaneously
280 One would use a slightly tailored version of this struct specific
281 to each family (replacing each sockaddr by one
282 of the family-specific type).
283 Where the sockaddr itself is larger than the
284 default size, one needs to modify the
286 identifier itself to include the total size, as described in
289 This requests deletes the specified address from the list
290 associated with an interface. It also uses the
292 structure to allow for the possibility of protocols allowing
293 multiple masks or destination addresses, and also adopts the
294 convention that specification of the default address means
295 to delete the first address for the interface belonging to
296 the address family in which the original socket was opened.
298 Get interface configuration list. This request takes an
300 structure (see below) as a value-result parameter. The
302 field should be initially set to the size of the buffer
305 On return it will contain the length, in bytes, of the
307 .It Dv SIOCIFGCLONERS
308 Get list of clonable interfaces.
309 This request takes an
311 structure (see below) as a value-result parameter.
314 field should be set to the number of
316 sized strings that can be fit in the buffer pointed to by
320 will be set to the number of clonable interfaces and the buffer pointed
323 will be filled with the names of clonable interfaces aligned on
329 * Structure used in SIOCAIFCONF request.
332 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
333 struct sockaddr ifra_addr;
334 struct sockaddr ifra_broadaddr;
335 struct sockaddr ifra_mask;
340 * Structure used in SIOCGIFCONF request.
341 * Used to retrieve interface configuration
342 * for machine (useful for programs which
343 * must know all networks accessible).
346 int ifc_len; /* size of associated buffer */
349 struct ifreq *ifcu_req;
351 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
352 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
356 /* Structure used in SIOCIFGCLONERS request. */
358 int ifcr_total; /* total cloners (out) */
359 int ifcr_count; /* room for this many in user buffer */
360 char *ifcr_buffer; /* buffer for cloner names */