OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [bridge.html] - Blame information for rev 510

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
<html>
2
<body>
3
<pre>
4
NAME
5
     bridge - Ethernet bridge interface
6
 
7
SYNOPSIS
8
     pseudo-device bridge 2
9
 
10
DESCRIPTION
11
     The bridge device creates a logical link between two or more Ethernet in
12
     terfaces.  This link between the interfaces selectively forwards frames
13
     from each interface on the bridge to every other interface on the bridge.
14
     A bridge can serve several services, including, isolation of traffic be
15
     tween sets of machines so that traffic local to one set of machines is
16
     not available on the wire of another set of machines, and it can act as a
17
     transparent filter for ip(4) datagrams.
18
 
19
     The bridges provided by this interface are learning bridges with IP fil
20
     tering, see ipf(4).  In general a bridge works like a hub, forwarding
21
     traffic from one interface to another.  It differs from a hub in that it
22
     will "learn" which machines are on each of its attached segments by ac
23
     tively listening to incoming traffic and examining the headers of each
24
     frame.  A table is built containing the MAC address and segment to which
25
     the MAC address is attached.  This allows a bridge to be more selective
26
     about what it forwards, which can be used to reduce traffic on a set of
27
     segments and also to provide an IP firewall without changing the topology
28
     of the network.
29
 
30
     The algorithm works as follows by default, but can be modified via
31
     ioctl(2) or the utility brconfig(8).  When a frame comes in, the origin
32
     segment and the source address are recorded.  If the bridge has no knowl
33
     edge about where the destination is to be found, the bridge will forward
34
     the frame to all attached segments.  If the destination is known to be on
35
     a different segment from its origin, the bridge will forward the packet
36
     only to the destination segment.  If the destination is on the same seg
37
     ment as the origin segment, the bridge will drop the packet because the
38
     receiver has already had a chance to see the frame.  Before forwarding a
39
     frame, the bridge will check to see if the packet contains an ip(4) data
40
     gram; if so, the datagram is run through the ipf(4) interface so that it
41
     can be filtered.  Only the ipf(4) input rules for the source interface
42
     are checked with the datagram; output rules have no effect.
43
 
44
IOCTLS
45
     A bridge interface responds to all of the ioctl(2) calls specific to oth
46
     er interfaces listed in netintro(4).  The following ioctl(2) calls are
47
     specific to bridge devices.  They are defined in <sys/sockio.h>.
48
 
49
     SIOCBRDGIFS      (struct ifbifconf) Retrieve member interface list from a
50
                      bridge.  This request takes an ifbifconf structure (see
51
                      below) as a value-result parameter.  The ifbic_len field
52
                      should be initially set to the size of the buffer point
53
                      ed to by ifbic_buf. On return it will contain the
54
                      length, in bytes, of the configuration list.  Alterna
55
                      tively, if the ifbic_len passed in is set to 0,
56
                      SIOCBRDGIFS will set ifbic_len to the size that
57
                      ifbic_buf needs to be to fit the entire configuration
58
                      list, and will not fill in the other parameters.  This
59
                      is useful for determining the exact size that ifbic_buf
60
                      needs to be in advance.
61
 
62
                      The argument structure is defined as follows:
63
 
64
                            struct ifbreq {
65
                                    char ifbr_name[IFNAMSIZ];    /* brdg nam */
66
                                    char ifbr_ifsname[IFNAMSIZ]; /* if name */
67
                                    u_int32_t ifbr_ifsflags;     /* if flags */
68
                            };
69
 
70
                            #define IFBIF_LEARNING  0x1 /* learns addrs */
71
                            #define IFBIF_DISCOVER  0x2 /* gets fwd'd pkts */
72
 
73
                            struct ifbifconf {
74
                                    char ifbic_name[IFNAMSIZ]; /* brdg name */
75
                                    u_int32_t       ifbic_len; /* buf size */
76
                                    union {
77
                                            caddr_t ifbicu_buf; /* buffer */
78
                                            struct  ifbreq *ifbicu_req;
79
                                    } ifbic_ifbicu;
80
                            #define ifbic_buf       ifbic_ifbicu.ifbicu_buf
81
                            #define ifbic_req       ifbic_ifbicu.ifbicu_req
82
                            };
83
 
84
     SIOCBRDGADD      (struct ifbreq) Add the interface named in ifbr_ifsname
85
                      to the bridge named in ifbr_name.
86
 
87
     SIOCBRDGDEL      (struct ifbreq) Delete the interface named in
88
                      ifbr_ifsname from the bridge named in ifbr_name.
89
 
90
     SIOCBRDGSIFFLGS  (struct ifbreq) Set the bridge member interface flags
91
                      for the interface named in ifbr_ifsname attached to the
92
                      bridge ifbr_name. If the flag IFBIF_LEARNING is set on
93
                      an interface, source addresses from frames received on
94
                      the interface are recorded in the address cache.  If the
95
                      flag IFBIF_DISCOVER is set, the interface will receive
96
                      packets destined for unknown destinations, otherwise a
97
                      frame that has a destination not found in the address
98
                      cache is not forwarded to this interface.  The default
99
                      for newly added interfaces has both flags set.  If the
100
                      flag IFBIF_BLOCKNONIP is set, packets that are one of
101
                      ip(4),  ip6(4),  arp(4),  or Reverse ARP, will not be
102
                      bridged from and to the interface.
103
 
104
     SIOCBRDGGIFFLGS  Retrieve the bridge member interface flags for the in
105
                      terface named in ifbr_ifsname attached to the bridge
106
                      ifbr_name.
107
 
108
     SIOCBRDGRTS      (struct ifbaconf) Retrieve the address cache of the
109
                      bridge named in ifbac_name. This request takes an
110
                      ifbaconf structure (see below) as a value result parame
111
                      ter.  The ifbac_len field should be initially set to the
112
                      size of the buffer pointed to by ifbac_buf. On return,
113
                      it will contain the length, in bytes, of the configura
114
                      tion list.  Alternatively, if the ifbac_len passed in is
115
                      set to 0, SIOCBRDGRTS will set it to the size that
116
                      ifbac_buf needs to be to fit the entire configuration
117
                      list and not fill in the other parameters.  As with
118
                      SIOCBRDGIFS, this is useful for determining the exact
119
                      size that ifbac_buf needs to be in advance.
120
 
121
                      The argument structure is defined as follows:
122
 
123
                            struct ifbareq {
124
                                    char ifba_name[IFNAMSIZ];   /* brdg nam */
125
                                    char ifba_ifsname[IFNAMSIZ];/* dest ifs */
126
                                    u_int8_t ifba_age;          /* addr age */
127
                                    u_int8_t ifba_flags;        /* addr flag */
128
                                    struct ether_addr ifba_dst; /* dst addr */
129
                            };
130
 
131
                            #define IFBAF_TYPEMASK 0x03  /* addr type mask */
132
                            #define IFBAF_DYNAMIC  0x00  /* dynamic addr */
133
                            #define IFBAF_STATIC   0x01  /* static address */
134
 
135
                            struct ifbaconf {
136
                                    char ifbac_name[IFNAMSIZ]; /* brdg name */
137
                                    u_int32_t ifbac_len;       /* buf size */
138
                                    union {
139
                                            caddr_t ifbacu_buf;     /* buf */
140
                                            struct ifbareq *ifbacu_req;
141
                                    } ifbac_ifbacu;
142
                            #define ifbac_buf       ifbac_ifbacu.ifbacu_buf
143
                            #define ifbac_req       ifbac_ifbacu.ifbacu_req
144
                            };
145
                      Address cache entries with the type set to IFBAF_DYNAMIC
146
                      in ifba_flags are entries learned by the bridge.  En
147
                      tries with the type set to IFBAF_STATIC are manually
148
                      added entries.
149
 
150
     SIOCBRDGSADDR    (struct ifbareq) Add an entry, manually, to the address
151
                      cache for the bridge named in ifba_name. The address and
152
                      its associated interface and flags are set in the
153
                      ifba_dst, ifba_ifsname, ifba_flags fields, respectively.
154
 
155
     SIOCBRDGDADDR    (struct ifbareq) Delete an entry from the address cache
156
                      of the bridge named in ifba_name. Entries are deleted
157
                      strictly based on the address field ifba_dst.
158
 
159
     SIOCBRDGSCACHE   (struct ifbcachereq) Set the maximum address cache size
160
                      for the bridge named in ifbc_name to ifbc_size entries.
161
 
162
                      The argument structure is as follows:
163
 
164
                            struct ifbcachereq {
165
                                    char ifbc_name[IFNAMSIZ]; /* bridge */
166
                                    u_int32_t ifbc_size;      /* size */
167
                            };
168
 
169
     SIOCBRDGGCACHE   (struct ifbcachereq) Retrieve the maximum size of the
170
                      address cache for the bridge ifbc_name.
171
 
172
     SIOCBRDGSTO      (struct ifbcachetoreq) Set the time, in seconds, that
173
                      addresses which have not been seen on the network
174
                      (transmitted a packet) remain in the cache.  If the time
175
                      is set to zero, no aging is performed on the address
176
                      cache.  The argument structure is as follows:
177
 
178
                            struct ifbcachetoreq {
179
                                    char ifbct_name[IFNAMSIZ]; /* bridge */
180
                                    u_int32_t ifbct_time;      /* time */
181
                            };
182
 
183
     SIOCBRDGGTO      (struct ifbcachetoreq) Retrieve the address cache expi
184
                      ration time (see above).
185
 
186
     SIOCBRDGFLUSH    (struct ifbreq) Flush addresses from the cache.
187
                      ifbr_name contains the name of the bridge device, and
188
                      ifbr_ifsflags should be set to IFBF_FLUSHALL to flush
189
                      all addresses from the cache or IFBF_FLUSHDYN to flush
190
                      only the dynamically learned addresses from the cache.
191
 
192
     SIOCBRDGARL      (struct ifbrlreq) Add a filtering rule to the bridge
193
                      named in ifbr_name on the interface named in
194
                      ifbr_ifsname. The argument structure is as follows:
195
 
196
                            struct ifbrlreq {
197
                                    char ifbr_name[IFNAMSIZ];    /* bridge */
198
                                    char ifbr_ifsname[IFNAMSIZ]; /* ifs */
199
                                    u_int8_t ifbr_action;        /* handling */
200
                                    u_int8_t ifbr_flags;         /* flags */
201
                                    struct ether_addr ifbr_src;  /* src mac */
202
                                    struct ether_addr ifbr_dst;  /* dst mac */
203
                            };
204
                            #define BRL_ACTION_BLOCK        0x01
205
                            #define BRL_ACTION_PASS         0x02
206
                            #define BRL_FLAG_IN             0x08
207
                            #define BRL_FLAG_OUT            0x04
208
                            #define BRL_FLAG_SRCVALID       0x02
209
                            #define BRL_FLAG_DSTVALID       0x01
210
 
211
                      Rules are applied in the order in which they were added
212
                      to the bridge, and the first matching rule's action pa
213
                      rameter determines the fate of the packet.  The
214
                      ifbr_action parameter specifies whether a frame matching
215
                      the rule is to be blocked or passed.
216
 
217
                      If the BRL_FLAG_IN bit is set in ifbr_flags, then the
218
                      rule applies to frames received by the interface.  If
219
                      the BRL_FLAG_OUT bit is set, then the rule applies to
220
                      frame transmitted by the interface.  At least one of
221
                      BRL_FLAG_IN or BRL_FLAG_OUT must be set.
222
 
223
                      The source ethernet address in ifbr_src is checked if
224
                      the BRL_FLAG_SRCVALID bit is set in ifbr_flags. The des
225
                      tination address in ifbr_dst is check if the
226
                      BRL_FLAG_DSTVALID bit is set.  If neither bit is set,
227
                      the rule is matches all frames.
228
 
229
     SIOCBRDGFRL      (struct ifbrlreq) Remove all filtering rules from a
230
                      bridge interface member.  ifbr_name contains the name of
231
                      the bridge device, and ifbr_ifsname contains the name of
232
                      the bridge member interface.
233
 
234
     SIOCBRDGGRL      (struct ifbrlconf) Retrieve all of the rules from the
235
                      bridge, ifbrl_name, for the member interface,
236
                      ifbrl_ifsname.
237
 
238
                      This request takes an ifbrlconf structure (see below) as
239
                      a value result parameter.  The ifbrl_len field should be
240
                      initially set to the size of the buffer pointed to by
241
                      ifbrl_buf. On return, it will contain the length, in
242
                      bytes, of the configuration list.  Alternatively, if the
243
                      ifbrl_len passed in is set to 0, SIOCBRDGGRL will set it
244
                      to the size that ifbrl_buf needs to be to fit the entire
245
                      configuration list and not fill in the other parameters.
246
                      As with SIOCBRDGIFS, this is useful for determining the
247
                      exact size that ifbrl_buf needs to be in advance.
248
 
249
                      The argument structure is defined as follows:
250
 
251
                            struct ifbrlconf {
252
                                    char ifbrl_name[IFNAMSIZ];   /* brdg nam */
253
                                    char ifbrl_ifsname[IFNAMSIZ];/* ifs name */
254
                                    u_int32_t ifbr_len;         /* buf len */
255
                                    union {
256
                                            caddr_t ifbrlu_buf;
257
                                            struct ifbrlreq *ifbrlu_req;
258
                                    } ifrl_ifbrlu;
259
                            #define ifbrl_buf ifbrl_ifbrlu.ifbrlu_buf
260
                            #define ifbrl_req ifbrl_ifbrlu.ifbrlu_req
261
                            };
262
 
263
 
264
ERRORS
265
     If the ioctl(2) call fails, errno(2) is set to one of the following val
266
     ues:
267
 
268
     [ENOENT]      For an add request, this means that the named interface is
269
                   not configured into the system.  For delete operation, it
270
                   means that the named interface is not a member of the
271
                   bridge.  For a address cache deletion, the address was not
272
                   found in the table.
273
 
274
     [ENOMEM]      Memory could not be allocated for an interface or cache en
275
                   try to be added to the bridge.
276
 
277
     [EEXIST]      The named interface is already a member of the bridge.
278
 
279
     [EBUSY]       The named interface is already a member of another bridge.
280
 
281
     [EINVAL]      The named interface is not an Ethernet interface or an in
282
                   valid ioctl was performed on the bridge.
283
 
284
     [ENETDOWN]    Address cache operation (flush, add, delete) on a bridge
285
                   that is in the down state.
286
 
287
     [EPERM]       Super-user privilege is required to add and delete inter
288
                   faces to and from bridges and to set the bridge interface
289
                   flags.
290
 
291
     [EFAULT]      The buffer used in a SIOCBRDGIFS or SIOCBRDGRTS request
292
 
293
                   points outside of the process's allocated address space.
294
 
295
     [ESRCH]       No such member interface in the bridge.
296
 
297
SEE ALSO
298
     errno(2),  ioctl(2),  ip(4),  ipf(4),  netintro(4),  bridgename.if(5),
299
     brconfig(8)
300
 
301
HISTORY
302
     The brconfig(8) command and the bridge(4) kernel interface first appeared
303
     in
304
 
305
AUTHOR
306
     The brconfig(8) command and the bridge(4) kernel interface were written
307
     by Jason L. Wright <jason@thought.net> as part of an undergraduate inde
308
     pendent study at the University of North Carolina at Greensboro.
309
 
310
BUGS
311
     There is currently no loop detection.  Care must be taken to make sure
312
     that loops are not created when a bridge is brought up.
313
 
314
     Only ipf(4) input rules are checked with incoming packet; there is no
315
     easy way to handle output rules.
316
 
317
</pre>
318
</body>
319
</html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.