Home | History | Annotate | Line # | Download | only in mrouted
dvmrp.h revision 1.1
      1 /*
      2  * The mrouted program is covered by the license in the accompanying file
      3  * named "LICENSE".  Use of the mrouted program represents acceptance of
      4  * the terms and conditions listed in that file.
      5  *
      6  * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
      7  * Leland Stanford Junior University.
      8  *
      9  *
     10  * $Id: dvmrp.h,v 1.1 1994/01/11 20:15:51 brezak Exp $
     11  */
     12 
     13 /*
     14  * A DVMRP message consists of an IP header + an IGMP header + (for some types)
     15  * zero or more bytes of data.
     16  *
     17  * For REPORT messages, the data is route information; the route information
     18  * consists of one or more lists of the following form:
     19  *
     20  *		(mask, (origin, metric), (origin, metric), ...)
     21  *
     22  * where:
     23  *
     24  *	"mask" is the subnet mask for all the origins in the list.
     25  *		It is always THREE bytes long, containing the low-order
     26  *		three bytes of the mask (the high-order byte is always
     27  *		0xff and therefore need not be transmitted).
     28  *
     29  *	"origin" is the number of a subnet from which multicast datagrams
     30  *		may originate.  It is from one to four bytes long,
     31  *		depending on the value of "mask":
     32  *			if all bytes of the mask are zero
     33  *			    the subnet number is one byte long
     34  *			else if the low-order two bytes of the mask are zero
     35  *			    the subnet number is two bytes long
     36  *			else if the lowest-order byte of the mask is zero
     37  *			    the subnet number is three bytes long,
     38  *			else
     39  *			    the subnet number is four bytes long.
     40  *
     41  *	"metric" is a one-byte value consisting of two subfields:
     42  *		- the high-order bit is a flag which, when set, indicates
     43  *		  the last (origin, metric) pair of a list.
     44  *		- the low-order seven bits contain the routing metric for
     45  *		  the corresponding origin, relative to the sender of the
     46  *		  DVMRP report.  The metric may have the value of UNREACHABLE
     47  *		  added to it as a "split horizon" indication (so called
     48  *		  "poisoned reverse").
     49  *
     50  * Within a list, the origin subnet numbers must be in ascending order, and
     51  * the lists themselves are in order of increasing mask value.  A message may
     52  * not exceed 576 bytes, the default maximum IP reassembly size, including
     53  * the IP and IGMP headers; the route information may be split across more
     54  * than one message if necessary, by terminating a list in one message and
     55  * starting a new list in the next message (repeating the same mask value,
     56  * if necessary).
     57  *
     58  * For NEIGHBORS messages, the data is neighboring-router information
     59  * consisting of one or more lists of the following form:
     60  *
     61  *	(local-addr, metric, threshold, ncount, neighbor, neighbor, ...)
     62  *
     63  * where:
     64  *
     65  *	"local-addr" is the sending router's address as seen by the neighbors
     66  *		     in this list; it is always four bytes long.
     67  *	"metric" is a one-byte unsigned value, the TTL `cost' of forwarding
     68  *		 packets to any of the neighbors on this list.
     69  *	"threshold" is a one-byte unsigned value, a lower bound on the TTL a
     70  *		    packet must have to be forwarded to any of the neighbors on
     71  *		    this list.
     72  *	"ncount" is the number of neighbors in this list.
     73  *	"neighbor" is the address of a neighboring router, four bytes long.
     74  *
     75  * As with REPORT messages, NEIGHBORS messages should not exceed 576 bytes,
     76  * including the IP and IGMP headers; split longer messages by terminating the
     77  * list in one and continuing in another, repeating the local-addr, etc., if
     78  * necessary.
     79  *
     80  * For NEIGHBORS2 messages, the data is identical to NEIGHBORS except
     81  * there is a flags byte before the neighbor count:
     82  *
     83  *	(local-addr, metric, threshold, flags, ncount, neighbor, neighbor, ...)
     84  */
     85 
     86 /*
     87  * DVMRP message types (carried in the "code" field of an IGMP header)
     88  */
     89 #define DVMRP_PROBE		1	/* for finding neighbors             */
     90 #define DVMRP_REPORT		2	/* for reporting some or all routes  */
     91 #define DVMRP_ASK_NEIGHBORS	3	/* sent by mapper, asking for a list */
     92 					/* of this router's neighbors. */
     93 #define DVMRP_NEIGHBORS		4	/* response to such a request */
     94 #define DVMRP_ASK_NEIGHBORS2	5	/* as above, want new format reply */
     95 #define DVMRP_NEIGHBORS2	6
     96 
     97 /*
     98  * 'flags' byte values in DVMRP_NEIGHBORS2 reply.
     99  */
    100 #define DVMRP_NF_TUNNEL		0x01	/* neighbors reached via tunnel */
    101 #define DVMRP_NF_SRCRT		0x02	/* tunnel uses IP source routing */
    102 #define DVMRP_NF_DOWN		0x10	/* kernel state of interface */
    103 #define DVMRP_NF_DISABLED	0x20	/* administratively disabled */
    104 #define DVMRP_NF_QUERIER	0x40	/* I am the subnet's querier */
    105 
    106 /*
    107  * Limit on length of route data
    108  */
    109 #define MAX_IP_PACKET_LEN	576
    110 #define MIN_IP_HEADER_LEN	20
    111 #define MAX_IP_HEADER_LEN	60
    112 #define MAX_DVMRP_DATA_LEN \
    113 		( MAX_IP_PACKET_LEN - MAX_IP_HEADER_LEN - IGMP_MINLEN )
    114 
    115 /*
    116  * Various protocol constants (all times in seconds)
    117  */
    118 				        /* address for multicast DVMRP msgs */
    119 #define INADDR_DVMRP_GROUP	(u_long)0xe0000004    /* 224.0.0.4 */
    120 
    121 #define ROUTE_MAX_REPORT_DELAY	5	/* max delay for reporting changes  */
    122 					/*  (This is the timer interrupt    */
    123 					/*  interval; all times must be     */
    124 					/*  multiples of this value.)       */
    125 
    126 #define	ROUTE_REPORT_INTERVAL	60	/* periodic route report interval   */
    127 #define ROUTE_SWITCH_TIME	140	/* time to switch to equivalent gw  */
    128 #define	ROUTE_EXPIRE_TIME	200	/* time to mark route invalid       */
    129 #define	ROUTE_DISCARD_TIME	340	/* time to garbage collect route    */
    130 
    131 #define LEAF_CONFIRMATION_TIME	200	/* time to consider subnet a leaf   */
    132 
    133 #define NEIGHBOR_PROBE_INTERVAL	190	/* periodic neighbor probe interval */
    134 #define NEIGHBOR_EXPIRE_TIME	140	/* time to consider neighbor gone   */
    135 
    136 #define GROUP_QUERY_INTERVAL	125	/* periodic group query interval    */
    137 #define GROUP_EXPIRE_TIME	270	/* time to consider group gone      */
    138 
    139 #define UNREACHABLE		32	/* "infinity" metric, must be <= 64 */
    140 #define DEFAULT_METRIC		1	/* default subnet/tunnel metric     */
    141 #define DEFAULT_THRESHOLD	1	/* default subnet/tunnel threshold  */
    142