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