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: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
This commit is contained in:
Thomas Haller 2021-02-09 16:26:53 +01:00
parent 94a75c8cd6
commit bbd36be44a
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;