From eaa55f7a0f0481dd3dcf934a916b23bc09cd3450 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 6 Mar 2017 18:52:15 +0100 Subject: bridge wip --- src/devices/nm-device-bridge.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 0ff6e634c1..4d5d145832 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -418,6 +418,56 @@ create_and_realize (NMDevice *device, return TRUE; } +static gboolean +can_reapply_change (NMDevice *device, + const char *setting_name, + NMSetting *s_old, + NMSetting *s_new, + GHashTable *diffs, + GError **error) +{ + NMDeviceClass *device_class; + + /* Only handle bridge setting here, delegate other settings to parent class */ + if (nm_streq (setting_name, NM_SETTING_BRIDGE_SETTING_NAME)) { + return nm_device_hash_check_invalid_keys (diffs, + NM_SETTING_BRIDGE_SETTING_NAME, + error, + NM_SETTING_BRIDGE_STP, + NM_SETTING_BRIDGE_PRIORITY, + NM_SETTING_BRIDGE_FORWARD_DELAY, + NM_SETTING_BRIDGE_HELLO_TIME, + NM_SETTING_BRIDGE_MAX_AGE, + NM_SETTING_BRIDGE_AGEING_TIME, + NM_SETTING_BRIDGE_MULTICAST_SNOOPING); + } + + device_class = NM_DEVICE_CLASS (nm_device_bridge_parent_class); + return device_class->can_reapply_change (device, + setting_name, + s_old, + s_new, + diffs, + error); +} + +static void +reapply_connection (NMDevice *device, NMConnection *con_old, NMConnection *con_new) +{ + NMDeviceBridge *self = NM_DEVICE_BRIDGE (device); + NMSettingBridge *s_bridge; + + NM_DEVICE_CLASS (nm_device_bridge_parent_class)->reapply_connection (device, + con_old, + con_new); + + _LOGD (LOGD_BRIDGE, "reapplying bridge settings"); + s_bridge = nm_connection_get_setting_bridge (con_new); + g_return_if_fail (s_bridge); + + commit_master_options (device, s_bridge); +} + /*****************************************************************************/ static void @@ -446,6 +496,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass) parent_class->enslave_slave = enslave_slave; parent_class->release_slave = release_slave; parent_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired; + parent_class->can_reapply_change = can_reapply_change; + parent_class->reapply_connection = reapply_connection; nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), NMDBUS_TYPE_DEVICE_BRIDGE_SKELETON, -- cgit v1.2.1