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