1 |
1254 |
phoenix |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/net/if_bridge.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
//
|
12 |
|
|
// Portions of this software may have been derived from OpenBSD or other sources,
|
13 |
|
|
// and are covered by the appropriate copyright disclaimers included herein.
|
14 |
|
|
//
|
15 |
|
|
// -------------------------------------------
|
16 |
|
|
//
|
17 |
|
|
//####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
//#####DESCRIPTIONBEGIN####
|
20 |
|
|
//
|
21 |
|
|
// Author(s): Jason L. Wright (jason@thought.net)
|
22 |
|
|
// Contributors: andrew.lunn@ascom.ch (Andrew Lunn), hmt
|
23 |
|
|
// Date: 2000-07-18
|
24 |
|
|
// Purpose: Ethernet bridge
|
25 |
|
|
// Description:
|
26 |
|
|
//
|
27 |
|
|
//
|
28 |
|
|
//####DESCRIPTIONEND####
|
29 |
|
|
//
|
30 |
|
|
//==========================================================================
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/* $OpenBSD: if_bridge.h,v 1.12 2000/01/25 22:06:27 jason Exp $ */
|
34 |
|
|
|
35 |
|
|
/*
|
36 |
|
|
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
|
37 |
|
|
* All rights reserved.
|
38 |
|
|
*
|
39 |
|
|
* Redistribution and use in source and binary forms, with or without
|
40 |
|
|
* modification, are permitted provided that the following conditions
|
41 |
|
|
* are met:
|
42 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
43 |
|
|
* notice, this list of conditions and the following disclaimer.
|
44 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
45 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
46 |
|
|
* documentation and/or other materials provided with the distribution.
|
47 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
48 |
|
|
* must display the following acknowledgement:
|
49 |
|
|
* This product includes software developed by Jason L. Wright
|
50 |
|
|
* 4. The name of the author may not be used to endorse or promote products
|
51 |
|
|
* derived from this software without specific prior written permission.
|
52 |
|
|
*
|
53 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
54 |
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
55 |
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
56 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
57 |
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
58 |
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
59 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
60 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
61 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
62 |
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
63 |
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
64 |
|
|
*/
|
65 |
|
|
|
66 |
|
|
/*
|
67 |
|
|
* Bridge control request: add/delete member interfaces.
|
68 |
|
|
*/
|
69 |
|
|
struct ifbreq {
|
70 |
|
|
char ifbr_name[IFNAMSIZ]; /* bridge ifs name */
|
71 |
|
|
char ifbr_ifsname[IFNAMSIZ]; /* member ifs name */
|
72 |
|
|
u_int32_t ifbr_ifsflags; /* member ifs flags */
|
73 |
|
|
};
|
74 |
|
|
/* SIOCBRDGIFFLGS, SIOCBRDGIFFLGS */
|
75 |
|
|
#define IFBIF_LEARNING 0x1 /* ifs can learn */
|
76 |
|
|
#define IFBIF_DISCOVER 0x2 /* ifs sends packets w/unknown dest */
|
77 |
|
|
#define IFBIF_BLOCKNONIP 0x04 /* ifs blocks non-IP/ARP traffic in/out */
|
78 |
|
|
/* SIOCBRDGFLUSH */
|
79 |
|
|
#define IFBF_FLUSHDYN 0x0 /* flush dynamic addresses only */
|
80 |
|
|
#define IFBF_FLUSHALL 0x1 /* flush all addresses from cache */
|
81 |
|
|
|
82 |
|
|
/*
|
83 |
|
|
* Interface list structure
|
84 |
|
|
*/
|
85 |
|
|
struct ifbifconf {
|
86 |
|
|
char ifbic_name[IFNAMSIZ]; /* bridge ifs name */
|
87 |
|
|
u_int32_t ifbic_len; /* buffer size */
|
88 |
|
|
union {
|
89 |
|
|
caddr_t ifbicu_buf;
|
90 |
|
|
struct ifbreq *ifbicu_req;
|
91 |
|
|
} ifbic_ifbicu;
|
92 |
|
|
#define ifbic_buf ifbic_ifbicu.ifbicu_buf
|
93 |
|
|
#define ifbic_req ifbic_ifbicu.ifbicu_req
|
94 |
|
|
};
|
95 |
|
|
|
96 |
|
|
/*
|
97 |
|
|
* Bridge address request
|
98 |
|
|
*/
|
99 |
|
|
struct ifbareq {
|
100 |
|
|
char ifba_name[IFNAMSIZ]; /* bridge name */
|
101 |
|
|
char ifba_ifsname[IFNAMSIZ]; /* destination ifs */
|
102 |
|
|
u_int8_t ifba_age; /* address age */
|
103 |
|
|
u_int8_t ifba_flags; /* address flags */
|
104 |
|
|
struct ether_addr ifba_dst; /* destination addr */
|
105 |
|
|
};
|
106 |
|
|
|
107 |
|
|
#define IFBAF_TYPEMASK 0x03 /* address type mask */
|
108 |
|
|
#define IFBAF_DYNAMIC 0x00 /* dynamically learned */
|
109 |
|
|
#define IFBAF_STATIC 0x01 /* static address */
|
110 |
|
|
|
111 |
|
|
struct ifbaconf {
|
112 |
|
|
char ifbac_name[IFNAMSIZ]; /* bridge ifs name */
|
113 |
|
|
u_int32_t ifbac_len; /* buffer size */
|
114 |
|
|
union {
|
115 |
|
|
caddr_t ifbacu_buf; /* buffer */
|
116 |
|
|
struct ifbareq *ifbacu_req; /* request pointer */
|
117 |
|
|
} ifbac_ifbacu;
|
118 |
|
|
#define ifbac_buf ifbac_ifbacu.ifbacu_buf
|
119 |
|
|
#define ifbac_req ifbac_ifbacu.ifbacu_req
|
120 |
|
|
};
|
121 |
|
|
|
122 |
|
|
/*
|
123 |
|
|
* Bridge cache size get/set
|
124 |
|
|
*/
|
125 |
|
|
struct ifbcachereq {
|
126 |
|
|
char ifbc_name[IFNAMSIZ]; /* bridge ifs name */
|
127 |
|
|
u_int32_t ifbc_size; /* cache size */
|
128 |
|
|
};
|
129 |
|
|
|
130 |
|
|
/*
|
131 |
|
|
* Bridge cache timeout get/set
|
132 |
|
|
*/
|
133 |
|
|
struct ifbcachetoreq {
|
134 |
|
|
char ifbct_name[IFNAMSIZ]; /* bridge ifs name */
|
135 |
|
|
u_int32_t ifbct_time; /* cache time (sec) */
|
136 |
|
|
};
|
137 |
|
|
|
138 |
|
|
/*
|
139 |
|
|
* Bridge mac rules
|
140 |
|
|
*/
|
141 |
|
|
struct ifbrlreq {
|
142 |
|
|
char ifbr_name[IFNAMSIZ]; /* bridge ifs name */
|
143 |
|
|
char ifbr_ifsname[IFNAMSIZ]; /* member ifs name */
|
144 |
|
|
u_int8_t ifbr_action; /* disposition */
|
145 |
|
|
u_int8_t ifbr_flags; /* flags */
|
146 |
|
|
struct ether_addr ifbr_src; /* source mac */
|
147 |
|
|
struct ether_addr ifbr_dst; /* destination mac */
|
148 |
|
|
};
|
149 |
|
|
#define BRL_ACTION_BLOCK 0x01 /* block frame */
|
150 |
|
|
#define BRL_ACTION_PASS 0x02 /* pass frame */
|
151 |
|
|
#define BRL_FLAG_IN 0x08 /* input rule */
|
152 |
|
|
#define BRL_FLAG_OUT 0x04 /* output rule */
|
153 |
|
|
#define BRL_FLAG_SRCVALID 0x02 /* src valid */
|
154 |
|
|
#define BRL_FLAG_DSTVALID 0x01 /* dst valid */
|
155 |
|
|
|
156 |
|
|
struct ifbrlconf {
|
157 |
|
|
char ifbrl_name[IFNAMSIZ]; /* bridge ifs name */
|
158 |
|
|
char ifbrl_ifsname[IFNAMSIZ];/* member ifs name */
|
159 |
|
|
u_int32_t ifbrl_len; /* buffer size */
|
160 |
|
|
union {
|
161 |
|
|
caddr_t ifbrlu_buf;
|
162 |
|
|
struct ifbrlreq *ifbrlu_req;
|
163 |
|
|
} ifbrl_ifbrlu;
|
164 |
|
|
#define ifbrl_buf ifbrl_ifbrlu.ifbrlu_buf
|
165 |
|
|
#define ifbrl_req ifbrl_ifbrlu.ifbrlu_req
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
#ifdef _KERNEL
|
169 |
|
|
void bridge_ifdetach __P((struct ifnet *));
|
170 |
|
|
struct mbuf *bridge_input __P((struct ifnet *, struct ether_header *,
|
171 |
|
|
struct mbuf *));
|
172 |
|
|
int bridge_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
|
173 |
|
|
struct rtentry *rt));
|
174 |
|
|
#endif /* _KERNEL */
|