4.3BSD-Reno/share/man/cat4/route.0

Compare this file to the similar file:
Show the results in this format:




ROUTE(4)		      1990			 ROUTE(4)



NNAAMMEE
NNAAMMEE
     ROUTE - Kernel Packet Forwarding Database

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
     ##iinncclluuddee <<nneett//iiff..hh>>
     ##iinncclluuddee <<nneett//rroouuttee..hh>>
     iinntt ffaammiillyy
     ss == ssoocckkeett((PPFF__RROOUUTTEE,, SSOOCCKK__RRAAWW,, ffaammiillyy));;

DDEESSCCRRIIPPTTIIOONN
     provides some packet routing facilities.  The kernel main-
     tains a routing information database, which is used in
     selecting the appropriate network interface when transmit-
     ting packets.

     A user process (or possibly multiple co-operating processes)
     maintains this database by sending messages over a special
     kind of socket.  This supplants fixed size _i_o_c_t_l's used in
     earlier releases.	Routing table changes may only be carried
     out by the super user.

     The operating system may spontaneously emit routing messages
     in response to external events, such as recipt of a re-
     direct, or failure to locate a suitable route for a request.
     The message types are described in greater detail below.

     Routing database entries come in two flavors: for a specific
     host, or for all hosts on a generic subnetwork (as specified
     by a bit mask and value under the mask.  The effect of wild-
     card or default route may be achieved by using a mask of all
     zeros, and there may be hierarchical routes.

     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.  Otherwise, the interface
     is requested to address the packet to the gateway listed in
     the routing entry (i.e. the packet is forwarded).

     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 no entry is found, the destination is declared
     to be unreachable, and a routing-miss message is generated
     if there are any listers on the routing control socket



Printed 7/27/90                May				1






ROUTE(4)		      1990			 ROUTE(4)



     described below.

     A wildcard routing entry is specified with a zero destina-
     tion 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.

     One opens the channel for passing routing control messasges
     by using the socket call shown in the synopsis above:

     The _f_a_m_i_l_y paramter may be AF_UNSPEC which will provide
     routing information for all address families, or can be res-
     tricted to a specific address family by specifying which one
     is desired.  There can be more than one routing socket open
     per system.

     Messages are formed by a header followed by a small number
     of sockadders (now variable length particularly in the ISO
     case), interpreted by position, and delimited by the new
     length entry in the sockaddr.  An example of a message with
     four addresses might be an ISO redirect: Destination, Net-
     mask, Gateway, and Author of the redirect.  The interpreta-
     tion of which address are present is given by a bit mask
     within the header, and the sequence is least significant to
     most significant bit within the vector.

     Any messages sent to the kernel are returned, and copies are
     sent to all interested listeners.	The kernel will provide
     the process id. for the sender, and the sender may use an
     additional sequence field to distinguish between outstanding
     messages.	However, message replies may be lost when kernel
     buffers are exhausted.

     The kernel may reject certain messages, and will indicate
     this by filling in the rtm_errno field.  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.  In the current implementation, all routing
     process run locally, and the values for rtm_errno are avail-
     able through the normal errno mechanism, even if the routing
     reply message is lost.

     A process may avoid the expense of reading replies to its
     own messages by issuing a _s_e_t_s_o_c_k_o_p_t() call indicating that
     the SO_USELOOPBACK option at the SOL_SOCKET level is to be
     turned off.  A process may ignore all messages from the
     routing socket by doing a _s_h_u_t_d_o_w_n(2) system call for
     further input.




Printed 7/27/90                May				2






ROUTE(4)		      1990			 ROUTE(4)



     If a route is in use when it is deleted, 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. User processes can obtain
     information about the routing entry to a specific destina-
     tion by using a RTM_GET message, or by reading the /_d_e_v/_k_m_e_m
     device, or by issuing a _g_e_t_k_e_r_n_i_n_f_o () system call.

     Messages include:

     #define  RTM_ADD	    0x1  /* _A_d_d _R_o_u_t_e */
     #define  RTM_DELETE    0x2  /* _D_e_l_e_t_e _R_o_u_t_e */
     #define  RTM_CHANGE    0x3  /* _C_h_a_n_g_e _M_e_t_r_i_c_s, _F_l_a_g_s, _o_r _G_a_t_e_w_a_y */
     #define  RTM_GET	    0x4  /* _R_e_p_o_r_t _I_n_f_o_r_m_a_t_i_o_n */
     #define  RTM_LOOSING   0x5  /* _K_e_r_n_e_l _S_u_s_p_e_c_t_s _P_a_r_t_i_t_i_o_n_i_n_g */
     #define  RTM_REDIRECT  0x6  /* _T_o_l_d _t_o _u_s_e _d_i_f_f_e_r_e_n_t _r_o_u_t_e */
     #define  RTM_MISS	    0x7  /* _L_o_o_k_u_p _f_a_i_l_e_d _o_n _t_h_i_s _a_d_d_r_e_s_s */
     #define  RTM_RESOLVE   0xb  /* _r_e_q_u_e_s_t _t_o _r_e_s_o_l_v_e _d_s_t _t_o _L_L _a_d_d_r */

     A message header consists of:
     struct rt_msghdr {
	     u_short   rmt_msglen;	     /* _t_o _s_k_i_p _o_v_e_r _n_o_n-_u_n_d_e_r_s_t_o_o_d _m_e_s_s_a_g_e_s */
	     u_char    rtm_version;	     /* _f_u_t_u_r_e _b_i_n_a_r_y _c_o_m_p_a_t_a_b_i_l_i_t_y */
	     u_char    rtm_type;	     /* _m_e_s_s_a_g_e _t_y_p_e */
	     u_short   rmt_index;	     /* _i_n_d_e_x _f_o_r _a_s_s_o_c_i_a_t_e_d _i_f_p  */
	     pid_t     rmt_pid;              /* _i_d_e_n_t_i_f_y _s_e_n_d_e_r */
	     int       rtm_addrs;	     /* _b_i_t_m_a_s_k _i_d_e_n_t_i_f_y_i_n_g _s_o_c_k_a_d_d_r_s _i_n _m_s_g */
	     int       rtm_seq;              /* _f_o_r _s_e_n_d_e_r _t_o _i_d_e_n_t_i_f_y _a_c_t_i_o_n */
	     int       rtm_errno;	     /* _w_h_y _f_a_i_l_e_d */
	     int       rtm_flags;	     /* _f_l_a_g_s, _i_n_c_l. _k_e_r_n & _m_e_s_s_a_g_e, _e._g. _D_O_N_E */
	     int       rtm_use;              /* _f_r_o_m _r_t_e_n_t_r_y */
	     u_long    rtm_inits;	     /* _w_h_i_c_h _v_a_l_u_e_s _w_e _a_r_e _i_n_i_t_i_a_l_i_z_i_n_g */
	     struct    rt_metrics rtm_rmx;   /* _m_e_t_r_i_c_s _t_h_e_m_s_e_l_v_e_s */
     };

     where

     struct rt_metrics {
	     u_long  rmx_locks;      /* _K_e_r_n_e_l _m_u_s_t _l_e_a_v_e _t_h_e_s_e _v_a_l_u_e_s _a_l_o_n_e */
	     u_long  rmx_mtu;	     /* _M_T_U _f_o_r _t_h_i_s _p_a_t_h */
	     u_long  rmx_hopcount;   /* _m_a_x _h_o_p_s _e_x_p_e_c_t_e_d */
	     u_long  rmx_expire;     /* _l_i_f_e_t_i_m_e _f_o_r _r_o_u_t_e, _e._g. _r_e_d_i_r_e_c_t */
	     u_long  rmx_recvpipe;   /* _i_n_b_o_u_n_d _d_e_l_a_y-_b_a_n_d_w_i_t_h _p_r_o_d_u_c_t */
	     u_long  rmx_sendpipe;   /* _o_u_t_b_o_u_n_d _d_e_l_a_y-_b_a_n_d_w_i_t_h _p_r_o_d_u_c_t */
	     u_long  rmx_ssthresh;   /* _o_u_t_b_o_u_n_d _g_a_t_e_w_a_y _b_u_f_f_e_r _l_i_m_i_t */
	     u_long  rmx_rtt;	     /* _e_s_t_i_m_a_t_e_d _r_o_u_n_d _t_r_i_p _t_i_m_e */
	     u_long  rmx_rttvar;     /* _e_s_t_i_m_a_t_e_d _r_t_t _v_a_r_i_a_n_c_e */
     };


     Flags include the values:




Printed 7/27/90                May				3






ROUTE(4)		      1990			 ROUTE(4)



     #define  RTF_UP	    0x1      /* _r_o_u_t_e _u_s_e_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_NORMAL    0x8      /* _s_u_b_n_e_t _m_a_s_k _i_s _c_a_n_n_o_n_i_c_a_l */
     #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  0x20     /* _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) */
     #define  RTF_DONE	    0x40     /* _m_e_s_s_a_g_e _c_o_n_f_i_r_m_e_d */
     #define  RTF_MASK	    0x80     /* _s_u_b_n_e_t _m_a_s_k _p_r_e_s_e_n_t */

     Specfiers for metric values in rmx_locks and rtm_inits are:

     #define  RTV_SSTHRESH  0x1      /* _i_n_i_t _o_r _l_o_c_k __s_s_t_h_r_e_s_h */
     #define  RTV_RPIPE     0x2      /* _i_n_i_t _o_r _l_o_c_k __r_e_c_v_p_i_p_e */
     #define  RTV_SPIPE     0x4      /* _i_n_i_t _o_r _l_o_c_k __s_e_n_d_p_i_p_e */
     #define  RTV_HOPCOUNT  0x8      /* _i_n_i_t _o_r _l_o_c_k __h_o_p_c_o_u_n_t */
     #define  RTV_RTT	    0x10     /* _i_n_i_t _o_r _l_o_c_k __r_t_t */
     #define  RTV_RTTVAR    0x20     /* _i_n_i_t _o_r _l_o_c_k __r_t_t_v_a_r */
     #define  RTV_MTU	    0x40     /* _i_n_i_t _o_r _l_o_c_k __m_t_u */

     Specifiers for which addresses are present in the messages are:

     #define RTA_DST	   0x1	    /* _d_e_s_t_i_n_a_t_i_o_n _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_GATEWAY   0x2	    /* _g_a_t_e_w_a_y _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_NETMASK   0x4	    /* _n_e_t_m_a_s_k _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_GENMASK   0x8	    /* _c_l_o_n_i_n_g _m_a_s_k _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_IFP	   0x10     /* _i_n_t_e_r_f_a_c_e _n_a_m_e _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_IFA	   0x20     /* _i_n_t_e_r_f_a_c_e _a_d_d_r _s_o_c_k_a_d_d_r _p_r_e_s_e_n_t */
     #define RTA_AUTHOR    0x40     /* _s_o_c_k_a_d_d_r _f_o_r _a_u_t_h_o_r _o_f _r_e_d_i_r_e_c_t */



























Printed 7/27/90                May				4