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 $
40 .Nd introduction to networking facilities
48 This section is a general introduction to the networking facilities
49 available in the system.
50 Documentation in this part of section
51 4 is broken up into three areas:
56 .Em network interfaces .
58 All network protocols are associated with a specific
60 A protocol family provides basic services to the protocol
61 implementation to allow it to function within a specific
62 network environment. These services may include
63 packet fragmentation and reassembly, routing, addressing, and
64 basic transport. A protocol family may support multiple
65 methods of addressing, though the current protocol implementations
66 do not. A protocol family is normally comprised of a number
69 type. It is not required that a protocol family support
70 all socket types. A protocol family may contain multiple
71 protocols supporting the same socket abstraction.
73 A protocol supports one of the socket abstractions detailed in
75 A specific protocol may be accessed either by creating a
76 socket of the appropriate type and protocol family, or
77 by requesting the protocol explicitly when creating a socket.
78 Protocols normally accept only one type of address format,
79 usually determined by the addressing structure inherent in
80 the design of the protocol family/network architecture.
81 Certain semantics of the basic socket abstractions are
82 protocol specific. All protocols are expected to support
83 the basic model for their particular socket type, but may,
84 in addition, provide non-standard facilities or extensions
85 to a mechanism. For example, a protocol supporting the
87 abstraction may allow more than one byte of out-of-band
88 data to be transmitted per out-of-band message.
90 A network interface is similar to a device interface.
91 Network interfaces comprise the lowest layer of the
92 networking subsystem, interacting with the actual transport
93 hardware. An interface may support one or more protocol
94 families and/or address formats.
95 The SYNOPSIS section of each network interface
96 entry gives a sample specification
97 of the related drivers for use in providing
98 a system description to the
101 The DIAGNOSTICS section lists messages which may appear on the console
102 and/or in the system error log,
103 .Pa /var/log/messages
106 due to errors in device operation.
108 The system currently supports the
110 protocols, the Xerox Network Systems(tm) protocols,
114 Raw socket interfaces are provided to the
122 Consult the appropriate manual pages in this section for more
123 information regarding the support for each protocol family.
125 Associated with each protocol family is an address
126 format. All network address adhere to a general structure,
127 called a sockaddr, described below.
128 However, each protocol
129 imposes finer and more specific structure, generally renaming
130 the variant, which is discussed in the protocol family manual
131 page alluded to above.
132 .Bd -literal -offset indent
142 contains the total length of the structure,
143 which may exceed 16 bytes.
144 The following address values for
146 are known to the system
147 (and additional formats are defined for possible future implementation):
149 #define AF_UNIX 1 /* local to host (pipes, portals) */
150 #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
151 #define AF_NS 6 /* Xerox NS protocols */
152 #define AF_CCITT 10 /* CCITT protocols, X.25 etc */
153 #define AF_HYLINK 15 /* NSC Hyperchannel */
154 #define AF_ISO 18 /* ISO protocols */
158 provides some packet routing facilities.
159 The kernel maintains a routing information database, which
160 is used in selecting the appropriate network interface when
161 transmitting packets.
163 A user process (or possibly multiple co-operating processes)
164 maintains this database by sending messages over a special kind
166 This supplants fixed size
168 used in earlier releases.
170 This facility is described in
173 Each network interface in a system corresponds to a
174 path through which messages may be sent and received. A network
175 interface usually has a hardware device associated with it, though
176 certain interfaces such as the loopback interface,
182 calls may be used to manipulate network interfaces.
185 is made on a socket (typically of type
187 in the desired domain.
188 Most of the requests supported in earlier releases
191 structure as its parameter. This structure has the form
195 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
197 struct sockaddr ifru_addr;
198 struct sockaddr ifru_dstaddr;
199 struct sockaddr ifru_broadaddr;
206 #define ifr_addr ifr_ifru.ifru_addr /* address */
207 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
208 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
209 #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
210 #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
211 #define ifr_metric ifr_ifru.ifru_metric /* metric */
212 #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
213 #define ifr_phys ifr_ifru.ifru_phys /* physical wire */
214 #define ifr_data ifr_ifru.ifru_data /* for use by interface */
218 Calls which are now deprecated are:
219 .Bl -tag -width SIOCGIFBRDADDR
221 Set interface address for protocol family. Following the address
222 assignment, the ``initialization'' routine for
223 the interface is called.
224 .It Dv SIOCSIFDSTADDR
225 Set point to point address for protocol family and interface.
226 .It Dv SIOCSIFBRDADDR
227 Set broadcast address for protocol family and interface.
231 requests to obtain addresses and requests both to set and
232 retrieve other data are still fully supported
236 .Bl -tag -width SIOCGIFBRDADDR
238 Get interface address for protocol family.
239 .It Dv SIOCGIFDSTADDR
240 Get point to point address for protocol family and interface.
241 .It Dv SIOCGIFBRDADDR
242 Get broadcast address for protocol family and interface.
244 Set interface flags field. If the interface is marked down,
245 any processes currently routing packets through the interface
247 some interfaces may be reset so that incoming packets are no longer received.
248 When marked up again, the interface is reinitialized.
252 Set interface routing metric.
253 The metric is used only by user-level routers.
255 Get interface metric.
257 Attempt to create the specified interface.
258 If the interface name is given without a unit number the system
259 will attempt to create a new interface with an arbitrary unit number.
260 On successful return the
262 field will contain the new interface name.
264 Attempt to destroy the specified interface.
267 There are two requests that make use of a new structure:
268 .Bl -tag -width SIOCGIFBRDADDR
270 An interface may have more than one address associated with it
271 in some protocols. This request provides a means to
272 add additional addresses (or modify characteristics of the
273 primary address if the default address for the address family
274 is specified). Rather than making separate calls to
275 set destination or broadcast addresses, or network masks
276 (now an integral feature of multiple protocols)
277 a separate structure is used to specify all three facets simultaneously
279 One would use a slightly tailored version of this struct specific
280 to each family (replacing each sockaddr by one
281 of the family-specific type).
282 Where the sockaddr itself is larger than the
283 default size, one needs to modify the
285 identifier itself to include the total size, as described in
288 This requests deletes the specified address from the list
289 associated with an interface. It also uses the
291 structure to allow for the possibility of protocols allowing
292 multiple masks or destination addresses, and also adopts the
293 convention that specification of the default address means
294 to delete the first address for the interface belonging to
295 the address family in which the original socket was opened.
297 Get interface configuration list. This request takes an
299 structure (see below) as a value-result parameter. The
301 field should be initially set to the size of the buffer
304 On return it will contain the length, in bytes, of the
306 .It Dv SIOCIFGCLONERS
307 Get list of clonable interfaces.
308 This request takes an
310 structure (see below) as a value-result parameter.
313 field should be set to the number of
315 sized strings that can be fit in the buffer pointed to by
319 will be set to the number of clonable interfaces and the buffer pointed
322 will be filled with the names of clonable interfaces aligned on
328 * Structure used in SIOCAIFCONF request.
331 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
332 struct sockaddr ifra_addr;
333 struct sockaddr ifra_broadaddr;
334 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 */
357 /* Structure used in SIOCIFGCLONERS request. */
359 int ifcr_total; /* total cloners (out) */
360 int ifcr_count; /* room for this many in user buffer */
361 char *ifcr_buffer; /* buffer for cloner names */