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.
This commit is contained in:
Thomas Haller 2022-07-18 21:24:04 +02:00
parent 45ca7dfaf3
commit 52c8ee2c9d
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

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