NetBSD/external/bsd/nsd/dist/rbtree.h

77 lines
2.4 KiB
C
Raw Permalink Normal View History

2017-01-07 22:41:59 +03:00
/*
* rbtree.h -- generic red-black tree
*
* Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
*
* See LICENSE for the license.
*
*/
Import 4.8.0 (previous was 4.6.0) 29 November 2023: Wouter - Tag for 4.8.0rc1. 28 November 2023: Wouter - Set up doc/RELNOTES for upcoming release. - Fix unit test kill_from_pidfile function for nonexistent files because the argument is evaluated before the test expression. - Fix rr-test to also convert the contents of the just written output file. - Fix test set to remove -f nsd.db and rm nsd.db commands. - Fix test set to remove difffile option. 27 November 2023: Jeroen - Fix #14: Set timeout to 3s when servicing remaining TCP connections. - Fix: Always instate write handler after reading queries from TCP. - Answer first query on connections accepted just before reload. 27 November 2023: Wouter - Merge #305: faster stats. Statistics can be gathered while a reload is in progress. 27 November 2023: Willem - Merge #302: Test package fixes. Correct Auxfiles, kill_from_pidfile function and fix drop_updates, rr-test and xfr_update tests. 1 November 2023: Jeroen - Remove on-disk database. 31 October 2023: Wouter - Merge #301: improve the logging of ixfr fallbacks to axfr. 30 October 2023: Jeroen - Fix processing of consolidated IXFRs. 30 October 2023: Wouter - Fix for interprocess communication to set quit sync command from main process explicitly. 3 October 2023: Wouter - Merge #281: Proxy protocol. An implementation of PROXYv2 for NSD. It can be configured with proxy-protocol-port: portnum with the port number of the interface on which proxy traffic is handled. The interface can support proxy traffic for UDP, TCP and TLS. 21 September 2023: Wouter - Merge #295: Update e-mail addresses, add ref to support contracts 31 August 2023: Wouter - Fix autoconf 2.69 warnings in configure. 14 July 2023: Wouter - Merge #287: Update nsd.conf.5.in. 11 July 2023: Wouter - Fix unused variable warning in unit test of udb. 22 June 2023: Wouter - Fix #284: dnstap_collector.c: SOCK_NONBLOCK is not available on Mac/Darwin. 7 June 2023: Wouter - Merge #282: Improve nsd.conf man page. - Fix unused but set variable warning. - Fix #283: Compile failure in remote.c when --disable-bind8-stats and --without-ssl are specified. 31 May 2023: Wouter - Add missing items to doc/RELNOTES. - Tag for 4.7.0rc1. It became release 4.7.0 on 7 june 2023. The code repository continues with 4.7.1. 30 May 2023: Jeroen - Fix #240: Prefix messages originating from verifier. - Fix #275: Drop unnecessary root server checks. 30 May 2023: Wouter - Next version is 4.7.0, instead of 4.6.2, because of the added features, like TLS for DNSTAP. - Fix unused variable warning in unit test, from clang compile. 24 May 2023: Wouter - For #279: Note that autoreconf -fi creates the configure script and also the needed auxiliary files, for autoconf 2.69 and 2.71. 4 May 2023: Wouter - Fix to remove unused whitespace from acx_nlnetlabs.m4 and config.h. 1 May 2023: Wouter - make depend. - Fix for build to run flex and bison before compiling code that needs the headers. 13 April 2023: Wouter - Fix cirrus script for submit to coverity scan to libtoolize the configure script components config.guess and config.sub. - Fix readme status badge links. 28 March 2023: Wouter - Fix #273: Large TXT record breaks AXFR. - Fix ixfr create from adding too many record types. 16 March 2023: Wouter - Fix include brackets for ssl.h include statements, instead of quotes. - Fix static analyzer warning about nsd_event_method initialization. 15 March 2023: Wouter - Dnstap tls code fixes. 14 March 2023: Wouter - Fix dnstap to not check socket path when using IP address. - dnstap over TLS, default enabled. Configured with the options dnstap-tls, dnstap-tls-server-name, dnstap-tls-cert-bundle, dnstap-tls-client-key-file and dnstap-tls-client-cert-file. - Fix to compile without ssl with dnstap-tls code. 9 March 2023: Wouter - Fix #271: DNSTAP over TCP, with dnstap-ip: "127.0.0.1@3333". - Fix to clean more memory on exit of dnstap collector. 23 February 2023: Wouter - Fix #270: reserved identifier violation. 20 February 2023: Wouter - Merge #269 from Fale: Add systemd service unit. 16 February 2023: Wouter - Fix #266: Fix build with --without-ssl. - Fix #267: Allow unencrypted local operation of nsd-control. - Fix for #267: neater variable definitions. 2 February 2023: Wouter - Merge #265: Fix C99 compatibility issue. 30 January 2023: Wouter - Merge #263: Add bash autocompletion script for nsd-control. - Fix for #262: More error logging for SSL read failures for zone transfers. 27 January 2023: Wouter - Fix #262: Zone(s) not synchronizing properly via TLS. - Fix ixfr_and_restart test to wait for processes to come to a stop. 26 January 2023: Wouter - Fix configure for -Wstrict-prototypes. 10 November 2022: Wouter - Tag for NSD 4.6.1, the repository continues with version 4.6.2. - Fix #239: -Wincompatible-pointer-types warning in remote.c. - Fix unit tests to succeed with --disable-bind8-stats. 1 November 2022: Wouter - Fixup for non-trailing newline lexer change warnings. - Update doc/RELNOTES for changes. - Fix ixfr_gone unit test to not use system default zone list file. - Fix credns tests for vm usage, and not use system default zone list file. - Fix verify tests to use more portable bash location in script. - Fix verify_again test to use ipv4 address for test. 1 November 2022: Tom - Add SVCB dohpath support 28 September 2022: Jeroen - Set ALPN "dot" token during connection establishment as per RFC9103 section 7.1 (Thanks Cesar Kuroiwa). 21 September 2022: Tom - Change zone parsing to accept non-trailing newline. 1 September 2022: Wouter - Merge #231 from moritzbuhl: Fix checking if nonblocking sockets work on OpenBSD. 19 August 2022: Wouter - Update cirrus build script for newer Ubuntu image, and FreeBSD build with libtoolize to install auxiliary files. - Update to clang 14 in cirrus build test on Ubuntu Jammy 22.04. 7 July 2022: Tom - Fix #212: Change commandline control actions to always log. 1 July 2022: Wouter - Fix static analyzer reports, fix wrong log print when skipping xfr, fix to print error on pipe read fail, and assert an xfr is in progress during packet checks.
2024-02-17 20:31:21 +03:00
#ifndef RBTREE_H
#define RBTREE_H
2017-01-07 22:41:59 +03:00
#include "region-allocator.h"
/*
* This structure must be the first member of the data structure in
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
* the rbtree. This allows easy casting between an rbnode_type and the
2017-01-07 22:41:59 +03:00
* user data (poor man's inheritance).
*/
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
typedef struct rbnode rbnode_type;
struct rbnode {
rbnode_type *parent;
rbnode_type *left;
rbnode_type *right;
const void *key;
uint8_t color;
} ATTR_PACKED;
2017-01-07 22:41:59 +03:00
#define RBTREE_NULL &rbtree_null_node
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
extern rbnode_type rbtree_null_node;
2017-01-07 22:41:59 +03:00
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
typedef struct rbtree rbtree_type;
struct rbtree {
2017-01-07 22:41:59 +03:00
region_type *region;
/* The root of the red-black tree */
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
rbnode_type *root;
2017-01-07 22:41:59 +03:00
/* The number of the nodes in the tree */
size_t count;
/* Current node for walks... */
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
rbnode_type *_node;
2017-01-07 22:41:59 +03:00
/* Key compare function. <0,0,>0 like strcmp. Return 0 on two NULL ptrs. */
int (*cmp) (const void *, const void *);
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
} ATTR_PACKED;
2017-01-07 22:41:59 +03:00
/* rbtree.c */
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
rbtree_type *rbtree_create(region_type *region, int (*cmpf)(const void *, const void *));
rbnode_type *rbtree_insert(rbtree_type *rbtree, rbnode_type *data);
2017-01-07 22:41:59 +03:00
/* returns node that is now unlinked from the tree. User to delete it.
* returns 0 if node not present */
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
rbnode_type *rbtree_delete(rbtree_type *rbtree, const void *key);
rbnode_type *rbtree_search(rbtree_type *rbtree, const void *key);
2017-01-07 22:41:59 +03:00
/* returns true if exact match in result. Else result points to <= element,
or NULL if key is smaller than the smallest key. */
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
int rbtree_find_less_equal(rbtree_type *rbtree, const void *key, rbnode_type **result);
rbnode_type *rbtree_first(rbtree_type *rbtree);
rbnode_type *rbtree_last(rbtree_type *rbtree);
rbnode_type *rbtree_next(rbnode_type *rbtree);
rbnode_type *rbtree_previous(rbnode_type *rbtree);
2017-01-07 22:41:59 +03:00
#define RBTREE_WALK(rbtree, k, d) \
for((rbtree)->_node = rbtree_first(rbtree);\
(rbtree)->_node != RBTREE_NULL && ((k) = (rbtree)->_node->key) && \
((d) = (void *) (rbtree)->_node); (rbtree)->_node = rbtree_next((rbtree)->_node))
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
/* call with node=variable of struct* with rbnode_type as first element.
2017-01-07 22:41:59 +03:00
with type is the type of a pointer to that struct. */
#define RBTREE_FOR(node, type, rbtree) \
for(node=(type)rbtree_first(rbtree); \
NSD 4.1.19 Dec 11, 2017 Bugfixes ignore fallthrough compiler warning in flex EOF rule. Fix warnings emitted by clang for --enable-packed. Alignment is not a problem for x86_64, don't enable packed when the platform requires aligned access. Fix spelling error in xfr-inspect. Fix 3392: Fix regression in 4.1.18 for notify lists with ip4 and ip6 targets. Add test for support of -Wno-address-of-packed-member for --enable-packed. NSD 4.1.18 Nov 30, 2017 Features xfr-inspect, it is not installed, it prints xfr files from /tmp made with 'make xfr-inspect' in the source dir. retry timeout between sending notifies dropped from 15 to 3 sec. NSD sends 16 notifies simultaneously. configure --enable-packed reduces memory usage, at expense of unaligned reads. Saves about 17%. Save memory by selectively allocate precompiled nsec3 hashes, saves about 16% memory. make ip-transparent option work on OpenBSD. Save about 2% memory by changing usage count size in name tree. Fix #2871: Increase number of sockets for xfrd transfers. Bugfixes Fix gcc 7.1.1 warnings. Fix writev compile warning on FreeBSD. Fix #1446: A corrupted zone file "propagates" to good ones. nsd-control zonestatus prints wait time between attempts, for zones that are in that waiting time. Fix collision printout of nsec3 to print name, hash and reverse. Fix #1567: Change crit to err log level for gettimeofday failure. Add defines for compile without syslog. Fix crash for DS query when parent and child zones both configured in nsd.conf and parent zone has not loaded properly. NSD 4.1.17 Jul 21, 2017 Features zone parser parses type AVC (it has TXT format). Fix #1272: use writev to put tcp length field with data for outgoing zone transfer requests. Bugfixes Fix potential null pointer in nsec3 adjustment tree. Fix text format of deletes for CDS and CDNSKEY, single 0 to represent empty base64 or hex string. NSD 4.1.16 Apr 25, 2017 Features zone parser can parse acronyms for algorithms ED25519 and ED448. Fix 1243: Option to make NSD emit really minimal responses, minimal-responses: yes in nsd.conf. Bugfixes Calculate new udb index after growing the array, fix from Chaofeng Liu. Fix missing _t to _type conversion for disable-radix-tree option. Printout serial error with hint it may be too big. Fix 1228: OpenSSL include is not guarded with HAVE_SSL Patch for expire state in multi-master when masters includes broken master, from Manabu Sonoda. minor manpage fix. NSD 4.1.15 Feb 16, 2017 Bugfixes Fix nsd-control and ipv6 only. Squelch zone transfer error address family not supported by protocol at low verbosity levels. Fix #1195: Fix so that NSD fails on non-compliant values for Serial. Fix to rename _t typedefs because POSIX reserves them. Fix that nsec3 hash collisions only reported on verbosity level 3.
2018-02-09 19:52:53 +03:00
(rbnode_type*)node != RBTREE_NULL; \
node = (type)rbtree_next((rbnode_type*)node))
2017-01-07 22:41:59 +03:00
Import 4.8.0 (previous was 4.6.0) 29 November 2023: Wouter - Tag for 4.8.0rc1. 28 November 2023: Wouter - Set up doc/RELNOTES for upcoming release. - Fix unit test kill_from_pidfile function for nonexistent files because the argument is evaluated before the test expression. - Fix rr-test to also convert the contents of the just written output file. - Fix test set to remove -f nsd.db and rm nsd.db commands. - Fix test set to remove difffile option. 27 November 2023: Jeroen - Fix #14: Set timeout to 3s when servicing remaining TCP connections. - Fix: Always instate write handler after reading queries from TCP. - Answer first query on connections accepted just before reload. 27 November 2023: Wouter - Merge #305: faster stats. Statistics can be gathered while a reload is in progress. 27 November 2023: Willem - Merge #302: Test package fixes. Correct Auxfiles, kill_from_pidfile function and fix drop_updates, rr-test and xfr_update tests. 1 November 2023: Jeroen - Remove on-disk database. 31 October 2023: Wouter - Merge #301: improve the logging of ixfr fallbacks to axfr. 30 October 2023: Jeroen - Fix processing of consolidated IXFRs. 30 October 2023: Wouter - Fix for interprocess communication to set quit sync command from main process explicitly. 3 October 2023: Wouter - Merge #281: Proxy protocol. An implementation of PROXYv2 for NSD. It can be configured with proxy-protocol-port: portnum with the port number of the interface on which proxy traffic is handled. The interface can support proxy traffic for UDP, TCP and TLS. 21 September 2023: Wouter - Merge #295: Update e-mail addresses, add ref to support contracts 31 August 2023: Wouter - Fix autoconf 2.69 warnings in configure. 14 July 2023: Wouter - Merge #287: Update nsd.conf.5.in. 11 July 2023: Wouter - Fix unused variable warning in unit test of udb. 22 June 2023: Wouter - Fix #284: dnstap_collector.c: SOCK_NONBLOCK is not available on Mac/Darwin. 7 June 2023: Wouter - Merge #282: Improve nsd.conf man page. - Fix unused but set variable warning. - Fix #283: Compile failure in remote.c when --disable-bind8-stats and --without-ssl are specified. 31 May 2023: Wouter - Add missing items to doc/RELNOTES. - Tag for 4.7.0rc1. It became release 4.7.0 on 7 june 2023. The code repository continues with 4.7.1. 30 May 2023: Jeroen - Fix #240: Prefix messages originating from verifier. - Fix #275: Drop unnecessary root server checks. 30 May 2023: Wouter - Next version is 4.7.0, instead of 4.6.2, because of the added features, like TLS for DNSTAP. - Fix unused variable warning in unit test, from clang compile. 24 May 2023: Wouter - For #279: Note that autoreconf -fi creates the configure script and also the needed auxiliary files, for autoconf 2.69 and 2.71. 4 May 2023: Wouter - Fix to remove unused whitespace from acx_nlnetlabs.m4 and config.h. 1 May 2023: Wouter - make depend. - Fix for build to run flex and bison before compiling code that needs the headers. 13 April 2023: Wouter - Fix cirrus script for submit to coverity scan to libtoolize the configure script components config.guess and config.sub. - Fix readme status badge links. 28 March 2023: Wouter - Fix #273: Large TXT record breaks AXFR. - Fix ixfr create from adding too many record types. 16 March 2023: Wouter - Fix include brackets for ssl.h include statements, instead of quotes. - Fix static analyzer warning about nsd_event_method initialization. 15 March 2023: Wouter - Dnstap tls code fixes. 14 March 2023: Wouter - Fix dnstap to not check socket path when using IP address. - dnstap over TLS, default enabled. Configured with the options dnstap-tls, dnstap-tls-server-name, dnstap-tls-cert-bundle, dnstap-tls-client-key-file and dnstap-tls-client-cert-file. - Fix to compile without ssl with dnstap-tls code. 9 March 2023: Wouter - Fix #271: DNSTAP over TCP, with dnstap-ip: "127.0.0.1@3333". - Fix to clean more memory on exit of dnstap collector. 23 February 2023: Wouter - Fix #270: reserved identifier violation. 20 February 2023: Wouter - Merge #269 from Fale: Add systemd service unit. 16 February 2023: Wouter - Fix #266: Fix build with --without-ssl. - Fix #267: Allow unencrypted local operation of nsd-control. - Fix for #267: neater variable definitions. 2 February 2023: Wouter - Merge #265: Fix C99 compatibility issue. 30 January 2023: Wouter - Merge #263: Add bash autocompletion script for nsd-control. - Fix for #262: More error logging for SSL read failures for zone transfers. 27 January 2023: Wouter - Fix #262: Zone(s) not synchronizing properly via TLS. - Fix ixfr_and_restart test to wait for processes to come to a stop. 26 January 2023: Wouter - Fix configure for -Wstrict-prototypes. 10 November 2022: Wouter - Tag for NSD 4.6.1, the repository continues with version 4.6.2. - Fix #239: -Wincompatible-pointer-types warning in remote.c. - Fix unit tests to succeed with --disable-bind8-stats. 1 November 2022: Wouter - Fixup for non-trailing newline lexer change warnings. - Update doc/RELNOTES for changes. - Fix ixfr_gone unit test to not use system default zone list file. - Fix credns tests for vm usage, and not use system default zone list file. - Fix verify tests to use more portable bash location in script. - Fix verify_again test to use ipv4 address for test. 1 November 2022: Tom - Add SVCB dohpath support 28 September 2022: Jeroen - Set ALPN "dot" token during connection establishment as per RFC9103 section 7.1 (Thanks Cesar Kuroiwa). 21 September 2022: Tom - Change zone parsing to accept non-trailing newline. 1 September 2022: Wouter - Merge #231 from moritzbuhl: Fix checking if nonblocking sockets work on OpenBSD. 19 August 2022: Wouter - Update cirrus build script for newer Ubuntu image, and FreeBSD build with libtoolize to install auxiliary files. - Update to clang 14 in cirrus build test on Ubuntu Jammy 22.04. 7 July 2022: Tom - Fix #212: Change commandline control actions to always log. 1 July 2022: Wouter - Fix static analyzer reports, fix wrong log print when skipping xfr, fix to print error on pipe read fail, and assert an xfr is in progress during packet checks.
2024-02-17 20:31:21 +03:00
#endif /* RBTREE_H */