From 6f28f4b661e8938c42951a8135bc0d6710978dfb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 18 Nov 2018 11:48:44 +0100 Subject: [PATCH] manager: allow add-and-activate option "bind" with non-volatile profiles For one, there was a bug here: we cannot "goto error" without setting the @error variable. Anyway, restricting "bind" "dbus-client" only to profiles that are "persist" mode "volatile" seems wrong. The "bind" option as it is, limits the lifetime of the active-connection. This has no direct relation with the lifetime of the setting-connection. Indeed, if the settings-connection's lifetime is itself set to "volatile", then it will indeed go away with the active-connection. However, these two concepts are not strictly related. In the future, we might add an option to limite the lifetime of a settings-connection to a D-Bus client ("bind-setting"). Possibly we should thus rename "bind" to "bind-activation", to make the distinction clearer. --- introspection/org.freedesktop.NetworkManager.xml | 2 +- src/nm-manager.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/introspection/org.freedesktop.NetworkManager.xml b/introspection/org.freedesktop.NetworkManager.xml index 715e182eda..f78a989a4b 100644 --- a/introspection/org.freedesktop.NetworkManager.xml +++ b/introspection/org.freedesktop.NetworkManager.xml @@ -129,7 +129,7 @@ parameters. At this time the following options are supported: * persist: A string value of either "disk" (default), "memory" or "volatile". If "memory" is passed, the connection will not be saved to disk. If "volatile" is passed, the connection will not be saved to disk and will be destroyed when disconnected. - * bind: Bind the connections lifetime. Set to "dbus-name" to automatically disconnect when the requesting process disappears from the bus. The default of "none" means the connection is kept alive normally. If restricted, then persist must be set to "volatile". + * bind: Bind the activation lifetime. Set to "dbus-name" to automatically disconnect when the requesting process disappears from the bus. The default of "none" means the connection is kept activated normally. --> diff --git a/src/nm-manager.c b/src/nm-manager.c index e5a0964192..e7ea86ffa1 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -5364,12 +5364,8 @@ impl_manager_add_and_activate_connection (NMDBusObject *obj, if (!active) goto error; - if (g_strcmp0 (bind_lifetime, "dbus-client") == 0) { - if (persist != NM_SETTINGS_CONNECTION_PERSIST_MODE_VOLATILE_ONLY) - goto error; - + if (g_strcmp0 (bind_lifetime, "dbus-client") == 0) nm_active_connection_bind_dbus_client (active, dbus_connection, sender); - } nm_active_connection_authorize (active, incompl_conn,