]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: introduce netdev "Netdevsim" Driver
authorSusant Sahani <susant@redhat.com>
Sat, 2 Jun 2018 13:06:33 +0000 (18:36 +0530)
committerSusant Sahani <susant@redhat.com>
Sun, 3 Jun 2018 02:46:11 +0000 (08:16 +0530)
This "netdevsim" as implied by the name is a tool for network developers and is 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.

man/systemd.netdev.xml
src/libsystemd/sd-netlink/netlink-types.c
src/libsystemd/sd-netlink/netlink-types.h
src/network/meson.build
src/network/netdev/netdev.c
src/network/netdev/netdev.h
src/network/netdev/netdevsim.c [new file with mode: 0644]
src/network/netdev/netdevsim.h [new file with mode: 0644]

index acda76fff392d65ce3d37e61c20951dde9f24689..e88897450c2a9ba300e07dadbc5e382165c0bdb0 100644 (file)
           <row><entry><varname>wireguard</varname></entry>
           <entry>WireGuard Secure Network Tunnel.</entry></row>
 
+          <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>
         </tbody>
       </tgroup>
     </table>
index 9dca344f8d63b8ecbe98da09a496dc6262dd0a2e..ddb4d90eaf2e82b930257e8bb19eff5716503c35 100644 (file)
@@ -325,6 +325,7 @@ static const char* const nl_union_link_info_data_table[] = {
         [NL_UNION_LINK_INFO_DATA_GENEVE] = "geneve",
         [NL_UNION_LINK_INFO_DATA_VXCAN] = "vxcan",
         [NL_UNION_LINK_INFO_DATA_WIREGUARD] = "wireguard",
+        [NL_UNION_LINK_INFO_DATA_NETDEVSIM] = "netdevsim",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(nl_union_link_info_data, NLUnionLinkInfoData);
index 456562d32924196b0c6d614aa2360d563127ba8a..a7542eb33d11297c975713bcf972169c9457cfd2 100644 (file)
@@ -82,6 +82,7 @@ typedef enum NLUnionLinkInfoData {
         NL_UNION_LINK_INFO_DATA_GENEVE,
         NL_UNION_LINK_INFO_DATA_VXCAN,
         NL_UNION_LINK_INFO_DATA_WIREGUARD,
+        NL_UNION_LINK_INFO_DATA_NETDEVSIM,
         _NL_UNION_LINK_INFO_DATA_MAX,
         _NL_UNION_LINK_INFO_DATA_INVALID = -1
 } NLUnionLinkInfoData;
index e9ce2083ececa2eba975e12fd10e881ab9d21d2a..a717152e203c0705300d007d26df23e5b5aa49a9 100644 (file)
@@ -35,6 +35,8 @@ sources = files('''
         netdev/vxcan.h
         netdev/wireguard.c
         netdev/wireguard.h
+        netdev/netdevsim.c
+        netdev/netdevsim.h
         networkd-address-label.c
         networkd-address-label.h
         networkd-address-pool.c
index a0b26971836ca619c11be70079371f8e99d6d9a3..da6a50c5a2711597e33792aa45fec73297351c21 100644 (file)
@@ -37,6 +37,7 @@
 #include "netdev/vcan.h"
 #include "netdev/vxcan.h"
 #include "netdev/wireguard.h"
+#include "netdev/netdevsim.h"
 
 const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = {
         [NETDEV_KIND_BRIDGE] = &bridge_vtable,
@@ -64,6 +65,7 @@ const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = {
         [NETDEV_KIND_GENEVE] = &geneve_vtable,
         [NETDEV_KIND_VXCAN] = &vxcan_vtable,
         [NETDEV_KIND_WIREGUARD] = &wireguard_vtable,
+        [NETDEV_KIND_NETDEVSIM] = &netdevsim_vtable,
 };
 
 static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
@@ -92,6 +94,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
         [NETDEV_KIND_GENEVE] = "geneve",
         [NETDEV_KIND_VXCAN] = "vxcan",
         [NETDEV_KIND_WIREGUARD] = "wireguard",
+        [NETDEV_KIND_NETDEVSIM] = "netdevsim",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
index 0d0671d37bc08893c69abd5c78dc08ee25239247..fa90b14f86359fd8b473b9665d31468998b717bc 100644 (file)
@@ -48,6 +48,7 @@ typedef enum NetDevKind {
         NETDEV_KIND_GENEVE,
         NETDEV_KIND_VXCAN,
         NETDEV_KIND_WIREGUARD,
+        NETDEV_KIND_NETDEVSIM,
         _NETDEV_KIND_MAX,
         _NETDEV_KIND_INVALID = -1
 } NetDevKind;
diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
new file mode 100644 (file)
index 0000000..857a63f
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+/***
+  This file is part of systemd.
+
+  Copyright 2018 Susant Sahani
+***/
+
+#include "netdev/netdevsim.h"
+#include "missing.h"
+
+const NetDevVTable netdevsim_vtable = {
+        .object_size = sizeof(NetDevSim),
+        .sections = "Match\0NetDev\0",
+        .create_type = NETDEV_CREATE_INDEPENDENT,
+};
diff --git a/src/network/netdev/netdevsim.h b/src/network/netdev/netdevsim.h
new file mode 100644 (file)
index 0000000..1e56027
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2018 Susant Sahani
+***/
+
+typedef struct NetDevSim NetDevSim;
+
+#include "netdev/netdev.h"
+
+struct NetDevSim {
+        NetDev meta;
+};
+
+DEFINE_NETDEV_CAST(NETDEVSIM, NetDevSim);
+extern const NetDevVTable netdevsim_vtable;