From 9c72ca5ee9e2d2f7543784f8778803ae472a4d81 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 16 Jul 2019 09:24:25 +0200 Subject: [PATCH] device: fix reapplying changes to connection ID and UUID 4 properties are not really relevant for an already activated connection or it makes not sense to change them. These are connection.id, connection.uuid, connection.autoconnect and connection.stable-id. For convenience, we allow to reapply these. This way, one can take a different setting (e.g. with a different connection.id or connection.uuid) and reapply them, but such changes are silently ignored. However this was done wrongly. Instead of reverting the change to the new applied connection, we would change the input connection. This is bad, for example with nmcli connection up uuid cb922f18-e99a-49c6-b200-1678b5070a82 nmcli connection modify cb922f18-e99a-49c6-b200-1678b5070a82 con-name "bogus" nmcli device reapply eth0 the last re-apply would reset the settings-connection's connection ID to what was before, while accepting the new name on the applied-connection (while it should have been rejected). Fixes: bf3b3d444c77 ('device: avoid changing immutable properties during reapply') (cherry picked from commit adb51c2a7f05fd15b5a0c51c01a6a725201c8c4a) (cherry picked from commit 09f37d5bd4542011588921bf28105bd3c1b249ee) --- src/devices/nm-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index e930acfb95..caf9121632 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -11203,7 +11203,7 @@ check_and_reapply_connection (NMDevice *self, || !nm_streq0 (nm_setting_connection_get_stable_id (s_con_a), nm_setting_connection_get_stable_id (s_con_n))) { connection_clean_free = nm_simple_connection_new_clone (connection); connection_clean = connection_clean_free; - s_con_n = nm_connection_get_setting_connection (connection); + s_con_n = nm_connection_get_setting_connection (connection_clean); g_object_set (s_con_n, NM_SETTING_CONNECTION_ID, nm_setting_connection_get_id (s_con_a), NM_SETTING_CONNECTION_UUID, nm_setting_connection_get_uuid (s_con_a),