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