On Sun, Sep 14, 2014 at 11:48:11PM -0300, Rafael Zalamena wrote:
> The following mails will contain patchs that implement the VPLS datapath
> in OpenBSD. Applying all patchs should allow people to configure a
> network using VPLS manually.
> 
> --- snipped diffs descriptions ---
> 
> How to use:
>  * Create a MPLS network.
>    Example: http://2011.eurobsdcon.org/papers/jeker/MPLS.pdf
>  * Create a pseudowire in both ends of your network (PEs)
>    # ifconfig wire<number> encap ethernet wirelabel <local label> \
>        <remote label> neighbor <other PE address> <controlword> up
> 
>    # ifconfig wire0 encap ethernet wirelabel 500 500 neighbor 1.2.3.4 up
>      or
>    # ifconfig wire0 encap ethernet wirelabel 500 500 neighbor 1.2.3.4 \
>        controlword up
>  * Create a bridge between the interface facing your customer (CE) and
>    your wireX, also in both PEs you are configuring the VPN.
> 
> --- more comments snipped ---
> 
> TODO list:
> * interface configuration code - SIOCSETWIRECFG / SIOCGETWIRECFG (DONE)
> * add / remove wire label (DONE)
> * add / remove wire control label (DONE)
> * ethernet-vlan support (WIP)

Ethernet-tagged support almost complete, it's not working in the case when
you have packets coming with 2 or more tags. I'm having problems to test
this since 5.6 and -current doesn't do QinQ properly. (I'll be sending
proposal diffs to fix this soon)

> * ifconfig(8) integration
> ** show wire configuration (DONE)
> ** configure wire (DONE)
> * man page:
> ** wire(4) (TODO)
> ** ifconfig(8) (TODO)

wire(4) is depending on some other diffs now that are unrelated to this,
please see:

(update mpe to use rt_ifa, wire will use that too)
http://marc.info/?l=openbsd-tech&m=141280528700615&w=2

(fix bridge + vlan, bridge expects the complete packet)
http://marc.info/?l=openbsd-tech&m=141575896420071&w=2


Here is the diff for the man pages:
diff --git sbin/ifconfig/ifconfig.8 sbin/ifconfig/ifconfig.8
index 0449b9f..99de2e4 100644
--- sbin/ifconfig/ifconfig.8
+++ sbin/ifconfig/ifconfig.8
@@ -185,7 +185,8 @@ At least the following devices can be created on demand:
 .Xr trunk 4 ,
 .Xr tun 4 ,
 .Xr vether 4 ,
-.Xr vlan 4
+.Xr vlan 4 ,
+.Xr wire 4
 .It Cm debug
 Enable driver-dependent debugging code; usually, this turns on
 extra console error logging.
@@ -494,6 +495,8 @@ and
 .Xr gre 4 )
 .It
 .Xr vlan 4
+.It
+.Xr wire 4
 .El
 .\" BRIDGE
 .Sh BRIDGE
@@ -1546,6 +1549,53 @@ Disassociate from the parent interface.
 This breaks the link between the vlan interface and its parent,
 clears its vlan tag, flags, and link address, and shuts the interface down.
 .El
+.\" wire
+.Sh WIRE
+.nr nS 1
+.Bk -words
+.Nm ifconfig
+.Ar wire-interface
+.Op Cm wirelabel Ar local-label Ar remote-label Cm neighbor Ar dest-address
+.Op Cm encap Ar encapsulation
+.Op Oo Fl Oc Ns Cm controlword
+.Ek
+.nr Ns 0
+.Pp
+The following options are available for a
+.Xr wire 4
+interface:
+.Bl -tag -width Ds
+.It Cm wirelabel Ar local-label Ar remote-label
+Set wire local label to
+.Ar local-label
+and remote label to
+.Ar remote-label .
+The
+.Ar local-label
+is a 20-bit number which will be used to create a local label route to
+the wire interface and the
+.Ar remote-label
+is another 20-bit number which will be used to create the output label header.
+.It Cm neighbor Ar dest-address
+Sets the destination address where this wire should output. The
+.Ar dest-address
+is an IPv4 address that will be used to find the nexthop in the MPLS
+network.
+.It Cm encap Ar encapsulation
+Configures the wire encapsulation type with value
+.Ar encapsulation
+which can be
+.Ql ethernet
+or
+.Ql ethernet-tagged
+By default it's assumed to be
+.Ql ethernet
+mode.
+.It Cm controlword
+Configure the wire interface to use control-words.
+.It Cm -controlword
+Remove control-word configuration from the interface.
+.El
 .Sh EXAMPLES
 Assign the
 address of 192.168.1.10 with a network mask of

diff --git wire.4 wire.4
new file mode 100644
index 0000000..b5b5cf3
--- /dev/null
+++ wire.4
@@ -0,0 +1,97 @@
+.\" Copyright (C) 2014 Rafael F. Zalamena <[email protected]>
+.\"
+.\" 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: September 23 2014 $
+.Dt WIRE 4
+.Os
+.Sh NAME
+.Nm wire
+.Nd Pseudowire
+.Sh SYNOPSIS
+.Cd "pseudo-device wire"
+.Pp
+.Fd #include <sys/types.h>
+.Fd #include <netmpls/mpls.h>
+.Sh DESCRIPTION
+The
+.Nm
+interface is used to create a MPLS layer 2 tunnel between two points.
+.Pp
+A
+.Nm
+interface can be created at runtime using the
+.Ic ifconfig wire 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
+The supported pseudowire operation modes are
+.Ql ethernet
+and
+.Ql ethernet-tagged .
+The
+.Ql ethernet
+operating mode passes all ethernet packets transparently through the
+interface, meanwhile the
+.Ql ethernet-tagged
+requires that the client uses at least one VLAN to pass the traffic.
+The configuration information that will be used by the ioctls are
+defined below:
+.Bd -literal
+#define IWR_TYPE_NONE                   0
+#define IWR_TYPE_ETHERNET               1
+#define IWR_TYPE_ETHERNET_TAGGED        2
+
+#define IWR_FLAG_CONTROLWORD            0x1
+
+struct ifwirereq {
+        u_int32_t       iwr_flags;
+        u_int32_t       iwr_type; /* pseudowire type */
+        struct          shim_hdr iwr_lshim; /* local label */
+        struct          shim_hdr iwr_rshim; /* remote label */
+        struct          sockaddr iwr_nexthop;
+};
+.Ed
+.Pp
+.Nm
+interfaces support the following unique ioctls:
+.Bl -tag -width "SIOCSETWIRECFG" -offset 3n
+.It SIOCSETWIRECFG
+Configure wire using the supplied configuration.
+.It SIOCGETWIRECFG
+Report the wire configuration.
+.El
+.\"
+.Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr hostname.if 5 ,
+.Xr ifconfig 8 ,
+.Xr ldpd 8 ,
+.Xr netstart 8
+.\"
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Ox 5.7 .
+.\"
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Rafael F. Zalamena Aq Mt [email protected] .

Reply via email to