summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-07-09 12:46:53 +0200
committerThomas Haller <thaller@redhat.com>2019-07-25 15:26:49 +0200
commit0aa323fb2887fc4b5decfb5360d7384bf774e6db (patch)
treedfb6902a740fdbc657d0b42ed8a6b745f3e005ce
parentdcdbe984065ed06753a0ce542c1aaaa9336d8424 (diff)
downloadNetworkManager-0aa323fb2887fc4b5decfb5360d7384bf774e6db.tar.gz
settings: add NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY to prevent runtime changes when updating connection profile
When modifying a connection profile that happens to be active on a device, then most of the changes don't take effect immediately. Only after a full re-activation or reapply (nmcli device reapply) does the configuration of the active device change (the "applied-connection"). With two execptions: "connection.zone" and "connection.metered" take effect immediately. I think this is historic, but also to facilitate firewall-cmd to modify a profile and change the zone right away. Anyway, I think it should be possible to modify a profile without changes to the runtime. Add a flag to prevent reapplying these properties right away. https://bugzilla.redhat.com/show_bug.cgi?id=1677070
-rw-r--r--libnm-core/nm-dbus-interface.h8
-rw-r--r--src/settings/nm-settings-connection.c11
-rw-r--r--src/settings/nm-settings-connection.h5
3 files changed, 19 insertions, 5 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index c68c7757b2..42c3319025 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -1039,6 +1039,13 @@ typedef enum { /*< flags >*/
* has autoconnect enabled and is modified, it becomes eligible to autoconnect
* right away. Setting this flag, disables autoconnect until the connection
* is manually activated.
+ * @NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY: when a profile gets modified that is
+ * currently active, then these changes don't take effect for the active
+ * device unless the profile gets reactivated or the configuration reapplied.
+ * There are two exceptions: by default "connection.zone" and "connection.metered"
+ * properties take effect immediately. Specify this flag to prevent these
+ * properties to take effect, so that the change is restricted to modify
+ * the profile. Since: 1.20.
*
* Since: 1.12
*/
@@ -1050,6 +1057,7 @@ typedef enum { /*< flags >*/
NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY = 0x8,
NM_SETTINGS_UPDATE2_FLAG_VOLATILE = 0x10,
NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT = 0x20,
+ NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY = 0x40,
} NMSettingsUpdate2Flags;
/**
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 06b1561b6b..c789ec0826 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -1529,7 +1529,9 @@ update_auth_cb (NMSettingsConnection *self,
NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED
| NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE,
NM_SETTINGS_CONNECTION_UPDATE_REASON_FORCE_RENAME
- | NM_SETTINGS_CONNECTION_UPDATE_REASON_REAPPLY_PARTIAL
+ | ( NM_FLAGS_HAS (info->flags, NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY)
+ ? NM_SETTINGS_CONNECTION_UPDATE_REASON_NONE
+ : NM_SETTINGS_CONNECTION_UPDATE_REASON_REAPPLY_PARTIAL)
| NM_SETTINGS_CONNECTION_UPDATE_REASON_RESET_SYSTEM_SECRETS
| NM_SETTINGS_CONNECTION_UPDATE_REASON_RESET_AGENT_SECRETS,
"update-from-dbus",
@@ -1733,9 +1735,10 @@ impl_settings_connection_update2 (NMDBusObject *obj,
g_variant_get (parameters, "(@a{sa{sv}}u@a{sv})", &settings, &flags_u, &args);
- if (NM_FLAGS_ANY (flags_u, ~((guint32) (ALL_PERSIST_MODES |
- NM_SETTINGS_UPDATE2_FLAG_VOLATILE |
- NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)))) {
+ if (NM_FLAGS_ANY (flags_u, ~((guint32) ( ALL_PERSIST_MODES
+ | NM_SETTINGS_UPDATE2_FLAG_VOLATILE
+ | NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT
+ | NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY)))) {
error = g_error_new_literal (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
"Unknown flags");
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index 9dfc473da7..f3d6e35e51 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -50,7 +50,10 @@ typedef enum {
/* Usually, changing a profile that is currently active does not immediately
* reapply the changes. The exception are connection.zone and connection.metered
* properties. When this flag is set, then these two properties are reapplied
- * right away. */
+ * right away.
+ *
+ * See also %NM_SETTINGS_UPDATE2_FLAG_NO_REAPPLY flag, to prevent partial reapply
+ * during Update2(). */
NM_SETTINGS_CONNECTION_UPDATE_REASON_REAPPLY_PARTIAL = (1u << 2),
NM_SETTINGS_CONNECTION_UPDATE_REASON_CLEAR_SYSTEM_SECRETS = (1u << 3),