From 52c8ee2c9dfe080155d3129eba69d19119e296a1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 18 Jul 2022 21:24:04 +0200 Subject: [PATCH] platform: drop detecting address scope in _nl_msg_new_address() All callers explicitly set a scope, like they should. Drop guessing the scope. Also, use the proper integer type. --- src/libnm-platform/nm-linux-platform.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 185c9aed3e..3c873c9ea7 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -4780,7 +4780,7 @@ _nl_msg_new_address(uint16_t nlmsg_type, guint8 plen, gconstpointer peer_address, guint32 flags, - int scope, + guint8 scope, guint32 lifetime, guint32 preferred, in_addr_t ip4_broadcast_address, @@ -4792,6 +4792,7 @@ _nl_msg_new_address(uint16_t nlmsg_type, .ifa_index = ifindex, .ifa_prefixlen = plen, .ifa_flags = flags, + .ifa_scope = scope, }; gsize addr_len; @@ -4800,15 +4801,6 @@ _nl_msg_new_address(uint16_t nlmsg_type, msg = nlmsg_alloc_simple(nlmsg_type, nlmsg_flags); - if (scope == -1) { - /* Allow having scope unset, and detect the scope (including IPv4 compatibility hack). */ - if (family == AF_INET && address && *((char *) address) == 127) - scope = RT_SCOPE_HOST; - else - scope = RT_SCOPE_UNIVERSE; - } - am.ifa_scope = scope, - addr_len = family == AF_INET ? sizeof(in_addr_t) : sizeof(struct in6_addr); if (nlmsg_append_struct(msg, &am) < 0)