mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 02:10:09 +01:00
ip6: use IN6_ARE_ADDR_EQUAL not memcmp
This commit is contained in:
parent
291211ac2b
commit
46c5a48ff2
2 changed files with 8 additions and 9 deletions
|
|
@ -652,7 +652,7 @@ process_nduseropt (NMIP6Manager *manager, struct nl_msg *msg)
|
|||
for (i = 0; i < servers->len; i++) {
|
||||
sa = &(g_array_index (servers, NMIP6RDNSS, i));
|
||||
sb = &(g_array_index (device->rdnss_servers, NMIP6RDNSS, i));
|
||||
if (memcmp (&sa->addr, &sb->addr, sizeof (struct in6_addr)) != 0) {
|
||||
if (IN6_ARE_ADDR_EQUAL (&sa->addr, &sb->addr) == FALSE) {
|
||||
changed = TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -965,11 +965,11 @@ nm_ip6_manager_get_ip6_config (NMIP6Manager *manager, int ifindex)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Also ignore routes where the destination and gateway are the same,
|
||||
* which apparently get added by the kernel but return -EINVAL when
|
||||
* we try to add them via netlink.
|
||||
/* Also ignore link-local routes where the destination and gateway are
|
||||
* the same, which apparently get added by the kernel but return -EINVAL
|
||||
* when we try to add them via netlink.
|
||||
*/
|
||||
if (gateway && !memcmp (dest, gateway, sizeof (struct in6_addr)))
|
||||
if (gateway && IN6_ARE_ADDR_EQUAL (dest, gateway))
|
||||
continue;
|
||||
|
||||
ip6route = nm_ip6_route_new ();
|
||||
|
|
|
|||
|
|
@ -203,9 +203,8 @@ void nm_ip6_config_add_nameserver (NMIP6Config *config, const struct in6_addr *n
|
|||
|
||||
/* No dupes */
|
||||
nameservers = (struct in6_addr *)priv->nameservers->data;
|
||||
for (i = 0; i < priv->nameservers->len; i++) {
|
||||
g_return_if_fail (memcmp (nameserver, &nameservers[i], sizeof (struct in6_addr)) != 0);
|
||||
}
|
||||
for (i = 0; i < priv->nameservers->len; i++)
|
||||
g_return_if_fail (IN6_ARE_ADDR_EQUAL (nameserver, &nameservers[i]) == FALSE);
|
||||
|
||||
g_array_append_val (priv->nameservers, *nameserver);
|
||||
}
|
||||
|
|
@ -572,7 +571,7 @@ addr_array_compare (GArray *a, GArray *b)
|
|||
addrs_b = (struct in6_addr *)b->data;
|
||||
for (i = 0; i < a->len; i++) {
|
||||
for (j = 0, found = FALSE; j < b->len; j++) {
|
||||
if (memcmp (&addrs_a[i], &addrs_b[j], sizeof (struct in6_addr)) == 0) {
|
||||
if (IN6_ARE_ADDR_EQUAL (&addrs_a[i], &addrs_b[j])) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue