diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-14 07:10:33 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-14 13:30:09 +0200 |
commit | bffaa49ec42ddc7560aff2981266216ab7ce0b20 (patch) | |
tree | 33b70464327c31c44d4ac2ffe873e2587a875c67 /src/basic/in-addr-util.c | |
parent | Merge pull request #20700 from yuwata/network-dhcp-cleanups (diff) | |
download | systemd-bffaa49ec42ddc7560aff2981266216ab7ce0b20.tar.xz systemd-bffaa49ec42ddc7560aff2981266216ab7ce0b20.zip |
in-addr-prefix-util: introduce several utilities for address prefix
Diffstat (limited to 'src/basic/in-addr-util.c')
-rw-r--r-- | src/basic/in-addr-util.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/basic/in-addr-util.c b/src/basic/in-addr-util.c index 2187bd0cba..3d392afc08 100644 --- a/src/basic/in-addr-util.c +++ b/src/basic/in-addr-util.c @@ -831,35 +831,6 @@ static int in_addr_data_compare_func(const struct in_addr_data *x, const struct DEFINE_HASH_OPS(in_addr_data_hash_ops, struct in_addr_data, in_addr_data_hash_func, in_addr_data_compare_func); -static void in_addr_prefix_hash_func(const struct in_addr_prefix *a, struct siphash *state) { - assert(a); - assert(state); - - siphash24_compress(&a->family, sizeof(a->family), state); - siphash24_compress(&a->prefixlen, sizeof(a->prefixlen), state); - siphash24_compress(&a->address, FAMILY_ADDRESS_SIZE(a->family), state); -} - -static int in_addr_prefix_compare_func(const struct in_addr_prefix *x, const struct in_addr_prefix *y) { - int r; - - assert(x); - assert(y); - - r = CMP(x->family, y->family); - if (r != 0) - return r; - - r = CMP(x->prefixlen, y->prefixlen); - if (r != 0) - return r; - - return memcmp(&x->address, &y->address, FAMILY_ADDRESS_SIZE(x->family)); -} - -DEFINE_HASH_OPS(in_addr_prefix_hash_ops, struct in_addr_prefix, in_addr_prefix_hash_func, in_addr_prefix_compare_func); -DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(in_addr_prefix_hash_ops_free, struct in_addr_prefix, in_addr_prefix_hash_func, in_addr_prefix_compare_func, free); - void in6_addr_hash_func(const struct in6_addr *addr, struct siphash *state) { assert(addr); assert(state); |