summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-01-31 14:14:33 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-02-22 21:05:04 +0100
commitb42f780e045c69e6b2c350dcd6de760c673a78e0 (patch)
tree6e85123cb2117d360afed7c40b2566cb3b075d61
parent1bf2d3b0495ce56132e601f6d68f403c99889739 (diff)
downloadNetworkManager-b42f780e045c69e6b2c350dcd6de760c673a78e0.tar.gz
core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used primarily for determining the device type but does not carry any properties.
-rw-r--r--Makefile.am8
-rw-r--r--introspection/org.freedesktop.NetworkManager.Device.Dummy.xml15
-rw-r--r--libnm-core/nm-dbus-interface.h3
-rw-r--r--libnm/NetworkManager.h1
-rw-r--r--libnm/libnm.ver1
-rw-r--r--libnm/nm-client.c3
-rw-r--r--libnm/nm-device-dummy.c80
-rw-r--r--libnm/nm-device-dummy.h57
-rw-r--r--libnm/nm-device.c3
-rw-r--r--libnm/nm-types.h1
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/devices/nm-device-dummy.c207
-rw-r--r--src/devices/nm-device-dummy.h38
-rw-r--r--src/devices/nm-device-factory.c1
-rw-r--r--src/devices/nm-device.c2
15 files changed, 422 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index f153af990c..670fb9d54e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,6 +188,8 @@ introspection_sources = \
introspection/org.freedesktop.NetworkManager.Device.Bridge.h \
introspection/org.freedesktop.NetworkManager.Device.Bluetooth.c \
introspection/org.freedesktop.NetworkManager.Device.Bluetooth.h \
+ introspection/org.freedesktop.NetworkManager.Device.Dummy.c \
+ introspection/org.freedesktop.NetworkManager.Device.Dummy.h \
introspection/org.freedesktop.NetworkManager.Device.Wired.c \
introspection/org.freedesktop.NetworkManager.Device.Wired.h \
introspection/org.freedesktop.NetworkManager.Device.Generic.c \
@@ -262,6 +264,7 @@ DBUS_INTERFACE_DOCS = \
docs/api/dbus-org.freedesktop.NetworkManager.Device.xml \
docs/api/dbus-org.freedesktop.NetworkManager.VPN.Plugin.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Bluetooth.xml \
+ docs/api/dbus-org.freedesktop.NetworkManager.Device.Dummy.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Vxlan.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Settings.Connection.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Bond.xml \
@@ -314,6 +317,7 @@ dbusinterfaces_DATA = \
introspection/org.freedesktop.NetworkManager.Device.Bond.xml \
introspection/org.freedesktop.NetworkManager.Device.Bridge.xml \
introspection/org.freedesktop.NetworkManager.Device.Bluetooth.xml \
+ introspection/org.freedesktop.NetworkManager.Device.Dummy.xml \
introspection/org.freedesktop.NetworkManager.Device.Wired.xml \
introspection/org.freedesktop.NetworkManager.Device.Generic.xml \
introspection/org.freedesktop.NetworkManager.Device.Infiniband.xml \
@@ -681,6 +685,7 @@ libnm_lib_h_pub_real = \
libnm/nm-device-bond.h \
libnm/nm-device-bridge.h \
libnm/nm-device-bt.h \
+ libnm/nm-device-dummy.h \
libnm/nm-device-ethernet.h \
libnm/nm-device-generic.h \
libnm/nm-device-infiniband.h \
@@ -731,6 +736,7 @@ libnm_lib_c_real = \
libnm/nm-device-bond.c \
libnm/nm-device-bridge.c \
libnm/nm-device-bt.c \
+ libnm/nm-device-dummy.c \
libnm/nm-device-ethernet.c \
libnm/nm-device-generic.c \
libnm/nm-device-infiniband.c \
@@ -1304,6 +1310,8 @@ src_libNetworkManager_la_SOURCES = \
src/devices/nm-device-bond.h \
src/devices/nm-device-bridge.c \
src/devices/nm-device-bridge.h \
+ src/devices/nm-device-dummy.c \
+ src/devices/nm-device-dummy.h \
src/devices/nm-device-ethernet.c \
src/devices/nm-device-ethernet.h \
src/devices/nm-device-infiniband.c \
diff --git a/introspection/org.freedesktop.NetworkManager.Device.Dummy.xml b/introspection/org.freedesktop.NetworkManager.Device.Dummy.xml
new file mode 100644
index 0000000000..7492c061bf
--- /dev/null
+++ b/introspection/org.freedesktop.NetworkManager.Device.Dummy.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/">
+ <interface name="org.freedesktop.NetworkManager.Device.Dummy">
+
+ <!--
+ PropertiesChanged:
+ @properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
+ -->
+ <signal name="PropertiesChanged">
+ <arg name="properties" type="a{sv}"/>
+ </signal>
+ </interface>
+</node>
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index 51ecfab42c..89c2ab1628 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -58,6 +58,7 @@
#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config"
#define NM_DBUS_INTERFACE_DEVICE_INFINIBAND NM_DBUS_INTERFACE_DEVICE ".Infiniband"
#define NM_DBUS_INTERFACE_DEVICE_BOND NM_DBUS_INTERFACE_DEVICE ".Bond"
+#define NM_DBUS_INTERFACE_DEVICE_DUMMY NM_DBUS_INTERFACE_DEVICE ".Dummy"
#define NM_DBUS_INTERFACE_DEVICE_TEAM NM_DBUS_INTERFACE_DEVICE ".Team"
#define NM_DBUS_INTERFACE_DEVICE_VLAN NM_DBUS_INTERFACE_DEVICE ".Vlan"
#define NM_DBUS_INTERFACE_DEVICE_BRIDGE NM_DBUS_INTERFACE_DEVICE ".Bridge"
@@ -200,6 +201,7 @@ typedef enum {
* @NM_DEVICE_TYPE_VXLAN: a VXLAN interface
* @NM_DEVICE_TYPE_VETH: a VETH interface
* @NM_DEVICE_TYPE_MACSEC: a MACsec interface
+ * @NM_DEVICE_TYPE_DUMMY: a dummy interface
*
* #NMDeviceType values indicate the type of hardware represented by a
* device object.
@@ -227,6 +229,7 @@ typedef enum {
NM_DEVICE_TYPE_VXLAN = 19,
NM_DEVICE_TYPE_VETH = 20,
NM_DEVICE_TYPE_MACSEC = 21,
+ NM_DEVICE_TYPE_DUMMY = 22,
} NMDeviceType;
/**
diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h
index 747510a268..4bf35df714 100644
--- a/libnm/NetworkManager.h
+++ b/libnm/NetworkManager.h
@@ -33,6 +33,7 @@
#include <nm-device-bond.h>
#include <nm-device-bridge.h>
#include <nm-device-bt.h>
+#include <nm-device-dummy.h>
#include <nm-device-ethernet.h>
#include <nm-device-generic.h>
#include <nm-device-infiniband.h>
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index bfcec2639d..2d6f739e6e 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1147,6 +1147,7 @@ global:
libnm_1_8_0 {
global:
nm_connection_get_setting_dummy;
+ nm_device_dummy_get_type;
nm_setting_802_1x_auth_flags_get_type;
nm_setting_802_1x_get_auth_timeout;
nm_setting_802_1x_get_ca_cert_password;
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index cd54a88c70..17c31bf043 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -52,6 +52,7 @@
#include "nm-device-bond.h"
#include "nm-device-bridge.h"
#include "nm-device-bt.h"
+#include "nm-device-dummy.h"
#include "nm-device-ethernet.h"
#include "nm-device-generic.h"
#include "nm-device-infiniband.h"
@@ -2046,6 +2047,8 @@ obj_nm_for_gdbus_object (GDBusObject *object, GDBusObjectManager *object_manager
type = NM_TYPE_DEVICE_BRIDGE;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH) == 0)
type = NM_TYPE_DEVICE_BT;
+ else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_DUMMY) == 0)
+ type = NM_TYPE_DEVICE_DUMMY;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIRED) == 0)
type = NM_TYPE_DEVICE_ETHERNET;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_GENERIC) == 0)
diff --git a/libnm/nm-device-dummy.c b/libnm/nm-device-dummy.c
new file mode 100644
index 0000000000..f5910dc869
--- /dev/null
+++ b/libnm/nm-device-dummy.c
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+
+#include <string.h>
+
+#include "nm-device-dummy.h"
+#include "nm-object-private.h"
+#include "nm-setting-dummy.h"
+#include "nm-setting-connection.h"
+
+G_DEFINE_TYPE (NMDeviceDummy, nm_device_dummy, NM_TYPE_DEVICE)
+
+#define NM_DEVICE_DUMMY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_DUMMY, NMDeviceDummyPrivate))
+
+/*****************************************************************************/
+
+static gboolean
+connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
+{
+ const char *iface_name;
+
+ if (!NM_DEVICE_CLASS (nm_device_dummy_parent_class)->connection_compatible (device, connection, error))
+ return FALSE;
+
+ if (!nm_connection_is_type (connection, NM_SETTING_DUMMY_SETTING_NAME)) {
+ g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
+ _("The connection was not a dummy connection."));
+ return FALSE;
+ }
+
+ iface_name = nm_connection_get_interface_name (connection);
+ if (!iface_name) {
+ g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
+ _("The connection did not specify an interface name."));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static GType
+get_setting_type (NMDevice *device)
+{
+ return NM_TYPE_SETTING_DUMMY;
+}
+
+/*****************************************************************************/
+
+static void
+nm_device_dummy_init (NMDeviceDummy *device)
+{
+}
+
+static void
+nm_device_dummy_class_init (NMDeviceDummyClass *klass)
+{
+ NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
+
+ device_class->connection_compatible = connection_compatible;
+ device_class->get_setting_type = get_setting_type;
+}
diff --git a/libnm/nm-device-dummy.h b/libnm/nm-device-dummy.h
new file mode 100644
index 0000000000..0d37e57557
--- /dev/null
+++ b/libnm/nm-device-dummy.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#ifndef __NM_DEVICE_DUMMY_H__
+#define __NM_DEVICE_DUMMY_H__
+
+#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
+#error "Only <NetworkManager.h> can be included directly."
+#endif
+
+#include <nm-device.h>
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_DEVICE_DUMMY (nm_device_dummy_get_type ())
+#define NM_DEVICE_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_DUMMY, NMDeviceDummy))
+#define NM_DEVICE_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_DUMMY, NMDeviceDummyClass))
+#define NM_IS_DEVICE_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_DUMMY))
+#define NM_IS_DEVICE_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_DUMMY))
+#define NM_DEVICE_DUMMY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_DUMMY, NMDeviceDummyClass))
+
+/**
+ * NMDeviceDummy:
+ */
+struct _NMDeviceDummy {
+ NMDevice parent;
+};
+
+typedef struct {
+ NMDeviceClass parent;
+
+ /*< private >*/
+ gpointer padding[4];
+} NMDeviceDummyClass;
+
+GType nm_device_dummy_get_type (void);
+
+G_END_DECLS
+
+#endif /* __NM_DEVICE_DUMMY_H__ */
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 85cd060b8f..02241567f9 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -277,6 +277,7 @@ coerce_type (NMDeviceType type)
case NM_DEVICE_TYPE_UNUSED1:
case NM_DEVICE_TYPE_UNUSED2:
case NM_DEVICE_TYPE_UNKNOWN:
+ case NM_DEVICE_TYPE_DUMMY:
return type;
}
return NM_DEVICE_TYPE_UNKNOWN;
@@ -1696,6 +1697,8 @@ get_type_name (NMDevice *device)
return _("Veth");
case NM_DEVICE_TYPE_MACSEC:
return _("MACsec");
+ case NM_DEVICE_TYPE_DUMMY:
+ return _("Dummy");
case NM_DEVICE_TYPE_GENERIC:
case NM_DEVICE_TYPE_UNUSED1:
case NM_DEVICE_TYPE_UNUSED2:
diff --git a/libnm/nm-types.h b/libnm/nm-types.h
index 7d224c86fe..05fea1746b 100644
--- a/libnm/nm-types.h
+++ b/libnm/nm-types.h
@@ -34,6 +34,7 @@ typedef struct _NMDeviceAdsl NMDeviceAdsl;
typedef struct _NMDeviceBond NMDeviceBond;
typedef struct _NMDeviceBridge NMDeviceBridge;
typedef struct _NMDeviceBt NMDeviceBt;
+typedef struct _NMDeviceDummy NMDeviceDummy;
typedef struct _NMDeviceEthernet NMDeviceEthernet;
typedef struct _NMDeviceGeneric NMDeviceGeneric;
typedef struct _NMDeviceInfiniband NMDeviceInfiniband;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d9faa7b112..3bdf6d79b3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -123,6 +123,7 @@ libnm/nm-device-adsl.c
libnm/nm-device-bond.c
libnm/nm-device-bridge.c
libnm/nm-device-bt.c
+libnm/nm-device-dummy.c
libnm/nm-device-ethernet.c
libnm/nm-device-generic.c
libnm/nm-device-tun.c
@@ -157,6 +158,7 @@ src/devices/bluetooth/nm-bluez-device.c
src/devices/bluetooth/nm-device-bt.c
src/devices/nm-device-bond.c
src/devices/nm-device-bridge.c
+src/devices/nm-device-dummy.c
src/devices/nm-device-ethernet.c
src/devices/nm-device-ethernet-utils.c
src/devices/nm-device-infiniband.c
diff --git a/src/devices/nm-device-dummy.c b/src/devices/nm-device-dummy.c
new file mode 100644
index 0000000000..c05cc5681a
--- /dev/null
+++ b/src/devices/nm-device-dummy.c
@@ -0,0 +1,207 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+
+#include "nm-device-dummy.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "nm-act-request.h"
+#include "nm-device-private.h"
+#include "nm-ip4-config.h"
+#include "platform/nm-platform.h"
+#include "nm-device-factory.h"
+#include "nm-setting-dummy.h"
+#include "nm-core-internal.h"
+
+#include "introspection/org.freedesktop.NetworkManager.Device.Dummy.h"
+
+#include "nm-device-logging.h"
+_LOG_DECLARE_SELF(NMDeviceDummy);
+
+/*****************************************************************************/
+
+struct _NMDeviceDummy {
+ NMDevice parent;
+};
+
+struct _NMDeviceDummyClass {
+ NMDeviceClass parent;
+};
+
+G_DEFINE_TYPE (NMDeviceDummy, nm_device_dummy, NM_TYPE_DEVICE)
+
+/*****************************************************************************/
+
+static NMDeviceCapabilities
+get_generic_capabilities (NMDevice *dev)
+{
+ return NM_DEVICE_CAP_IS_SOFTWARE;
+}
+
+static gboolean
+complete_connection (NMDevice *device,
+ NMConnection *connection,
+ const char *specific_object,
+ const GSList *existing_connections,
+ GError **error)
+{
+ NMSettingDummy *s_dummy;
+
+ nm_utils_complete_generic (NM_PLATFORM_GET,
+ connection,
+ NM_SETTING_DUMMY_SETTING_NAME,
+ existing_connections,
+ NULL,
+ _("Dummy connection"),
+ NULL,
+ TRUE);
+
+ s_dummy = nm_connection_get_setting_dummy (connection);
+ if (!s_dummy) {
+ g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
+ "A 'dummy' setting is required.");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+update_connection (NMDevice *device, NMConnection *connection)
+{
+ NMSettingDummy *s_dummy = nm_connection_get_setting_dummy (connection);
+
+ if (!s_dummy) {
+ s_dummy = (NMSettingDummy *) nm_setting_dummy_new ();
+ nm_connection_add_setting (connection, (NMSetting *) s_dummy);
+ }
+}
+
+static gboolean
+create_and_realize (NMDevice *device,
+ NMConnection *connection,
+ NMDevice *parent,
+ const NMPlatformLink **out_plink,
+ GError **error)
+{
+ const char *iface = nm_device_get_iface (device);
+ NMPlatformError plerr;
+ NMSettingDummy *s_dummy;
+
+ s_dummy = nm_connection_get_setting_dummy (connection);
+ g_assert (s_dummy);
+
+ plerr = nm_platform_link_dummy_add (NM_PLATFORM_GET, iface, out_plink);
+ if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
+ g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
+ "Failed to create dummy interface '%s' for '%s': %s",
+ iface,
+ nm_connection_get_id (connection),
+ nm_platform_error_to_string (plerr));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+check_connection_compatible (NMDevice *device, NMConnection *connection)
+{
+ NMSettingDummy *s_dummy;
+
+ if (!NM_DEVICE_CLASS (nm_device_dummy_parent_class)->check_connection_compatible (device, connection))
+ return FALSE;
+
+ s_dummy = nm_connection_get_setting_dummy (connection);
+ if (!s_dummy)
+ return FALSE;
+
+ return TRUE;
+}
+
+static NMActStageReturn
+act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
+{
+ NMActStageReturn ret;
+
+ g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+ ret = NM_DEVICE_CLASS (nm_device_dummy_parent_class)->act_stage1_prepare (device, reason);
+ if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
+ return ret;
+
+ if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
+ return NM_ACT_STAGE_RETURN_FAILURE;
+
+ return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
+/*****************************************************************************/
+
+static void
+nm_device_dummy_init (NMDeviceDummy *self)
+{
+}
+
+static void
+nm_device_dummy_class_init (NMDeviceDummyClass *klass)
+{
+ NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
+
+ NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_DUMMY)
+
+ device_class->connection_type = NM_SETTING_DUMMY_SETTING_NAME;
+ device_class->complete_connection = complete_connection;
+ device_class->check_connection_compatible = check_connection_compatible;
+ device_class->create_and_realize = create_and_realize;
+ device_class->get_generic_capabilities = get_generic_capabilities;
+ device_class->update_connection = update_connection;
+ device_class->act_stage1_prepare = act_stage1_prepare;
+ device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
+
+ nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
+ NMDBUS_TYPE_DEVICE_DUMMY_SKELETON,
+ NULL);
+}
+
+
+/*****************************************************************************/
+
+#define NM_TYPE_DUMMY_DEVICE_FACTORY (nm_dummy_device_factory_get_type ())
+#define NM_DUMMY_DEVICE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DUMMY_DEVICE_FACTORY, NMDummyDeviceFactory))
+
+static NMDevice *
+create_device (NMDeviceFactory *factory,
+ const char *iface,
+ const NMPlatformLink *plink,
+ NMConnection *connection,
+ gboolean *out_ignore)
+{
+ return (NMDevice *) g_object_new (NM_TYPE_DEVICE_DUMMY,
+ NM_DEVICE_IFACE, iface,
+ NM_DEVICE_TYPE_DESC, "Dummy",
+ NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_DUMMY,
+ NM_DEVICE_LINK_TYPE, NM_LINK_TYPE_DUMMY,
+ NULL);
+}
+
+NM_DEVICE_FACTORY_DEFINE_INTERNAL (DUMMY, Dummy, dummy,
+ NM_DEVICE_FACTORY_DECLARE_LINK_TYPES (NM_LINK_TYPE_DUMMY)
+ NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_DUMMY_SETTING_NAME),
+ factory_class->create_device = create_device;
+);
diff --git a/src/devices/nm-device-dummy.h b/src/devices/nm-device-dummy.h
new file mode 100644
index 0000000000..cc89a84736
--- /dev/null
+++ b/src/devices/nm-device-dummy.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#ifndef __NETWORKMANAGER_DEVICE_DUMMY_H__
+#define __NETWORKMANAGER_DEVICE_DUMMY_H__
+
+#include "nm-device-generic.h"
+
+#define NM_TYPE_DEVICE_DUMMY (nm_device_dummy_get_type ())
+#define NM_DEVICE_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_DUMMY, NMDeviceDummy))
+#define NM_DEVICE_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_DUMMY, NMDeviceDummyClass))
+#define NM_IS_DEVICE_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_DUMMY))
+#define NM_IS_DEVICE_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_DUMMY))
+#define NM_DEVICE_DUMMY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_DUMMY, NMDeviceDummyClass))
+
+typedef struct _NMDeviceDummy NMDeviceDummy;
+typedef struct _NMDeviceDummyClass NMDeviceDummyClass;
+
+GType nm_device_dummy_get_type (void);
+
+#endif /* __NETWORKMANAGER_DEVICE_DUMMY_H__ */
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index dbe68048a9..f512b8b25d 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -403,6 +403,7 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call
_ADD_INTERNAL (nm_bond_device_factory_get_type);
_ADD_INTERNAL (nm_bridge_device_factory_get_type);
+ _ADD_INTERNAL (nm_dummy_device_factory_get_type);
_ADD_INTERNAL (nm_ethernet_device_factory_get_type);
_ADD_INTERNAL (nm_infiniband_device_factory_get_type);
_ADD_INTERNAL (nm_ip_tunnel_device_factory_get_type);
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 006e523641..38e1453d47 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1349,6 +1349,8 @@ nm_device_get_priority (NMDevice *self)
return 450;
case NM_DEVICE_TYPE_VXLAN:
return 500;
+ case NM_DEVICE_TYPE_DUMMY:
+ return 550;
case NM_DEVICE_TYPE_WIFI:
return 600;
case NM_DEVICE_TYPE_OLPC_MESH: