summary refs log tree commit diff
path: root/src/devices/team
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-09-23 10:10:27 +0200
committerMichael Biebl <biebl@debian.org>2018-09-23 10:10:27 +0200
commite126f3e804c35480c4f075777430419d6ece23da (patch)
tree5d5821ebcda8cd6ac34d2483bb3354910e508930 /src/devices/team
parentc240974325c552cad177c457d6ff04e381fd77a3 (diff)
New upstream version 1.12.4 upstream/1.12.4
Diffstat (limited to 'src/devices/team')
-rw-r--r--src/devices/team/meson.build6
-rw-r--r--src/devices/team/nm-device-team.c75
2 files changed, 48 insertions, 33 deletions
diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build
index 0f0763bd..159c182a 100644
--- a/src/devices/team/meson.build
+++ b/src/devices/team/meson.build
@@ -21,10 +21,10 @@ libnm_device_plugin_team = shared_module(
 
 core_plugins += libnm_device_plugin_team
 
-test(
+run_target(
   'check-local-devices-team',
-  check_exports,
-  args: [libnm_device_plugin_team.full_path(), linker_script_devices],
+  command: [check_exports, libnm_device_plugin_team.full_path(), linker_script_devices],
+  depends: libnm_device_plugin_team
 )
 
 # FIXME: check_so_symbols replacement
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index 899932fd..f83ba22b 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -1,6 +1,8 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* NetworkManager -- Network link manager
  *
+ * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us>
+ *
  * 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
@@ -14,9 +16,6 @@
  * 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 (C) 2013 Jiri Pirko <jiri@resnulli.us>
- * Copyright (C) 2018 Red Hat, Inc.
  */
 
 #include "nm-default.h"
@@ -85,6 +84,23 @@ get_generic_capabilities (NMDevice *device)
 }
 
 static gboolean
+check_connection_compatible (NMDevice *device, NMConnection *connection)
+{
+	NMSettingTeam *s_team;
+
+	if (!NM_DEVICE_CLASS (nm_device_team_parent_class)->check_connection_compatible (device, connection))
+		return FALSE;
+
+	s_team = nm_connection_get_setting_team (connection);
+	if (!s_team || !nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME))
+		return FALSE;
+
+	/* FIXME: match team properties like mode, etc? */
+
+	return TRUE;
+}
+
+static gboolean
 complete_connection (NMDevice *device,
                      NMConnection *connection,
                      const char *specific_object,
@@ -351,8 +367,8 @@ teamd_timeout_cb (gpointer user_data)
 
 static void
 teamd_dbus_appeared (GDBusConnection *connection,
-                     const char *name,
-                     const char *name_owner,
+                     const gchar *name,
+                     const gchar *name_owner,
                      gpointer user_data)
 {
 	NMDeviceTeam *self = NM_DEVICE_TEAM (user_data);
@@ -414,7 +430,7 @@ teamd_dbus_appeared (GDBusConnection *connection,
 
 static void
 teamd_dbus_vanished (GDBusConnection *dbus_connection,
-                     const char *name,
+                     const gchar *name,
                      gpointer user_data)
 {
 	NMDeviceTeam *self = NM_DEVICE_TEAM (user_data);
@@ -447,7 +463,7 @@ teamd_dbus_vanished (GDBusConnection *dbus_connection,
 }
 
 static void
-teamd_process_watch_cb (GPid pid, int status, gpointer user_data)
+teamd_process_watch_cb (GPid pid, gint status, gpointer user_data)
 {
 	NMDeviceTeam *self = NM_DEVICE_TEAM (user_data);
 	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
@@ -500,7 +516,7 @@ teamd_kill (NMDeviceTeam *self, const char *teamd_binary, GError **error)
 	g_ptr_array_add (argv, (gpointer) nm_device_get_iface (NM_DEVICE (self)));
 	g_ptr_array_add (argv, NULL);
 
-	_LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (char **) argv->pdata)));
+	_LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (gchar **) argv->pdata)));
 	return g_spawn_sync ("/", (char **) argv->pdata, NULL, 0, teamd_child_setup, NULL, NULL, NULL, NULL, error);
 }
 
@@ -588,7 +604,7 @@ teamd_start (NMDevice *device, NMConnection *connection)
 		g_ptr_array_add (argv, (gpointer) "-gg");
 	g_ptr_array_add (argv, NULL);
 
-	_LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (char **) argv->pdata)));
+	_LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (gchar **) argv->pdata)));
 	if (!g_spawn_async ("/", (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
 	                    teamd_child_setup, NULL, &priv->teamd_pid, &error)) {
 		_LOGW (LOGD_TEAM, "Activation: (team) failed to start teamd: %s", error->message);
@@ -687,7 +703,7 @@ enslave_slave (NMDevice *device,
 {
 	NMDeviceTeam *self = NM_DEVICE_TEAM (device);
 	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
-	gboolean success = TRUE;
+	gboolean success = TRUE, no_firmware = FALSE;
 	const char *slave_iface = nm_device_get_ip_iface (slave);
 	NMSettingTeamPort *s_team_port;
 
@@ -722,7 +738,7 @@ enslave_slave (NMDevice *device,
 		success = nm_platform_link_enslave (nm_device_get_platform (device),
 		                                    nm_device_get_ip_ifindex (device),
 		                                    nm_device_get_ip_ifindex (slave));
-		nm_device_bring_up (slave, TRUE, NULL);
+		nm_device_bring_up (slave, TRUE, &no_firmware);
 
 		if (!success)
 			return FALSE;
@@ -746,7 +762,7 @@ release_slave (NMDevice *device,
 {
 	NMDeviceTeam *self = NM_DEVICE_TEAM (device);
 	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
-	gboolean success;
+	gboolean success, no_firmware = FALSE;
 
 	if (configure) {
 		success = nm_platform_link_release (nm_device_get_platform (device),
@@ -762,7 +778,7 @@ release_slave (NMDevice *device,
 		 * IFF_UP), so we must bring it back up here to ensure carrier changes and
 		 * other state is noticed by the now-released port.
 		 */
-		if (!nm_device_bring_up (slave, TRUE, NULL))
+		if (!nm_device_bring_up (slave, TRUE, &no_firmware))
 			_LOGW (LOGD_TEAM, "released team port %s could not be brought up",
 			       nm_device_get_ip_iface (slave));
 
@@ -894,7 +910,9 @@ nm_device_team_class_init (NMDeviceTeamClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
-	NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
+	NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
+
+	NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_TEAM_SETTING_NAME, NM_LINK_TYPE_TEAM)
 
 	object_class->constructed = constructed;
 	object_class->dispose = dispose;
@@ -902,22 +920,19 @@ nm_device_team_class_init (NMDeviceTeamClass *klass)
 
 	dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_team);
 
-	device_class->connection_type_supported = NM_SETTING_TEAM_SETTING_NAME;
-	device_class->connection_type_check_compatible = NM_SETTING_TEAM_SETTING_NAME;
-	device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_TEAM);
-
-	device_class->is_master = TRUE;
-	device_class->create_and_realize = create_and_realize;
-	device_class->get_generic_capabilities = get_generic_capabilities;
-	device_class->complete_connection = complete_connection;
-	device_class->update_connection = update_connection;
-	device_class->master_update_slave_connection = master_update_slave_connection;
-
-	device_class->act_stage1_prepare = act_stage1_prepare;
-	device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
-	device_class->deactivate = deactivate;
-	device_class->enslave_slave = enslave_slave;
-	device_class->release_slave = release_slave;
+	parent_class->is_master = TRUE;
+	parent_class->create_and_realize = create_and_realize;
+	parent_class->get_generic_capabilities = get_generic_capabilities;
+	parent_class->check_connection_compatible = check_connection_compatible;
+	parent_class->complete_connection = complete_connection;
+	parent_class->update_connection = update_connection;
+	parent_class->master_update_slave_connection = master_update_slave_connection;
+
+	parent_class->act_stage1_prepare = act_stage1_prepare;
+	parent_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
+	parent_class->deactivate = deactivate;
+	parent_class->enslave_slave = enslave_slave;
+	parent_class->release_slave = release_slave;
 
 	obj_properties[PROP_CONFIG] =
 	    g_param_spec_string (NM_DEVICE_TEAM_CONFIG, "", "",