summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-07-22 18:34:33 +0200
committerThomas Haller <thaller@redhat.com>2022-07-26 12:28:05 +0200
commite466ad62e5d77c5d02d0fa572583c8e93785022a (patch)
treeef6972663d84b4c7648651bb2521d810b69441a9
parente25b7a579e8ca9fb6f7764f898481af37f11ab33 (diff)
platform: set the scope for IPv4 loopback address to "host"
For IPv6, kernel does not accept the ifa_scope parameter and always determines the scope based on the address itself. For IPv4, it honors whatever scope the user sets via netlink. NetworkManager does not allow to directly configure the address scope, but autodetects it. Use nm_platform_ip4_address_get_scope() for detecting the scopt. This also fixes the issue that to detect loopback addresses 127.0.0.0/8 and use scope "host". Try: $ nmcli device modify "$IFACE" +ipv4.addresses 127.0.0.5/8
-rw-r--r--src/libnm-platform/nm-linux-platform.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 7601db5cc2..e445d0757b 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -8964,8 +8964,7 @@ ip4_address_add(NMPlatform *platform,
plen,
&peer_addr,
flags,
- nm_utils_ip4_address_is_link_local(addr) ? RT_SCOPE_LINK
- : RT_SCOPE_UNIVERSE,
+ nm_platform_ip4_address_get_scope(addr),
lifetime,
preferred,
broadcast_address,