xref: /openbsd/sys/net/if_bridge.h (revision 1cfe6aaa)
1 /*	$OpenBSD: if_bridge.h,v 1.58 2018/12/07 16:19:40 mpi Exp $	*/
2 
3 /*
4  * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
5  * Copyright (c) 2006 Andrew Thompson (thompsa@FreeBSD.org)
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Effort sponsored in part by the Defense Advanced Research Projects
30  * Agency (DARPA) and Air Force Research Laboratory, Air Force
31  * Materiel Command, USAF, under agreement number F30602-01-2-0537.
32  *
33  */
34 
35 #ifndef _NET_IF_BRIDGE_H_
36 #define _NET_IF_BRIDGE_H_
37 
38 #include <sys/timeout.h>
39 #include <net/pfvar.h>
40 
41 /*
42  * Bridge control request: add/delete member interfaces.
43  */
44 struct ifbreq {
45 	char		ifbr_name[IFNAMSIZ];	/* bridge ifs name */
46 	char		ifbr_ifsname[IFNAMSIZ];	/* member ifs name */
47 	u_int32_t	ifbr_ifsflags;		/* member ifs flags */
48 	u_int32_t	ifbr_portno;		/* member port number */
49 	u_int32_t	ifbr_protected;		/* protected domains */
50 
51 	u_int8_t	ifbr_state;		/* member stp state */
52 	u_int8_t	ifbr_priority;		/* member stp priority */
53 	u_int32_t	ifbr_path_cost;		/* member stp path cost */
54 	u_int32_t	ifbr_stpflags;          /* member stp flags */
55 	u_int8_t	ifbr_proto;		/* member stp protocol */
56 	u_int8_t	ifbr_role;		/* member stp role */
57 	u_int32_t	ifbr_fwd_trans;		/* member stp fwd transitions */
58 	u_int64_t	ifbr_desg_bridge;	/* member stp designated bridge */
59 	u_int32_t	ifbr_desg_port;		/* member stp designated port */
60 	u_int64_t	ifbr_root_bridge;	/* member stp root bridge */
61 	u_int32_t	ifbr_root_cost;		/* member stp root cost */
62 	u_int32_t	ifbr_root_port;		/* member stp root port */
63 };
64 
65 /* SIOCBRDGIFFLGS, SIOCBRDGIFFLGS */
66 #define	IFBIF_LEARNING		0x0001	/* ifs can learn */
67 #define	IFBIF_DISCOVER		0x0002	/* ifs sends packets w/unknown dest */
68 #define	IFBIF_BLOCKNONIP	0x0004	/* ifs blocks non-IP/ARP in/out */
69 #define	IFBIF_STP		0x0008	/* ifs participates in spanning tree */
70 #define IFBIF_BSTP_EDGE		0x0010	/* member stp edge port */
71 #define IFBIF_BSTP_AUTOEDGE	0x0020  /* member stp autoedge enabled */
72 #define IFBIF_BSTP_PTP		0x0040  /* member stp ptp */
73 #define IFBIF_BSTP_AUTOPTP	0x0080	/* member stp autoptp enabled */
74 #define	IFBIF_SPAN		0x0100	/* ifs is a span port (ro) */
75 #define	IFBIF_LOCAL		0x1000	/* local port in switch(4) */
76 #define	IFBIF_RO_MASK		0x0f00	/* read only bits */
77 
78 /* SIOCBRDGFLUSH */
79 #define	IFBF_FLUSHDYN	0x0	/* flush dynamic addresses only */
80 #define	IFBF_FLUSHALL	0x1	/* flush all addresses from cache */
81 
82 /* port states */
83 #define	BSTP_IFSTATE_DISABLED	0
84 #define	BSTP_IFSTATE_LISTENING	1
85 #define	BSTP_IFSTATE_LEARNING	2
86 #define	BSTP_IFSTATE_FORWARDING	3
87 #define	BSTP_IFSTATE_BLOCKING	4
88 #define	BSTP_IFSTATE_DISCARDING	5
89 
90 #define	BSTP_TCSTATE_ACTIVE	1
91 #define	BSTP_TCSTATE_DETECTED	2
92 #define	BSTP_TCSTATE_INACTIVE	3
93 #define	BSTP_TCSTATE_LEARNING	4
94 #define	BSTP_TCSTATE_PROPAG	5
95 #define	BSTP_TCSTATE_ACK	6
96 #define	BSTP_TCSTATE_TC		7
97 #define	BSTP_TCSTATE_TCN	8
98 
99 #define	BSTP_ROLE_DISABLED	0
100 #define	BSTP_ROLE_ROOT		1
101 #define	BSTP_ROLE_DESIGNATED	2
102 #define	BSTP_ROLE_ALTERNATE	3
103 #define	BSTP_ROLE_BACKUP	4
104 
105 /*
106  * Interface list structure
107  */
108 struct ifbifconf {
109 	char		ifbic_name[IFNAMSIZ];	/* bridge ifs name */
110 	u_int32_t	ifbic_len;		/* buffer size */
111 	union {
112 		caddr_t	ifbicu_buf;
113 		struct	ifbreq *ifbicu_req;
114 	} ifbic_ifbicu;
115 #define	ifbic_buf	ifbic_ifbicu.ifbicu_buf
116 #define	ifbic_req	ifbic_ifbicu.ifbicu_req
117 };
118 
119 /*
120  * Bridge address request
121  */
122 struct ifbareq {
123 	char			ifba_name[IFNAMSIZ];	/* bridge name */
124 	char			ifba_ifsname[IFNAMSIZ];	/* destination ifs */
125 	u_int8_t		ifba_age;		/* address age */
126 	u_int8_t		ifba_flags;		/* address flags */
127 	struct ether_addr	ifba_dst;		/* destination addr */
128 	struct sockaddr_storage	ifba_dstsa;		/* tunnel endpoint */
129 };
130 
131 #define	IFBAF_TYPEMASK		0x03		/* address type mask */
132 #define	IFBAF_DYNAMIC		0x00		/* dynamically learned */
133 #define	IFBAF_STATIC		0x01		/* static address */
134 
135 struct ifbaconf {
136 	char			ifbac_name[IFNAMSIZ];	/* bridge ifs name */
137 	u_int32_t		ifbac_len;		/* buffer size */
138 	union {
139 		caddr_t	ifbacu_buf;			/* buffer */
140 		struct ifbareq *ifbacu_req;		/* request pointer */
141 	} ifbac_ifbacu;
142 #define	ifbac_buf	ifbac_ifbacu.ifbacu_buf
143 #define	ifbac_req	ifbac_ifbacu.ifbacu_req
144 };
145 
146 struct ifbrparam {
147 	char			ifbrp_name[IFNAMSIZ];
148 	union {
149 		u_int32_t	ifbrpu_csize;		/* cache size */
150 		int		ifbrpu_ctime;		/* cache time (sec) */
151 		u_int16_t	ifbrpu_prio;		/* bridge priority */
152 		u_int8_t	ifbrpu_hellotime;	/* hello time (sec) */
153 		u_int8_t	ifbrpu_fwddelay;	/* fwd delay (sec) */
154 		u_int8_t	ifbrpu_maxage;		/* max age (sec) */
155 		u_int8_t	ifbrpu_proto;		/* bridge protocol */
156 		u_int8_t	ifbrpu_txhc;		/* bpdu tx holdcount */
157 		u_int64_t	ifbrpu_datapath;	/* datapath-id */
158 		u_int32_t	ifbrpu_maxgroup;	/* group size */
159 	} ifbrp_ifbrpu;
160 };
161 #define	ifbrp_csize	ifbrp_ifbrpu.ifbrpu_csize
162 #define	ifbrp_ctime	ifbrp_ifbrpu.ifbrpu_ctime
163 #define	ifbrp_prio	ifbrp_ifbrpu.ifbrpu_prio
164 #define	ifbrp_proto	ifbrp_ifbrpu.ifbrpu_proto
165 #define	ifbrp_txhc	ifbrp_ifbrpu.ifbrpu_txhc
166 #define	ifbrp_hellotime	ifbrp_ifbrpu.ifbrpu_hellotime
167 #define	ifbrp_fwddelay	ifbrp_ifbrpu.ifbrpu_fwddelay
168 #define	ifbrp_maxage	ifbrp_ifbrpu.ifbrpu_maxage
169 #define	ifbrp_datapath	ifbrp_ifbrpu.ifbrpu_datapath
170 #define	ifbrp_maxflow	ifbrp_ifbrpu.ifbrpu_csize
171 #define	ifbrp_maxgroup	ifbrp_ifbrpu.ifbrpu_maxgroup
172 
173 /* Protocol versions */
174 #define	BSTP_PROTO_ID		0x00
175 #define	BSTP_PROTO_STP		0x00
176 #define	BSTP_PROTO_RSTP		0x02
177 #define	BSTP_PROTO_MAX		BSTP_PROTO_RSTP
178 
179 /*
180  * Bridge current operational parameters structure.
181  */
182 struct ifbropreq {
183 	char		ifbop_name[IFNAMSIZ];
184 	u_int8_t	ifbop_holdcount;
185 	u_int8_t	ifbop_maxage;
186 	u_int8_t	ifbop_hellotime;
187 	u_int8_t	ifbop_fwddelay;
188 	u_int8_t	ifbop_protocol;
189 	u_int16_t	ifbop_priority;
190 	u_int64_t	ifbop_root_bridge;
191 	u_int16_t	ifbop_root_port;
192 	u_int32_t	ifbop_root_path_cost;
193 	u_int64_t	ifbop_desg_bridge;
194 	struct timeval	ifbop_last_tc_time;
195 };
196 
197 /*
198  * Bridge mac rules
199  */
200 struct ifbrarpf {
201 	u_int16_t		brla_flags;
202 	u_int16_t		brla_op;
203 	struct ether_addr	brla_sha;
204 	struct in_addr		brla_spa;
205 	struct ether_addr	brla_tha;
206 	struct in_addr		brla_tpa;
207 };
208 #define	BRLA_ARP	0x01
209 #define	BRLA_RARP	0x02
210 #define	BRLA_SHA	0x10
211 #define	BRLA_SPA	0x20
212 #define	BRLA_THA	0x40
213 #define	BRLA_TPA	0x80
214 
215 struct ifbrlreq {
216 	char			ifbr_name[IFNAMSIZ];	/* bridge ifs name */
217 	char			ifbr_ifsname[IFNAMSIZ];	/* member ifs name */
218 	u_int8_t		ifbr_action;		/* disposition */
219 	u_int8_t		ifbr_flags;		/* flags */
220 	struct ether_addr	ifbr_src;		/* source mac */
221 	struct ether_addr	ifbr_dst;		/* destination mac */
222 	char			ifbr_tagname[PF_TAG_NAME_SIZE];	/* pf tagname */
223 	struct ifbrarpf		ifbr_arpf;		/* arp filter */
224 };
225 #define	BRL_ACTION_BLOCK	0x01			/* block frame */
226 #define	BRL_ACTION_PASS		0x02			/* pass frame */
227 #define	BRL_FLAG_IN		0x08			/* input rule */
228 #define	BRL_FLAG_OUT		0x04			/* output rule */
229 #define	BRL_FLAG_SRCVALID	0x02			/* src valid */
230 #define	BRL_FLAG_DSTVALID	0x01			/* dst valid */
231 
232 struct ifbrlconf {
233 	char		ifbrl_name[IFNAMSIZ];	/* bridge ifs name */
234 	char		ifbrl_ifsname[IFNAMSIZ];/* member ifs name */
235 	u_int32_t	ifbrl_len;		/* buffer size */
236 	union {
237 		caddr_t	ifbrlu_buf;
238 		struct	ifbrlreq *ifbrlu_req;
239 	} ifbrl_ifbrlu;
240 #define	ifbrl_buf	ifbrl_ifbrlu.ifbrlu_buf
241 #define	ifbrl_req	ifbrl_ifbrlu.ifbrlu_req
242 };
243 
244 #ifdef _KERNEL
245 /* STP port flags */
246 #define	BSTP_PORT_CANMIGRATE	0x0001
247 #define	BSTP_PORT_NEWINFO	0x0002
248 #define	BSTP_PORT_DISPUTED	0x0004
249 #define	BSTP_PORT_ADMCOST	0x0008
250 #define	BSTP_PORT_AUTOEDGE	0x0010
251 #define	BSTP_PORT_AUTOPTP	0x0020
252 
253 /* BPDU priority */
254 #define	BSTP_PDU_SUPERIOR	1
255 #define	BSTP_PDU_REPEATED	2
256 #define	BSTP_PDU_INFERIOR	3
257 #define	BSTP_PDU_INFERIORALT	4
258 #define	BSTP_PDU_OTHER		5
259 
260 /* BPDU flags */
261 #define	BSTP_PDU_PRMASK		0x0c		/* Port Role */
262 #define	BSTP_PDU_PRSHIFT	2		/* Port Role offset */
263 #define	BSTP_PDU_F_UNKN		0x00		/* Unknown port    (00) */
264 #define	BSTP_PDU_F_ALT		0x01		/* Alt/Backup port (01) */
265 #define	BSTP_PDU_F_ROOT		0x02		/* Root port       (10) */
266 #define	BSTP_PDU_F_DESG		0x03		/* Designated port (11) */
267 
268 #define	BSTP_PDU_STPMASK	0x81		/* strip unused STP flags */
269 #define	BSTP_PDU_RSTPMASK	0x7f		/* strip unused RSTP flags */
270 #define	BSTP_PDU_F_TC		0x01		/* Topology change */
271 #define	BSTP_PDU_F_P		0x02		/* Proposal flag */
272 #define	BSTP_PDU_F_L		0x10		/* Learning flag */
273 #define	BSTP_PDU_F_F		0x20		/* Forwarding flag */
274 #define	BSTP_PDU_F_A		0x40		/* Agreement flag */
275 #define	BSTP_PDU_F_TCA		0x80		/* Topology change ack */
276 
277 /*
278  * Bridge filtering rules
279  */
280 SIMPLEQ_HEAD(brl_head, brl_node);
281 
282 struct brl_node {
283 	SIMPLEQ_ENTRY(brl_node)	brl_next;	/* next rule */
284 	struct ether_addr	brl_src;	/* source mac address */
285 	struct ether_addr	brl_dst;	/* destination mac address */
286 	u_int16_t		brl_tag;	/* pf tag ID */
287 	u_int8_t		brl_action;	/* what to do with match */
288 	u_int8_t		brl_flags;	/* comparision flags */
289 	struct ifbrarpf		brl_arpf;	/* arp filter */
290 };
291 
292 struct bstp_timer {
293 	u_int16_t	active;
294 	u_int16_t	value;
295 	u_int32_t	latched;
296 };
297 
298 struct bstp_pri_vector {
299 	u_int64_t	pv_root_id;
300 	u_int32_t	pv_cost;
301 	u_int64_t	pv_dbridge_id;
302 	u_int16_t	pv_dport_id;
303 	u_int16_t	pv_port_id;
304 };
305 
306 struct bstp_config_unit {
307 	struct bstp_pri_vector	cu_pv;
308 	u_int16_t	cu_message_age;
309 	u_int16_t	cu_max_age;
310 	u_int16_t	cu_forward_delay;
311 	u_int16_t	cu_hello_time;
312 	u_int8_t	cu_message_type;
313 	u_int8_t	cu_topology_change_ack;
314 	u_int8_t	cu_topology_change;
315 	u_int8_t	cu_proposal;
316 	u_int8_t	cu_agree;
317 	u_int8_t	cu_learning;
318 	u_int8_t	cu_forwarding;
319 	u_int8_t	cu_role;
320 };
321 
322 struct bstp_tcn_unit {
323 	u_int8_t	tu_message_type;
324 };
325 
326 struct bstp_port {
327 	LIST_ENTRY(bstp_port)	bp_next;
328 	struct ifnet		*bp_ifp;	/* parent if */
329 	struct bstp_state	*bp_bs;
330 	void			*bp_lhcookie;	/* if linkstate hook */
331 	u_int8_t		bp_active;
332 	u_int8_t		bp_protover;
333 	u_int32_t		bp_flags;
334 	u_int32_t		bp_path_cost;
335 	u_int16_t		bp_port_msg_age;
336 	u_int16_t		bp_port_max_age;
337 	u_int16_t		bp_port_fdelay;
338 	u_int16_t		bp_port_htime;
339 	u_int16_t		bp_desg_msg_age;
340 	u_int16_t		bp_desg_max_age;
341 	u_int16_t		bp_desg_fdelay;
342 	u_int16_t		bp_desg_htime;
343 	struct bstp_timer	bp_edge_delay_timer;
344 	struct bstp_timer	bp_forward_delay_timer;
345 	struct bstp_timer	bp_hello_timer;
346 	struct bstp_timer	bp_message_age_timer;
347 	struct bstp_timer	bp_migrate_delay_timer;
348 	struct bstp_timer	bp_recent_backup_timer;
349 	struct bstp_timer	bp_recent_root_timer;
350 	struct bstp_timer	bp_tc_timer;
351 	struct bstp_config_unit bp_msg_cu;
352 	struct bstp_pri_vector	bp_desg_pv;
353 	struct bstp_pri_vector	bp_port_pv;
354 	u_int16_t		bp_port_id;
355 	u_int8_t		bp_state;
356 	u_int8_t		bp_tcstate;
357 	u_int8_t		bp_role;
358 	u_int8_t		bp_infois;
359 	u_int8_t		bp_tc_ack;
360 	u_int8_t		bp_tc_prop;
361 	u_int8_t		bp_fdbflush;
362 	u_int8_t		bp_priority;
363 	u_int8_t		bp_ptp_link;
364 	u_int8_t		bp_agree;
365 	u_int8_t		bp_agreed;
366 	u_int8_t		bp_sync;
367 	u_int8_t		bp_synced;
368 	u_int8_t		bp_proposing;
369 	u_int8_t		bp_proposed;
370 	u_int8_t		bp_operedge;
371 	u_int8_t		bp_reroot;
372 	u_int8_t		bp_rcvdtc;
373 	u_int8_t		bp_rcvdtca;
374 	u_int8_t		bp_rcvdtcn;
375 	u_int32_t		bp_forward_transitions;
376 	u_int8_t		bp_txcount;
377 };
378 
379 /*
380  * Software state for each bridge STP.
381  */
382 struct bstp_state {
383 	struct ifnet		*bs_ifp;
384 	struct bstp_pri_vector	bs_bridge_pv;
385 	struct bstp_pri_vector	bs_root_pv;
386 	struct bstp_port	*bs_root_port;
387 	u_int8_t		bs_protover;
388 	u_int16_t		bs_migration_delay;
389 	u_int16_t		bs_edge_delay;
390 	u_int16_t		bs_bridge_max_age;
391 	u_int16_t		bs_bridge_fdelay;
392 	u_int16_t		bs_bridge_htime;
393 	u_int16_t		bs_root_msg_age;
394 	u_int16_t		bs_root_max_age;
395 	u_int16_t		bs_root_fdelay;
396 	u_int16_t		bs_root_htime;
397 	u_int16_t		bs_hold_time;
398 	u_int16_t		bs_bridge_priority;
399 	u_int8_t		bs_txholdcount;
400 	u_int8_t		bs_allsynced;
401 	struct timeout		bs_bstptimeout;		/* stp timeout */
402 	struct bstp_timer	bs_link_timer;
403 	struct timeval		bs_last_tc_time;
404 	LIST_HEAD(, bstp_port)	bs_bplist;
405 };
406 #define	bs_ifflags		bs_ifp->if_flags
407 
408 /*
409  * Bridge interface list
410  */
411 struct bridge_iflist {
412 	TAILQ_ENTRY(bridge_iflist)	next;		/* next in list */
413 	struct bridge_softc		*bridge_sc;
414 	struct bstp_port		*bif_stp;	/* STP port state */
415 	struct brl_head			bif_brlin;	/* input rules */
416 	struct brl_head			bif_brlout;	/* output rules */
417 	struct				ifnet *ifp;	/* member interface */
418 	u_int32_t			bif_flags;	/* member flags */
419 	u_int32_t			bif_protected;	/* protected domains */
420 	void				*bif_dhcookie;
421 };
422 #define bif_state			bif_stp->bp_state
423 
424 #define SAME_BRIDGE(_bp1, _bp2)						\
425 	(_bp1 && _bp2 && ((struct bridge_iflist *)_bp1)->bridge_sc ==	\
426 	    ((struct bridge_iflist *)_bp2)->bridge_sc)
427 
428 /*
429  * XXX ip_ipsp.h's sockaddr_union should be converted to sockaddr *
430  * passing with correct sa_len, then a good approach for cleaning this
431  * will become more clear.
432  */
433 union brsockaddr_union {
434 	struct sockaddr		sa;
435 	struct sockaddr_in	sin;
436 	struct sockaddr_in6	sin6;
437 };
438 
439 /*
440  * Bridge tunnel tagging
441  */
442 struct bridge_tunneltag {
443 	union brsockaddr_union		brtag_peer;
444 	union brsockaddr_union		brtag_local;
445 	u_int32_t			brtag_id;
446 };
447 
448 /*
449  * Bridge route node
450  */
451 struct bridge_rtnode {
452 	LIST_ENTRY(bridge_rtnode)	brt_next;	/* next in list */
453 	struct ifnet			*brt_if;	/* destination ifs */
454 	u_int8_t			brt_flags;	/* address flags */
455 	u_int8_t			brt_age;	/* age counter */
456 	struct ether_addr		brt_addr;	/* dst addr */
457 	struct bridge_tunneltag		brt_tunnel;	/* tunnel endpoint */
458 };
459 
460 #ifndef BRIDGE_RTABLE_SIZE
461 #define BRIDGE_RTABLE_SIZE	1024
462 #endif
463 #define BRIDGE_RTABLE_MASK	(BRIDGE_RTABLE_SIZE - 1)
464 
465 /*
466  * Software state for each bridge
467  */
468 struct bridge_softc {
469 	struct ifnet			sc_if;	/* the interface */
470 	u_int32_t			sc_brtmax;	/* max # addresses */
471 	u_int32_t			sc_brtcnt;	/* current # addrs */
472 	int				sc_brttimeout;	/* timeout ticks */
473 	u_int64_t			sc_hashkey[2];	/* siphash key */
474 	struct timeout			sc_brtimeout;	/* timeout state */
475 	struct bstp_state		*sc_stp;	/* stp state */
476 	TAILQ_HEAD(, bridge_iflist)	sc_iflist;	/* interface list */
477 	TAILQ_HEAD(, bridge_iflist)	sc_spanlist;	/* span ports */
478 	LIST_HEAD(, bridge_rtnode)	sc_rts[BRIDGE_RTABLE_SIZE];	/* hash table */
479 };
480 
481 extern const u_int8_t bstp_etheraddr[];
482 struct llc;
483 
484 int	bridge_output(struct ifnet *, struct mbuf *, struct sockaddr *,
485     struct rtentry *);
486 void	bridge_update(struct ifnet *, struct ether_addr *, int);
487 void	bridge_rtdelete(struct bridge_softc *, struct ifnet *, int);
488 void	bridge_rtagenode(struct ifnet *, int);
489 struct bridge_tunneltag *bridge_tunnel(struct mbuf *);
490 struct bridge_tunneltag *bridge_tunneltag(struct mbuf *);
491 void	bridge_tunneluntag(struct mbuf *);
492 void	bridge_copyaddr(struct sockaddr *, struct sockaddr *);
493 void	bridge_copytag(struct bridge_tunneltag *, struct bridge_tunneltag *);
494 
495 struct bstp_state *bstp_create(struct ifnet *);
496 void	bstp_destroy(struct bstp_state *);
497 void	bstp_initialization(struct bstp_state *);
498 void	bstp_stop(struct bstp_state *);
499 int	bstp_ioctl(struct ifnet *, u_long, caddr_t);
500 struct bstp_port *bstp_add(struct bstp_state *, struct ifnet *);
501 void	bstp_delete(struct bstp_port *);
502 struct mbuf *bstp_input(struct bstp_state *, struct bstp_port *,
503     struct ether_header *, struct mbuf *);
504 void	bstp_ifstate(void *);
505 u_int8_t bstp_getstate(struct bstp_state *, struct bstp_port *);
506 void	bstp_ifsflags(struct bstp_port *, u_int);
507 
508 int	bridgectl_ioctl(struct ifnet *, u_long, caddr_t);
509 struct ifnet *bridge_rtupdate(struct bridge_softc *,
510     struct ether_addr *, struct ifnet *ifp, int, u_int8_t, struct mbuf *);
511 struct bridge_rtnode *bridge_rtlookup(struct bridge_softc *,
512     struct ether_addr *);
513 void	bridge_rtflush(struct bridge_softc *, int);
514 void	bridge_rtage(void *);
515 
516 u_int8_t bridge_filterrule(struct brl_head *, struct ether_header *,
517     struct mbuf *);
518 void	bridge_flushrule(struct bridge_iflist *);
519 
520 void	bridge_fragment(struct ifnet *, struct ifnet *, struct ether_header *,
521     struct mbuf *);
522 
523 #endif /* _KERNEL */
524 #endif /* _NET_IF_BRIDGE_H_ */
525