summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-08-19 13:35:27 +0200
committerThomas Haller <thaller@redhat.com>2021-08-19 13:48:22 +0200
commitc380893dc6757e30b429f968bc90bc1edda68998 (patch)
tree96cf7882583039ff63f485c3a66af8aea9b4bc7c
parentb08eef9d385f8c39c43975c5900530e5258c1dae (diff)
downloadNetworkManager-c380893dc6757e30b429f968bc90bc1edda68998.tar.gz
platform: fix capturing addresses from platform for assuming after restart
Commit c631aa48f034 ('platform: capture NMIP[46]Config from platform with correct (reversed) order of IP addresses') changed this for IPv6 and IPv4, but it's not correct for IPv4. For IPv6, later `ip addr add` calls adds a new primary address, which is also listed in `ip addr show` first. Hence, as NMIP6Config tracks addresses in increasing priority, while NMPlatform tracks them as exposed by kernel, the order when appending addresses form platform to NMIP6Config must be reversed. That is not the case for IPv4. For IPv4, later `ip addr add` calls add a secondary IP address. Also, in `ip addr show` output they are appended. Consequently, IPv4 addresses are tracked by NMPlatform with decreasing priority (in the reverse order than for IPv6). Fix constructing the NMIP4Config by fixing the address order. This is important, because during restart devices get assumed and our code would configure the order of addresses as it finds them. Fixes: c631aa48f034 ('platform: capture NMIP[46]Config from platform with correct (reversed) order of IP addresses')
-rw-r--r--src/core/nm-ip4-config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/nm-ip4-config.c b/src/core/nm-ip4-config.c
index b9917ac95a..1a31caeaa3 100644
--- a/src/core/nm-ip4-config.c
+++ b/src/core/nm-ip4-config.c
@@ -543,7 +543,7 @@ nm_ip4_config_capture(NMDedupMultiIndex *multi_idx, NMPlatform *platform, int if
head_entry = nm_platform_lookup_object(platform, NMP_OBJECT_TYPE_IP4_ADDRESS, ifindex);
if (head_entry) {
- nmp_cache_iter_for_each_reverse (&iter, head_entry, &plobj) {
+ nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
if (!_nm_ip_config_add_obj(priv->multi_idx,
&priv->idx_ip4_addresses_,
ifindex,