17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*bd670b35SErik Nordmark  * Common Development and Distribution License (the "License").
6*bd670b35SErik Nordmark  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*bd670b35SErik Nordmark 
227c478bd9Sstevel@tonic-gate /*
23*bd670b35SErik Nordmark  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*bd670b35SErik Nordmark  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_NETINET_IP_MROUTE_H
297c478bd9Sstevel@tonic-gate #define	_NETINET_IP_MROUTE_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Definitions for the kernel part of DVMRP,
377c478bd9Sstevel@tonic-gate  * a Distance-Vector Multicast Routing Protocol.
387c478bd9Sstevel@tonic-gate  * (See RFC-1075.)
397c478bd9Sstevel@tonic-gate  *
407c478bd9Sstevel@tonic-gate  * Written by David Waitzman, BBN Labs, August 1988.
417c478bd9Sstevel@tonic-gate  * Modified by Steve Deering, Stanford, February 1989.
427c478bd9Sstevel@tonic-gate  * Modified by Ajit Thyagarajan, PARC, August 1993.
437c478bd9Sstevel@tonic-gate  * Modified by Ajit Thyagarajan, PARC, August 1994.
447c478bd9Sstevel@tonic-gate  *
457c478bd9Sstevel@tonic-gate  * MROUTING 3.5
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * DVMRP-specific setsockopt commands.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #define	MRT_INIT		100	/* initialize forwarder */
537c478bd9Sstevel@tonic-gate #define	MRT_DONE		101	/* shut down forwarder */
547c478bd9Sstevel@tonic-gate #define	MRT_ADD_VIF		102	/* create virtual interface */
557c478bd9Sstevel@tonic-gate #define	MRT_DEL_VIF		103	/* delete virtual interface */
567c478bd9Sstevel@tonic-gate #define	MRT_ADD_MFC		104	/* insert forwarding cache entry */
577c478bd9Sstevel@tonic-gate #define	MRT_DEL_MFC		105	/* delete forwarding cache entry */
587c478bd9Sstevel@tonic-gate #define	MRT_VERSION		106	/* get kernel version number */
597c478bd9Sstevel@tonic-gate #define	MRT_ASSERT		107	/* enable PIM assert processing */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * Types and macros for handling bitmaps with one bit per virtual interface.
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate #define	MAXVIFS			32
657c478bd9Sstevel@tonic-gate typedef uint_t			vifbitmap_t;
667c478bd9Sstevel@tonic-gate typedef ushort_t		vifi_t;	/* type of a vif index */
677c478bd9Sstevel@tonic-gate #define	ALL_VIFS		(vifi_t)-1
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	VIFM_SET(n, m)		((m) |=  (1 << (n)))
707c478bd9Sstevel@tonic-gate #define	VIFM_CLR(n, m)		((m) &= ~(1 << (n)))
717c478bd9Sstevel@tonic-gate #define	VIFM_ISSET(n, m)	((m) &   (1 << (n)))
727c478bd9Sstevel@tonic-gate #define	VIFM_CLRALL(m)		((m) = 0x00000000)
737c478bd9Sstevel@tonic-gate #define	VIFM_COPY(mfrom, mto)	((mto) = (mfrom))
747c478bd9Sstevel@tonic-gate #define	VIFM_SAME(m1, m2)	((m1) == (m2))
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Argument structure for MRT_ADD_VIF. Also used for netstat.
797c478bd9Sstevel@tonic-gate  * (MRT_DEL_VIF takes a single vifi_t argument.)
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate struct vifctl {
827c478bd9Sstevel@tonic-gate     vifi_t	vifc_vifi;	/* the index of the vif to be added   */
837c478bd9Sstevel@tonic-gate 	uchar_t	vifc_flags;	/* VIFF_ flags defined below	*/
847c478bd9Sstevel@tonic-gate 	uchar_t	vifc_threshold;		/* min ttl required to forward on vif */
857c478bd9Sstevel@tonic-gate 	uint_t	vifc_rate_limit;	/* max rate	*/
867c478bd9Sstevel@tonic-gate 	struct	in_addr	vifc_lcl_addr;	/* local interface address	*/
877c478bd9Sstevel@tonic-gate 	struct	in_addr	vifc_rmt_addr;	/* remote address(tunnels only)	*/
887c478bd9Sstevel@tonic-gate 	/*
897c478bd9Sstevel@tonic-gate 	 * vifc_pkt_in/out in Solaris, to report out of the kernel.
907c478bd9Sstevel@tonic-gate 	 * Not nec. in BSD.
917c478bd9Sstevel@tonic-gate 	 */
927c478bd9Sstevel@tonic-gate 	uint_t	vifc_pkt_in;		/* # Pkts in on interface	*/
937c478bd9Sstevel@tonic-gate 	uint_t	vifc_pkt_out;		/* # Pkts out on interface	*/
947c478bd9Sstevel@tonic-gate };
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #define	VIFF_TUNNEL	0x1		/* vif represents a tunnel end-point */
977c478bd9Sstevel@tonic-gate #define	VIFF_SRCRT	0x2		/* tunnel uses IP src routing	*/
987c478bd9Sstevel@tonic-gate #define	VIFF_REGISTER	0x4		/* for RPF check of PIM Register msg */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
1027c478bd9Sstevel@tonic-gate  * (mfcc_tos to be added at a future point)
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate struct mfcctl {
1057c478bd9Sstevel@tonic-gate     struct	in_addr	mfcc_origin;	/* ip origin of mcasts	*/
1067c478bd9Sstevel@tonic-gate     struct	in_addr	mfcc_mcastgrp; 	/* multicast group associated */
1077c478bd9Sstevel@tonic-gate     vifi_t		mfcc_parent;	/* incoming vif	*/
1087c478bd9Sstevel@tonic-gate     uint_t		mfcc_pkt_cnt;	/* pkt count for src-grp	*/
1097c478bd9Sstevel@tonic-gate     uchar_t		mfcc_ttls[MAXVIFS]; 	/* forwarding ttls on vifs    */
1107c478bd9Sstevel@tonic-gate };
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate /*
1137c478bd9Sstevel@tonic-gate  * The kernel's multicast routing statistics.
1147c478bd9Sstevel@tonic-gate  */
1157c478bd9Sstevel@tonic-gate struct mrtstat {
1167c478bd9Sstevel@tonic-gate     uint_t	mrts_mfcfind_lookups;	/* #forwarding cache table lookups */
1177c478bd9Sstevel@tonic-gate     uint_t	mrts_mfcfind_misses;    /* # forwarding cache table misses */
1187c478bd9Sstevel@tonic-gate     uint_t	mrts_mfc_hits;		/* forwarding pkt mfctable hits	   */
1197c478bd9Sstevel@tonic-gate     uint_t	mrts_mfc_misses;	/* forwarding pkt mfctable misses  */
1207c478bd9Sstevel@tonic-gate     uint_t	mrts_upcalls;		/* # calls to mrouted		   */
1217c478bd9Sstevel@tonic-gate     uint_t	mrts_fwd_in;		/* # packets potentially forwarded */
1227c478bd9Sstevel@tonic-gate     uint_t	mrts_fwd_out;		/* # resulting outgoing packets    */
1237c478bd9Sstevel@tonic-gate     uint_t	mrts_fwd_drop;		/* # dropped for lack of resources */
1247c478bd9Sstevel@tonic-gate     uint_t	mrts_bad_tunnel;	/* malformed tunnel options	   */
1257c478bd9Sstevel@tonic-gate     uint_t	mrts_cant_tunnel;	/* no room for tunnel options	   */
1267c478bd9Sstevel@tonic-gate     uint_t	mrts_wrong_if;		/* arrived on wrong interface	   */
1277c478bd9Sstevel@tonic-gate     uint_t	mrts_upq_ovflw;		/* upcall Q overflow		   */
1287c478bd9Sstevel@tonic-gate     uint_t	mrts_cache_cleanups;	/* # entries with no upcalls	   */
1297c478bd9Sstevel@tonic-gate     uint_t	mrts_drop_sel;		/* pkts dropped selectively	   */
1307c478bd9Sstevel@tonic-gate     uint_t	mrts_q_overflow;	/* pkts dropped - Q overflow	   */
1317c478bd9Sstevel@tonic-gate     uint_t	mrts_pkt2large;		/* pkts dropped - size > BKT SIZE  */
1327c478bd9Sstevel@tonic-gate     uint_t	mrts_vifctlSize;	/* Size of vifctl		   */
1337c478bd9Sstevel@tonic-gate     uint_t	mrts_mfcctlSize;	/* Size of mfcctl		   */
1347c478bd9Sstevel@tonic-gate     uint_t 	mrts_pim_badversion;    /* dtgrms dropped - bad version */
1357c478bd9Sstevel@tonic-gate     uint_t 	mrts_pim_rcv_badcsum;   /* dtgrms dropped - bad checksum */
1367c478bd9Sstevel@tonic-gate     uint_t 	mrts_pim_badregisters;  /* dtgrms dropped - bad register pkts */
1377c478bd9Sstevel@tonic-gate     uint_t 	mrts_pim_regforwards;   /* dtgrms to be forwd - register pkts */
1387c478bd9Sstevel@tonic-gate     uint_t 	mrts_pim_regsend_drops; /* dtgrms dropped - register send */
1397c478bd9Sstevel@tonic-gate     uint_t	mrts_pim_malformed;	/* dtgrms dropped - packet malformed */
1407c478bd9Sstevel@tonic-gate     uint_t	mrts_pim_nomemory;	/* dtgrms dropped - no memory to fwd. */
1417c478bd9Sstevel@tonic-gate };
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * Argument structure used by mrouted to get src-grp pkt counts
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate struct sioc_sg_req {
1477c478bd9Sstevel@tonic-gate     struct in_addr src;
1487c478bd9Sstevel@tonic-gate     struct in_addr grp;
1497c478bd9Sstevel@tonic-gate     uint_t pktcnt;
1507c478bd9Sstevel@tonic-gate     uint_t bytecnt;
1517c478bd9Sstevel@tonic-gate     uint_t wrong_if;
1527c478bd9Sstevel@tonic-gate };
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /*
1557c478bd9Sstevel@tonic-gate  * Argument structure used by mrouted to get vif pkt counts
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate struct sioc_vif_req {
1587c478bd9Sstevel@tonic-gate     vifi_t	vifi;		/* vif number				*/
1597c478bd9Sstevel@tonic-gate     uint_t	icount;		/* Input packet count on vif		*/
1607c478bd9Sstevel@tonic-gate     uint_t	ocount;		/* Output packet count on vif		*/
1617c478bd9Sstevel@tonic-gate     uint_t	ibytes;		/* Input byte count on vif		*/
1627c478bd9Sstevel@tonic-gate     uint_t	obytes;		/* Output byte count on vif		*/
1637c478bd9Sstevel@tonic-gate };
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifdef _KERNEL
1667c478bd9Sstevel@tonic-gate /*
1677c478bd9Sstevel@tonic-gate  * The kernel's virtual-interface structure.
1687c478bd9Sstevel@tonic-gate  */
1697c478bd9Sstevel@tonic-gate struct vif {
1707c478bd9Sstevel@tonic-gate 	uchar_t		v_flags;	/* VIFF_ flags defined above	*/
1717c478bd9Sstevel@tonic-gate 	uchar_t		v_threshold;	/* Min ttl required to forward on vif */
1727c478bd9Sstevel@tonic-gate 	uint_t		v_rate_limit;	/* Max rate, in kbits/sec	*/
1737c478bd9Sstevel@tonic-gate 	struct tbf	*v_tbf;		/* Token bkt structure at intf.	*/
1747c478bd9Sstevel@tonic-gate 	struct in_addr	v_lcl_addr;	/* Local interface address	*/
1757c478bd9Sstevel@tonic-gate 	struct in_addr	v_rmt_addr;	/* Remote address(tunnels only)	*/
1767c478bd9Sstevel@tonic-gate 	struct ipif_s 	*v_ipif;	/* Pointer to logical interface	*/
1777c478bd9Sstevel@tonic-gate 	uint_t		v_pkt_in;	/* # Pkts in on interface	*/
1787c478bd9Sstevel@tonic-gate 	uint_t		v_pkt_out;	/* # Pkts out on interface	*/
1797c478bd9Sstevel@tonic-gate 	uint_t		v_bytes_in;	/* # Bytes in on interface	*/
1807c478bd9Sstevel@tonic-gate 	uint_t		v_bytes_out;	/* # Bytes out on interface	*/
1817c478bd9Sstevel@tonic-gate 	timeout_id_t	v_timeout_id;	/* Qtimeout return id	*/
1827c478bd9Sstevel@tonic-gate 	/*
1837c478bd9Sstevel@tonic-gate 	 * struct route	v_route;	Cached route if this is a tunnel
1847c478bd9Sstevel@tonic-gate 	 *				Used in bsd for performance
1857c478bd9Sstevel@tonic-gate 	 */
1867c478bd9Sstevel@tonic-gate 	uint_t			v_refcnt;
1877c478bd9Sstevel@tonic-gate 	uchar_t 		v_marks;
1887c478bd9Sstevel@tonic-gate 	kmutex_t		v_lock;
189*bd670b35SErik Nordmark 	ilm_t			*v_ilm;	/* allmulti join */
1907c478bd9Sstevel@tonic-gate };
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
1937c478bd9Sstevel@tonic-gate  * vif is not being used. However if refcnt != 0 than its being initalized.
1947c478bd9Sstevel@tonic-gate  */
1957c478bd9Sstevel@tonic-gate #define	VIF_MARK_NOTINUSE	0x0	/* see comment above */
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate #define	VIF_MARK_CONDEMNED	0x1	/* delete when refcnt goes to zero. */
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate #define	VIF_MARK_GOOD		0x2	/* vif is good */
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate #define	VIF_MARK_INUSE		VIF_MARK_CONDEMNED | VIF_MARK_GOOD
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate /*
2047c478bd9Sstevel@tonic-gate  * The kernel's multicast forwarding cache entry structure
2057c478bd9Sstevel@tonic-gate  * (A field for the type of service (mfc_tos) is to be added
2067c478bd9Sstevel@tonic-gate  * at a future point)
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate struct mfc {
2097c478bd9Sstevel@tonic-gate     struct in_addr	mfc_origin;	/* ip origin of mcasts	*/
2107c478bd9Sstevel@tonic-gate     struct in_addr  	mfc_mcastgrp;	/* multicast group associated */
2117c478bd9Sstevel@tonic-gate     vifi_t		mfc_parent;	/* incoming vif	*/
2127c478bd9Sstevel@tonic-gate     uchar_t		mfc_ttls[MAXVIFS];	/* forwarding ttls on vifs    */
2137c478bd9Sstevel@tonic-gate     uint_t		mfc_pkt_cnt;	/* pkt count for src-grp	*/
2147c478bd9Sstevel@tonic-gate     uint_t		mfc_byte_cnt;	/* byte count for src-grp	*/
2157c478bd9Sstevel@tonic-gate     uint_t		mfc_wrong_if;	/* wrong if for src-grp	*/
2167c478bd9Sstevel@tonic-gate     struct timespec  	mfc_last_assert;	/* last time I sent an assert */
2177c478bd9Sstevel@tonic-gate     struct rtdetq	*mfc_rte;	/* pending upcall	*/
2187c478bd9Sstevel@tonic-gate     timeout_id_t	mfc_timeout_id;	/* qtimeout return id	*/
2197c478bd9Sstevel@tonic-gate     struct mfc		*mfc_next;
2207c478bd9Sstevel@tonic-gate     uchar_t 		mfc_marks;
2217c478bd9Sstevel@tonic-gate     kmutex_t		mfc_mutex;	/* protects fields and rte list */
2227c478bd9Sstevel@tonic-gate };
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /*
2257c478bd9Sstevel@tonic-gate  * mfc bucket structure.
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate struct mfcb {
2287c478bd9Sstevel@tonic-gate     struct mfc  *mfcb_mfc;	/* first mfc in this bucket */
2297c478bd9Sstevel@tonic-gate     kmutex_t	mfcb_lock;
2307c478bd9Sstevel@tonic-gate     uint_t	mfcb_refcnt;	/* protected by mfcb_lock */
2317c478bd9Sstevel@tonic-gate     uchar_t	mfcb_marks;	/* protected by mfcb_lock */
2327c478bd9Sstevel@tonic-gate };
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate #define	MFCB_MARK_CONDEMNED	0x1
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate /*
2377c478bd9Sstevel@tonic-gate  * Argument structure used for pkt info. while upcall is made
2387c478bd9Sstevel@tonic-gate  */
2397c478bd9Sstevel@tonic-gate struct rtdetq {
2407c478bd9Sstevel@tonic-gate     mblk_t		*mp;		/*  A copy of the packet	*/
2417c478bd9Sstevel@tonic-gate     ill_t		*ill;		/*  Interface pkt came in on	*/
2427c478bd9Sstevel@tonic-gate     struct rtdetq	*rte_next;
2437c478bd9Sstevel@tonic-gate };
2447c478bd9Sstevel@tonic-gate #endif
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * Struct used to communicate from kernel to multicast router
2487c478bd9Sstevel@tonic-gate  * note the convenient similarity to an IP packet
2497c478bd9Sstevel@tonic-gate  */
2507c478bd9Sstevel@tonic-gate struct igmpmsg {
2517c478bd9Sstevel@tonic-gate     uint_t	    unused1;
2527c478bd9Sstevel@tonic-gate     uint_t	    unused2;
2537c478bd9Sstevel@tonic-gate     uchar_t	    im_msgtype;			/* what type of message	    */
2547c478bd9Sstevel@tonic-gate #define	IGMPMSG_NOCACHE		1
2557c478bd9Sstevel@tonic-gate #define	IGMPMSG_WRONGVIF	2
2567c478bd9Sstevel@tonic-gate #define	IGMPMSG_WHOLEPKT	3
2577c478bd9Sstevel@tonic-gate     uchar_t	    im_mbz;			/* must be zero		    */
2587c478bd9Sstevel@tonic-gate     uchar_t	    im_vif;			/* vif rec'd on		    */
2597c478bd9Sstevel@tonic-gate     uchar_t	    unused3;
2607c478bd9Sstevel@tonic-gate     struct in_addr  im_src, im_dst;
2617c478bd9Sstevel@tonic-gate };
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate #ifdef _KERNEL
2647c478bd9Sstevel@tonic-gate #define	MFCTBLSIZ	256
2657c478bd9Sstevel@tonic-gate #if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0	  /* from sys:route.h */
2667c478bd9Sstevel@tonic-gate #define	MFCHASHMOD(h)	((h) & (MFCTBLSIZ - 1))
2677c478bd9Sstevel@tonic-gate #else
2687c478bd9Sstevel@tonic-gate #define	MFCHASHMOD(h)	((h) % MFCTBLSIZ)
2697c478bd9Sstevel@tonic-gate #endif
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate #define	MAX_UPQ	4		/* max. no of pkts in upcall Q */
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate  * Token Bucket filter code
2757c478bd9Sstevel@tonic-gate  */
2767c478bd9Sstevel@tonic-gate #define	MAX_BKT_SIZE	10000		/* 10K bytes size 		*/
2777c478bd9Sstevel@tonic-gate #define	MAXQSIZE	10		/* max # of pkts in queue 	*/
2787c478bd9Sstevel@tonic-gate #define	TOKEN_SIZE	8		/* number of bits in token	*/
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate /*
2817c478bd9Sstevel@tonic-gate  * The token bucket filter at each vif
2827c478bd9Sstevel@tonic-gate  */
2837c478bd9Sstevel@tonic-gate struct tbf {
2847c478bd9Sstevel@tonic-gate     timespec_t 		tbf_last_pkt_t; /* arr. time of last pkt 	*/
2857c478bd9Sstevel@tonic-gate     uint_t 		tbf_n_tok;	/* no of tokens in bucket 	*/
2867c478bd9Sstevel@tonic-gate     uint_t 		tbf_q_len;    	/* length of queue at this vif	*/
2877c478bd9Sstevel@tonic-gate     uint_t 		tbf_max_q_len;  /* max queue length		*/
2887c478bd9Sstevel@tonic-gate     mblk_t		*tbf_q;		/* Packet queue	*/
2897c478bd9Sstevel@tonic-gate     mblk_t		*tbf_t;		/* Tail-insertion pointer	*/
2907c478bd9Sstevel@tonic-gate     kmutex_t 		tbf_lock;	/* lock on the tbf		*/
2917c478bd9Sstevel@tonic-gate };
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2967c478bd9Sstevel@tonic-gate }
2977c478bd9Sstevel@tonic-gate #endif
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate #endif	/* _NETINET_IP_MROUTE_H */
300