home *** CD-ROM | disk | FTP | other *** search
-
-
-
- NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777)))) NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777))))
-
-
-
- NNNNAAAAMMMMEEEE
- networking - introduction to networking facilities
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ssssoooocccckkkkeeeetttt....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeetttt////rrrroooouuuutttteeee....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeetttt////iiiiffff....hhhh>>>>
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This section briefly describes the networking facilities available in the
- system. Documentation in this part of section 7 is broken up into three
- areas: _p_r_o_t_o_c_o_l _f_a_m_i_l_i_e_s (domains), _p_r_o_t_o_c_o_l_s, and _n_e_t_w_o_r_k _i_n_t_e_r_f_a_c_e_s.
- Entries describing a protocol family are marked ``7F,'' while entries
- describing protocol use are marked ``7P.'' Hardware support for network
- interfaces are found among the standard ``7'' entries.
-
- All network protocols are associated with a specific _p_r_o_t_o_c_o_l _f_a_m_i_l_y. A
- protocol family provides basic services to the protocol implementation to
- allow it to function within a specific network environment. These
- services may include packet fragmentation and reassembly, routing,
- addressing, and basic transport. A protocol family may support multiple
- methods of addressing, though the current protocol implementations do
- not. A protocol family is normally comprised of a number of protocols,
- one per _s_o_c_k_e_t(2) type. It is not required that a protocol family
- support all socket types. A protocol family may contain multiple
- protocols supporting the same socket abstraction.
-
- A protocol supports one of the socket abstractions detailed in _s_o_c_k_e_t(2).
- A specific protocol may be accessed either by creating a socket of the
- appropriate type and protocol family, or by requesting the protocol
- explicitly when creating a socket. Protocols normally accept only one
- type of address format, usually determined by the addressing structure
- inherent in the design of the protocol family/network architecture.
- Certain semantics of the basic socket abstractions are protocol specific.
- All protocols are expected to support the basic model for their
- particular socket type, but may, in addition, provide non-standard
- facilities or extensions to a mechanism. For example, a protocol
- supporting the SOCK_STREAM abstraction may allow more than one byte of
- out-of-band data to be transmitted per out-of-band message.
-
- A network interface is similar to a device interface. Network interfaces
- comprise the lowest layer of the networking subsystem, interacting with
- the actual transport hardware. An interface may support one or more
- protocol families and/or address formats. The _e_t_h_e_r_n_e_t(7) manual entry
- lists messages which may appear on the console and/or in the system error
- log, /_v_a_r/_a_d_m/_S_Y_S_L_O_G (see _s_y_s_l_o_g_d(1M)), due to errors in device
- operation.
-
- PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLLSSSS
- The system currently supports the DARPA Internet protocols. Raw socket
- interfaces are provided to the IP protocol layer of the DARPA Internet
- and to the link-level layer. Consult the appropriate manual pages in
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777)))) NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777))))
-
-
-
- this section for more information regarding the support for each protocol
- family.
-
- AAAADDDDDDDDRRRREEEESSSSSSSSIIIINNNNGGGG
- Associated with each protocol family is an address format. The following
- address formats are used by the system (and additional formats are
- defined for possible future implementation):
-
- #define AF_UNIX 1 /* _l_o_c_a_l _t_o _h_o_s_t (_p_i_p_e_s) */
- #define AF_INET 2 /* _i_n_t_e_r_n_e_t_w_o_r_k: _U_D_P, _T_C_P, _e_t_c. */
-
- RRRROOOOUUUUTTTTIIIINNNNGGGG
- The network facilities provided limited packet routing. A simple set of
- data structures comprise a ``routing table'' used in selecting the
- appropriate network interface when transmitting packets. This table
- contains a single entry for each route to a specific network or host. A
- user process, the routing daemon, maintains this data base with the aid
- of two socket-specific _i_o_c_t_l(2) commands, SIOCADDRT and SIOCDELRT. The
- commands allow the addition and deletion of a single routing table entry,
- respectively. Routing table manipulations may only be carried out by
- super-user.
-
- A routing table entry has the following form, as defined in
- <_n_e_t/_r_o_u_t_e._h>;
-
- struct rtentry {
- u_long rt_hash;
- struct sockaddr rt_dst;
- struct sockaddr rt_gateway;
- short rt_flags;
- short rt_refcnt;
- u_long rt_use;
- struct ifnet *rt_ifp;
- };
-
- with _r_t__f_l_a_g_s defined from,
-
- #define RTF_UP 0x1 /* _r_o_u_t_e _u_s_a_b_l_e */
- #define RTF_GATEWAY 0x2 /* _d_e_s_t_i_n_a_t_i_o_n _i_s _a _g_a_t_e_w_a_y */
- #define RTF_HOST 0x4 /* _h_o_s_t _e_n_t_r_y (_n_e_t _o_t_h_e_r_w_i_s_e) */
- #define RTF_DYNAMIC 0x10 /* _c_r_e_a_t_e_d _d_y_n_a_m_i_c_a_l_l_y (_b_y _r_e_d_i_r_e_c_t) */
- #define RTF_MODIFIED 0x10 /* _m_o_d_i_f_i_e_d _d_y_n_a_m_i_c_a_l_l_y (_b_y _r_e_d_i_r_e_c_t) */
-
- Routing table entries come in three flavors: for a specific host, for all
- hosts on a specific network, for any destination not matched by entries
- of the first two types (a wildcard route). When the system is booted and
- addresses are assigned to the network interfaces, each protocol family
- installs a routing table entry for each interface when it is ready for
- traffic. Normally the protocol specifies the route through each
- interface as a ``direct'' connection to the destination host or network.
- If the route is direct, the transport layer of a protocol family usually
- requests the packet be sent to the same host specified in the packet.
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777)))) NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777))))
-
-
-
- Otherwise, the interface is requested to address the packet to the
- gateway listed in the routing entry (i.e., the packet is forwarded).
-
- Routing table entries installed by a user process may not specify the
- hash, reference count, use, or interface fields; these are filled in by
- the routing routines. If a route is in use when it is deleted (_r_t__r_e_f_c_n_t
- is non-zero), the routing entry will be marked down and removed from the
- routing table, but the resources associated with it will not be reclaimed
- until all references to it are released. The routing code returns EEXIST
- if requested to duplicate an existing entry, ESRCH if requested to delete
- a non-existent entry, or ENOBUFS if insufficient resources were available
- to install a new route. User processes read the routing tables through
- the /_d_e_v/_k_m_e_m device. The _r_t__u_s_e field contains the number of packets
- sent along the route.
-
- When routing a packet, the kernel will first attempt to find a route to
- the destination host. Failing that, a search is made for a route to the
- network of the destination. Finally, any route to a default
- (``wildcard'') gateway is chosen. If multiple routes are present in the
- table, the first route found will be used. If no entry is found, the
- destination is declared to be unreachable.
-
- A wildcard routing entry is specified with a zero destination address
- value. Wildcard routes are used only when the system fails to find a
- route to the destination host and network. The combination of wildcard
- routes and routing redirects can provide an economical mechanism for
- routing traffic.
-
- IIIINNNNTTTTEEEERRRRFFFFAAAACCCCEEEESSSS
- Each network interface in a system corresponds to a path through which
- messages may be sent and received. A network interface usually has a
- hardware device associated with it, though certain interfaces such as the
- loopback interface, _l_o(7), do not.
-
- The following _i_o_c_t_l calls may be used to manipulate network interfaces.
- The _i_o_c_t_l is made on a socket (typically of type SOCK_DGRAM) in the
- desired domain. Unless specified otherwise, the request takes an
- _i_f_r_e_q_u_e_s_t structure as its parameter. This structure has the form
-
- struct ifreq {
- #define IFNAMSIZ 16
- char ifr_name[IFNAMSIZE]; /* _i_f _n_a_m_e, _e._g. "_e_n_p_0" */
- union {
- struct sockaddr ifru_addr;
- struct sockaddr ifru_dstaddr;
- struct sockaddr ifru_broadaddr;
- short ifru_flags;
- int ifru_metric;
- caddr_t ifru_data;
- } ifr_ifru;
- #define ifr_addr ifr_ifru.ifru_addr /* _a_d_d_r_e_s_s */
- #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* _o_t_h_e_r _e_n_d _o_f _p-_t_o-_p _l_i_n_k */
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777)))) NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777))))
-
-
-
- #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* _b_r_o_a_d_c_a_s_t _a_d_d_r_e_s_s */
- #define ifr_flags ifr_ifru.ifru_flags /* _f_l_a_g_s */
- #define ifr_metric ifr_ifru.ifru_metric /* _m_e_t_r_i_c */
- #define ifr_data ifr_ifru.ifru_data /* _f_o_r _u_s_e _b_y _i_n_t_e_r_f_a_c_e */
- };
-
- SIOCSIFADDR
- Set interface address for protocol family. Following the address
- assignment, the ``initialization'' routine for the interface is
- called.
-
- SIOCGIFADDR
- Get interface address for protocol family.
-
- SIOCSIFDSTADDR
- Set point to point address for protocol family and interface.
-
- SIOCGIFDSTADDR
- Get point to point address for protocol family and interface.
-
- SIOCSIFBRDADDR
- Set broadcast address for protocol family and interface.
-
- SIOCGIFBRDADDR
- Get broadcast address for protocol family and interface.
-
- SIOCSIFFLAGS
- Set interface flags field. If the interface is marked down, any
- processes currently routing packets through the interface are
- notified; some interfaces may be reset so that incoming packets are
- no longer received. When marked up again, the interface is
- reinitialized.
-
- SIOCGIFFLAGS
- Get interface flags.
-
- SIOCSIFMETRIC
- Set interface routing metric. The metric is used only by user-level
- routers.
-
- SIOCGIFMETRIC
- Get interface metric.
-
- SIOCGIFCONF
- Get interface configuration list. This request takes an _i_f_c_o_n_f
- structure (see below) as a value-result parameter. The _i_f_c__l_e_n
- field should be initially set to the size of the buffer pointed to
- by _i_f_c__b_u_f. On return it will contain the length, in bytes, of the
- configuration list.
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777)))) NNNNEEEETTTTIIIINNNNTTTTRRRROOOO((((7777))))
-
-
-
- /*
- * Structure used in SIOCGIFCONF request.
- * Used to retrieve interface configuration
- * for machine (useful for programs which
- * must know all networks accessible).
- */
- struct ifconf {
- int ifc_len; /* _s_i_z_e _o_f _a_s_s_o_c_i_a_t_e_d _b_u_f_f_e_r */
- union {
- caddr_t ifcu_buf;
- struct ifreq *ifcu_req;
- } ifc_ifcu;
- #define ifc_buf ifc_ifcu.ifcu_buf /* _b_u_f_f_e_r _a_d_d_r_e_s_s */
- #define ifc_req ifc_ifcu.ifcu_req /* _a_r_r_a_y _o_f _s_t_r_u_c_t_u_r_e_s _r_e_t_u_r_n_e_d */
- };
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- socket(2), ioctl(2), routed(1M), route(7F), _I_R_I_X _N_e_t_w_o_r_k _P_r_o_g_r_a_m_m_i_n_g
- _G_u_i_d_e.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-