Merge branch 'master' of ssh://swildner@crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / usr.sbin / mrouted / dvmrp.h
blob9c591a0d42e699efed600585ea4195a08dee14f7
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.
6 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
7 * Leland Stanford Junior University.
10 * $FreeBSD: src/usr.sbin/mrouted/dvmrp.h,v 1.9 1999/08/28 01:17:03 peter Exp $
11 * $DragonFly: src/usr.sbin/mrouted/dvmrp.h,v 1.2 2003/06/17 04:29:57 dillon Exp $
12 * dvmrp.h,v 3.8.4.5 1997/11/18 23:25:57 fenner Exp
16 * A DVMRP message consists of an IP header + an IGMP header + (for some types)
17 * zero or more bytes of data.
19 * For REPORT messages, the data is route information; the route information
20 * consists of one or more lists of the following form:
22 * (mask, (origin, metric), (origin, metric), ...)
24 * where:
26 * "mask" is the subnet mask for all the origins in the list.
27 * It is always THREE bytes long, containing the low-order
28 * three bytes of the mask (the high-order byte is always
29 * 0xff and therefore need not be transmitted).
31 * "origin" is the number of a subnet from which multicast datagrams
32 * may originate. It is from one to four bytes long,
33 * depending on the value of "mask":
34 * if all bytes of the mask are zero
35 * the subnet number is one byte long
36 * else if the low-order two bytes of the mask are zero
37 * the subnet number is two bytes long
38 * else if the lowest-order byte of the mask is zero
39 * the subnet number is three bytes long,
40 * else
41 * the subnet number is four bytes long.
43 * "metric" is a one-byte value consisting of two subfields:
44 * - the high-order bit is a flag which, when set, indicates
45 * the last (origin, metric) pair of a list.
46 * - the low-order seven bits contain the routing metric for
47 * the corresponding origin, relative to the sender of the
48 * DVMRP report. The metric may have the value of UNREACHABLE
49 * added to it as a "split horizon" indication (so called
50 * "poisoned reverse").
52 * Within a list, the origin subnet numbers must be in ascending order, and
53 * the lists themselves are in order of increasing mask value. A message may
54 * not exceed 576 bytes, the default maximum IP reassembly size, including
55 * the IP and IGMP headers; the route information may be split across more
56 * than one message if necessary, by terminating a list in one message and
57 * starting a new list in the next message (repeating the same mask value,
58 * if necessary).
60 * For NEIGHBORS messages, the data is neighboring-router information
61 * consisting of one or more lists of the following form:
63 * (local-addr, metric, threshold, ncount, neighbor, neighbor, ...)
65 * where:
67 * "local-addr" is the sending router's address as seen by the neighbors
68 * in this list; it is always four bytes long.
69 * "metric" is a one-byte unsigned value, the TTL `cost' of forwarding
70 * packets to any of the neighbors on this list.
71 * "threshold" is a one-byte unsigned value, a lower bound on the TTL a
72 * packet must have to be forwarded to any of the neighbors on
73 * this list.
74 * "ncount" is the number of neighbors in this list.
75 * "neighbor" is the address of a neighboring router, four bytes long.
77 * As with REPORT messages, NEIGHBORS messages should not exceed 576 bytes,
78 * including the IP and IGMP headers; split longer messages by terminating the
79 * list in one and continuing in another, repeating the local-addr, etc., if
80 * necessary.
82 * For NEIGHBORS2 messages, the data is identical to NEIGHBORS except
83 * there is a flags byte before the neighbor count:
85 * (local-addr, metric, threshold, flags, ncount, neighbor, neighbor, ...)
89 * DVMRP message types (carried in the "code" field of an IGMP header)
91 #define DVMRP_PROBE 1 /* for finding neighbors */
92 #define DVMRP_REPORT 2 /* for reporting some or all routes */
93 #define DVMRP_ASK_NEIGHBORS 3 /* sent by mapper, asking for a list */
94 /* of this router's neighbors. */
95 #define DVMRP_NEIGHBORS 4 /* response to such a request */
96 #define DVMRP_ASK_NEIGHBORS2 5 /* as above, want new format reply */
97 #define DVMRP_NEIGHBORS2 6
98 #define DVMRP_PRUNE 7 /* prune message */
99 #define DVMRP_GRAFT 8 /* graft message */
100 #define DVMRP_GRAFT_ACK 9 /* graft acknowledgement */
101 #define DVMRP_INFO_REQUEST 10 /* information request */
102 #define DVMRP_INFO_REPLY 11 /* information reply */
105 * 'flags' byte values in DVMRP_NEIGHBORS2 reply.
107 #define DVMRP_NF_TUNNEL 0x01 /* neighbors reached via tunnel */
108 #define DVMRP_NF_SRCRT 0x02 /* tunnel uses IP source routing */
109 #define DVMRP_NF_PIM 0x04 /* neighbor is a PIM neighbor */
110 #define DVMRP_NF_DOWN 0x10 /* kernel state of interface */
111 #define DVMRP_NF_DISABLED 0x20 /* administratively disabled */
112 #define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */
113 #define DVMRP_NF_LEAF 0x80 /* Neighbor reports that it is a leaf */
116 * Request/reply types for info queries/replies
118 #define DVMRP_INFO_VERSION 1 /* version string */
119 #define DVMRP_INFO_NEIGHBORS 2 /* neighbors2 data */
122 * Limit on length of route data
124 #define MAX_IP_PACKET_LEN 576
125 #define MIN_IP_HEADER_LEN 20
126 #define MAX_IP_HEADER_LEN 60
127 #define MAX_DVMRP_DATA_LEN \
128 ( MAX_IP_PACKET_LEN - MAX_IP_HEADER_LEN - IGMP_MINLEN )
131 * Various protocol constants (all times in seconds)
133 /* address for multicast DVMRP msgs */
134 #define INADDR_DVMRP_GROUP (u_int32)0xe0000004 /* 224.0.0.4 */
136 * The IGMPv2 <netinet/in.h> defines INADDR_ALLRTRS_GROUP, but earlier
137 * ones don't, so we define it conditionally here.
139 #ifndef INADDR_ALLRTRS_GROUP
140 /* address for multicast mtrace msg */
141 #define INADDR_ALLRTRS_GROUP (u_int32)0xe0000002 /* 224.0.0.2 */
142 #endif
144 #define ROUTE_MAX_REPORT_DELAY 5 /* max delay for reporting changes */
145 /* (This is the timer interrupt */
146 /* interval; all times must be */
147 /* multiples of this value.) */
149 #define ROUTE_REPORT_INTERVAL 60 /* periodic route report interval */
150 #define ROUTE_SWITCH_TIME 140 /* time to switch to equivalent gw */
151 #define ROUTE_EXPIRE_TIME 200 /* time to mark route invalid */
152 #define ROUTE_DISCARD_TIME 340 /* time to garbage collect route */
154 #define LEAF_CONFIRMATION_TIME 200 /* time to consider subnet a leaf */
156 #define NEIGHBOR_PROBE_INTERVAL 10 /* periodic neighbor probe interval */
157 #define NEIGHBOR_EXPIRE_TIME 30 /* time to consider neighbor gone */
158 #define OLD_NEIGHBOR_EXPIRE_TIME 140 /* time to consider neighbor gone */
160 #define UNREACHABLE 32 /* "infinity" metric, must be <= 64 */
161 #define DEFAULT_METRIC 1 /* default subnet/tunnel metric */
162 #define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */
164 #define MAX_RATE_LIMIT 100000 /* max rate limit */
165 #define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */
166 #define DEFAULT_TUN_RATE_LIMIT 0 /* default tunnel rate limit */
168 #define DEFAULT_CACHE_LIFETIME 300 /* kernel route entry discard time */
169 #define MIN_CACHE_LIFETIME 60 /* minimum allowed cache lifetime */
170 #define AVERAGE_PRUNE_LIFETIME 7200 /* average lifetime of prunes sent */
171 #define MIN_PRUNE_LIFETIME 120 /* minimum allowed prune lifetime */
172 #define GRAFT_TIMEOUT_VAL 5 /* retransmission time for grafts */
173 #define PRUNE_REXMIT_VAL 3 /* initial time for prune rexmission*/