From 8707cb7ad4cfb5ae129f4d98a75a57e85eb72325 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Wed, 6 Apr 2022 18:37:54 +0100 Subject: [PATCH 1/3] Reduce padding in ADB address entries Saves a couple of bytes in `struct dns_adbentry`. --- lib/dns/adb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 0986219425..40a262917b 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -232,16 +232,16 @@ struct dns_adbentry { dns_adb_t *adb; dns_adbentrybucket_t *bucket; + unsigned int nh; unsigned int flags; unsigned int srtt; - uint16_t udpsize; unsigned int completed; unsigned int timeouts; unsigned char plain; unsigned char plainto; unsigned char edns; unsigned char ednsto; - unsigned int nh; + uint16_t udpsize; uint8_t mode; atomic_uint_fast32_t quota; From c44d7c8034384a284a8df1f57fd2b7d60f505a61 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Wed, 6 Apr 2022 18:52:18 +0100 Subject: [PATCH 2/3] Use a case-sensitive hash table for ADB address entries The key for the ADB `entrybuckets` hash table is a binary `struct isc_sockaddr` so it seems wrong to use a case-insensitive hash. --- lib/dns/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 40a262917b..a5949999e2 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -2114,7 +2114,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_taskmgr_t *taskmgr, isc_ht_init(&adb->namebuckets, adb->mctx, 1, ISC_HT_CASE_INSENSITIVE); isc_rwlock_init(&adb->names_lock, 0, 0); - isc_ht_init(&adb->entrybuckets, adb->mctx, 1, ISC_HT_CASE_INSENSITIVE); + isc_ht_init(&adb->entrybuckets, adb->mctx, 1, ISC_HT_CASE_SENSITIVE); isc_rwlock_init(&adb->entries_lock, 0, 0); isc_mutex_init(&adb->lock); From fb8b627d44640a62bcf6886113b6f7bef2bb229b Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Thu, 28 Apr 2022 15:02:15 +0100 Subject: [PATCH 3/3] CHANGES entry for [GL !6219] [cleanup] Reduce struct padding in ADB address entries, and use a binary hash function to find addresses. --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index b0e770e88c..152f0ff783 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5884. [cleanup] Reduce struct padding in ADB address entries, and use a + binary hash function to find addresses. [GL !6219] + 5883. [cleanup] Move netmgr/uv-compat.{c,h} to , so the compatibility libuv shims could be used outside the network manager. [GL !6199]