⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bridge.man

📁 开放源码实时操作系统源码.
💻 MAN
📖 第 1 页 / 共 2 页
字号:

NAME
     bridge - Ethernet bridge interface

SYNOPSIS
     pseudo-device bridge 2

DESCRIPTION
     The bridge device creates a logical link between two or more Ethernet in
     terfaces.  This link between the interfaces selectively forwards frames
     from each interface on the bridge to every other interface on the bridge.
     A bridge can serve several services, including, isolation of traffic be
     tween sets of machines so that traffic local to one set of machines is
     not available on the wire of another set of machines, and it can act as a
     transparent filter for ip(4) datagrams.

     The bridges provided by this interface are learning bridges with IP fil
     tering, see ipf(4).  In general a bridge works like a hub, forwarding
     traffic from one interface to another.  It differs from a hub in that it
     will "learn" which machines are on each of its attached segments by ac
     tively listening to incoming traffic and examining the headers of each
     frame.  A table is built containing the MAC address and segment to which
     the MAC address is attached.  This allows a bridge to be more selective
     about what it forwards, which can be used to reduce traffic on a set of
     segments and also to provide an IP firewall without changing the topology
     of the network.

     The algorithm works as follows by default, but can be modified via
     ioctl(2) or the utility brconfig(8).  When a frame comes in, the origin
     segment and the source address are recorded.  If the bridge has no knowl
     edge about where the destination is to be found, the bridge will forward
     the frame to all attached segments.  If the destination is known to be on
     a different segment from its origin, the bridge will forward the packet
     only to the destination segment.  If the destination is on the same seg
     ment as the origin segment, the bridge will drop the packet because the
     receiver has already had a chance to see the frame.  Before forwarding a
     frame, the bridge will check to see if the packet contains an ip(4) data
     gram; if so, the datagram is run through the ipf(4) interface so that it
     can be filtered.  Only the ipf(4) input rules for the source interface
     are checked with the datagram; output rules have no effect.

IOCTLS
     A bridge interface responds to all of the ioctl(2) calls specific to oth
     er interfaces listed in netintro(4).  The following ioctl(2) calls are
     specific to bridge devices.  They are defined in <sys/sockio.h>.

     SIOCBRDGIFS      (struct ifbifconf) Retrieve member interface list from a
                      bridge.  This request takes an ifbifconf structure (see
                      below) as a value-result parameter.  The ifbic_len field
                      should be initially set to the size of the buffer point
                      ed to by ifbic_buf. On return it will contain the
                      length, in bytes, of the configuration list.  Alterna
                      tively, if the ifbic_len passed in is set to 0,
                      SIOCBRDGIFS will set ifbic_len to the size that
                      ifbic_buf needs to be to fit the entire configuration
                      list, and will not fill in the other parameters.  This
                      is useful for determining the exact size that ifbic_buf
                      needs to be in advance.

                      The argument structure is defined as follows:

                            struct ifbreq {
                                    char ifbr_name[IFNAMSIZ];    /* brdg nam */
                                    char ifbr_ifsname[IFNAMSIZ]; /* if name */
                                    u_int32_t ifbr_ifsflags;     /* if flags */
                            };

                            #define IFBIF_LEARNING  0x1 /* learns addrs */
                            #define IFBIF_DISCOVER  0x2 /* gets fwd'd pkts */

                            struct ifbifconf {
                                    char ifbic_name[IFNAMSIZ]; /* brdg name */
                                    u_int32_t       ifbic_len; /* buf size */
                                    union {
                                            caddr_t ifbicu_buf; /* buffer */
                                            struct  ifbreq *ifbicu_req;
                                    } ifbic_ifbicu;
                            #define ifbic_buf       ifbic_ifbicu.ifbicu_buf
                            #define ifbic_req       ifbic_ifbicu.ifbicu_req
                            };

     SIOCBRDGADD      (struct ifbreq) Add the interface named in ifbr_ifsname
                      to the bridge named in ifbr_name.

     SIOCBRDGDEL      (struct ifbreq) Delete the interface named in
                      ifbr_ifsname from the bridge named in ifbr_name.

     SIOCBRDGSIFFLGS  (struct ifbreq) Set the bridge member interface flags
                      for the interface named in ifbr_ifsname attached to the
                      bridge ifbr_name. If the flag IFBIF_LEARNING is set on
                      an interface, source addresses from frames received on
                      the interface are recorded in the address cache.  If the
                      flag IFBIF_DISCOVER is set, the interface will receive
                      packets destined for unknown destinations, otherwise a
                      frame that has a destination not found in the address
                      cache is not forwarded to this interface.  The default
                      for newly added interfaces has both flags set.  If the
                      flag IFBIF_BLOCKNONIP is set, packets that are one of
                      ip(4),  ip6(4),  arp(4),  or Reverse ARP, will not be
                      bridged from and to the interface.

     SIOCBRDGGIFFLGS  Retrieve the bridge member interface flags for the in
                      terface named in ifbr_ifsname attached to the bridge
                      ifbr_name.

     SIOCBRDGRTS      (struct ifbaconf) Retrieve the address cache of the
                      bridge named in ifbac_name. This request takes an
                      ifbaconf structure (see below) as a value result parame
                      ter.  The ifbac_len field should be initially set to the
                      size of the buffer pointed to by ifbac_buf. On return,
                      it will contain the length, in bytes, of the configura
                      tion list.  Alternatively, if the ifbac_len passed in is
                      set to 0, SIOCBRDGRTS will set it to the size that
                      ifbac_buf needs to be to fit the entire configuration
                      list and not fill in the other parameters.  As with
                      SIOCBRDGIFS, this is useful for determining the exact
                      size that ifbac_buf needs to be in advance.

                      The argument structure is defined as follows:

                            struct ifbareq {
                                    char ifba_name[IFNAMSIZ];   /* brdg nam */
                                    char ifba_ifsname[IFNAMSIZ];/* dest ifs */
                                    u_int8_t ifba_age;          /* addr age */
                                    u_int8_t ifba_flags;        /* addr flag */
                                    struct ether_addr ifba_dst; /* dst addr */
                            };

                            #define IFBAF_TYPEMASK 0x03  /* addr type mask */
                            #define IFBAF_DYNAMIC  0x00  /* dynamic addr */
                            #define IFBAF_STATIC   0x01  /* static address */

                            struct ifbaconf {
                                    char ifbac_name[IFNAMSIZ]; /* brdg name */
                                    u_int32_t ifbac_len;       /* buf size */
                                    union {
                                            caddr_t ifbacu_buf;     /* buf */
                                            struct ifbareq *ifbacu_req;
                                    } ifbac_ifbacu;
                            #define ifbac_buf       ifbac_ifbacu.ifbacu_buf
                            #define ifbac_req       ifbac_ifbacu.ifbacu_req
                            };
                      Address cache entries with the type set to IFBAF_DYNAMIC
                      in ifba_flags are entries learned by the bridge.  En
                      tries with the type set to IFBAF_STATIC are manually
                      added entries.

     SIOCBRDGSADDR    (struct ifbareq) Add an entry, manually, to the address
                      cache for the bridge named in ifba_name. The address and
                      its associated interface and flags are set in the
                      ifba_dst, ifba_ifsname, ifba_flags fields, respectively.

     SIOCBRDGDADDR    (struct ifbareq) Delete an entry from the address cache
                      of the bridge named in ifba_name. Entries are deleted
                      strictly based on the address field ifba_dst.

     SIOCBRDGSCACHE   (struct ifbcachereq) Set the maximum address cache size
                      for the bridge named in ifbc_name to ifbc_size entries.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -