On Tue, Jul 30, 2019 at 01:36:59PM +1000, David Gwynne wrote:
> a Two-Port MAC Relay is basically a cut down bridge(4). it only supports
> two ports, and unconditionally relays packets between those ports
> instead of doing learning or anything like that.

i had written a manpage too:


TPMR(4)                      Device Drivers Manual                     TPMR(4)

NAME
     tpmr - IEEE 802.1Q Two-Port MAC Relay interface

SYNOPSIS
     pseudo-device tpmr

DESCRIPTION
     The tpmr driver implements an 802.1Q (originally 802.1aj) Two-Port MAC
     Relay (TPMR), otherwise known as an Ethernet cross-connect, or layer 2
     circuit.

     A TPMR is a simplified Ethernet bridge that provides a subset of the
     functionality as found in bridge(4).  A TPMR has exactly two ports, and
     unconditionally relays Ethernet packets between the two ports.

     tpmr interfaces can be created at runtime using the ifconfig tpmrN create
     command or by setting up a hostname.if(5) configuration file for
     netstart(8).  The interface itself can be configured with ifconfig(8);
     see its manual page for more information.

     tpmr interfaces may be configured with ifconfig(8) and netstart(8) using
     the following options:

     trunkport child-iface
             Add child-iface as a port.

     -trunkport child-iface
             Remove the port child-iface.

     Other forms of Ethernet bridging are available using the bridge(4)
     driver.  Other forms of aggregation of Ethernet interfaces are available
     using the aggr(4) and trunk(4) drivers.

EXAMPLES
     tpmr can be used to cross-connect Ethernet devices that support different
     physical media.  For example, a device that supports a 100baseTX half-
     duplex connection can be connected to a switch with 1000baseSX optical
     ports by using tpmr with a pair of physical network interfaces, each of
     which supports the required media types.  If fxp(4) is used to connect to
     the 100baseTX device, and em(4) is used to connect to the 1000baseSX
     switch, the following configuration can be used:

     # ifconfig tpmr0 create
     # ifconfig tpmr0 trunkport fxp0 trunkport em0
     # ifconfig fxp0 up
     # ifconfig em0 up
     # ifconfig tpmr0 up

     Multiple TPMRs can be chained to transport Ethernet traffic for a pair of
     devices over another network.  Given two physically separate Ethernet
     switches, TPMRs can be used as follows to provide a point-to-point
     Ethernet link between them.  TPMRs allow the use of the Link Aggregation
     Control Protocol (LACP) or Spanning Tree Protocol (STP) by the switches
     to detect communication failures or connectivity loops respectively,
     which is not possible using bridge(4) as it filters those protocols.

     If Host A connected to Router B has the external IP address 192.0.2.10 on
     em0, Host D connected to Router C has the external IP address
     198.51.100.14 on em0, and both hosts have em1 connected to the switches,
     the following configuration can be used to connect the switches together.
     etherip(4) is used to transport the Ethernet packets over the IP network.

     Switch X ---- Host A ---------- tunnel ----------- Host D ---- Switch E
                    \                                    /
                     \                                  /
                      +---- Router B ---- Router C ----+

     Create the tpmr and etherip(4) interfaces:

           # ifconfig etherip0 create
           # ifconfig tpmr0 create

     Configure the etherip interface:

           (on Host A) # ifconfig etherip0 tunnel 192.0.2.10 198.51.100.14 up
           (on Host D) # ifconfig etherip0 tunnel 198.51.100.14 192.0.2.10 up

     Add the etherip interface and physical interface to the TPMR:

           # ifconfig tpmr0 trunkport em1 trunkport etherip0 up

     An equivalent setup using MPLS pseudowires instead of IP as the transport
     can be built using mpw(4) interfaces.

SEE ALSO
     aggr(4), bridge(4), trunk(4), hostname.if(5), ifconfig(8), netstart(8)

HISTORY
     The tpmr driver first appeared in OpenBSD 6.6.

OpenBSD 6.5                      July 5, 2019                      OpenBSD 6.5


Index: Makefile
===================================================================
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.716
diff -u -p -r1.716 Makefile
--- Makefile    5 Jul 2019 01:41:14 -0000       1.716
+++ Makefile    30 Jul 2019 04:10:34 -0000
@@ -70,8 +70,8 @@ MAN=  aac.4 abcrtc.4 ac97.4 acphy.4 acrtc
        st.4 ste.4 stge.4 sti.4 stp.4 sv.4 switch.4 sxiccmu.4 sximmc.4 \
        sxipio.4 sxirsb.4 sxirtc.4 sxitemp.4 sxitwi.4 sym.4 sypwr.4 syscon.4 \
        tcic.4 tcp.4 termios.4 tht.4 ti.4 tipmic.4 tl.4 \
-       tlphy.4 thmc.4 tpm.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 tap.4 \
-       twe.4 \
+       tlphy.4 thmc.4 tpm.4 tpmr.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 \
+       tun.4 tap.4 twe.4 \
        txp.4 txphy.4 uaudio.4 uark.4 uath.4 ubcmtp.4 uberry.4 ubsa.4 \
        ubsec.4 ucom.4 uchcom.4 ucrcom.4 ucycom.4 ukspan.4 uslhcom.4 \
        udav.4 udcf.4 udl.4 udp.4 udsbr.4 \
Index: tpmr.4
===================================================================
RCS file: tpmr.4
diff -N tpmr.4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tpmr.4      30 Jul 2019 04:10:34 -0000
@@ -0,0 +1,165 @@
+.\" $OpenBSD$
+.\"
+.\" Copyright (c) 2019 David Gwynne <d...@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: July 5 2019 $
+.Dt TPMR 4
+.Os
+.Sh NAME
+.Nm tpmr
+.Nd IEEE 802.1Q Two-Port MAC Relay interface
+.Sh SYNOPSIS
+.Cd "pseudo-device tpmr"
+.Sh DESCRIPTION
+The
+.Nm
+driver implements an 802.1Q (originally 802.1aj) Two-Port MAC Relay
+(TPMR), otherwise known as an Ethernet cross-connect, or layer 2
+circuit.
+.Pp
+A TPMR is a simplified Ethernet bridge that provides a subset of the 
functionality as found in
+.Xr bridge 4 .
+A TPMR has exactly two ports, and unconditionally relays Ethernet
+packets between the two ports.
+.Pp
+.Nm
+interfaces can be created at runtime using the
+.Ic ifconfig tpmr Ns Ar N Ic create
+command or by setting up a
+.Xr hostname.if 5
+configuration file for
+.Xr netstart 8 .
+The interface itself can be configured with
+.Xr ifconfig 8 ;
+see its manual page for more information.
+.Pp
+.Nm
+interfaces may be configured with
+.Xr ifconfig 8
+and
+.Xr netstart 8
+using the following options:
+.Bl -tag -width Ds
+.It Cm trunkport Ar child-iface
+Add
+.Ar child-iface
+as a port.
+.It Cm -trunkport Ar child-iface
+Remove the port
+.Ar child-iface .
+.El
+.\" document the ioctls?
+.Pp
+Other forms of Ethernet bridging are available using the
+.Xr bridge 4
+driver.
+Other forms of aggregation of Ethernet interfaces are available
+using the
+.Xr aggr 4
+and
+.Xr trunk 4
+drivers.
+.Sh EXAMPLES
+.Nm
+can be used to cross-connect Ethernet devices that support different
+physical media.
+For example, a device that supports a 100baseTX half-duplex connection
+can be connected to a switch with 1000baseSX optical ports by using
+.Nm
+with a pair of physical network interfaces, each of which supports
+the required media types.
+If
+.Xr fxp 4
+is used to connect to the 100baseTX device, and
+.Xr em 4
+is used to connect to the 1000baseSX switch, the following configuration
+can be used:
+.Bd -literal
+# ifconfig tpmr0 create
+# ifconfig tpmr0 trunkport fxp0 trunkport em0
+# ifconfig fxp0 up
+# ifconfig em0 up
+# ifconfig tpmr0 up
+.Ed
+.Pp
+Multiple TPMRs can be chained to transport Ethernet traffic for a
+pair of devices over another network.
+Given two physically separate Ethernet switches, TPMRs can be used
+as follows to provide a point-to-point Ethernet link between them.
+TPMRs allow the use of the Link Aggregation Control Protocol (LACP)
+or Spanning Tree Protocol (STP) by the switches to detect communication
+failures or connectivity loops respectively, which is not possible
+using
+.Xr bridge 4
+as it filters those protocols.
+.Pp
+If Host A connected to Router B has the external IP address 192.0.2.10
+on em0, Host D connected to Router C has the external IP address
+198.51.100.14 on em0, and both hosts have em1 connected to the
+switches, the following configuration can be used to connect the
+switches together.
+.Xr etherip 4
+is used to transport the Ethernet packets over the IP network.
+.Bd -literal
+Switch X ---- Host A ---------- tunnel ----------- Host D ---- Switch E
+               \e                                    /
+                \e                                  /
+                 +---- Router B ---- Router C ----+
+.Ed
+.Pp
+Create the
+.Nm
+and
+.Xr etherip 4
+interfaces:
+.Bd -literal -offset indent
+# ifconfig etherip0 create
+# ifconfig tpmr0 create
+.Ed
+.Pp
+Configure the etherip interface:
+.Bd -literal -offset indent
+(on Host A) # ifconfig etherip0 tunnel 192.0.2.10 198.51.100.14 up
+(on Host D) # ifconfig etherip0 tunnel 198.51.100.14 192.0.2.10 up
+.Ed
+.Pp
+Add the etherip interface and physical interface to the TPMR:
+.Bd -literal -offset indent
+# ifconfig tpmr0 trunkport em1 trunkport etherip0 up
+.Ed
+.Pp
+An equivalent setup using MPLS pseudowires instead of IP as the
+transport can be built using
+.Xr mpw 4
+interfaces.
+.Sh SEE ALSO
+.Xr aggr 4 ,
+.Xr bridge 4 ,
+.Xr trunk 4 ,
+.Xr hostname.if 5 ,
+.Xr ifconfig 8 ,
+.Xr netstart 8
+.\" .Sh STANDARDS
+.\" .Rs
+.\" .%T IEEE 802.1Q
+.\" .Re
+.\" .Rs
+.\" .%T IEEE 802.1aj
+.\" .Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 6.6 .

Reply via email to