No empty .Rs/.Re
[netbsd-mini2440.git] / usr.sbin / mrouted / dvmrp.h
bloba7e71a9bdc31f42e7cecbe4210fd42b4829a81ad
1 /* $NetBSD: dvmrp.h,v 1.1 2002/10/01 03:31:07 itojun Exp $ */
3 /*
4 * The mrouted program is covered by the license in the accompanying file
5 * named "LICENSE". Use of the mrouted program represents acceptance of
6 * the terms and conditions listed in that file.
8 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
9 * Leland Stanford Junior University.
13 * A DVMRP message consists of an IP header + an IGMP header + (for some types)
14 * zero or more bytes of data.
16 * For REPORT messages, the data is route information; the route information
17 * consists of one or more lists of the following form:
19 * (mask, (origin, metric), (origin, metric), ...)
21 * where:
23 * "mask" is the subnet mask for all the origins in the list.
24 * It is always THREE bytes long, containing the low-order
25 * three bytes of the mask (the high-order byte is always
26 * 0xff and therefore need not be transmitted).
28 * "origin" is the number of a subnet from which multicast datagrams
29 * may originate. It is from one to four bytes long,
30 * depending on the value of "mask":
31 * if all bytes of the mask are zero
32 * the subnet number is one byte long
33 * else if the low-order two bytes of the mask are zero
34 * the subnet number is two bytes long
35 * else if the lowest-order byte of the mask is zero
36 * the subnet number is three bytes long,
37 * else
38 * the subnet number is four bytes long.
40 * "metric" is a one-byte value consisting of two subfields:
41 * - the high-order bit is a flag which, when set, indicates
42 * the last (origin, metric) pair of a list.
43 * - the low-order seven bits contain the routing metric for
44 * the corresponding origin, relative to the sender of the
45 * DVMRP report. The metric may have the value of UNREACHABLE
46 * added to it as a "split horizon" indication (so called
47 * "poisoned reverse").
49 * Within a list, the origin subnet numbers must be in ascending order, and
50 * the lists themselves are in order of increasing mask value. A message may
51 * not exceed 576 bytes, the default maximum IP reassembly size, including
52 * the IP and IGMP headers; the route information may be split across more
53 * than one message if necessary, by terminating a list in one message and
54 * starting a new list in the next message (repeating the same mask value,
55 * if necessary).
57 * For NEIGHBORS messages, the data is neighboring-router information
58 * consisting of one or more lists of the following form:
60 * (local-addr, metric, threshold, ncount, neighbor, neighbor, ...)
62 * where:
64 * "local-addr" is the sending router's address as seen by the neighbors
65 * in this list; it is always four bytes long.
66 * "metric" is a one-byte unsigned value, the TTL `cost' of forwarding
67 * packets to any of the neighbors on this list.
68 * "threshold" is a one-byte unsigned value, a lower bound on the TTL a
69 * packet must have to be forwarded to any of the neighbors on
70 * this list.
71 * "ncount" is the number of neighbors in this list.
72 * "neighbor" is the address of a neighboring router, four bytes long.
74 * As with REPORT messages, NEIGHBORS messages should not exceed 576 bytes,
75 * including the IP and IGMP headers; split longer messages by terminating the
76 * list in one and continuing in another, repeating the local-addr, etc., if
77 * necessary.
79 * For NEIGHBORS2 messages, the data is identical to NEIGHBORS except
80 * there is a flags byte before the neighbor count:
82 * (local-addr, metric, threshold, flags, ncount, neighbor, neighbor, ...)
86 * DVMRP message types (carried in the "code" field of an IGMP header)
88 #define DVMRP_PROBE 1 /* for finding neighbors */
89 #define DVMRP_REPORT 2 /* for reporting some or all routes */
90 #define DVMRP_ASK_NEIGHBORS 3 /* sent by mapper, asking for a list */
91 /* of this router's neighbors. */
92 #define DVMRP_NEIGHBORS 4 /* response to such a request */
93 #define DVMRP_ASK_NEIGHBORS2 5 /* as above, want new format reply */
94 #define DVMRP_NEIGHBORS2 6
95 #define DVMRP_PRUNE 7 /* prune message */
96 #define DVMRP_GRAFT 8 /* graft message */
97 #define DVMRP_GRAFT_ACK 9 /* graft acknowledgement */
98 #define DVMRP_INFO_REQUEST 10 /* information request */
99 #define DVMRP_INFO_REPLY 11 /* information reply */
102 * 'flags' byte values in DVMRP_NEIGHBORS2 reply.
104 #define DVMRP_NF_TUNNEL 0x01 /* neighbors reached via tunnel */
105 #define DVMRP_NF_SRCRT 0x02 /* tunnel uses IP source routing */
106 #define DVMRP_NF_PIM 0x04 /* neighbor is a PIM neighbor */
107 #define DVMRP_NF_DOWN 0x10 /* kernel state of interface */
108 #define DVMRP_NF_DISABLED 0x20 /* administratively disabled */
109 #define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */
110 #define DVMRP_NF_LEAF 0x80 /* Neighbor reports that it is a leaf */
113 * Request/reply types for info queries/replies
115 #define DVMRP_INFO_VERSION 1 /* version string */
116 #define DVMRP_INFO_NEIGHBORS 2 /* neighbors2 data */
119 * Limit on length of route data
121 #define MAX_IP_PACKET_LEN 576
122 #define MIN_IP_HEADER_LEN 20
123 #define MAX_IP_HEADER_LEN 60
124 #define MAX_DVMRP_DATA_LEN \
125 ( MAX_IP_PACKET_LEN - MAX_IP_HEADER_LEN - IGMP_MINLEN )
128 * Various protocol constants (all times in seconds)
130 /* address for multicast DVMRP msgs */
131 #define INADDR_DVMRP_GROUP (u_int32_t)0xe0000004 /* 224.0.0.4 */
133 * The IGMPv2 <netinet/in.h> defines INADDR_ALLRTRS_GROUP, but earlier
134 * ones don't, so we define it conditionally here.
136 #ifndef INADDR_ALLRTRS_GROUP
137 /* address for multicast mtrace msg */
138 #define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */
139 #endif
141 #define ROUTE_MAX_REPORT_DELAY 5 /* max delay for reporting changes */
142 /* (This is the timer interrupt */
143 /* interval; all times must be */
144 /* multiples of this value.) */
146 #define ROUTE_REPORT_INTERVAL 60 /* periodic route report interval */
147 #define ROUTE_SWITCH_TIME 140 /* time to switch to equivalent gw */
148 #define ROUTE_EXPIRE_TIME 200 /* time to mark route invalid */
149 #define ROUTE_DISCARD_TIME 340 /* time to garbage collect route */
151 #define LEAF_CONFIRMATION_TIME 200 /* time to consider subnet a leaf */
153 #define NEIGHBOR_PROBE_INTERVAL 10 /* periodic neighbor probe interval */
154 #define NEIGHBOR_EXPIRE_TIME 140 /* time to consider neighbor gone */
156 #define GROUP_QUERY_INTERVAL 125 /* periodic group query interval */
157 #define GROUP_EXPIRE_TIME 270 /* time to consider group gone */
158 #define LEAVE_EXPIRE_TIME 3 /* " " after receiving a leave */
159 /* Note: LEAVE_EXPIRE_TIME should ideally be shorter, but the resolution of
160 * the timer in mrouted doesn't allow us to make it any shorter. */
162 #define UNREACHABLE 32 /* "infinity" metric, must be <= 64 */
163 #define DEFAULT_METRIC 1 /* default subnet/tunnel metric */
164 #define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */
166 #define MAX_RATE_LIMIT 100000 /* max rate limit */
167 #define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */
168 #define DEFAULT_TUN_RATE_LIMIT 500 /* default tunnel rate limit */
170 #define DEFAULT_CACHE_LIFETIME 300 /* kernel route entry discard time */
171 #define GRAFT_TIMEOUT_VAL 5 /* retransmission time for grafts */
173 #define OLD_AGE_THRESHOLD 2