Annotation of 43BSDReno/share/man/man4/route.4, revision 1.1

1.1     ! root        1: .\" Copyright (c) 1990 The Regents of the University of California.
        !             2: .\" All rights reserved.
        !             3: .\"
        !             4: .\" Redistribution and use in source and binary forms are permitted
        !             5: .\" provided that: (1) source distributions retain this entire copyright
        !             6: .\" notice and comment, and (2) distributions including binaries display
        !             7: .\" the following acknowledgement:  ``This product includes software
        !             8: .\" developed by the University of California, Berkeley and its contributors''
        !             9: .\" in the documentation or other materials provided with the distribution
        !            10: .\" and in all advertising materials mentioning features or use of this
        !            11: .\" software. Neither the name of the University nor the names of its
        !            12: .\" contributors may be used to endorse or promote products derived
        !            13: .\" from this software without specific prior written permission.
        !            14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            15: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            17: .\"
        !            18: .\"    @(#)route.4     6.2 (Berkeley) 5/30/90
        !            19: .\"
        !            20: .TH ROUTE 4 "May 30, 1990"
        !            21: .UC 5
        !            22: .SH NAME
        !            23: .UC 4
        !            24: .SH NAME
        !            25: ROUTE \- Kernel Packet Forwarding Database
        !            26: .SH SYNOPSIS
        !            27: .nf
        !            28: \fB#include <sys/socket.h>\fR
        !            29: \fB#include <net/if.h>\fR
        !            30: \fB#include <net/route.h>\fR
        !            31: .br
        !            32: .B int family
        !            33: .br
        !            34: .B s = socket(PF_ROUTE, SOCK_RAW, family);
        !            35: .SH DESCRIPTION
        !            36: .PP
        !            37: .UX
        !            38: provides some packet routing facilities.
        !            39: The kernel maintains a routing information database, which
        !            40: is used in selecting the appropriate network interface when
        !            41: transmitting packets.
        !            42: .PP
        !            43: A user process (or possibly multiple co-operating processes)
        !            44: maintains this database by sending messages over a special kind
        !            45: of socket.
        !            46: This supplants fixed size
        !            47: .IR ioctl 's
        !            48: used in earlier releases.
        !            49: Routing table changes may only be carried out by the super user.
        !            50: .PP
        !            51: The operating system may spontaneously emit routing messages in response
        !            52: to external events, such as recipt of a re-direct, or failure to
        !            53: locate a suitable route for a request.
        !            54: The message types are described in greater detail below.
        !            55: .PP
        !            56: Routing database entries come in two flavors: for a specific
        !            57: host, or for all hosts on a generic subnetwork (as specified
        !            58: by a bit mask and value under the mask.
        !            59: The effect of wildcard or default route may be achieved by using
        !            60: a mask of all zeros, and there may be hierarchical routes.
        !            61: .PP
        !            62: When the system is booted and addresses are assigned
        !            63: to the network interfaces, each protocol family
        !            64: installs a routing table entry for each interface when it is ready for traffic.
        !            65: Normally the protocol specifies the route
        !            66: through each interface as a ``direct'' connection to the destination host
        !            67: or network.  If the route is direct, the transport layer of
        !            68: a protocol family usually requests the packet be sent to the
        !            69: same host specified in the packet.  Otherwise, the interface
        !            70: is requested to address the packet to the gateway listed in the routing entry
        !            71: (i.e. the packet is forwarded).
        !            72: .PP
        !            73: When routing a packet,
        !            74: the kernel will first attempt to find a route to the destination host.
        !            75: Failing that, a search is made for a route to the network of the destination.
        !            76: Finally, any route to a default (``wildcard'') gateway is chosen.
        !            77: If no entry is found, the destination is declared to be unreachable,
        !            78: and a routing\-miss message is generated if there are any
        !            79: listers on the routing control socket described below.
        !            80: .PP
        !            81: A wildcard routing entry is specified with a zero
        !            82: destination address value.  Wildcard routes are used
        !            83: only when the system fails to find a route to the
        !            84: destination host and network.  The combination of wildcard
        !            85: routes and routing redirects can provide an economical
        !            86: mechanism for routing traffic.
        !            87: .PP
        !            88: One opens the channel for passing routing control messasges
        !            89: by using the socket call shown in the synopsis above:
        !            90: .PP
        !            91: The \fIfamily\fP paramter may be AF_UNSPEC which will provide
        !            92: routing information for all address families, or can be restricted
        !            93: to a specific address family by specifying which one is desired.
        !            94: There can be more than one routing socket open per system.
        !            95: .PP
        !            96: Messages are formed by a header followed by a small
        !            97: number of sockadders (now variable length particularly
        !            98: in the ISO case), interpreted by position, and delimited
        !            99: by the new length entry in the sockaddr.
        !           100: An example of a message with four addresses might be an ISO redirect:
        !           101: Destination, Netmask, Gateway, and Author of the redirect.
        !           102: The interpretation of which address are present is given by a
        !           103: bit mask within the header, and the sequence is least significant
        !           104: to most significant bit within the vector.
        !           105: .PP
        !           106: Any messages sent to the kernel are returned, and copies are sent
        !           107: to all interested listeners.  The kernel will provide the process
        !           108: id. for the sender, and the sender may use an additional sequence
        !           109: field to distinguish between outstanding messages.  However,
        !           110: message replies may be lost when kernel buffers are exhausted.
        !           111: .PP
        !           112: The kernel may reject certain messages, and will indicate this
        !           113: by filling in the rtm_errno field.
        !           114: The routing code returns EEXIST if
        !           115: requested to duplicate an existing entry, ESRCH if
        !           116: requested to delete a non-existent entry,
        !           117: or ENOBUFS if insufficient resources were available
        !           118: to install a new route.
        !           119: In the current implementation, all routing process run locally,
        !           120: and the values for rtm_errno are available through the normal
        !           121: errno mechanism, even if the routing reply message is lost.
        !           122: .PP
        !           123: A process may avoid the expense of reading replies to
        !           124: its own messages by issuing a
        !           125: .IR setsockopt ()
        !           126: call indicating that the SO_USELOOPBACK option
        !           127: at the SOL_SOCKET level is to be turned off.
        !           128: A process may ignore all messages from the routing socket
        !           129: by doing a 
        !           130: .IR shutdown (2)
        !           131: system call for further input.
        !           132: .PP
        !           133: If a route is in use when it is deleted,
        !           134: the routing entry will be marked down and removed from the routing table,
        !           135: but the resources associated with it will not
        !           136: be reclaimed until all references to it are released. 
        !           137: User processes can obtain information about the routing
        !           138: entry to a specific destination by using a RTM_GET message,
        !           139: or by reading the
        !           140: .I /dev/kmem 
        !           141: device, or by issuing a
        !           142: .I getkerninfo ()
        !           143: system call.
        !           144: .nf
        !           145: 
        !           146: Messages include:
        !           147: 
        !           148: .ta \w'#define  'u +\w'RTM_REDIRECT  'u +\w'0x7  'u
        !           149: #define        RTM_ADD 0x1     /* \fIAdd Route\fP */
        !           150: #define        RTM_DELETE      0x2     /* \fIDelete Route\fP */
        !           151: #define        RTM_CHANGE      0x3     /* \fIChange Metrics, Flags, or Gateway\fP */
        !           152: #define        RTM_GET 0x4     /* \fIReport Information\fP */
        !           153: #define        RTM_LOOSING     0x5     /* \fIKernel Suspects Partitioning\fP */
        !           154: #define        RTM_REDIRECT    0x6     /* \fITold to use different route\fP */
        !           155: #define        RTM_MISS        0x7     /* \fILookup failed on this address\fP */
        !           156: #define        RTM_RESOLVE     0xb     /* \fIrequest to resolve dst to LL addr\fP */
        !           157: 
        !           158: .ta \w'struct  'u +\w'u_short   'u +\w'rt_metrics rtm_rmx    'u
        !           159: A message header consists of:
        !           160: struct rt_msghdr {
        !           161:        u_short rmt_msglen;     /* \fIto skip over non-understood messages\fP */
        !           162:        u_char  rtm_version;    /* \fIfuture binary compatability\fP */
        !           163:        u_char  rtm_type;       /* \fImessage type\fP */
        !           164:        u_short rmt_index;      /* \fIindex for associated ifp \fP */
        !           165:        pid_t   rmt_pid;        /* \fIidentify sender\fP */
        !           166:        int     rtm_addrs;      /* \fIbitmask identifying sockaddrs in msg\fP */
        !           167:        int     rtm_seq;        /* \fIfor sender to identify action\fP */
        !           168:        int     rtm_errno;      /* \fIwhy failed\fP */
        !           169:        int     rtm_flags;      /* \fIflags, incl. kern & message, e.g. DONE\fP */
        !           170:        int     rtm_use;        /* \fIfrom rtentry\fP */
        !           171:        u_long  rtm_inits;      /* \fIwhich values we are initializing\fP */
        !           172:        struct  rt_metrics rtm_rmx;     /* \fImetrics themselves\fP */
        !           173: };
        !           174: 
        !           175: where
        !           176: 
        !           177: .ta \w'struct  'u +\w'u_long  'u +\w'rmx_hopcount    'u
        !           178: struct rt_metrics {
        !           179:        u_long  rmx_locks;      /* \fIKernel must leave these values alone\fP */
        !           180:        u_long  rmx_mtu;        /* \fIMTU for this path\fP */
        !           181:        u_long  rmx_hopcount;   /* \fImax hops expected\fP */
        !           182:        u_long  rmx_expire;     /* \fIlifetime for route, e.g. redirect\fP */
        !           183:        u_long  rmx_recvpipe;   /* \fIinbound delay-bandwith product\fP */
        !           184:        u_long  rmx_sendpipe;   /* \fIoutbound delay-bandwith product\fP */
        !           185:        u_long  rmx_ssthresh;   /* \fIoutbound gateway buffer limit\fP */
        !           186:        u_long  rmx_rtt;        /* \fIestimated round trip time\fP */
        !           187:        u_long  rmx_rttvar;     /* \fIestimated rtt variance\fP */
        !           188: };
        !           189: 
        !           190: 
        !           191: Flags include the values:
        !           192: 
        !           193: .ta \w'#define  'u +\w'RTF_MODIFIED  'u +\w'0x80     'u
        !           194: #define        RTF_UP  0x1     /* \fIroute useable\fP */
        !           195: #define        RTF_GATEWAY     0x2     /* \fIdestination is a gateway\fP */
        !           196: #define        RTF_HOST        0x4     /* \fIhost entry (net otherwise)\fP */
        !           197: #define        RTF_NORMAL      0x8     /* \fIsubnet mask is cannonical\fP */
        !           198: #define        RTF_DYNAMIC     0x10    /* \fIcreated dynamically (by redirect)\fP */
        !           199: #define        RTF_MODIFIED    0x20    /* \fImodified dynamically (by redirect)\fP */
        !           200: #define        RTF_DONE        0x40    /* \fImessage confirmed\fP */
        !           201: #define        RTF_MASK        0x80    /* \fIsubnet mask present\fP */
        !           202: 
        !           203: Specfiers for metric values in rmx_locks and rtm_inits are:
        !           204: 
        !           205: .ta \w'#define  'u +\w'RTF_HOPCOUNT  'u +\w'0x80     'u
        !           206: #define        RTV_SSTHRESH    0x1     /* \fIinit or lock _ssthresh\fP */
        !           207: #define        RTV_RPIPE       0x2     /* \fIinit or lock _recvpipe\fP */
        !           208: #define        RTV_SPIPE       0x4     /* \fIinit or lock _sendpipe\fP */
        !           209: #define        RTV_HOPCOUNT    0x8     /* \fIinit or lock _hopcount\fP */
        !           210: #define        RTV_RTT 0x10    /* \fIinit or lock _rtt\fP */
        !           211: #define        RTV_RTTVAR      0x20    /* \fIinit or lock _rttvar\fP */
        !           212: #define        RTV_MTU 0x40    /* \fIinit or lock _mtu\fP */
        !           213: 
        !           214: Specifiers for which addresses are present in the messages are:
        !           215: 
        !           216: .ta \w'#define  'u +\w'RTA_GATEWAY  'u +\w'0x80     'u
        !           217: #define RTA_DST        0x1     /* \fIdestination sockaddr present\fP */
        !           218: #define RTA_GATEWAY    0x2     /* \fIgateway sockaddr present\fP */
        !           219: #define RTA_NETMASK    0x4     /* \fInetmask sockaddr present\fP */
        !           220: #define RTA_GENMASK    0x8     /* \fIcloning mask sockaddr present\fP */
        !           221: #define RTA_IFP        0x10    /* \fIinterface name sockaddr present\fP */
        !           222: #define RTA_IFA        0x20    /* \fIinterface addr sockaddr present\fP */
        !           223: #define RTA_AUTHOR     0x40    /* \fIsockaddr for author of redirect\fP */
        !           224: 
        !           225: .fi
        !           226: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.