core: fix type for nameservers in nm_ip_config_dns_hash()

nm_l3_config_data_get_nameservers() returns an array of in_addr_t or
struct in6_addr. This is not a string list.

Incidentally, it was still used correctly, using nm_ip_addr_from_packed_array().

Fix the code to use the right type. Also, only call g_checksum_update()
once for the packed array. No need to iterate over the list one by one.

Fixes: 8995d44a0b ('core: compare the DNS configurations before updating DNS')
This commit is contained in:
Thomas Haller 2023-02-09 19:56:10 +01:00
parent 227f0fdfaf
commit 6d96289942
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -503,7 +503,7 @@ nm_ip_config_dns_hash(const NML3ConfigData *l3cd, GChecksum *sum, int addr_famil
{
guint i;
int val;
const char *const *nameservers;
gconstpointer nameservers;
const in_addr_t *wins;
const char *const *domains;
const char *const *searches;
@ -518,10 +518,10 @@ nm_ip_config_dns_hash(const NML3ConfigData *l3cd, GChecksum *sum, int addr_famil
g_return_if_fail(sum);
nameservers = nm_l3_config_data_get_nameservers(l3cd, addr_family, &num_nameservers);
for (i = 0; i < num_nameservers; i++) {
if (num_nameservers > 0) {
g_checksum_update(sum,
nm_ip_addr_from_packed_array(addr_family, nameservers, i),
nm_utils_addr_family_to_size(addr_family));
nameservers,
num_nameservers * nm_utils_addr_family_to_size(addr_family));
}
if (addr_family == AF_INET) {