From bbd36be44adcde91a86181bb5d6e9218caf39d2a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 9 Feb 2021 16:26:53 +0100 Subject: [PATCH] cloud-setup: fix replacing IPv4 addresses during update If previously the profile would track two addresses ("10.116.1.130/24", "10.116.1.65/24"), and during an update the second address was removed (leaving "10.116.1.130/24"), then the addresses of the profile were wrongly not changed. The effect is that removing a secondary IP address might not take effect. Fix that. https://bugzilla.redhat.com/show_bug.cgi?id=1920838 Fixes: 69f048bf0ca3 ('cloud-setup: add tool for automatic IP configuration in cloud') --- clients/cloud-setup/nm-cloud-setup-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/cloud-setup/nm-cloud-setup-utils.c b/clients/cloud-setup/nm-cloud-setup-utils.c index 6d446343fc..f5550a1286 100644 --- a/clients/cloud-setup/nm-cloud-setup-utils.c +++ b/clients/cloud-setup/nm-cloud-setup-utils.c @@ -704,7 +704,7 @@ nmcs_setting_ip_replace_ipv4_addresses(NMSettingIPConfig *s_ip, i_next++; } - if (any_changes) { + if (!any_changes) { while (i_next < num) { nm_setting_ip_config_remove_address(s_ip, --num); any_changes = TRUE;