BRIDGE(3)                                               BRIDGE(3)

     NAME
          bridge - IPv4 Ethernet bridge

     SYNOPSIS
          bind -a #Bb /net

          /net/bridgeb/ctl
          /net/bridgeb/cache
          /net/bridgeb/log
          /net/bridgeb/stats
          /net/bridgeb/n
          /net/bridgeb/n/ctl
          /net/bridgeb/n/local
          /net/bridgeb/n/status

     DESCRIPTION
          The bridge device bridges IPv4 packets amongst Ethernet
          interfaces.  The number b in the bind is optional and
          selects a particular bridge (default 0).

          The /net/bridge0 directory contains ctl, cache, log, and
          stats files, and numbered subdirectories for each physical
          interface.

          Opening the ctl file reserves an interface.  The file
          descriptor returned from the open(2) will point to the con-
          trol file, ctl, of the newly allocated interface.  Reading
          ctl returns a text string representing the number of the
          interface.  Writing ctl alters aspects of the interface.
          The possible ctl messages are:

          bind ether name ownhash path
                      Treat the device mounted at path (e.g.,
                      `/net/ether0') as an Ethernet medium carrying
                      IPv4 and ARP packets and associate it with this
                      bridge (forward its packets to the other inter-
                      faces associated with this bridge).  Ownhash is
                      an `owner hash'.

          bind tunnel name ownhash path path2
                      Treat the device mounted at path as a network
                      tunnel carrying IPv4 and ARP packets, the device
                      mounted at path2 as an Ethernet medium carrying
                      IPv4 and ARP packets and associate them with
                      this bridge (forward its packets to the other
                      interfaces associated with this bridge).  Read
                      packets from the path interface and write them
                      to the path2 interface.  Such tunnels have an
                      MTU of 1400 bytes.

     Page 1                       Plan 9            (printed 11/18/24)

     BRIDGE(3)                                               BRIDGE(3)

          unbind type address [ownhash]
                      Disassociate the interface associated with
                      address from this bridge.  Type must be `ether'
                      or `tunnel'.

          cacheflush  Clear the cache of (destination MAC address,
                      port) tuples.

          delay delay0 delayn
                      Set the delay0 and delayn parameters.  delay0 is
                      the constant microsecond delay per packet and
                      delayn is the microsecond delay per byte.

          set option  Set bridge option. The only known option is
                      `tcpmss', which limits the TCP Maximum Segment
                      Size of TCPv4 packets passing through to 1300
                      bytes.

          clear option
                      Clear bridge option.

          Reading stats returns statistics about the bridge.

          Reading the log file returns data from the bridge's log and
          will block at end of file awaiting new data.

          Reading the cache file prints the cache of (destination MAC
          address, port) tuples, one entry per line.  The format is:
          the destination MAC (e.g., Ethernet) address in hex, port
          number, count of packets from this address, count of packets
          to this address, expiry time in seconds since the epoch, and
          `e' for expired entries or `v' for valid entries.

          In a connection subdirectory, ctl and local don't do any-
          thing, but status returns a one-line status summary.

     EXAMPLES
          Set up a network bridge between two Ethernets (`#l0' and
          `#l1').

               bind -a '#B' /net
               bind -a '#l1' /net
               echo 'bind ether outer 0 /net/ether0' >/net/bridge0/ctl
               echo 'bind ether inner 0 /net/ether1' >/net/bridge0/ctl

     SEE ALSO
          ip(3)

     SOURCE
          /sys/src/9/port/devbridge.c

     BUGS

     Page 2                       Plan 9            (printed 11/18/24)

     BRIDGE(3)                                               BRIDGE(3)

          Doesn't understand IPv6.

     Page 3                       Plan 9            (printed 11/18/24)