summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-20 19:02:57 +0200
committerThomas Haller <thaller@redhat.com>2020-07-20 19:02:57 +0200
commite73bd2cf5f933f770971adc40fbb4129d23379db (patch)
tree3f89c28801d402eed4a4f4f1816ee957bf8bd284 /clients
parent6f29ed9f3f12062fcdf8c37a1177eb13dcda99e5 (diff)
downloadNetworkManager-e73bd2cf5f933f770971adc40fbb4129d23379db.tar.gz
cloud-setup: always replace addresses, routes and rules in _nmc_mangle_connection()
If the list of addresses, routes and rules is empty, we still want to mangle the applied connection, to also have an empty list. nm-cloud-setup has certain expectations. For example, that the static addresses, routes and rules of the active connection is entirely under the control of the tool. For example, so it usually replaces the lists entirely. It also should do that, if the new list is empty. Maybe, one day there could be more complex merging strategies, where the user could also add static addresses, routes, or rules to the profile, and nm-cloud-setup would preserve them. However, that is not implemented, nor is it clear how exactly that would work.
Diffstat (limited to 'clients')
-rw-r--r--clients/cloud-setup/main.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/clients/cloud-setup/main.c b/clients/cloud-setup/main.c
index 78260b9732..8805742d94 100644
--- a/clients/cloud-setup/main.c
+++ b/clients/cloud-setup/main.c
@@ -358,23 +358,17 @@ _nmc_mangle_connection (NMDevice *device,
for (i = 0; i < config_data->iproutes_len; ++i)
g_ptr_array_add (routes_new, config_data->iproutes_arr[i]);
- if (addrs_new->len) {
- addrs_changed = nmcs_setting_ip_replace_ipv4_addresses (s_ip,
- (NMIPAddress **) addrs_new->pdata,
- addrs_new->len);
- }
+ addrs_changed = nmcs_setting_ip_replace_ipv4_addresses (s_ip,
+ (NMIPAddress **) addrs_new->pdata,
+ addrs_new->len);
- if (routes_new->len) {
- routes_changed = nmcs_setting_ip_replace_ipv4_routes (s_ip,
- (NMIPRoute **) routes_new->pdata,
- routes_new->len);
- }
+ routes_changed = nmcs_setting_ip_replace_ipv4_routes (s_ip,
+ (NMIPRoute **) routes_new->pdata,
+ routes_new->len);
- if (rules_new->len) {
- rules_changed = nmcs_setting_ip_replace_ipv4_rules (s_ip,
- (NMIPRoutingRule **) rules_new->pdata,
- rules_new->len);
- }
+ rules_changed = nmcs_setting_ip_replace_ipv4_rules (s_ip,
+ (NMIPRoutingRule **) rules_new->pdata,
+ rules_new->len);
NM_SET_OUT (out_changed, addrs_changed
|| routes_changed