xref: /openbsd/sys/net/if_bridge.h (revision 13dba897)
1 /*	$OpenBSD: if_bridge.h,v 1.70 2020/07/30 11:32:06 mvs 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 		u_int64_t	ifbrpu_datapath;	/* datapath-id */
159 		u_int32_t	ifbrpu_maxgroup;	/* group size */
160 	} ifbrp_ifbrpu;
161 };
162 #define	ifbrp_csize	ifbrp_ifbrpu.ifbrpu_csize
163 #define	ifbrp_ctime	ifbrp_ifbrpu.ifbrpu_ctime
164 #define	ifbrp_prio	ifbrp_ifbrpu.ifbrpu_prio
165 #define	ifbrp_proto	ifbrp_ifbrpu.ifbrpu_proto
166 #define	ifbrp_txhc	ifbrp_ifbrpu.ifbrpu_txhc
167 #define	ifbrp_hellotime	ifbrp_ifbrpu.ifbrpu_hellotime
168 #define	ifbrp_fwddelay	ifbrp_ifbrpu.ifbrpu_fwddelay
169 #define	ifbrp_maxage	ifbrp_ifbrpu.ifbrpu_maxage
170 #define	ifbrp_datapath	ifbrp_ifbrpu.ifbrpu_datapath
171 #define	ifbrp_maxflow	ifbrp_ifbrpu.ifbrpu_csize
172 #define	ifbrp_maxgroup	ifbrp_ifbrpu.ifbrpu_maxgroup
173 
174 /* Protocol versions */
175 #define	BSTP_PROTO_ID		0x00
176 #define	BSTP_PROTO_STP		0x00
177 #define	BSTP_PROTO_RSTP		0x02
178 #define	BSTP_PROTO_MAX		BSTP_PROTO_RSTP
179 
180 /*
181  * Bridge current operational parameters structure.
182  */
183 struct ifbropreq {
184 	char		ifbop_name[IFNAMSIZ];
185 	u_int8_t	ifbop_holdcount;
186 	u_int8_t	ifbop_maxage;
187 	u_int8_t	ifbop_hellotime;
188 	u_int8_t	ifbop_fwddelay;
189 	u_int8_t	ifbop_protocol;
190 	u_int16_t	ifbop_priority;
191 	u_int64_t	ifbop_root_bridge;
192 	u_int16_t	ifbop_root_port;
193 	u_int32_t	ifbop_root_path_cost;
194 	u_int64_t	ifbop_desg_bridge;
195 	struct timeval	ifbop_last_tc_time;
196 };
197 
198 /*
199  * Bridge mac rules
200  */
201 struct ifbrarpf {
202 	u_int16_t		brla_flags;
203 	u_int16_t		brla_op;
204 	struct ether_addr	brla_sha;
205 	struct in_addr		brla_spa;
206 	struct ether_addr	brla_tha;
207 	struct in_addr		brla_tpa;
208 };
209 #define	BRLA_ARP	0x01
210 #define	BRLA_RARP	0x02
211 #define	BRLA_SHA	0x10
212 #define	BRLA_SPA	0x20
213 #define	BRLA_THA	0x40
214 #define	BRLA_TPA	0x80
215 
216 struct ifbrlreq {
217 	char			ifbr_name[IFNAMSIZ];	/* bridge ifs name */
218 	char			ifbr_ifsname[IFNAMSIZ];	/* member ifs name */
219 	u_int8_t		ifbr_action;		/* disposition */
220 	u_int8_t		ifbr_flags;		/* flags */
221 	struct ether_addr	ifbr_src;		/* source mac */
222 	struct ether_addr	ifbr_dst;		/* destination mac */
223 	char			ifbr_tagname[PF_TAG_NAME_SIZE];	/* pf tagname */
224 	struct ifbrarpf		ifbr_arpf;		/* arp filter */
225 };
226 #define	BRL_ACTION_BLOCK	0x01			/* block frame */
227 #define	BRL_ACTION_PASS		0x02			/* pass frame */
228 #define	BRL_FLAG_IN		0x08			/* input rule */
229 #define	BRL_FLAG_OUT		0x04			/* output rule */
230 #define	BRL_FLAG_SRCVALID	0x02			/* src valid */
231 #define	BRL_FLAG_DSTVALID	0x01			/* dst valid */
232 
233 struct ifbrlconf {
234 	char		ifbrl_name[IFNAMSIZ];	/* bridge ifs name */
235 	char		ifbrl_ifsname[IFNAMSIZ];/* member ifs name */
236 	u_int32_t	ifbrl_len;		/* buffer size */
237 	union {
238 		caddr_t	ifbrlu_buf;
239 		struct	ifbrlreq *ifbrlu_req;
240 	} ifbrl_ifbrlu;
241 #define	ifbrl_buf	ifbrl_ifbrlu.ifbrlu_buf
242 #define	ifbrl_req	ifbrl_ifbrlu.ifbrlu_req
243 };
244 
245 #ifdef _KERNEL
246 
247 #include <sys/mutex.h>
248 
249 /* STP port flags */
250 #define	BSTP_PORT_CANMIGRATE	0x0001
251 #define	BSTP_PORT_NEWINFO	0x0002
252 #define	BSTP_PORT_DISPUTED	0x0004
253 #define	BSTP_PORT_ADMCOST	0x0008
254 #define	BSTP_PORT_AUTOEDGE	0x0010
255 #define	BSTP_PORT_AUTOPTP	0x0020
256 
257 /* BPDU priority */
258 #define	BSTP_PDU_SUPERIOR	1
259 #define	BSTP_PDU_REPEATED	2
260 #define	BSTP_PDU_INFERIOR	3
261 #define	BSTP_PDU_INFERIORALT	4
262 #define	BSTP_PDU_OTHER		5
263 
264 /* BPDU flags */
265 #define	BSTP_PDU_PRMASK		0x0c		/* Port Role */
266 #define	BSTP_PDU_PRSHIFT	2		/* Port Role offset */
267 #define	BSTP_PDU_F_UNKN		0x00		/* Unknown port    (00) */
268 #define	BSTP_PDU_F_ALT		0x01		/* Alt/Backup port (01) */
269 #define	BSTP_PDU_F_ROOT		0x02		/* Root port       (10) */
270 #define	BSTP_PDU_F_DESG		0x03		/* Designated port (11) */
271 
272 #define	BSTP_PDU_STPMASK	0x81		/* strip unused STP flags */
273 #define	BSTP_PDU_RSTPMASK	0x7f		/* strip unused RSTP flags */
274 #define	BSTP_PDU_F_TC		0x01		/* Topology change */
275 #define	BSTP_PDU_F_P		0x02		/* Proposal flag */
276 #define	BSTP_PDU_F_L		0x10		/* Learning flag */
277 #define	BSTP_PDU_F_F		0x20		/* Forwarding flag */
278 #define	BSTP_PDU_F_A		0x40		/* Agreement flag */
279 #define	BSTP_PDU_F_TCA		0x80		/* Topology change ack */
280 
281 /*
282  * Bridge filtering rules
283  */
284 SIMPLEQ_HEAD(brl_head, brl_node);
285 
286 struct brl_node {
287 	SIMPLEQ_ENTRY(brl_node)	brl_next;	/* next rule */
288 	struct ether_addr	brl_src;	/* source mac address */
289 	struct ether_addr	brl_dst;	/* destination mac address */
290 	u_int16_t		brl_tag;	/* pf tag ID */
291 	u_int8_t		brl_action;	/* what to do with match */
292 	u_int8_t		brl_flags;	/* comparision flags */
293 	struct ifbrarpf		brl_arpf;	/* arp filter */
294 };
295 
296 struct bstp_timer {
297 	u_int16_t	active;
298 	u_int16_t	value;
299 	u_int32_t	latched;
300 };
301 
302 struct bstp_pri_vector {
303 	u_int64_t	pv_root_id;
304 	u_int32_t	pv_cost;
305 	u_int64_t	pv_dbridge_id;
306 	u_int16_t	pv_dport_id;
307 	u_int16_t	pv_port_id;
308 };
309 
310 struct bstp_config_unit {
311 	struct bstp_pri_vector	cu_pv;
312 	u_int16_t	cu_message_age;
313 	u_int16_t	cu_max_age;
314 	u_int16_t	cu_forward_delay;
315 	u_int16_t	cu_hello_time;
316 	u_int8_t	cu_message_type;
317 	u_int8_t	cu_topology_change_ack;
318 	u_int8_t	cu_topology_change;
319 	u_int8_t	cu_proposal;
320 	u_int8_t	cu_agree;
321 	u_int8_t	cu_learning;
322 	u_int8_t	cu_forwarding;
323 	u_int8_t	cu_role;
324 };
325 
326 struct bstp_tcn_unit {
327 	u_int8_t	tu_message_type;
328 };
329 
330 struct bstp_port {
331 	LIST_ENTRY(bstp_port)	bp_next;
332 	unsigned int		bp_ifindex;	/* parent interface index */
333 	struct bstp_state	*bp_bs;
334 	struct task		bp_ltask;	/* if linkstate hook */
335 	u_int8_t		bp_active;
336 	u_int8_t		bp_protover;
337 	u_int32_t		bp_flags;
338 	u_int32_t		bp_path_cost;
339 	u_int16_t		bp_port_msg_age;
340 	u_int16_t		bp_port_max_age;
341 	u_int16_t		bp_port_fdelay;
342 	u_int16_t		bp_port_htime;
343 	u_int16_t		bp_desg_msg_age;
344 	u_int16_t		bp_desg_max_age;
345 	u_int16_t		bp_desg_fdelay;
346 	u_int16_t		bp_desg_htime;
347 	struct bstp_timer	bp_edge_delay_timer;
348 	struct bstp_timer	bp_forward_delay_timer;
349 	struct bstp_timer	bp_hello_timer;
350 	struct bstp_timer	bp_message_age_timer;
351 	struct bstp_timer	bp_migrate_delay_timer;
352 	struct bstp_timer	bp_recent_backup_timer;
353 	struct bstp_timer	bp_recent_root_timer;
354 	struct bstp_timer	bp_tc_timer;
355 	struct bstp_config_unit bp_msg_cu;
356 	struct bstp_pri_vector	bp_desg_pv;
357 	struct bstp_pri_vector	bp_port_pv;
358 	u_int16_t		bp_port_id;
359 	u_int8_t		bp_state;
360 	u_int8_t		bp_tcstate;
361 	u_int8_t		bp_role;
362 	u_int8_t		bp_infois;
363 	u_int8_t		bp_tc_ack;
364 	u_int8_t		bp_tc_prop;
365 	u_int8_t		bp_fdbflush;
366 	u_int8_t		bp_priority;
367 	u_int8_t		bp_ptp_link;
368 	u_int8_t		bp_agree;
369 	u_int8_t		bp_agreed;
370 	u_int8_t		bp_sync;
371 	u_int8_t		bp_synced;
372 	u_int8_t		bp_proposing;
373 	u_int8_t		bp_proposed;
374 	u_int8_t		bp_operedge;
375 	u_int8_t		bp_reroot;
376 	u_int8_t		bp_rcvdtc;
377 	u_int8_t		bp_rcvdtca;
378 	u_int8_t		bp_rcvdtcn;
379 	u_int32_t		bp_forward_transitions;
380 	u_int8_t		bp_txcount;
381 };
382 
383 /*
384  * Software state for each bridge STP.
385  */
386 struct bstp_state {
387 	unsigned int		bs_ifindex;
388 	struct bstp_pri_vector	bs_bridge_pv;
389 	struct bstp_pri_vector	bs_root_pv;
390 	struct bstp_port	*bs_root_port;
391 	u_int8_t		bs_protover;
392 	u_int16_t		bs_migration_delay;
393 	u_int16_t		bs_edge_delay;
394 	u_int16_t		bs_bridge_max_age;
395 	u_int16_t		bs_bridge_fdelay;
396 	u_int16_t		bs_bridge_htime;
397 	u_int16_t		bs_root_msg_age;
398 	u_int16_t		bs_root_max_age;
399 	u_int16_t		bs_root_fdelay;
400 	u_int16_t		bs_root_htime;
401 	u_int16_t		bs_hold_time;
402 	u_int16_t		bs_bridge_priority;
403 	u_int8_t		bs_txholdcount;
404 	u_int8_t		bs_allsynced;
405 	struct timeout		bs_bstptimeout;		/* stp timeout */
406 	struct bstp_timer	bs_link_timer;
407 	struct timeval		bs_last_tc_time;
408 	LIST_HEAD(, bstp_port)	bs_bplist;
409 };
410 
411 /*
412  * Bridge interface list
413  *
414  *  Locks used to protect struct members in this file:
415  *	I	immutable after creation
416  *	k	kernel lock
417  */
418 struct bridge_iflist {
419 	SMR_SLIST_ENTRY(bridge_iflist)	bif_next;	/* [k] next in list */
420 	struct bridge_softc		*bridge_sc;	/* [I] sc backpointer */
421 	struct bstp_port		*bif_stp;	/* [I] STP port state */
422 	struct brl_head			bif_brlin;	/* [k] input rules */
423 	struct brl_head			bif_brlout;	/* [k] output rules */
424 	struct ifnet			*ifp;		/* [I] net interface */
425 	u_int32_t			bif_flags;	/* member flags */
426 	u_int32_t			bif_protected;	/* protected domains */
427 	struct task			bif_dtask;
428 };
429 #define bif_state			bif_stp->bp_state
430 
431 /*
432  * XXX ip_ipsp.h's sockaddr_union should be converted to sockaddr *
433  * passing with correct sa_len, then a good approach for cleaning this
434  * will become more clear.
435  */
436 union brsockaddr_union {
437 	struct sockaddr		sa;
438 	struct sockaddr_in	sin;
439 	struct sockaddr_in6	sin6;
440 };
441 
442 /*
443  * Bridge tunnel tagging
444  */
445 struct bridge_tunneltag {
446 	union brsockaddr_union		brtag_peer;
447 	union brsockaddr_union		brtag_local;
448 	u_int32_t			brtag_id;
449 };
450 
451 /*
452  * Bridge route node
453  */
454 struct bridge_rtnode {
455 	LIST_ENTRY(bridge_rtnode)	brt_next;	/* next in list */
456 	unsigned int			brt_ifidx;	/* destination ifs */
457 	u_int8_t			brt_flags;	/* address flags */
458 	u_int8_t			brt_age;	/* age counter */
459 	struct ether_addr		brt_addr;	/* dst addr */
460 	struct bridge_tunneltag		brt_tunnel;	/* tunnel endpoint */
461 };
462 #define brt_family brt_tunnel.brtag_peer.sa.sa_family
463 
464 #ifndef BRIDGE_RTABLE_SIZE
465 #define BRIDGE_RTABLE_SIZE	1024
466 #endif
467 #define BRIDGE_RTABLE_MASK	(BRIDGE_RTABLE_SIZE - 1)
468 
469 /*
470  * Software state for each bridge
471  *
472  *  Locks used to protect struct members in this file:
473  *	I	immutable after creation
474  *	m	per-softc mutex
475  *	k	kernel lock
476  */
477 struct bridge_softc {
478 	struct ifnet			sc_if;	/* the interface */
479 	uint32_t			sc_brtmax;	/* [m] max # addresses */
480 	uint32_t			sc_brtcnt;	/* [m] current # addrs */
481 	int				sc_brttimeout;	/* timeout ticks */
482 	uint64_t			sc_hashkey[2];	/* [I] siphash key */
483 	struct timeout			sc_brtimeout;	/* timeout state */
484 	struct bstp_state		*sc_stp;	/* stp state */
485 	SMR_SLIST_HEAD(, bridge_iflist)	sc_iflist;	/* [k] interface list */
486 	SMR_SLIST_HEAD(, bridge_iflist)	sc_spanlist;	/* [k] span ports */
487 	struct mutex			sc_mtx;		/* mutex */
488 	LIST_HEAD(, bridge_rtnode)	sc_rts[BRIDGE_RTABLE_SIZE];	/* [m] hash table */
489 };
490 
491 extern const u_int8_t bstp_etheraddr[];
492 struct llc;
493 
494 int	bridge_enqueue(struct ifnet *, struct mbuf *);
495 void	bridge_update(struct ifnet *, struct ether_addr *, int);
496 void	bridge_rtdelete(struct bridge_softc *, struct ifnet *, int);
497 void	bridge_rtagenode(struct ifnet *, int);
498 struct bridge_tunneltag *bridge_tunnel(struct mbuf *);
499 struct bridge_tunneltag *bridge_tunneltag(struct mbuf *);
500 void	bridge_tunneluntag(struct mbuf *);
501 void	bridge_copyaddr(struct sockaddr *, struct sockaddr *);
502 void	bridge_copytag(struct bridge_tunneltag *, struct bridge_tunneltag *);
503 
504 struct bstp_state *bstp_create(void);
505 void	bstp_enable(struct bstp_state *bs, unsigned int);
506 void	bstp_disable(struct bstp_state *bs);
507 void	bstp_destroy(struct bstp_state *);
508 void	bstp_initialization(struct bstp_state *);
509 void	bstp_stop(struct bstp_state *);
510 int	bstp_ioctl(struct ifnet *, u_long, caddr_t);
511 struct bstp_port *bstp_add(struct bstp_state *, struct ifnet *);
512 void	bstp_delete(struct bstp_port *);
513 struct mbuf *bstp_input(struct bstp_state *, struct bstp_port *,
514     struct ether_header *, struct mbuf *);
515 void	bstp_ifstate(void *);
516 u_int8_t bstp_getstate(struct bstp_state *, struct bstp_port *);
517 void	bstp_ifsflags(struct bstp_port *, u_int);
518 
519 int	bridgectl_ioctl(struct ifnet *, u_long, caddr_t);
520 int	bridge_rtupdate(struct bridge_softc *,
521     struct ether_addr *, struct ifnet *, int, u_int8_t, struct mbuf *);
522 unsigned int bridge_rtlookup(struct ifnet *,
523     struct ether_addr *, struct mbuf *);
524 void	bridge_rtflush(struct bridge_softc *, int);
525 void	bridge_rtage(void *);
526 
527 u_int8_t bridge_filterrule(struct brl_head *, struct ether_header *,
528     struct mbuf *);
529 void	bridge_flushrule(struct bridge_iflist *);
530 
531 void	bridge_fragment(struct ifnet *, struct ifnet *, struct ether_header *,
532     struct mbuf *);
533 struct bridge_iflist *bridge_getbif(struct ifnet *);
534 
535 #endif /* _KERNEL */
536 #endif /* _NET_IF_BRIDGE_H_ */
537