mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 08:10:17 +01:00
settings: preserve existing connection flags on update
We are passing to the plugin only 'sett_flags', which is the bitmask of flags to change and works together with 'sett_mask'; however, plugins interpret that value as the new flags value. The result is that if there is no change needed (0/0), the existing flags are lost. Simple reproducer: ip link add dummy1 type dummy ip link set dummy1 up ip addr add dev dummy1 fd01::12/64 sleep 1 # now, a external connection is created by NM echo "BEFORE:" cat /run/NetworkManager/system-connections/dummy1.nmconnection | grep "nm-generated\|volatile\|external" # just add a new address to the interface to make it lose # the external flag ip addr add dev dummy1 172.25.42.1/24 sleep 1 echo "AFTER:" cat /run/NetworkManager/system-connections/dummy1.nmconnection | grep "nm-generated\|volatile\|external" Output: BEFORE: nm-generated=true volatile=true external=true AFTER: Fixes:d35d3c468a('settings: rework tracking settings connections and settings plugins') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1548 (cherry picked from commit86b922695f) (cherry picked from commit4353f84230)
This commit is contained in:
parent
7886f945ba
commit
164591f754
1 changed files with 6 additions and 2 deletions
|
|
@ -2009,6 +2009,7 @@ nm_settings_update_connection(NMSettings *self,
|
|||
const char *uuid;
|
||||
gboolean tombstone_in_memory = FALSE;
|
||||
gboolean tombstone_on_disk = FALSE;
|
||||
NMSettingsConnectionIntFlags new_flags;
|
||||
|
||||
g_return_val_if_fail(NM_IS_SETTINGS(self), FALSE);
|
||||
g_return_val_if_fail(NM_IS_SETTINGS_CONNECTION(sett_conn), FALSE);
|
||||
|
|
@ -2228,13 +2229,16 @@ nm_settings_update_connection(NMSettings *self,
|
|||
}
|
||||
}
|
||||
|
||||
new_flags = nm_settings_connection_get_flags(sett_conn);
|
||||
new_flags = NM_FLAGS_ASSIGN_MASK(new_flags, sett_mask, sett_flags);
|
||||
|
||||
if (!update_storage) {
|
||||
success = _add_connection_to_first_plugin(self,
|
||||
plugin_name,
|
||||
sett_conn_entry,
|
||||
connection,
|
||||
new_in_memory,
|
||||
sett_flags,
|
||||
new_flags,
|
||||
new_shadowed_storage_filename,
|
||||
new_shadowed_owned,
|
||||
&new_storage,
|
||||
|
|
@ -2245,7 +2249,7 @@ nm_settings_update_connection(NMSettings *self,
|
|||
success = _update_connection_to_plugin(self,
|
||||
update_storage,
|
||||
connection,
|
||||
sett_flags,
|
||||
new_flags,
|
||||
update_reason,
|
||||
new_shadowed_storage_filename,
|
||||
new_shadowed_owned,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue