diff options
-rw-r--r-- | share/man/man4/tpmr.4 | 20 | ||||
-rw-r--r-- | sys/net/if_tpmr.c | 23 |
2 files changed, 22 insertions, 21 deletions
diff --git a/share/man/man4/tpmr.4 b/share/man/man4/tpmr.4 index 0f7d41a4285..d30027d2b12 100644 --- a/share/man/man4/tpmr.4 +++ b/share/man/man4/tpmr.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tpmr.4,v 1.4 2019/08/20 08:21:03 dlg Exp $ +.\" $OpenBSD: tpmr.4,v 1.5 2020/07/22 02:43:06 kn Exp $ .\" .\" Copyright (c) 2019 David Gwynne <dlg@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 20 2019 $ +.Dd $Mdocdate: July 22 2020 $ .Dt TPMR 4 .Os .Sh NAME @@ -30,8 +30,8 @@ driver implements an 802.1Q (originally 802.1aj) Two-Port MAC Relay 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. +A TPMR has exactly two members, and unconditionally relays Ethernet +packets between the them. .Pp .Nm interfaces can be created at runtime using the @@ -51,12 +51,12 @@ and .Xr netstart 8 using the following options: .Bl -tag -width Ds -.It Cm trunkport Ar child-iface +.It Cm add Ar child-iface Add .Ar child-iface -as a port. -.It Cm -trunkport Ar child-iface -Remove the port +as a member. +.It Cm del Ar child-iface +Remove the member .Ar child-iface . .It Cm link0 Disable the filtering of Ethernet frames destined for the TPMR @@ -102,7 +102,7 @@ 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 tpmr0 add fxp0 add em0 # ifconfig fxp0 up # ifconfig em0 up # ifconfig tpmr0 up @@ -154,7 +154,7 @@ Configure the etherip interface: .Pp Add the etherip interface and physical interface to the TPMR: .Bd -literal -offset indent -# ifconfig tpmr0 trunkport em1 trunkport etherip0 up +# ifconfig tpmr0 add em1 add etherip0 up .Ed .Pp An equivalent setup using MPLS pseudowires instead of IP as the diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c index 697049ff147..b5debe57b21 100644 --- a/sys/net/if_tpmr.c +++ b/sys/net/if_tpmr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tpmr.c,v 1.12 2020/07/22 00:48:29 dlg Exp $ */ +/* $OpenBSD: if_tpmr.c,v 1.13 2020/07/22 02:43:06 kn Exp $ */ /* * Copyright (c) 2019 The University of Queensland @@ -48,6 +48,7 @@ #include <netinet/in.h> #include <netinet/if_ether.h> +#include <net/if_bridge.h> #include <net/if_media.h> /* if_trunk.h uses ifmedia bits */ #include <crypto/siphash.h> /* if_trunk.h uses siphash bits */ #include <net/if_trunk.h> @@ -131,10 +132,10 @@ static int tpmr_get_trunk(struct tpmr_softc *, struct trunk_reqall *); static void tpmr_p_dtor(struct tpmr_softc *, struct tpmr_port *, const char *); static int tpmr_add_port(struct tpmr_softc *, - const struct trunk_reqport *); + const struct ifbreq *); static int tpmr_get_port(struct tpmr_softc *, struct trunk_reqport *); static int tpmr_del_port(struct tpmr_softc *, - const struct trunk_reqport *); + const struct ifbreq *); static struct if_clone tpmr_cloner = IF_CLONE_INITIALIZER("tpmr", tpmr_clone_create, tpmr_clone_destroy); @@ -438,19 +439,19 @@ tpmr_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCGTRUNKPORT: error = tpmr_get_port(sc, (struct trunk_reqport *)data); break; - case SIOCSTRUNKPORT: + case SIOCBRDGADD: error = suser(curproc); if (error != 0) break; - error = tpmr_add_port(sc, (struct trunk_reqport *)data); + error = tpmr_add_port(sc, (struct ifbreq *)data); break; - case SIOCSTRUNKDELPORT: + case SIOCBRDGDEL: error = suser(curproc); if (error != 0) break; - error = tpmr_del_port(sc, (struct trunk_reqport *)data); + error = tpmr_del_port(sc, (struct ifbreq *)data); break; default: @@ -518,7 +519,7 @@ tpmr_get_trunk(struct tpmr_softc *sc, struct trunk_reqall *ra) } static int -tpmr_add_port(struct tpmr_softc *sc, const struct trunk_reqport *rp) +tpmr_add_port(struct tpmr_softc *sc, const struct ifbreq *req) { struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp0; @@ -531,7 +532,7 @@ tpmr_add_port(struct tpmr_softc *sc, const struct trunk_reqport *rp) if (sc->sc_nports >= nitems(sc->sc_ports)) return (ENOSPC); - ifp0 = ifunit(rp->rp_portname); + ifp0 = ifunit(req->ifbr_ifsname); if (ifp0 == NULL) return (EINVAL); @@ -645,12 +646,12 @@ tpmr_get_port(struct tpmr_softc *sc, struct trunk_reqport *rp) } static int -tpmr_del_port(struct tpmr_softc *sc, const struct trunk_reqport *rp) +tpmr_del_port(struct tpmr_softc *sc, const struct ifbreq *req) { struct tpmr_port *p; NET_ASSERT_LOCKED(); - p = tpmr_trunkport(sc, rp->rp_portname); + p = tpmr_trunkport(sc, req->ifbr_ifsname); if (p == NULL) return (EINVAL); |