[systemd-devel] [PATCH] networkd vxlan: Add support for enabling UDP checksums

Susant Sahani susant at redhat.com
Thu Mar 5 00:35:27 PST 2015


Add UdpCheckSum option to enable transmitting UDP checksums when doing
VXLAN/IPv4. Add Udp6ZeroChecksumRx, and Udp6ZeroChecksumTx
options to enable sending zero checksums and receiving zero
checksums in VXLAN/IPv6
---
 man/systemd.netdev.xml                  | 24 +++++++++++++++++++++++-
 src/libsystemd/sd-rtnl/rtnl-types.c     |  3 +++
 src/network/networkd-netdev-gperf.gperf |  3 +++
 src/network/networkd-netdev-vxlan.c     | 27 +++++++++++++++++++++++++++
 src/network/networkd-netdev-vxlan.h     |  3 +++
 5 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml
index e278aa1..9304ce2 100644
--- a/man/systemd.netdev.xml
+++ b/man/systemd.netdev.xml
@@ -391,7 +391,29 @@
                                                 <para>A boolean. When true route short circuit is turned on.</para>
                                         </listitem>
                                 </varlistentry>
-                        </variablelist>
+                                <varlistentry>
+                                        <term><varname>UdpCheckSum=</varname></term>
+                                        <listitem>
+                                          <para>A boolean. When true transmitting UDP checksums when doing
+                                          VXLAN/IPv4 is turned on. The default value is false.</para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                        <term><varname>Udp6ZeroCheckSumTx=</varname></term>
+                                        <listitem>
+                                          <para>A boolean. When true sending zero checksums in VXLAN/IPv6 is turned on.
+                                          The default value is false.</para>
+                                        </listitem>
+                                </varlistentry>
+                                <varlistentry>
+                                  <term><varname>Udp6ZeroCheckSumRx=</varname></term>
+                                  <listitem>
+                                    <para>A boolean. When true receiving zero checksums in VXLAN/IPv6 is turned on.
+                                    The default value is false./</para>
+                                  </listitem>
+                                </varlistentry>
+
+                              </variablelist>
         </refsect1>
         <refsect1>
                 <title>[Tunnel] Section Options</title>
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index d4abe4c..95924cd 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -89,6 +89,9 @@ static const NLType rtnl_link_info_data_vxlan_types[IFLA_VXLAN_MAX+1] = {
         [IFLA_VXLAN_RSC] = { .type = NLA_U8 },
         [IFLA_VXLAN_L2MISS] = { .type = NLA_U8 },
         [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 },
+        [IFLA_VXLAN_UDP_CSUM] = { .type = NLA_U8 },
+        [IFLA_VXLAN_UDP_ZERO_CSUM6_TX] = { .type = NLA_U8 },
+        [IFLA_VXLAN_UDP_ZERO_CSUM6_RX] = { .type = NLA_U8 },
 };
 
 static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf
index 963c47c..7a9fbf8 100644
--- a/src/network/networkd-netdev-gperf.gperf
+++ b/src/network/networkd-netdev-gperf.gperf
@@ -47,6 +47,9 @@ VXLAN.ARPProxy,           config_parse_bool,                  0,
 VXLAN.L2MissNotification, config_parse_bool,                  0,                             offsetof(VxLan, l2miss)
 VXLAN.L3MissNotification, config_parse_bool,                  0,                             offsetof(VxLan, l3miss)
 VXLAN.RouteShortCircuit,  config_parse_bool,                  0,                             offsetof(VxLan, route_short_circuit)
+VXLAN.UdpCheckSum,        config_parse_bool,                  0,                             offsetof(VxLan, udpcsum)
+VXLAN.Udp6ZeroCheckSumRx, config_parse_bool,                  0,                             offsetof(VxLan, udp6zerocsumrx)
+VXLAN.Udp6ZeroCheckSumTx, config_parse_bool,                  0,                             offsetof(VxLan, udp6zerocsumtx)
 VXLAN.FDBAgeingSec,       config_parse_sec,                   0,                             offsetof(VxLan, fdb_ageing)
 Tun.OneQueue,             config_parse_bool,                  0,                             offsetof(TunTap, one_queue)
 Tun.MultiQueue,           config_parse_bool,                  0,                             offsetof(TunTap, multi_queue)
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index d5128cb..d9b13e3 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -135,6 +135,30 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
                 }
         }
 
+        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
+        if (r < 0) {
+                log_netdev_error(netdev,
+                                 "Could not append IFLA_VXLAN_UDP_CSUM attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
+        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
+        if (r < 0) {
+                log_netdev_error(netdev,
+                                 "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
+        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
+        if (r < 0) {
+                log_netdev_error(netdev,
+                                 "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
         return r;
 }
 
@@ -199,6 +223,9 @@ static void vxlan_init(NetDev *netdev) {
 
         v->id = VXLAN_VID_MAX + 1;
         v->learning = true;
+        v->udpcsum = false;
+        v->udp6zerocsumtx = false;
+        v->udp6zerocsumrx = false;
 }
 
 const NetDevVTable vxlan_vtable = {
diff --git a/src/network/networkd-netdev-vxlan.h b/src/network/networkd-netdev-vxlan.h
index 6339af9..fe5254e 100644
--- a/src/network/networkd-netdev-vxlan.h
+++ b/src/network/networkd-netdev-vxlan.h
@@ -47,6 +47,9 @@ struct VxLan {
         bool route_short_circuit;
         bool l2miss;
         bool l3miss;
+        bool udpcsum;
+        bool udp6zerocsumtx;
+        bool udp6zerocsumrx;
 };
 
 extern const NetDevVTable vxlan_vtable;
-- 
2.3.1



More information about the systemd-devel mailing list