mirror of
https://github.com/systemd/systemd
synced 2024-09-18 15:42:03 +00:00
network: use in6_addr_hash_ops
This commit is contained in:
parent
2968913e64
commit
5279914e2c
|
@ -1264,18 +1264,6 @@ static int dhcp6_route_add_handler(sd_netlink *nl, sd_netlink_message *m, Link *
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void dhcp6_prefixes_hash_func(const struct in6_addr *addr, struct siphash *state) {
|
||||
assert(addr);
|
||||
|
||||
siphash24_compress(addr, sizeof(*addr), state);
|
||||
}
|
||||
|
||||
static int dhcp6_prefixes_compare_func(const struct in6_addr *a, const struct in6_addr *b) {
|
||||
return memcmp(a, b, sizeof(*a));
|
||||
}
|
||||
|
||||
DEFINE_PRIVATE_HASH_OPS(dhcp6_prefixes_hash_ops, struct in6_addr, dhcp6_prefixes_hash_func, dhcp6_prefixes_compare_func);
|
||||
|
||||
int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link) {
|
||||
_cleanup_free_ struct in6_addr *a = NULL;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
|
@ -1308,7 +1296,7 @@ int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link) {
|
|||
if (!a)
|
||||
return -ENOMEM;
|
||||
|
||||
r = hashmap_ensure_allocated(&m->dhcp6_prefixes, &dhcp6_prefixes_hash_ops);
|
||||
r = hashmap_ensure_allocated(&m->dhcp6_prefixes, &in6_addr_hash_ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
Loading…
Reference in a new issue