2013-05-06 09:16:17 -04:00
|
|
|
/* -*- 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.
|
|
|
|
|
*
|
2015-10-01 11:06:42 +02:00
|
|
|
* Copyright 2013 - 2015 Red Hat, Inc.
|
2013-05-06 09:16:17 -04:00
|
|
|
*/
|
|
|
|
|
|
2016-02-19 14:57:48 +01:00
|
|
|
#include "nm-default.h"
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2016-05-16 19:01:37 +02:00
|
|
|
#include "nm-device-macvlan.h"
|
|
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
#include <string.h>
|
|
|
|
|
|
2013-05-29 12:57:13 -03:00
|
|
|
#include "nm-device-private.h"
|
2016-11-21 00:43:52 +01:00
|
|
|
#include "settings/nm-settings.h"
|
2016-09-28 19:37:10 +02:00
|
|
|
#include "nm-act-request.h"
|
2013-05-06 09:16:17 -04:00
|
|
|
#include "nm-manager.h"
|
2016-11-21 00:43:52 +01:00
|
|
|
#include "platform/nm-platform.h"
|
2014-09-08 11:11:19 -05:00
|
|
|
#include "nm-device-factory.h"
|
2015-10-01 11:06:42 +02:00
|
|
|
#include "nm-setting-macvlan.h"
|
|
|
|
|
#include "nm-setting-wired.h"
|
|
|
|
|
#include "nm-active-connection.h"
|
|
|
|
|
#include "nm-ip4-config.h"
|
|
|
|
|
#include "nm-utils.h"
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2016-11-23 13:14:08 +01:00
|
|
|
#include "introspection/org.freedesktop.NetworkManager.Device.Macvlan.h"
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2014-08-02 15:14:26 +02:00
|
|
|
#include "nm-device-logging.h"
|
|
|
|
|
_LOG_DECLARE_SELF(NMDeviceMacvlan);
|
|
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
/*****************************************************************************/
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceMacvlan,
|
|
|
|
|
PROP_MODE,
|
|
|
|
|
PROP_NO_PROMISC,
|
|
|
|
|
PROP_TAP,
|
|
|
|
|
);
|
2013-05-06 09:16:17 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2016-01-04 10:29:06 +01:00
|
|
|
gulong parent_state_id;
|
2015-10-12 15:15:21 +02:00
|
|
|
NMPlatformLnkMacvlan props;
|
2013-05-06 09:16:17 -04:00
|
|
|
} NMDeviceMacvlanPrivate;
|
|
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
struct _NMDeviceMacvlan {
|
|
|
|
|
NMDevice parent;
|
|
|
|
|
NMDeviceMacvlanPrivate _priv;
|
|
|
|
|
};
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
struct _NMDeviceMacvlanClass {
|
|
|
|
|
NMDeviceClass parent;
|
2013-05-06 09:16:17 -04:00
|
|
|
};
|
|
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
G_DEFINE_TYPE (NMDeviceMacvlan, nm_device_macvlan, NM_TYPE_DEVICE)
|
|
|
|
|
|
|
|
|
|
#define NM_DEVICE_MACVLAN_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceMacvlan, NM_IS_DEVICE_MACVLAN)
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static int modes[][2] = {
|
|
|
|
|
{ NM_SETTING_MACVLAN_MODE_VEPA, MACVLAN_MODE_VEPA },
|
|
|
|
|
{ NM_SETTING_MACVLAN_MODE_BRIDGE, MACVLAN_MODE_BRIDGE },
|
|
|
|
|
{ NM_SETTING_MACVLAN_MODE_PRIVATE, MACVLAN_MODE_PRIVATE },
|
|
|
|
|
{ NM_SETTING_MACVLAN_MODE_PASSTHRU, MACVLAN_MODE_PASSTHRU },
|
|
|
|
|
};
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static int
|
|
|
|
|
setting_mode_to_platform (int mode)
|
|
|
|
|
{
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (modes); i++) {
|
|
|
|
|
if (modes[i][0] == mode)
|
|
|
|
|
return modes[i][1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
platform_mode_to_setting (int mode)
|
|
|
|
|
{
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (modes); i++) {
|
|
|
|
|
if (modes[i][1] == mode)
|
|
|
|
|
return modes[i][0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2015-12-03 15:44:33 +01:00
|
|
|
static const char *
|
2015-10-01 11:06:42 +02:00
|
|
|
platform_mode_to_string (guint mode)
|
2015-12-03 15:44:33 +01:00
|
|
|
{
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case MACVLAN_MODE_PRIVATE:
|
|
|
|
|
return "private";
|
|
|
|
|
case MACVLAN_MODE_VEPA:
|
|
|
|
|
return "vepa";
|
|
|
|
|
case MACVLAN_MODE_BRIDGE:
|
|
|
|
|
return "bridge";
|
|
|
|
|
case MACVLAN_MODE_PASSTHRU:
|
|
|
|
|
return "passthru";
|
|
|
|
|
default:
|
|
|
|
|
return "unknown";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
parent_state_changed (NMDevice *parent,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state,
|
|
|
|
|
NMDeviceStateReason reason,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceMacvlan *self = NM_DEVICE_MACVLAN (user_data);
|
|
|
|
|
|
|
|
|
|
/* We'll react to our own carrier state notifications. Ignore the parent's. */
|
2017-02-23 15:19:03 +01:00
|
|
|
if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_CARRIER)
|
2015-10-01 11:06:42 +02:00
|
|
|
return;
|
|
|
|
|
|
device: remove default-unmanaged and refactor unmanaged flags
Get rid of NM_UNMANAGED_DEFAULT and refine the interaction between
unmanaged flags, device state and managed property.
Previously, the NM_UNMANAGED_DEFAULT was special in that a device was
still considered managed if it had solely the NM_UNMANAGED_DEFAULT flag
set and its state was managed. Thus, whether the device (state) was managed,
depended on the device state too.
Now, a device is considered managed (or unmanaged) based on the unmanaged
flags and realization state alone. At the same time, the device state
directly corresponds to the managed property of the device. Of course,
while changing the unmanaged flags, that invariant is shortly violated
until the state transistion is complete.
Introduce more unmanaged flags whereas some of them are non-authorative.
For example, the EXTERNAL_DOWN flag has only effect as long as the user
didn't explicitly manage the device (NM_UNMANAGED_USER_EXPLICIT). In other
words, certain flags can render other flags ineffective. Whether the device
is considered managed depends on the flags but also at the explicitly unset flags.
In a way, this is similar to previous where NM_UNMANAGED_DEFAULT was ignored
(if no other flags were present).
Also, previously a device that was NM_UNMANAGED_DEFAULT and in disconnected
state would transition back to unmanaged. No longer do that. Once a device is
managed, it stays managed as long as the flags indicate it should be managed.
However, the user can also modify the unmanaged flags via the D-Bus API.
Also get rid or nm_device_finish_init(). That was previously called
by NMManager after add_device(). As we now realize devices (possibly
multiple times) this should be handled during realization.
https://bugzilla.gnome.org/show_bug.cgi?id=746566
2015-09-15 15:35:16 +02:00
|
|
|
nm_device_set_unmanaged_by_flags (NM_DEVICE (self), NM_UNMANAGED_PARENT, !nm_device_get_managed (parent, FALSE), reason);
|
2015-10-01 11:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-01-02 09:27:20 +01:00
|
|
|
parent_changed_notify (NMDevice *device,
|
|
|
|
|
int old_ifindex,
|
|
|
|
|
NMDevice *old_parent,
|
|
|
|
|
int new_ifindex,
|
|
|
|
|
NMDevice *new_parent)
|
|
|
|
|
{
|
|
|
|
|
NMDeviceMacvlan *self = NM_DEVICE_MACVLAN (device);
|
2015-10-01 11:06:42 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (self);
|
|
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->parent_changed_notify (device, old_ifindex, old_parent, new_ifindex, new_parent);
|
2015-10-01 11:06:42 +02:00
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
/* note that @self doesn't have to clear @parent_state_id on dispose,
|
|
|
|
|
* because NMDevice's dispose() will unset the parent, which in turn calls
|
|
|
|
|
* parent_changed_notify(). */
|
|
|
|
|
nm_clear_g_signal_handler (old_parent, &priv->parent_state_id);
|
2015-10-01 11:06:42 +02:00
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
if (new_parent) {
|
|
|
|
|
priv->parent_state_id = g_signal_connect (new_parent,
|
2017-01-14 16:36:33 +01:00
|
|
|
NM_DEVICE_STATE_CHANGED,
|
2015-10-01 11:06:42 +02:00
|
|
|
G_CALLBACK (parent_state_changed),
|
|
|
|
|
device);
|
|
|
|
|
|
|
|
|
|
/* Set parent-dependent unmanaged flag */
|
2016-01-13 12:03:47 +01:00
|
|
|
nm_device_set_unmanaged_by_flags (device,
|
|
|
|
|
NM_UNMANAGED_PARENT,
|
2017-01-02 09:27:20 +01:00
|
|
|
!nm_device_get_managed (new_parent, FALSE),
|
2016-01-13 12:03:47 +01:00
|
|
|
NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED);
|
2015-10-01 11:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
if (new_ifindex > 0) {
|
|
|
|
|
/* Recheck availability now that the parent has changed */
|
|
|
|
|
nm_device_queue_recheck_available (device,
|
|
|
|
|
NM_DEVICE_STATE_REASON_PARENT_CHANGED,
|
|
|
|
|
NM_DEVICE_STATE_REASON_PARENT_CHANGED);
|
|
|
|
|
}
|
2015-10-01 11:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
static void
|
2013-08-21 12:36:14 +02:00
|
|
|
update_properties (NMDevice *device)
|
2013-05-06 09:16:17 -04:00
|
|
|
{
|
2014-08-02 15:14:26 +02:00
|
|
|
NMDeviceMacvlan *self = NM_DEVICE_MACVLAN (device);
|
2016-09-29 13:49:01 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (self);
|
2013-05-06 09:16:17 -04:00
|
|
|
GObject *object = G_OBJECT (device);
|
2015-10-12 15:15:21 +02:00
|
|
|
const NMPlatformLnkMacvlan *props;
|
|
|
|
|
const NMPlatformLink *plink;
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
if (priv->props.tap)
|
2017-04-18 12:09:02 +02:00
|
|
|
props = nm_platform_link_get_lnk_macvtap (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink);
|
2015-10-01 11:06:42 +02:00
|
|
|
else
|
2017-04-18 12:09:02 +02:00
|
|
|
props = nm_platform_link_get_lnk_macvlan (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink);
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2015-10-12 15:15:21 +02:00
|
|
|
if (!props) {
|
2016-10-06 21:28:40 +02:00
|
|
|
_LOGW (LOGD_PLATFORM, "could not get %s properties", priv->props.tap ? "macvtap" : "macvlan");
|
2013-05-06 09:16:17 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_freeze_notify (object);
|
|
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
nm_device_parent_set_ifindex (device, plink->parent);
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2018-03-05 15:23:31 +01:00
|
|
|
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
|
|
|
|
G_STMT_START { \
|
|
|
|
|
if (priv->props.field != props->field) { \
|
|
|
|
|
priv->props.field = props->field; \
|
|
|
|
|
_notify (self, prop); \
|
|
|
|
|
} \
|
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
|
|
CHECK_PROPERTY_CHANGED (mode, PROP_MODE);
|
|
|
|
|
CHECK_PROPERTY_CHANGED (no_promisc, PROP_NO_PROMISC);
|
2013-05-06 09:16:17 -04:00
|
|
|
|
|
|
|
|
g_object_thaw_notify (object);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 12:36:14 +02:00
|
|
|
static void
|
2017-01-02 15:38:24 +01:00
|
|
|
link_changed (NMDevice *device,
|
|
|
|
|
const NMPlatformLink *pllink)
|
2013-08-21 12:36:14 +02:00
|
|
|
{
|
2017-01-02 15:38:24 +01:00
|
|
|
NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->link_changed (device, pllink);
|
2013-08-21 12:36:14 +02:00
|
|
|
update_properties (device);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static gboolean
|
|
|
|
|
create_and_realize (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
NMDevice *parent,
|
2015-12-09 15:13:57 +01:00
|
|
|
const NMPlatformLink **out_plink,
|
2015-10-01 11:06:42 +02:00
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
const char *iface = nm_device_get_iface (device);
|
|
|
|
|
NMPlatformError plerr;
|
|
|
|
|
NMSettingMacvlan *s_macvlan;
|
|
|
|
|
NMPlatformLnkMacvlan lnk = { };
|
|
|
|
|
int parent_ifindex;
|
|
|
|
|
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
2017-01-02 09:27:20 +01:00
|
|
|
g_return_val_if_fail (s_macvlan, FALSE);
|
|
|
|
|
|
|
|
|
|
parent_ifindex = parent ? nm_device_get_ifindex (parent) : 0;
|
2015-10-01 11:06:42 +02:00
|
|
|
|
2017-01-02 09:27:20 +01:00
|
|
|
if (parent_ifindex <= 0) {
|
2017-09-14 09:26:51 +02:00
|
|
|
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_MISSING_DEPENDENCIES,
|
device: check for a parent device
The device creation can be attempted if the name can be determined. It
alone is doesn't mean that there's a parent device -- the name could
just have been hardcoded in the connection.
NetworkManager[21519]: nm_device_get_ifindex: assertion 'NM_IS_DEVICE (self)' failed
Program received signal SIGTRAP, Trace/breakpoint trap.
g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
1046 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
(gdb) bt
#0 0x00007ffff4ec88c3 in g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
#1 0x00007ffff4ec8a3f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
#2 0x00005555555d2090 in nm_device_get_ifindex (self=0x0) at devices/nm-device.c:562
#3 0x00005555555ef77a in nm_device_supports_vlans (self=0x0) at devices/nm-device.c:9865
#4 0x00005555555bf2f9 in create_and_realize (device=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, out_plink=0x7fffffffd5f8, error=0x7fffffffd700) at devices/nm-device-vlan.c:225
#5 0x00005555555d5757 in nm_device_create_and_realize (self=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, error=0x7fffffffd700) at devices/nm-device.c:1783
#6 0x0000555555688601 in system_create_virtual_device (self=0x555555af51c0 [NMManager], connection=0x555555b451e0) at nm-manager.c:1120
#7 0x000055555568894e in connection_changed (settings=0x555555ae8220 [NMSettings], connection=0x555555b451e0, manager=0x555555af51c0 [NMManager]) at nm-manager.c:1172
#8 0x0000555555693448 in nm_manager_start (self=0x555555af51c0 [NMManager], error=0x7fffffffda30) at nm-manager.c:4466
#9 0x00005555555d166f in main (argc=1, argv=0x7fffffffdba8) at main.c:454
(gdb)
Fixes: 332994f1b19ded7cb343ef573443916bab05aaec
2016-04-19 12:02:02 +02:00
|
|
|
"MACVLAN devices can not be created without a parent interface");
|
2017-01-02 09:27:20 +01:00
|
|
|
g_return_val_if_fail (!parent, FALSE);
|
device: check for a parent device
The device creation can be attempted if the name can be determined. It
alone is doesn't mean that there's a parent device -- the name could
just have been hardcoded in the connection.
NetworkManager[21519]: nm_device_get_ifindex: assertion 'NM_IS_DEVICE (self)' failed
Program received signal SIGTRAP, Trace/breakpoint trap.
g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
1046 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
(gdb) bt
#0 0x00007ffff4ec88c3 in g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
#1 0x00007ffff4ec8a3f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
#2 0x00005555555d2090 in nm_device_get_ifindex (self=0x0) at devices/nm-device.c:562
#3 0x00005555555ef77a in nm_device_supports_vlans (self=0x0) at devices/nm-device.c:9865
#4 0x00005555555bf2f9 in create_and_realize (device=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, out_plink=0x7fffffffd5f8, error=0x7fffffffd700) at devices/nm-device-vlan.c:225
#5 0x00005555555d5757 in nm_device_create_and_realize (self=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, error=0x7fffffffd700) at devices/nm-device.c:1783
#6 0x0000555555688601 in system_create_virtual_device (self=0x555555af51c0 [NMManager], connection=0x555555b451e0) at nm-manager.c:1120
#7 0x000055555568894e in connection_changed (settings=0x555555ae8220 [NMSettings], connection=0x555555b451e0, manager=0x555555af51c0 [NMManager]) at nm-manager.c:1172
#8 0x0000555555693448 in nm_manager_start (self=0x555555af51c0 [NMManager], error=0x7fffffffda30) at nm-manager.c:4466
#9 0x00005555555d166f in main (argc=1, argv=0x7fffffffdba8) at main.c:454
(gdb)
Fixes: 332994f1b19ded7cb343ef573443916bab05aaec
2016-04-19 12:02:02 +02:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
lnk.mode = setting_mode_to_platform (nm_setting_macvlan_get_mode (s_macvlan));
|
|
|
|
|
if (!lnk.mode) {
|
2016-04-19 11:59:48 +02:00
|
|
|
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
|
|
|
|
|
"unsupported MACVLAN mode %u in connection %s",
|
2015-10-01 11:06:42 +02:00
|
|
|
nm_setting_macvlan_get_mode (s_macvlan),
|
|
|
|
|
nm_connection_get_uuid (connection));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
lnk.no_promisc = !nm_setting_macvlan_get_promiscuous (s_macvlan);
|
|
|
|
|
lnk.tap = nm_setting_macvlan_get_tap (s_macvlan);
|
|
|
|
|
|
2017-04-18 12:09:02 +02:00
|
|
|
plerr = nm_platform_link_macvlan_add (nm_device_get_platform (device), iface, parent_ifindex, &lnk, out_plink);
|
2016-01-25 13:03:51 +01:00
|
|
|
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
|
2015-10-01 11:06:42 +02:00
|
|
|
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
|
|
|
|
|
"Failed to create %s interface '%s' for '%s': %s",
|
|
|
|
|
lnk.tap ? "macvtap" : "macvlan",
|
|
|
|
|
iface,
|
|
|
|
|
nm_connection_get_id (connection),
|
2017-08-21 19:18:45 +02:00
|
|
|
nm_platform_error_to_string_a (plerr));
|
2015-10-01 11:06:42 +02:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
static NMDeviceCapabilities
|
|
|
|
|
get_generic_capabilities (NMDevice *dev)
|
|
|
|
|
{
|
|
|
|
|
/* We assume MACVLAN interfaces always support carrier detect */
|
|
|
|
|
return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_IS_SOFTWARE;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
|
|
|
|
{
|
2017-01-02 09:27:20 +01:00
|
|
|
if (!nm_device_parent_get_device (device))
|
2015-10-01 11:06:42 +02:00
|
|
|
return FALSE;
|
|
|
|
|
return NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->is_available (device, flags);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static gboolean
|
|
|
|
|
check_connection_compatible (NMDevice *device, NMConnection *connection)
|
|
|
|
|
{
|
2016-09-29 13:49:01 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE ((NMDeviceMacvlan *) device);
|
2015-10-01 11:06:42 +02:00
|
|
|
NMSettingMacvlan *s_macvlan;
|
2016-02-16 16:50:00 +01:00
|
|
|
const char *parent = NULL;
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
if (!NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->check_connection_compatible (device, connection))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
|
|
|
|
if (!s_macvlan)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (nm_setting_macvlan_get_tap (s_macvlan) != priv->props.tap)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Before the device is realized some properties will not be set */
|
|
|
|
|
if (nm_device_is_real (device)) {
|
|
|
|
|
|
|
|
|
|
if (setting_mode_to_platform (nm_setting_macvlan_get_mode (s_macvlan)) != priv->props.mode)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (nm_setting_macvlan_get_promiscuous (s_macvlan) == priv->props.no_promisc)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Check parent interface; could be an interface name or a UUID */
|
|
|
|
|
parent = nm_setting_macvlan_get_parent (s_macvlan);
|
|
|
|
|
if (parent) {
|
2017-09-27 09:40:45 +02:00
|
|
|
if (!nm_device_match_parent (device, parent))
|
2015-10-01 11:06:42 +02:00
|
|
|
return FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
/* Parent could be a MAC address in an NMSettingWired */
|
2017-09-27 09:47:22 +02:00
|
|
|
if (!nm_device_match_hwaddr (device, connection, TRUE))
|
2015-10-01 11:06:42 +02:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
complete_connection (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
const GSList *existing_connections,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
NMSettingMacvlan *s_macvlan;
|
|
|
|
|
|
2017-04-18 12:09:02 +02:00
|
|
|
nm_utils_complete_generic (nm_device_get_platform (device),
|
2016-03-08 13:57:20 +01:00
|
|
|
connection,
|
2015-10-01 11:06:42 +02:00
|
|
|
NM_SETTING_MACVLAN_SETTING_NAME,
|
|
|
|
|
existing_connections,
|
|
|
|
|
NULL,
|
|
|
|
|
_("MACVLAN connection"),
|
|
|
|
|
NULL,
|
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
|
|
|
|
if (!s_macvlan) {
|
|
|
|
|
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
|
|
|
|
|
"A 'macvlan' setting is required.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If there's no MACVLAN interface, no parent, and no hardware address in the
|
|
|
|
|
* settings, then there's not enough information to complete the setting.
|
|
|
|
|
*/
|
|
|
|
|
if ( !nm_setting_macvlan_get_parent (s_macvlan)
|
2017-09-27 09:47:22 +02:00
|
|
|
&& !nm_device_match_hwaddr (device, connection, TRUE)) {
|
2015-10-01 11:06:42 +02:00
|
|
|
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
|
|
|
|
|
"The 'macvlan' setting had no interface name, parent, or hardware address.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
static void
|
2015-10-01 11:06:42 +02:00
|
|
|
update_connection (NMDevice *device, NMConnection *connection)
|
2013-05-06 09:16:17 -04:00
|
|
|
{
|
2016-09-29 13:49:01 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE ((NMDeviceMacvlan *) device);
|
2015-10-01 11:06:42 +02:00
|
|
|
NMSettingMacvlan *s_macvlan = nm_connection_get_setting_macvlan (connection);
|
2017-01-02 09:27:20 +01:00
|
|
|
NMDevice *parent_device;
|
2015-10-01 11:06:42 +02:00
|
|
|
const char *setting_parent, *new_parent;
|
|
|
|
|
int new_mode;
|
|
|
|
|
|
|
|
|
|
if (!s_macvlan) {
|
|
|
|
|
s_macvlan = (NMSettingMacvlan *) nm_setting_macvlan_new ();
|
|
|
|
|
nm_connection_add_setting (connection, (NMSetting *) s_macvlan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new_mode = platform_mode_to_setting (priv->props.mode);
|
|
|
|
|
if (new_mode != nm_setting_macvlan_get_mode (s_macvlan))
|
|
|
|
|
g_object_set (s_macvlan, NM_SETTING_MACVLAN_MODE, new_mode, NULL);
|
|
|
|
|
|
|
|
|
|
if (priv->props.no_promisc == nm_setting_macvlan_get_promiscuous (s_macvlan))
|
|
|
|
|
g_object_set (s_macvlan, NM_SETTING_MACVLAN_PROMISCUOUS, !priv->props.no_promisc, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (priv->props.tap != nm_setting_macvlan_get_tap (s_macvlan))
|
|
|
|
|
g_object_set (s_macvlan, NM_SETTING_MACVLAN_TAP, !!priv->props.tap, NULL);
|
|
|
|
|
|
|
|
|
|
/* Update parent in the connection; default to parent's interface name */
|
2017-01-02 09:27:20 +01:00
|
|
|
parent_device = nm_device_parent_get_device (device);
|
|
|
|
|
if (parent_device) {
|
|
|
|
|
new_parent = nm_device_get_iface (parent_device);
|
2015-10-01 11:06:42 +02:00
|
|
|
setting_parent = nm_setting_macvlan_get_parent (s_macvlan);
|
|
|
|
|
if (setting_parent && nm_utils_is_uuid (setting_parent)) {
|
|
|
|
|
NMConnection *parent_connection;
|
|
|
|
|
|
|
|
|
|
/* Don't change a parent specified by UUID if it's still valid */
|
2016-05-16 19:01:37 +02:00
|
|
|
parent_connection = (NMConnection *) nm_settings_get_connection_by_uuid (nm_device_get_settings (device), setting_parent);
|
2017-01-02 09:27:20 +01:00
|
|
|
if (parent_connection && nm_device_check_connection_compatible (parent_device, parent_connection))
|
2015-10-01 11:06:42 +02:00
|
|
|
new_parent = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (new_parent)
|
|
|
|
|
g_object_set (s_macvlan, NM_SETTING_MACVLAN_PARENT, new_parent, NULL);
|
|
|
|
|
} else
|
|
|
|
|
g_object_set (s_macvlan, NM_SETTING_MACVLAN_PARENT, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static NMActStageReturn
|
2017-02-22 17:04:00 +01:00
|
|
|
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
|
2015-10-01 11:06:42 +02:00
|
|
|
{
|
|
|
|
|
NMActStageReturn ret;
|
|
|
|
|
|
2017-02-22 17:04:00 +01:00
|
|
|
ret = NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->act_stage1_prepare (dev, out_failure_reason);
|
2015-10-01 11:06:42 +02:00
|
|
|
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
|
|
|
|
return ret;
|
|
|
|
|
|
2016-06-18 19:14:33 +02:00
|
|
|
if (!nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE))
|
|
|
|
|
return NM_ACT_STAGE_RETURN_FAILURE;
|
|
|
|
|
return NM_ACT_STAGE_RETURN_SUCCESS;
|
2013-05-06 09:16:17 -04:00
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-10-01 11:06:42 +02:00
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
2016-09-29 13:49:01 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE ((NMDeviceMacvlan *) object);
|
2013-05-06 09:16:17 -04:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_MODE:
|
2015-10-01 11:06:42 +02:00
|
|
|
g_value_set_string (value, platform_mode_to_string (priv->props.mode));
|
2013-05-06 09:16:17 -04:00
|
|
|
break;
|
|
|
|
|
case PROP_NO_PROMISC:
|
|
|
|
|
g_value_set_boolean (value, priv->props.no_promisc);
|
|
|
|
|
break;
|
2015-10-01 11:06:42 +02:00
|
|
|
case PROP_TAP:
|
|
|
|
|
g_value_set_boolean (value, priv->props.tap);
|
|
|
|
|
break;
|
2013-05-06 09:16:17 -04:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
2016-09-29 13:49:01 +02:00
|
|
|
const GValue *value, GParamSpec *pspec)
|
2015-10-01 11:06:42 +02:00
|
|
|
{
|
2016-09-29 13:49:01 +02:00
|
|
|
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE ((NMDeviceMacvlan *) object);
|
2015-10-01 11:06:42 +02:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_TAP:
|
|
|
|
|
priv->props.tap = g_value_get_boolean (value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_macvlan_init (NMDeviceMacvlan *self)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
static void
|
|
|
|
|
nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
|
|
|
|
|
2014-10-09 12:42:29 -05:00
|
|
|
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP)
|
|
|
|
|
|
2013-05-06 09:16:17 -04:00
|
|
|
object_class->get_property = get_property;
|
2015-10-01 11:06:42 +02:00
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
|
|
|
|
|
device_class->act_stage1_prepare = act_stage1_prepare;
|
|
|
|
|
device_class->check_connection_compatible = check_connection_compatible;
|
|
|
|
|
device_class->complete_connection = complete_connection;
|
|
|
|
|
device_class->connection_type = NM_SETTING_MACVLAN_SETTING_NAME;
|
|
|
|
|
device_class->create_and_realize = create_and_realize;
|
|
|
|
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
2017-01-14 17:04:17 +01:00
|
|
|
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
2015-10-01 11:06:42 +02:00
|
|
|
device_class->is_available = is_available;
|
2013-05-06 09:16:17 -04:00
|
|
|
device_class->link_changed = link_changed;
|
2017-01-02 09:27:20 +01:00
|
|
|
device_class->parent_changed_notify = parent_changed_notify;
|
2015-10-01 11:06:42 +02:00
|
|
|
device_class->update_connection = update_connection;
|
2013-05-06 09:16:17 -04:00
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
obj_properties[PROP_MODE] =
|
|
|
|
|
g_param_spec_string (NM_DEVICE_MACVLAN_MODE, "", "",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READABLE |
|
|
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
|
|
obj_properties[PROP_NO_PROMISC] =
|
|
|
|
|
g_param_spec_boolean (NM_DEVICE_MACVLAN_NO_PROMISC, "", "",
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READABLE |
|
|
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
|
|
obj_properties[PROP_TAP] =
|
|
|
|
|
g_param_spec_boolean (NM_DEVICE_MACVLAN_TAP, "", "",
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
2015-10-01 11:06:42 +02:00
|
|
|
|
2015-04-13 13:31:42 -04:00
|
|
|
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
2015-04-15 14:53:30 -04:00
|
|
|
NMDBUS_TYPE_DEVICE_MACVLAN_SKELETON,
|
|
|
|
|
NULL);
|
2013-05-06 09:16:17 -04:00
|
|
|
}
|
2014-09-08 11:11:19 -05:00
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2014-09-08 11:11:19 -05:00
|
|
|
|
2016-10-07 17:00:59 +02:00
|
|
|
#define NM_TYPE_MACVLAN_DEVICE_FACTORY (nm_macvlan_device_factory_get_type ())
|
|
|
|
|
#define NM_MACVLAN_DEVICE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MACVLAN_DEVICE_FACTORY, NMMacvlanDeviceFactory))
|
2014-09-08 11:11:19 -05:00
|
|
|
|
|
|
|
|
static NMDevice *
|
2014-09-05 08:50:02 -05:00
|
|
|
create_device (NMDeviceFactory *factory,
|
|
|
|
|
const char *iface,
|
2016-01-10 15:13:20 +01:00
|
|
|
const NMPlatformLink *plink,
|
2014-09-05 08:50:02 -05:00
|
|
|
NMConnection *connection,
|
|
|
|
|
gboolean *out_ignore)
|
2014-09-08 11:11:19 -05:00
|
|
|
{
|
2015-10-01 11:06:42 +02:00
|
|
|
NMSettingMacvlan *s_macvlan;
|
|
|
|
|
NMLinkType link_type;
|
|
|
|
|
gboolean tap;
|
|
|
|
|
|
|
|
|
|
if (connection) {
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
|
|
|
|
g_assert (s_macvlan);
|
|
|
|
|
tap = nm_setting_macvlan_get_tap (s_macvlan);
|
|
|
|
|
} else {
|
|
|
|
|
g_assert (plink);
|
|
|
|
|
tap = plink->type == NM_LINK_TYPE_MACVTAP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
link_type = tap ? NM_LINK_TYPE_MACVTAP : NM_LINK_TYPE_MACVLAN;
|
2015-12-08 14:51:12 +01:00
|
|
|
|
2014-09-17 14:17:30 -05:00
|
|
|
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_MACVLAN,
|
2014-09-05 08:50:02 -05:00
|
|
|
NM_DEVICE_IFACE, iface,
|
2014-09-17 14:17:30 -05:00
|
|
|
NM_DEVICE_TYPE_DESC, "Macvlan",
|
2015-10-01 11:06:42 +02:00
|
|
|
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_MACVLAN,
|
|
|
|
|
NM_DEVICE_LINK_TYPE, link_type,
|
|
|
|
|
NM_DEVICE_MACVLAN_TAP, tap,
|
2014-09-17 14:17:30 -05:00
|
|
|
NULL);
|
2014-09-08 11:11:19 -05:00
|
|
|
}
|
|
|
|
|
|
2015-10-01 11:06:42 +02:00
|
|
|
static const char *
|
|
|
|
|
get_connection_parent (NMDeviceFactory *factory, NMConnection *connection)
|
|
|
|
|
{
|
|
|
|
|
NMSettingMacvlan *s_macvlan;
|
|
|
|
|
NMSettingWired *s_wired;
|
|
|
|
|
const char *parent = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_MACVLAN_SETTING_NAME), NULL);
|
|
|
|
|
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
|
|
|
|
g_assert (s_macvlan);
|
|
|
|
|
|
|
|
|
|
parent = nm_setting_macvlan_get_parent (s_macvlan);
|
|
|
|
|
if (parent)
|
|
|
|
|
return parent;
|
|
|
|
|
|
|
|
|
|
/* Try the hardware address from the MACVLAN connection's hardware setting */
|
|
|
|
|
s_wired = nm_connection_get_setting_wired (connection);
|
|
|
|
|
if (s_wired)
|
|
|
|
|
return nm_setting_wired_get_mac_address (s_wired);
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *
|
2016-02-17 15:11:02 +01:00
|
|
|
get_connection_iface (NMDeviceFactory *factory,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
const char *parent_iface)
|
2015-10-01 11:06:42 +02:00
|
|
|
{
|
|
|
|
|
NMSettingMacvlan *s_macvlan;
|
|
|
|
|
const char *ifname;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_MACVLAN_SETTING_NAME), NULL);
|
|
|
|
|
|
|
|
|
|
s_macvlan = nm_connection_get_setting_macvlan (connection);
|
|
|
|
|
g_assert (s_macvlan);
|
|
|
|
|
|
|
|
|
|
if (!parent_iface)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
ifname = nm_connection_get_interface_name (connection);
|
|
|
|
|
return g_strdup (ifname);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-17 14:17:30 -05:00
|
|
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL (MACVLAN, Macvlan, macvlan,
|
2015-10-01 11:06:42 +02:00
|
|
|
NM_DEVICE_FACTORY_DECLARE_LINK_TYPES (NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP)
|
|
|
|
|
NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_MACVLAN_SETTING_NAME),
|
2016-10-07 16:05:43 +02:00
|
|
|
factory_class->create_device = create_device;
|
|
|
|
|
factory_class->get_connection_parent = get_connection_parent;
|
|
|
|
|
factory_class->get_connection_iface = get_connection_iface;
|
2016-09-29 13:49:01 +02:00
|
|
|
);
|