xref: /netbsd-src/usr.sbin/mrouted/vif.h (revision c60d41a9defbc86d2618a348d2dccca1f30bc3a7)
1*c60d41a9Swiz /*	$NetBSD: vif.h,v 1.8 2003/03/05 21:05:41 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  * User level Virtual Interface structure
14*c60d41a9Swiz  *
15*c60d41a9Swiz  * A "virtual interface" is either a physical, multicast-capable interface
16*c60d41a9Swiz  * (called a "phyint") or a virtual point-to-point link (called a "tunnel").
17*c60d41a9Swiz  * (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
18*c60d41a9Swiz  */
19*c60d41a9Swiz struct uvif {
20*c60d41a9Swiz     u_short	     uv_flags;	    /* VIFF_ flags defined below            */
21*c60d41a9Swiz     u_char	     uv_metric;     /* cost of this vif                     */
22*c60d41a9Swiz     u_int	     uv_rate_limit; /* rate limit on this vif               */
23*c60d41a9Swiz     u_char	     uv_threshold;  /* min ttl required to forward on vif   */
24*c60d41a9Swiz     u_int32_t	     uv_lcl_addr;   /* local address of this vif            */
25*c60d41a9Swiz     u_int32_t	     uv_rmt_addr;   /* remote end-point addr (tunnels only) */
26*c60d41a9Swiz     u_int32_t	     uv_subnet;     /* subnet number         (phyints only) */
27*c60d41a9Swiz     u_int32_t	     uv_subnetmask; /* subnet mask           (phyints only) */
28*c60d41a9Swiz     u_int32_t	     uv_subnetbcast;/* subnet broadcast addr (phyints only) */
29*c60d41a9Swiz     char	     uv_name[IFNAMSIZ]; /* interface name                   */
30*c60d41a9Swiz     struct listaddr *uv_groups;     /* list of local groups  (phyints only) */
31*c60d41a9Swiz     struct listaddr *uv_neighbors;  /* list of neighboring routers          */
32*c60d41a9Swiz     struct vif_acl  *uv_acl;	    /* access control list of groups        */
33*c60d41a9Swiz     int		     uv_leaf_timer; /* time until this vif is considrd leaf */
34*c60d41a9Swiz     struct phaddr   *uv_addrs;	    /* Additional subnets on this vif       */
35*c60d41a9Swiz };
36*c60d41a9Swiz 
37*c60d41a9Swiz #define VIFF_KERNEL_FLAGS	(VIFF_TUNNEL|VIFF_SRCRT)
38*c60d41a9Swiz #define VIFF_DOWN		0x0100	       /* kernel state of interface */
39*c60d41a9Swiz #define VIFF_DISABLED		0x0200	       /* administratively disabled */
40*c60d41a9Swiz #define VIFF_QUERIER		0x0400	       /* I am the subnet's querier */
41*c60d41a9Swiz #define VIFF_ONEWAY		0x0800         /* Maybe one way interface   */
42*c60d41a9Swiz #define VIFF_LEAF		0x1000         /* all neighbors are leaves  */
43*c60d41a9Swiz #define VIFF_IGMPV1		0x2000         /* Act as an IGMPv1 Router   */
44*c60d41a9Swiz 
45*c60d41a9Swiz struct phaddr {
46*c60d41a9Swiz     struct phaddr   *pa_next;
47*c60d41a9Swiz     u_int32_t	     pa_subnet;		/* extra subnet			*/
48*c60d41a9Swiz     u_int32_t	     pa_subnetmask;	/* netmask of extra subnet	*/
49*c60d41a9Swiz     u_int32_t	     pa_subnetbcast;	/* broadcast of extra subnet	*/
50*c60d41a9Swiz };
51*c60d41a9Swiz 
52*c60d41a9Swiz struct vif_acl {
53*c60d41a9Swiz     struct vif_acl  *acl_next;	    /* next acl member         */
54*c60d41a9Swiz     u_int32_t	     acl_addr;	    /* Group address           */
55*c60d41a9Swiz     u_int32_t	     acl_mask;	    /* Group addr. mask        */
56*c60d41a9Swiz };
57*c60d41a9Swiz 
58*c60d41a9Swiz struct listaddr {
59*c60d41a9Swiz     struct listaddr *al_next;		/* link to next addr, MUST BE FIRST */
60*c60d41a9Swiz     u_int32_t	     al_addr;		/* local group or neighbor address  */
61*c60d41a9Swiz     u_long	     al_timer;		/* for timing out group or neighbor */
62*c60d41a9Swiz     time_t	     al_ctime;		/* neighbor creation time	    */
63*c60d41a9Swiz     u_int32_t	     al_genid;		/* generation id for neighbor       */
64*c60d41a9Swiz     u_char	     al_pv;		/* router protocol version	    */
65*c60d41a9Swiz     u_char	     al_mv;		/* router mrouted version	    */
66*c60d41a9Swiz     u_long           al_timerid;        /* returned by set timer            */
67*c60d41a9Swiz     u_long	     al_query;		/* second query in case of leave    */
68*c60d41a9Swiz     u_short          al_old;            /* time since heard old report      */
69*c60d41a9Swiz     u_char	     al_flags;		/* flags related to this neighbor   */
70*c60d41a9Swiz };
71*c60d41a9Swiz 
72*c60d41a9Swiz #define NF_LEAF			0x01	/* This neighbor is a leaf */
73*c60d41a9Swiz #define NF_PRUNE		0x02	/* This neighbor understands prunes */
74*c60d41a9Swiz #define NF_GENID		0x04	/* I supply genid & rtrlist in probe*/
75*c60d41a9Swiz #define NF_MTRACE		0x08	/* I can understand mtrace requests */
76*c60d41a9Swiz 
77*c60d41a9Swiz #define NO_VIF		((vifi_t)MAXVIFS)  /* An invalid vif index */
78