summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-07-20 21:54:37 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-07-22 12:55:14 +0200
commitf281fc1e95ff2e39c3cc4a90444434339ae24c04 (patch)
tree0a7bdf667b388e373c51b1f5f96931702f2dbb8f
parentutil: introduce siphash24_compress_string() (diff)
downloadsystemd-f281fc1e95ff2e39c3cc4a90444434339ae24c04.tar.xz
systemd-f281fc1e95ff2e39c3cc4a90444434339ae24c04.zip
tree-wide: use siphash24_compress_string() where it is applicable
-rw-r--r--src/journal/catalog.c2
-rw-r--r--src/network/networkd-ndisc.c4
-rw-r--r--src/network/networkd-routing-policy-rule.c7
-rw-r--r--src/network/networkd-util.c2
-rw-r--r--src/resolve/resolved-dns-server.c3
5 files changed, 7 insertions, 11 deletions
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 70b2c8b46c..b2589271ca 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -55,7 +55,7 @@ typedef struct CatalogItem {
static void catalog_hash_func(const CatalogItem *i, struct siphash *state) {
siphash24_compress(&i->id, sizeof(i->id), state);
- siphash24_compress(i->language, strlen(i->language), state);
+ siphash24_compress_string(i->language, state);
}
static int catalog_compare_func(const CatalogItem *a, const CatalogItem *b) {
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 409db8c3c5..fb7fa98b2b 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -70,7 +70,7 @@ static int make_stableprivate_address(Link *link, const struct in6_addr *prefix,
l = MAX(DIV_ROUND_UP(prefix_len, 8), 8);
siphash24_compress(prefix, l, &state);
- siphash24_compress(link->ifname, strlen(link->ifname), &state);
+ siphash24_compress_string(link->ifname, &state);
siphash24_compress(&link->mac, sizeof(struct ether_addr), &state);
siphash24_compress(&dad_counter, sizeof(uint8_t), &state);
@@ -577,7 +577,7 @@ static int ndisc_router_process_rdnss(Link *link, sd_ndisc_router *rt) {
}
static void ndisc_dnssl_hash_func(const NDiscDNSSL *x, struct siphash *state) {
- siphash24_compress(NDISC_DNSSL_DOMAIN(x), strlen(NDISC_DNSSL_DOMAIN(x)), state);
+ siphash24_compress_string(NDISC_DNSSL_DOMAIN(x), state);
}
static int ndisc_dnssl_compare_func(const NDiscDNSSL *a, const NDiscDNSSL *b) {
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
index 9777e020ed..e06d4b070a 100644
--- a/src/network/networkd-routing-policy-rule.c
+++ b/src/network/networkd-routing-policy-rule.c
@@ -132,11 +132,8 @@ static void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct
siphash24_compress(&rule->dport, sizeof(rule->dport), state);
siphash24_compress(&rule->uid_range, sizeof(rule->uid_range), state);
- if (rule->iif)
- siphash24_compress(rule->iif, strlen(rule->iif), state);
-
- if (rule->oif)
- siphash24_compress(rule->oif, strlen(rule->oif), state);
+ siphash24_compress_string(rule->iif, state);
+ siphash24_compress_string(rule->oif, state);
break;
default:
diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c
index 43507d8c63..ce9319d942 100644
--- a/src/network/networkd-util.c
+++ b/src/network/networkd-util.c
@@ -117,7 +117,7 @@ int kernel_route_expiration_supported(void) {
}
static void network_config_hash_func(const NetworkConfigSection *c, struct siphash *state) {
- siphash24_compress(c->filename, strlen(c->filename), state);
+ siphash24_compress_string(c->filename, state);
siphash24_compress(&c->line, sizeof(c->line), state);
}
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c
index c87026f434..9c221e1989 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/resolved-dns-server.c
@@ -627,8 +627,7 @@ static void dns_server_hash_func(const DnsServer *s, struct siphash *state) {
siphash24_compress(&s->address, FAMILY_ADDRESS_SIZE(s->family), state);
siphash24_compress(&s->port, sizeof(s->port), state);
siphash24_compress(&s->ifindex, sizeof(s->ifindex), state);
- if (s->server_name)
- siphash24_compress(s->server_name, strlen(s->server_name), state);
+ siphash24_compress_string(s->server_name, state);
}
static int dns_server_compare_func(const DnsServer *x, const DnsServer *y) {