summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-07 16:56:32 +0200
committerGitHub <noreply@github.com>2018-06-07 16:56:32 +0200
commitce3ec07f412c6e7094fafb6b358b549ca801363c (patch)
tree3101e9cac45ca2645b0cf778382c0a9e81b5fa73 /src/network
parentd40f5cc498a781bb2fc7b465c7be4372444754ed (diff)
parente60dc5b441e2c86d1d0b3712ab46caac5bffcef2 (diff)
downloadsystemd-ce3ec07f412c6e7094fafb6b358b549ca801363c.tar.gz
Merge pull request #9165 from ssahani/networkd-netdevsim
networkd: introduce netdev "Netdevsim" Driver
Diffstat (limited to 'src/network')
-rw-r--r--src/network/meson.build2
-rw-r--r--src/network/netdev/netdev.c3
-rw-r--r--src/network/netdev/netdev.h1
-rw-r--r--src/network/netdev/netdevsim.c15
-rw-r--r--src/network/netdev/netdevsim.h19
-rw-r--r--src/network/netdev/vxcan.h1
6 files changed, 41 insertions, 0 deletions
diff --git a/src/network/meson.build b/src/network/meson.build
index e9ce2083ec..a717152e20 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -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
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index a0b2697183..da6a50c5a2 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -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);
diff --git a/src/network/netdev/netdev.h b/src/network/netdev/netdev.h
index 0d0671d37b..fa90b14f86 100644
--- a/src/network/netdev/netdev.h
+++ b/src/network/netdev/netdev.h
@@ -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
index 0000000000..857a63f3de
--- /dev/null
+++ b/src/network/netdev/netdevsim.c
@@ -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
index 0000000000..1e560279ff
--- /dev/null
+++ b/src/network/netdev/netdevsim.h
@@ -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;
diff --git a/src/network/netdev/vxcan.h b/src/network/netdev/vxcan.h
index a41b75ce96..a8af01ba33 100644
--- a/src/network/netdev/vxcan.h
+++ b/src/network/netdev/vxcan.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***