mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 14:20:17 +01:00
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
This commit is contained in:
parent
dcdbe98406
commit
0aa323fb28
3 changed files with 19 additions and 5 deletions
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue