From 8cc85bb7367aa60fb48acd77fe3c4f6b03ab77a3 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 8 Sep 2017 15:47:04 -0700 Subject: [PATCH] [v9_10] change hash function for RRL 4709. [cleanup] Use dns_name_fullhash() to hash names for RRL. [RT #45435] (cherry picked from commit f13385770ee4b84c0ba74a8b09bc0447492a6f53) (cherry picked from commit b9fd54f8d4572fe5dcaf9d4b74f6ecb8027cc450) --- CHANGES | 3 +++ lib/dns/include/dns/name.h | 6 +++++- lib/dns/rrl.c | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index d75b28ee31..c8a2cd4d8a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4709. [cleanup] Use dns_name_fullhash() to hash names for RRL. + [RT #45435] + 4703. [bug] BINDInstall.exe was missing some buffer length checks. [RT #45898] diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index 16c9f63329..507124192c 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -346,7 +346,11 @@ unsigned int dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive); /*%< * Provide a hash value for 'name', where the hash value is the sum - * of the hash values of each label. + * of the hash values of each label. This function should only be used + * when incremental hashing is necessary, for example, during RBT + * traversal. It is not currently used in BIND. Generally, + * dns_name_fullhash() is the correct function to use for name + * hashing. * * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in * case will have the same hash value. diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index b655e25116..9855c58b5e 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -425,11 +425,11 @@ make_key(const dns_rrl_t *rrl, dns_rrl_key_t *key, { dns_name_init(&base, base_offsets); dns_name_getlabelsequence(qname, 1, labels-1, &base); - key->s.qname_hash = dns_name_hashbylabel(&base, - ISC_FALSE); + key->s.qname_hash = + dns_name_fullhash(&base, ISC_FALSE); } else { - key->s.qname_hash = dns_name_hashbylabel(qname, - ISC_FALSE); + key->s.qname_hash = + dns_name_fullhash(qname, ISC_FALSE); } }