diff options
author | Thomas Haller <thaller@redhat.com> | 2023-02-09 19:56:10 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-02-09 19:56:19 +0100 |
commit | 6d96289942b0b55344f202cc2e941c45881e0c3a (patch) | |
tree | 8ef53a6da62929eaaf92122fc2030d840dadfbb3 | |
parent | 227f0fdfafd8306cc365c924e3b8f05502c84585 (diff) | |
download | NetworkManager-6d96289942b0b55344f202cc2e941c45881e0c3a.tar.gz |
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: 8995d44a0bae ('core: compare the DNS configurations before updating DNS')
-rw-r--r-- | src/core/nm-ip-config.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/nm-ip-config.c b/src/core/nm-ip-config.c index b191b54bb2..b61a932d9e 100644 --- a/src/core/nm-ip-config.c +++ b/src/core/nm-ip-config.c @@ -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) { |