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

246 lines
7.0 KiB
C
Raw Normal View History

2017-01-07 22:41:59 +03:00
/*
* radtree -- generic radix tree for binary strings.
*
* Copyright (c) 2010, NLnet Labs. See LICENSE for license.
*/
#ifndef RADTREE_H
#define RADTREE_H
struct radnode;
struct region;
/** length of the binary string */
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 uint16_t radstrlen_type;
2017-01-07 22:41:59 +03:00
/**
* The radix tree
*
* The elements are stored based on binary strings(0-255) of a given length.
* They are sorted, a prefix is sorted before its suffixes.
* If you want to know the key string, you should store it yourself, the
* tree stores it in the parts necessary for lookup.
* For binary strings for domain names see the radname routines.
*/
struct radtree {
/** root node in tree */
struct radnode* root;
/** count of number of elements */
size_t count;
/** region for allocation */
struct region* region;
};
/**
* A radix tree lookup node.
* The array is malloced separately from the radnode.
*/
struct radnode {
/** data element associated with the binary string up to this node */
void* elem;
/** parent node (NULL for the root) */
struct radnode* parent;
/** index in the parent lookup array */
uint8_t pidx;
/** offset of the lookup array, add to [i] for lookups */
uint8_t offset;
/** length of the lookup array */
uint16_t len;
/** capacity of the lookup array (can be larger than length) */
uint16_t capacity;
/** the lookup array by [byte-offset] */
struct radsel* array;
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
/**
* radix select edge in array
*/
struct radsel {
/** additional string after the selection-byte for this edge. */
uint8_t* str;
/** length of the additional string for this edge */
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
radstrlen_type len;
2017-01-07 22:41:59 +03:00
/** node that deals with byte+str */
struct radnode* 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
} ATTR_PACKED;
2017-01-07 22:41:59 +03:00
/**
* Create new radix tree
* @param region: where to allocate the tree.
* @return new tree or NULL on alloc failure.
*/
struct radtree* radix_tree_create(struct region* region);
/**
* Init new radix tree.
* @param rt: radix tree to be initialized.
*/
void radix_tree_init(struct radtree* rt);
/**
* Delete intermediate nodes from radix tree
* @param rt: radix tree to be initialized.
*/
void radix_tree_clear(struct radtree* rt);
/**
* Delete radix tree.
* @param rt: radix tree to be deleted.
*/
void radix_tree_delete(struct radtree* rt);
/**
* Insert element into radix tree.
* @param rt: the radix tree.
* @param key: key string.
* @param len: length of key.
* @param elem: pointer to element data.
* @return NULL on failure - out of memory.
* NULL on failure - duplicate entry.
* On success the new radix node for this element.
*/
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
struct radnode* radix_insert(struct radtree* rt, uint8_t* k,
radstrlen_type len, void* elem);
2017-01-07 22:41:59 +03:00
/**
* Delete element from radix tree.
* @param rt: the radix tree.
* @param n: radix node for that element.
* if NULL, nothing is deleted.
*/
void radix_delete(struct radtree* rt, struct radnode* n);
/**
* Find radix element in tree.
* @param rt: the radix tree.
* @param key: key string.
* @param len: length of key.
* @return the radix node or NULL if not found.
*/
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
struct radnode* radix_search(struct radtree* rt, uint8_t* k,
radstrlen_type len);
2017-01-07 22:41:59 +03:00
/**
* Find radix element in tree, and if not found, find the closest smaller or
* equal element in the tree.
* @param rt: the radix tree.
* @param key: key string.
* @param len: length of key.
* @param result: returns the radix node or closest match (NULL if key is
* smaller than the smallest key in the tree).
* @return true if exact match, false if no match.
*/
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 radix_find_less_equal(struct radtree* rt, uint8_t* k, radstrlen_type len,
2017-01-07 22:41:59 +03:00
struct radnode** result);
/**
* Return the first (smallest) element in the tree.
* @param rt: the radix tree.
* @return: first node or NULL if none.
*/
struct radnode* radix_first(struct radtree* rt);
/**
* Return the last (largest) element in the tree.
* @param rt: the radix tree.
* @return: last node or NULL if none.
*/
struct radnode* radix_last(struct radtree* rt);
/**
* Return the next element.
* @param n: the element to go from.
* @return: next node or NULL if none.
*/
struct radnode* radix_next(struct radnode* n);
/**
* Return the previous element.
* @param n: the element to go from.
* @return: prev node or NULL if none.
*/
struct radnode* radix_prev(struct radnode* n);
/*
* Perform a walk through all elements of the tree.
* node: variable of type struct radnode*.
* tree: pointer to the tree.
* for(node=radix_first(tree); node; node=radix_next(node))
*/
/**
* Create a binary string to represent a domain name
* @param k: string buffer to store into
* @param len: output length, initially, the max, output the result.
* @param dname: the domain name to convert, in wireformat.
* @param dlen: length of space for dname.
*/
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
void radname_d2r(uint8_t* k, radstrlen_type* len, const uint8_t* dname,
2017-01-07 22:41:59 +03:00
size_t dlen);
/**
* Convert a binary string back to a domain name.
* @param k: the binary string.
* @param len: length of k.
* @param dname: buffer to store domain name into.
* @param dlen: length of dname (including root label).
*/
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
void radname_r2d(uint8_t* k, radstrlen_type len, uint8_t* dname, size_t* dlen);
2017-01-07 22:41:59 +03:00
/**
* Search the radix tree using a domain name.
* The name is internally converted to a radname.
* @param rt: tree
* @param d: domain name, no compression pointers allowed.
* @param max: max length to go from d.
* @return NULL on parse error or if not found.
*/
struct radnode* radname_search(struct radtree* rt, const uint8_t* d,
size_t max);
/**
* Find radix element in tree by domain name, and if not found,
* find the closest smaller or equal element in the tree.
* The name is internally converted to a radname (same sorting order).
* @param rt: the radix tree.
* @param d: domain name, no compression pointers allowed.
* @param max: max length to go from d.
* @param result: returns the radix node or closest match (NULL if key is
* smaller than the smallest key in the tree).
* could result in NULL on a parse error as well (with return false).
* @return true if exact match, false if no match.
*/
int radname_find_less_equal(struct radtree* rt, const uint8_t* d, size_t max,
struct radnode** result);
/**
* Insert radix element by domain name.
* @param rt: the radix tree
* @param d: domain name, no compression pointers.
* @param max: max length from d.
* @param elem: the element pointer to insert.
* @return NULL on failure - out of memory.
* NULL on failure - duplicate entry.
* NULL on failure - parse error.
* On success the radix node for this element.
*/
struct radnode* radname_insert(struct radtree* rt, const uint8_t* d,
size_t max, void* elem);
/**
* Delete element by domain name from radix tree.
* @param rt: the radix tree.
* @param d: the domain name. If it is not in the tree nothing happens.
* @param max: max length.
*/
void radname_delete(struct radtree* rt, const uint8_t* d, size_t max);
/** number of bytes in common in strings */
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
radstrlen_type bstr_common_ext(uint8_t* x, radstrlen_type xlen, uint8_t* y,
radstrlen_type ylen);
2017-01-07 22:41:59 +03:00
/** true if one is prefix of the other */
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 bstr_is_prefix_ext(uint8_t* p, radstrlen_type plen, uint8_t* x,
radstrlen_type xlen);
2017-01-07 22:41:59 +03:00
#endif /* RADTREE_H */