diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-13 09:11:49 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-21 04:04:49 +0900 |
commit | b6af282475ac950e83d761146d59bc0bffe5e9c6 (patch) | |
tree | b481cb46599b2cfa744a54477dfd75dff57db479 /src/resolve/resolved-dns-server.c | |
parent | 1b86009298c0c15678abb976e561de64f65decc9 (diff) | |
download | systemd-b6af282475ac950e83d761146d59bc0bffe5e9c6.tar.gz |
resolve: compare port and SNI in dns_server_hash_ops
Diffstat (limited to 'src/resolve/resolved-dns-server.c')
-rw-r--r-- | src/resolve/resolved-dns-server.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index 1bd9c6fcbd..0ace7d37f2 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -609,7 +609,10 @@ static void dns_server_hash_func(const DnsServer *s, struct siphash *state) { siphash24_compress(&s->family, sizeof(s->family), 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); } static int dns_server_compare_func(const DnsServer *x, const DnsServer *y) { @@ -623,11 +626,15 @@ static int dns_server_compare_func(const DnsServer *x, const DnsServer *y) { if (r != 0) return r; + r = CMP(x->port, y->port); + if (r != 0) + return r; + r = CMP(x->ifindex, y->ifindex); if (r != 0) return r; - return 0; + return streq_ptr(x->server_name, y->server_name); } DEFINE_HASH_OPS(dns_server_hash_ops, DnsServer, dns_server_hash_func, dns_server_compare_func); |