1994-09-08 00:26:13 +00:00
|
|
|
/*
|
|
|
|
* The mrouted program is covered by the license in the accompanying file
|
|
|
|
* named "LICENSE". Use of the mrouted program represents acceptance of
|
|
|
|
* the terms and conditions listed in that file.
|
|
|
|
*
|
|
|
|
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
|
|
|
* Leland Stanford Junior University.
|
|
|
|
*
|
|
|
|
*
|
1996-01-06 21:10:30 +00:00
|
|
|
* $Id: prune.h,v 3.8 1995/11/29 22:36:57 fenner Rel $
|
1994-09-08 00:26:13 +00:00
|
|
|
*/
|
|
|
|
|
1995-05-30 03:57:47 +00:00
|
|
|
/*
|
1995-06-13 18:05:16 +00:00
|
|
|
* Group table
|
|
|
|
*
|
|
|
|
* Each group entry is a member of two doubly-linked lists:
|
|
|
|
*
|
|
|
|
* a) A list hanging off of the routing table entry for this source (rt_groups)
|
|
|
|
* sorted by group address under the routing entry (gt_next, gt_prev)
|
|
|
|
* b) An independent list pointed to by kernel_table, which is a list of
|
|
|
|
* active source,group's (gt_gnext, gt_gprev).
|
|
|
|
*
|
1994-09-08 00:26:13 +00:00
|
|
|
*/
|
1995-06-13 18:05:16 +00:00
|
|
|
struct gtable {
|
|
|
|
struct gtable *gt_next; /* pointer to the next entry */
|
|
|
|
struct gtable *gt_prev; /* back pointer for linked list */
|
|
|
|
struct gtable *gt_gnext; /* fwd pointer for group list */
|
|
|
|
struct gtable *gt_gprev; /* rev pointer for group list */
|
|
|
|
u_int32 gt_mcastgrp; /* multicast group associated */
|
|
|
|
vifbitmap_t gt_scope; /* scoped interfaces */
|
|
|
|
u_char gt_ttls[MAXVIFS]; /* ttl vector for forwarding */
|
|
|
|
vifbitmap_t gt_grpmems; /* forw. vifs for src, grp */
|
|
|
|
int gt_prsent_timer; /* prune timer for this group */
|
|
|
|
int gt_timer; /* timer for this group entry */
|
|
|
|
time_t gt_ctime; /* time of entry creation */
|
|
|
|
u_char gt_grftsnt; /* graft sent/retransmit timer */
|
|
|
|
struct stable *gt_srctbl; /* source table */
|
|
|
|
struct ptable *gt_pruntbl; /* prune table */
|
|
|
|
struct rtentry *gt_route; /* parent route */
|
|
|
|
#ifdef RSRR
|
|
|
|
struct rsrr_cache *gt_rsrr_cache; /* RSRR cache */
|
|
|
|
#endif /* RSRR */
|
1994-09-08 00:26:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
1995-06-13 18:05:16 +00:00
|
|
|
* Source table
|
1994-09-08 00:26:13 +00:00
|
|
|
*
|
1995-06-13 18:05:16 +00:00
|
|
|
* When source-based prunes exist, there will be a struct ptable here as well.
|
1994-09-08 00:26:13 +00:00
|
|
|
*/
|
1995-06-13 18:05:16 +00:00
|
|
|
struct stable
|
1994-09-08 00:26:13 +00:00
|
|
|
{
|
1995-06-13 18:05:16 +00:00
|
|
|
struct stable *st_next; /* pointer to the next entry */
|
|
|
|
u_int32 st_origin; /* host origin of multicasts */
|
|
|
|
u_long st_pktcnt; /* packet count for src-grp entry */
|
1994-09-08 00:26:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
1995-06-13 18:05:16 +00:00
|
|
|
* structure to store incoming prunes. Can hang off of either group or source.
|
1994-09-08 00:26:13 +00:00
|
|
|
*/
|
1995-06-13 18:05:16 +00:00
|
|
|
struct ptable
|
1994-09-08 00:26:13 +00:00
|
|
|
{
|
1995-06-13 18:05:16 +00:00
|
|
|
struct ptable *pt_next; /* pointer to the next entry */
|
|
|
|
u_int32 pt_router; /* router that sent this prune */
|
|
|
|
vifi_t pt_vifi; /* vif prune received on */
|
|
|
|
int pt_timer; /* timer for prune */
|
1994-09-08 00:26:13 +00:00
|
|
|
};
|
|
|
|
|
1995-06-13 18:05:16 +00:00
|
|
|
/*
|
|
|
|
* The packet format for a traceroute request.
|
|
|
|
*/
|
1994-09-08 00:26:13 +00:00
|
|
|
struct tr_query {
|
1995-06-13 18:05:16 +00:00
|
|
|
u_int32 tr_src; /* traceroute source */
|
|
|
|
u_int32 tr_dst; /* traceroute destination */
|
|
|
|
u_int32 tr_raddr; /* traceroute response address */
|
|
|
|
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
|
|
|
|
struct {
|
|
|
|
u_int qid : 24; /* traceroute query id */
|
|
|
|
u_int ttl : 8; /* traceroute response ttl */
|
|
|
|
} q;
|
|
|
|
#else
|
1994-09-08 00:26:13 +00:00
|
|
|
struct {
|
|
|
|
u_int ttl : 8; /* traceroute response ttl */
|
|
|
|
u_int qid : 24; /* traceroute query id */
|
|
|
|
} q;
|
1995-06-13 18:05:16 +00:00
|
|
|
#endif /* BYTE_ORDER */
|
|
|
|
};
|
1994-09-08 00:26:13 +00:00
|
|
|
|
|
|
|
#define tr_rttl q.ttl
|
|
|
|
#define tr_qid q.qid
|
|
|
|
|
1995-06-13 18:05:16 +00:00
|
|
|
/*
|
|
|
|
* Traceroute response format. A traceroute response has a tr_query at the
|
|
|
|
* beginning, followed by one tr_resp for each hop taken.
|
|
|
|
*/
|
1994-09-08 00:26:13 +00:00
|
|
|
struct tr_resp {
|
1995-06-13 18:05:16 +00:00
|
|
|
u_int32 tr_qarr; /* query arrival time */
|
|
|
|
u_int32 tr_inaddr; /* incoming interface address */
|
|
|
|
u_int32 tr_outaddr; /* outgoing interface address */
|
|
|
|
u_int32 tr_rmtaddr; /* parent address in source tree */
|
|
|
|
u_int32 tr_vifin; /* input packet count on interface */
|
|
|
|
u_int32 tr_vifout; /* output packet count on interface */
|
|
|
|
u_int32 tr_pktcnt; /* total incoming packets for src-grp */
|
1994-09-08 00:26:13 +00:00
|
|
|
u_char tr_rproto; /* routing protocol deployed on router */
|
|
|
|
u_char tr_fttl; /* ttl required to forward on outvif */
|
|
|
|
u_char tr_smask; /* subnet mask for src addr */
|
|
|
|
u_char tr_rflags; /* forwarding error codes */
|
1995-06-13 18:05:16 +00:00
|
|
|
};
|
1994-09-08 00:26:13 +00:00
|
|
|
|
|
|
|
/* defs within mtrace */
|
|
|
|
#define QUERY 1
|
|
|
|
#define RESP 2
|
|
|
|
#define QLEN sizeof(struct tr_query)
|
|
|
|
#define RLEN sizeof(struct tr_resp)
|
|
|
|
|
|
|
|
/* fields for tr_rflags (forwarding error codes) */
|
1995-06-13 18:05:16 +00:00
|
|
|
#define TR_NO_ERR 0
|
|
|
|
#define TR_WRONG_IF 1
|
|
|
|
#define TR_PRUNED 2
|
|
|
|
#define TR_OPRUNED 3
|
|
|
|
#define TR_SCOPED 4
|
|
|
|
#define TR_NO_RTE 5
|
|
|
|
#define TR_NO_FWD 7
|
|
|
|
#define TR_NO_SPACE 0x81
|
|
|
|
#define TR_OLD_ROUTER 0x82
|
1994-09-08 00:26:13 +00:00
|
|
|
|
|
|
|
/* fields for tr_rproto (routing protocol) */
|
1995-06-13 18:05:16 +00:00
|
|
|
#define PROTO_DVMRP 1
|
|
|
|
#define PROTO_MOSPF 2
|
|
|
|
#define PROTO_PIM 3
|
|
|
|
#define PROTO_CBT 4
|
1994-09-08 00:26:13 +00:00
|
|
|
|
|
|
|
#define MASK_TO_VAL(x, i) { \
|
1995-06-13 18:05:16 +00:00
|
|
|
u_int32 _x = ntohl(x); \
|
1995-06-28 17:58:49 +00:00
|
|
|
(i) = 1; \
|
|
|
|
while ((_x) <<= 1) \
|
1994-09-08 00:26:13 +00:00
|
|
|
(i)++; \
|
1995-06-13 18:05:16 +00:00
|
|
|
};
|
1994-09-08 00:26:13 +00:00
|
|
|
|
|
|
|
#define VAL_TO_MASK(x, i) { \
|
1995-06-13 18:05:16 +00:00
|
|
|
x = htonl(~((1 << (32 - (i))) - 1)); \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)
|