diff options
| author | Michael Biebl <biebl@debian.org> | 2018-02-07 02:40:03 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-02-07 02:40:03 +0100 |
| commit | 77dfac263f463c1cdb8afb9b8c79a4e83bf08cd8 (patch) | |
| tree | e5288440b22e159a601450c2e5d40b013bdb4aa0 /src/settings/plugins/ifcfg-rh | |
| parent | 3d9525cb641ac53c6d36bf5312710c22ae4bd926 (diff) | |
| parent | 50f6b47074e01dffb8dc536c0a20961dcf28ae9b (diff) | |
Update upstream source from tag 'upstream/1.10.4'
Update to upstream version '1.10.4' with Debian dir d2c0f877c591b3125f4e0cfcc711c04669d8d62b
Diffstat (limited to 'src/settings/plugins/ifcfg-rh')
5 files changed, 34 insertions, 10 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c index 4c65b02d..97417db9 100644 --- a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c +++ b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Red Hat, Inc. + * (C) Copyright 2008 - 2017 Red Hat, Inc. */ #include "nm-default.h" @@ -44,6 +44,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { int ifd; + guint inotify_id; GHashTable *wd_refs; } NMInotifyHelperPrivate; @@ -142,7 +143,6 @@ init_inotify (NMInotifyHelper *self) { NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE (self); GIOChannel *channel; - guint source_id; priv->ifd = inotify_init1 (IN_CLOEXEC); if (priv->ifd == -1) { @@ -157,10 +157,10 @@ init_inotify (NMInotifyHelper *self) g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); g_io_channel_set_encoding (channel, NULL, NULL); - source_id = g_io_add_watch (channel, - G_IO_IN | G_IO_ERR, - (GIOFunc) inotify_event_handler, - (gpointer) self); + priv->inotify_id = g_io_add_watch (channel, + G_IO_IN | G_IO_ERR, + (GIOFunc) inotify_event_handler, + (gpointer) self); g_io_channel_unref (channel); return TRUE; } @@ -188,6 +188,7 @@ finalize (GObject *object) { NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE ((NMInotifyHelper *) object); + nm_clear_g_source (&priv->inotify_id); nm_close (priv->ifd); g_hash_table_destroy (priv->wd_refs); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c index 3cf5c978..6979fdaa 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c @@ -442,7 +442,7 @@ nm_ifcfg_connection_new (NMConnection *source, if (nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), tmp, full_path - ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP /* connection is already on disk */ + ? NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED : NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, NULL, diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index 04e74bbd..0743fc9f 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -161,7 +161,7 @@ remove_connection (SettingsPluginIfcfg *self, NMIfcfgConnection *connection) g_object_ref (connection); g_hash_table_remove (priv->connections, nm_connection_get_uuid (NM_CONNECTION (connection))); if (!unmanaged && !unrecognized) - nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection), FALSE); + nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection)); g_object_unref (connection); /* Emit changes _after_ removing the connection */ @@ -315,7 +315,7 @@ update_connection (SettingsPluginIfcfg *self, if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (connection_by_uuid), NM_CONNECTION (connection_new), - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, "ifcfg-update", &local)) { @@ -331,7 +331,7 @@ update_connection (SettingsPluginIfcfg *self, /* Unexport the connection by telling the settings service it's * been removed. */ - nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection_by_uuid), TRUE); + nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection_by_uuid)); /* Remove the path so that claim_connection() doesn't complain later when * interface gets managed and connection is re-added. */ nm_connection_set_path (NM_CONNECTION (connection_by_uuid), NULL); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index b9900eec..bdd3ee0a 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -294,6 +294,23 @@ make_connection_setting (const char *file, check_if_team_slave (ifcfg, s_con); nm_clear_g_free (&value); + v = svGetValueStr (ifcfg, "OVS_PORT_UUID", &value); + if (!v) + v = svGetValueStr (ifcfg, "OVS_PORT", &value); + if (v) { + const char *old_value; + + if ((old_value = nm_setting_connection_get_master (s_con))) { + PARSE_WARNING ("Already configured as slave of %s. Ignoring OVS_PORT=\"%s\"", + old_value, v); + } else { + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, v, NULL); + g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE, + NM_SETTING_OVS_PORT_SETTING_NAME, NULL); + } + } + + nm_clear_g_free (&value); v = svGetValueStr (ifcfg, "GATEWAY_PING_TIMEOUT", &value); if (v) { gint64 tmp; diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 5cb8ee98..e9dd08b7 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1832,6 +1832,12 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_VLAN_SETTING_NAME)) svUnsetValue (ifcfg, "TYPE"); + } else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_OVS_PORT_SETTING_NAME)) { + svSetValueStr (ifcfg, "OVS_PORT_UUID", master); + svSetValueStr (ifcfg, "OVS_PORT", master_iface); + } else { + _LOGW ("don't know how to set master for a %s slave", + nm_setting_connection_get_slave_type (s_con)); } } |