networkd and sd-netlink: add support for Generic netlink And FooOverUDP to IPIP tunnel

This work add support to generic netlink to sd-netlink.
See https://lwn.net/Articles/208755/

networkd: add support FooOverUDP support to IPIP tunnel netdev
https://lwn.net/Articles/614348/

Example conf:

/lib/systemd/network/1-fou-tunnel.netdev
```
[NetDev]
Name=fou-tun
Kind=fou

[FooOverUDP]
Port=5555
Protocol=4

```

/lib/systemd/network/ipip-tunnel.netdev
```
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Independent=true
Local=10.65.208.212
Remote=10.65.208.211
FooOverUDP=true
FOUDestinationPort=5555
```

$ ip -d link show ipip-tun
```
5: ipip-tun@NONE: <POINTOPOINT,NOARP> mtu 1472 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ipip 10.65.208.212 peer 10.65.208.211 promiscuity 0
    ipip remote 10.65.208.211 local 10.65.208.212 ttl inherit pmtudisc encap fou encap-sport auto encap-dport 5555 noencap-csum noencap-csum6 noencap-remcsum numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
```
This commit is contained in:
Susant Sahani
2018-08-23 11:30:37 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent c07fe6d0df
commit 53cb501a13
14 changed files with 386 additions and 2 deletions
+98
View File
@@ -163,6 +163,10 @@
<row><entry><varname>netdevsim</varname></entry>
<entry> A simulator. This simulated networking device is used for testing various networking APIs and at this time is particularly focused on testing hardware offloading related interfaces.</entry></row>
<row><entry><varname>fou</varname></entry>
<entry>Foo-over-UDP tunneling.</entry></row>
</tbody>
</tgroup>
</table>
@@ -879,8 +883,76 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FooOverUDP=</varname></term>
<listitem>
<para>A boolean. Specifies whether <varname>FooOverUDP=</varname> tunnel is to be configured.
Defaults to false. For more detail information see
<ulink url="https://lwn.net/Articles/614348">Foo over UDP</ulink></para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FOUDestinationPort=</varname></term>
<listitem>
<para>The <varname>FOUDestinationPort=</varname> specifies the UDP destination port for encapsulation.
This field is mandatory and is not set by default.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>FOUSourcePort=</varname></term>
<listitem>
<para>The <constant>FOUSourcePort=</constant> specifies the UDP source port for encapsulation. Defaults to <varname>0</varname>,
that is, the source port for packets is left to the network stack to decide.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Encapsulation=</varname></term>
<listitem>
<para>Accepts the same key as <literal>[FooOverUDP]</literal></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>[FooOverUDP] Section Options</title>
<para>The <literal>[FooOverUDP]</literal> section only applies for
netdevs of kind <literal>fou</literal> and accepts the
following keys:</para>
<variablelist class='network-directives'>
<varlistentry>
<term><varname>Protocol=</varname></term>
<listitem>
<para>The <varname>Protocol=</varname> specifies the protocol number of the
packets arriving at the UDP port. This field is mandatory and is not set by default. Valid range is 1-255.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Encapsulation=</varname></term>
<listitem>
<para>Specifies the encapsulation mechanism used to store networking packets of various protocols inside the UDP packets. Supports the following values:
<literal>FooOverUDP</literal> provides the simplest no frills model of UDP encapsulation, it simply encapsulates
packets directly in the UDP payload.
<literal>GenericUDPEncapsulation</literal> is a generic and extensible encapsulation, it allows encapsulation of packets for any IP
protocol and optional data as part of the encapsulation.
For more detailed information see <ulink url="https://lwn.net/Articles/615044">Generic UDP Encapsulation</ulink>.
Defaults to <literal>FooOverUDP</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Port=</varname></term>
<listitem>
<para>Specifies the port number, where the IP encapsulation packets will arrive. Please take note that the packets
will arrive with the encapsulation will be removed. Then they will be manually fed back into the network stack, and sent ahead
for delivery to the real destination. This option is mandatory.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>[Peer] Section Options</title>
@@ -1379,6 +1451,32 @@ Local=192.168.223.238
Remote=192.169.224.239
TTL=64</programlisting>
</example>
<example>
<title>/etc/systemd/network/1-fou-tunnel.netdev</title>
<programlisting>[NetDev]
Name=fou-tun
Kind=fou
[FooOverUDP]
Port=5555
Protocol=4
</programlisting>
</example>
<example>
<title>/etc/systemd/network/25-fou-ipip.netdev</title>
<programlisting>[NetDev]
[NetDev]
Name=ipip-tun
Kind=ipip
[Tunnel]
Independent=true
Local=10.65.208.212
Remote=10.65.208.211
FooOverUDP=true
FOUDestinationPort=5555
</programlisting>
</example>
<example>
<title>/etc/systemd/network/25-tap.netdev</title>
<programlisting>[NetDev]