bind9/lib/dns
Tony Finch 1c0f607811 Simplify and speed up DNS name decompression
The aim is to do less work per byte:

  * Check the bounds for each label, instead of checking the
    bounds for each character.

  * Instead of copying one character at a time from the wire to
    the name, copy entire runs of sequential labels using memmove()
    to make the most of its fast loop.

  * To remember where the name ends, we only need to set the end
    marker when we see a compression pointer or when we reach the
    root label. There is no need to check if we jumped back and
    conditionally update the counter for every character.

  * To parse a compression pointer, we no longer take a diversion
    around the outer loop in between reading the upper byte of the
    pointer and the lower byte.

  * The parser state machine is now implicit in the instruction
    pointer, instead of being an explicit variable. Similarly,
    when we reach the root label we break directly out of the loop
    instead of setting a second state machine variable.

  * DNS_NAME_DOWNCASE is never used with dns_name_fromwire() so
    that option is no longer supported.

I have removed this comment which dated from January 1999 when
dns_name_fromwire() was first introduced:

   /*
    * Note:  The following code is not optimized for speed, but
    * rather for correctness.  Speed will be addressed in the future.
    */

No functional change, apart from removing support for the unused
DNS_NAME_DOWNCASE option. The new code is about 2x faster than the
old code: best case 11x faster, worst case 1.4x faster.
2022-11-17 08:45:15 +00:00
..
include Simplify and speed up DNS name decompression 2022-11-17 08:45:15 +00:00
rdata Add dns_rdata_checksvcb 2022-10-29 00:22:54 +11:00
.gitignore 4394. [func] Add rndc command "dnstap-reopen" to close and 2016-06-24 09:37:04 +10:00
acl.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
adb.c Use isc_hashmap instead of isc_ht in the dns_adb API 2022-11-10 15:07:19 +01:00
badcache.c Use designated initializers instead of memset()/MEM_ZERO for structs 2022-10-05 16:44:05 +02:00
byaddr.c Remove dns_lookup and unused functions in dns_byaddr 2022-05-25 14:44:32 +02:00
cache.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
callbacks.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
catz.c Add and use semantic patch to replace isc_mem_get/allocate+memset 2022-10-05 16:44:05 +02:00
client.c Remove unused lib/dns/tsec 2022-10-25 10:35:07 +02:00
clientinfo.c allow dns_clientinfo to store client ECS data 2022-01-27 13:53:59 -08:00
compress.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
db.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
dbiterator.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
diff.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
dispatch.c Implement TLS transport support for dns_request and dns_dispatch 2022-09-19 16:36:28 +00:00
dlz.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
dns64.c Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
dnsrps.c Use designated initializers instead of memset()/MEM_ZERO for structs 2022-10-05 16:44:05 +02:00
dnssec.c Add the ability specify the signing / verification time 2022-09-26 16:28:12 +02:00
dnstap.c Use designated initializers instead of memset()/MEM_ZERO for structs 2022-10-05 16:44:05 +02:00
dnstap.proto Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ds.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
dst_api.c Change the return type of isc_lex_create() to void 2022-10-26 12:55:06 +02:00
dst_internal.h Check if key metadata is modified before writing 2022-05-13 13:31:17 +02:00
dst_openssl.h Use autoconf check for BN_GENCB_new() 2022-03-02 10:48:09 +00:00
dst_parse.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dst_parse.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dyndb.c Improve reporting for pthread_once errors 2022-10-14 16:39:21 +02:00
ecs.c Simplify way we tag unreachable code with only ISC_UNREACHABLE() 2022-03-25 08:33:43 +01:00
fixedname.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
forward.c Cleanup dns_fwdtable_delete() 2022-06-09 10:47:04 +00:00
gen.c Use the semantic patch to do the unsigned -> unsigned int change 2022-09-19 15:56:02 +02:00
geoip2.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
gssapi_link.c Remove a redundant variable-length array 2022-03-18 15:06:31 +00:00
gssapictx.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
hmac_link.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
ipkeylist.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
iptable.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
journal.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
kasp.c Store built-in dnssec-policies in defaultconf 2022-06-28 11:56:31 +02:00
key.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keydata.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keymgr.c Nit changes in keymgr and kasp 2022-06-28 11:56:31 +02:00
keytable.c Add synth-from-dnssec namespaces for keytable entries 2022-07-05 12:29:01 +10:00
log.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
Makefile.am Remove unused lib/dns/tsec 2022-10-25 10:35:07 +02:00
master.c Move the zone loading to the offloaded threads 2022-10-30 14:56:40 -07:00
masterdump.c Refactor dns_master_dump*async() to use offloaded work 2022-10-31 10:30:27 +00:00
message.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
name.c Simplify and speed up DNS name decompression 2022-11-17 08:45:15 +00:00
ncache.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
nsec.c Wait with NSEC3 during a DNSSEC policy change 2022-08-22 15:55:46 +02:00
nsec3.c nsec3.c: Add a missing dns_db_detachnode() call 2022-08-23 11:01:31 +02:00
nta.c Resolve violation of weak referencing dns_view 2022-10-05 11:59:36 -07:00
openssl_link.c Add ENGINE_init and ENGINE_finish calls 2022-09-23 13:15:16 +10:00
openssl_shim.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
openssl_shim.h Remove DH_clear_flags call 2022-07-18 13:38:47 +02:00
openssldh_link.c Do not use OSSL_PARAM when engine API is compiled 2022-09-23 13:17:53 +10:00
opensslecdsa_link.c Remove engine related parts for OpenSSL 3.0 2022-09-23 13:17:55 +10:00
openssleddsa_link.c Free ctx on invalid siglen 2022-09-08 11:27:31 +02:00
opensslrsa_link.c Check BN_dup results in rsa_check 2022-09-28 09:24:34 +10:00
order.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
peer.c Add server clause require-cookie 2022-09-13 12:07:13 +10:00
private.c Increase the BUFSIZ-long buffers 2022-07-15 10:33:46 +00:00
rbt.c Replace #define DNS_NAMEATTR_ with struct of bools 2022-10-13 17:04:02 +02:00
rbtdb.c Don't release the tree read lock in dereference_iter_node() 2022-11-03 14:07:44 +00:00
rbtdb.h Remove remaining checks for rbt64 2022-05-03 00:41:42 +01:00
rcode.c Use the semantic patch to do the unsigned -> unsigned int change 2022-09-19 15:56:02 +02:00
rdata.c Add dns_rdata_checksvcb 2022-10-29 00:22:54 +11:00
rdatalist.c dns_rdatalist_tordataset() and dns_rdatalist_fromrdataset() can not fail 2022-08-09 08:19:51 +00:00
rdatalist_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdataset.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
rdatasetiter.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdataslab.c Add and use semantic patch to replace isc_mem_get/allocate+memset 2022-10-05 16:44:05 +02:00
request.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
resolver.c Select the appropriate namespace when using a dual stack server 2022-11-17 12:23:45 +11:00
result.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rootns.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
rpz.c De-duplicate __FILE__, __LINE__ 2022-10-17 11:58:26 +01:00
rriterator.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rrl.c Replace #define DNS_NAMEATTR_ with struct of bools 2022-10-13 17:04:02 +02:00
sdb.c Change the return type of isc_lex_create() to void 2022-10-26 12:55:06 +02:00
sdlz.c Change the return type of isc_lex_create() to void 2022-10-26 12:55:06 +02:00
soa.c Remove use of the inline keyword used as suggestion to compiler 2022-03-25 08:33:43 +01:00
ssu.c Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
ssu_external.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
stats.c Emit key algorithm + key id in dnssec signing statsistics 2022-09-15 08:42:45 +10:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
time.c Clean up #include <isc/string.h> 2022-05-03 12:38:59 +00:00
tkey.c Refactor tkey.c:buildquery() error handling 2022-08-16 07:36:12 +00:00
transport.c Implement DoT support for nsupdate 2022-09-23 13:23:49 +00:00
tsig.c Replace #define DNS_NAMEATTR_ with struct of bools 2022-10-13 17:04:02 +02:00
tsig_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ttl.c Use the semantic patch to do the unsigned -> unsigned int change 2022-09-19 15:56:02 +02:00
update.c Create per-thread task and memory context for zonemgr 2022-04-01 23:50:34 +02:00
validator.c the validator can attach to the view normally 2022-05-13 13:36:10 -07:00
view.c Have dns_zt_apply lock the zone table 2022-11-11 15:26:11 +00:00
xfrin.c Simplify and speed up DNS name compression 2022-10-17 08:45:44 +02:00
zone.c Change default TTL of NSEC3PARAM to SOA MINIMUM 2022-11-11 12:06:33 +01:00
zone_p.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zonekey.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zoneverify.c Add and use semantic patch to replace isc_mem_get/allocate+memset 2022-10-05 16:44:05 +02:00
zt.c Have dns_zt_apply lock the zone table 2022-11-11 15:26:11 +00:00