diff options
| author | Michael Biebl <biebl@debian.org> | 2018-02-07 02:39:23 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-02-07 02:39:23 +0100 |
| commit | 50f6b47074e01dffb8dc536c0a20961dcf28ae9b (patch) | |
| tree | b4bd771d78ebe38661b8c4ec8b9a8e0eb8261eb5 /src/settings | |
| parent | afcd268ea7b1149fbfb66bce4eca659b675da0a2 (diff) | |
New upstream version 1.10.4 upstream/1.10.4
Diffstat (limited to 'src/settings')
| -rw-r--r-- | src/settings/nm-settings-connection.c | 24 | ||||
| -rw-r--r-- | src/settings/nm-settings-connection.h | 7 | ||||
| -rw-r--r-- | src/settings/nm-settings.c | 17 | ||||
| -rw-r--r-- | src/settings/plugins/ibft/nms-ibft-connection.c | 2 | ||||
| -rw-r--r-- | src/settings/plugins/ifcfg-rh/nm-inotify-helper.c | 13 | ||||
| -rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c | 2 | ||||
| -rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 6 | ||||
| -rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 17 | ||||
| -rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 6 | ||||
| -rw-r--r-- | src/settings/plugins/ifnet/nms-ifnet-connection.c | 2 | ||||
| -rw-r--r-- | src/settings/plugins/ifnet/nms-ifnet-plugin.c | 6 | ||||
| -rw-r--r-- | src/settings/plugins/keyfile/nms-keyfile-connection.c | 2 | ||||
| -rw-r--r-- | src/settings/plugins/keyfile/nms-keyfile-plugin.c | 4 |
13 files changed, 67 insertions, 41 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index b6e89404..37a0b3a6 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -517,6 +517,7 @@ set_persist_mode (NMSettingsConnection *self, NMSettingsConnectionPersistMode pe TRUE); return; case NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP: + case NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED: /* Nothing to do */ return; } @@ -793,7 +794,7 @@ nm_settings_connection_delete (NMSettingsConnection *self, /* Remove connection from seen-bssids database file */ remove_entry_from_db (self, "seen-bssids"); - nm_settings_connection_signal_remove (self, FALSE); + nm_settings_connection_signal_remove (self); return TRUE; } @@ -2187,15 +2188,24 @@ impl_settings_connection_clear_secrets (NMSettingsConnection *self, /*****************************************************************************/ void -nm_settings_connection_signal_remove (NMSettingsConnection *self, gboolean allow_reuse) +nm_settings_connection_added (NMSettingsConnection *self) { NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self); - if (!allow_reuse) { - if (priv->removed) - g_return_if_reached (); - priv->removed = TRUE; - } + /* FIXME: we should always dispose connections that are removed + * and not reuse them, but currently plugins keep alive unmanaged + * (e.g. NM_CONTROLLED=no) connections. */ + priv->removed = FALSE; +} + +void +nm_settings_connection_signal_remove (NMSettingsConnection *self) +{ + NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self); + + if (priv->removed) + return; + priv->removed = TRUE; g_signal_emit_by_name (self, NM_SETTINGS_CONNECTION_REMOVED); } diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index fc8ad1de..29ec05dd 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -137,6 +137,9 @@ gboolean nm_settings_connection_has_unmodified_applied_connection (NMSettingsCon typedef enum { NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + + /* like KEEP, but always clears the UNSAVED flag */ + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, /* unsaved, only sets the unsaved flag, but it doesn't touch @@ -190,7 +193,9 @@ void nm_settings_connection_recheck_visibility (NMSettingsConnection *self); gboolean nm_settings_connection_check_permission (NMSettingsConnection *self, const char *permission); -void nm_settings_connection_signal_remove (NMSettingsConnection *self, gboolean allow_reuse); +void nm_settings_connection_added (NMSettingsConnection *self); + +void nm_settings_connection_signal_remove (NMSettingsConnection *self); gboolean nm_settings_connection_get_unsaved (NMSettingsConnection *self); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 21fdf9e0..51b7bea7 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -89,21 +89,6 @@ EXPORT(nm_settings_connection_update) /*****************************************************************************/ static NM_CACHED_QUARK_FCN ("plugin-module-path", plugin_module_path_quark) - -#if (defined(HOSTNAME_PERSIST_SUSE) + defined(HOSTNAME_PERSIST_SLACKWARE) + defined(HOSTNAME_PERSIST_GENTOO)) > 1 -#error "Can only define one of HOSTNAME_PERSIST_*" -#endif - -#if defined(HOSTNAME_PERSIST_SUSE) -#define HOSTNAME_FILE HOSTNAME_FILE_UCASE_HOSTNAME -#elif defined(HOSTNAME_PERSIST_SLACKWARE) -#define HOSTNAME_FILE HOSTNAME_FILE_UCASE_HOSTNAME -#elif defined(HOSTNAME_PERSIST_GENTOO) -#define HOSTNAME_FILE HOSTNAME_FILE_GENTOO -#else -#define HOSTNAME_FILE HOSTNAME_FILE_DEFAULT -#endif - static NM_CACHED_QUARK_FCN ("default-wired-connection", _default_wired_connection_quark) static NM_CACHED_QUARK_FCN ("default-wired-device", _default_wired_device_quark) @@ -1004,6 +989,8 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) /* Exported D-Bus signal */ g_signal_emit (self, signals[NEW_CONNECTION], 0, connection); } + + nm_settings_connection_added (connection); } static gboolean diff --git a/src/settings/plugins/ibft/nms-ibft-connection.c b/src/settings/plugins/ibft/nms-ibft-connection.c index 2a7c5f4a..fb7f18f8 100644 --- a/src/settings/plugins/ibft/nms-ibft-connection.c +++ b/src/settings/plugins/ibft/nms-ibft-connection.c @@ -62,7 +62,7 @@ nms_ibft_connection_new (const GPtrArray *block, GError **error) /* Update settings with what was read from iscsiadm */ if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (object), source, - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, NULL, error)) 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)); } } diff --git a/src/settings/plugins/ifnet/nms-ifnet-connection.c b/src/settings/plugins/ifnet/nms-ifnet-connection.c index e7cd19cd..ce0b3f2b 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nms-ifnet-connection.c @@ -190,7 +190,7 @@ nm_ifnet_connection_new (NMConnection *source, const char *conn_name) tmp, update_unsaved ? NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED - : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, NULL, NULL)) { diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c index 38d23f30..8332358f 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c +++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c @@ -262,7 +262,7 @@ reload_connections (NMSettingsPlugin *config) NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS)) { nm_log_info (LOGD_SETTINGS, "Auto refreshing %s", conn_name); - nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (old), FALSE); + nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (old)); track_new_connection (self, new); if (is_managed_plugin () && is_managed (conn_name)) g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, new); @@ -271,7 +271,7 @@ reload_connections (NMSettingsPlugin *config) /* Update existing connection with new settings */ if (!nm_settings_connection_update (NM_SETTINGS_CONNECTION (old), NM_CONNECTION (new), - NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, "ifnet-update", &error)) { @@ -305,7 +305,7 @@ reload_connections (NMSettingsPlugin *config) */ if ( nm_ifnet_connection_get_conn_name (NM_IFNET_CONNECTION (candidate)) && !g_hash_table_lookup (new_connections, uuid)) { - nm_settings_connection_signal_remove (candidate, FALSE); + nm_settings_connection_signal_remove (candidate); g_hash_table_iter_remove (&iter); } } diff --git a/src/settings/plugins/keyfile/nms-keyfile-connection.c b/src/settings/plugins/keyfile/nms-keyfile-connection.c index 5a6d8a76..5f72a9fa 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nms-keyfile-connection.c @@ -163,7 +163,7 @@ nms_keyfile_connection_new (NMConnection *source, tmp, update_unsaved ? NM_SETTINGS_CONNECTION_PERSIST_MODE_UNSAVED - : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP, + : NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP_SAVED, NM_SETTINGS_CONNECTION_COMMIT_REASON_NONE, NULL, error)) { diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c index bc64b3ca..cb5f2c9f 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c +++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c @@ -107,7 +107,7 @@ remove_connection (NMSKeyfilePlugin *self, NMSKeyfileConnection *connection) g_signal_handlers_disconnect_by_func (connection, connection_removed_cb, self); removed = g_hash_table_remove (NMS_KEYFILE_PLUGIN_GET_PRIVATE (self)->connections, nm_connection_get_uuid (NM_CONNECTION (connection))); - nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection), FALSE); + nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection)); g_object_unref (connection); g_return_if_fail (removed); @@ -260,7 +260,7 @@ update_connection (NMSKeyfilePlugin *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, "keyfile-update", &local)) { |