2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

68 Commits

Author SHA1 Message Date
Mark Andrews
2f51bb2d93 Check that ALPN is present when NO-DEFAULT-ALPN is present in fromwire 2021-08-19 07:10:00 +00:00
Mark Andrews
cd985d96e3 Add additional processing to HTTPS and SVBC records
The additional processing method has been expanded to take the
owner name of the record, as HTTPS and SVBC need it to process "."
in service form.

The additional section callback can now return the RRset that was
added.  We use this when adding CNAMEs.  Previously, the recursion
would stop if it detected that a record you added already exists.  With
CNAMEs this rule doesn't work, as you ultimately care about the RRset
at the target of the CNAME and not the presence of the CNAME itself.
Returning the record allows the caller to restart with the target
name.  As CNAMEs can form loops, loop protection was added.

As HTTPS and SVBC can produce infinite chains, we prevent this by
tracking recursion depth and stopping if we go too deep.
2021-08-18 13:49:48 +10:00
Mark Andrews
bc21015438 Add invalid test vectors 2021-08-18 13:49:48 +10:00
Mark Andrews
3e459b4808 add text vs unknown test vectors 2021-08-18 13:49:48 +10:00
Mark Andrews
36f34a3e79 Parse and print HTTPS and SVCB records 2021-08-18 13:49:48 +10:00
Mark Andrews
8510ccaa54 Update ZONEMD to match RFC 8976
* The location of the digest type field has changed to where the
  reserved field was.
* The reserved field is now called scheme and is where the digest
  type field was.
* Digest type 2 has been defined (SHA256).
2021-04-30 10:43:37 +10:00
Mark Andrews
07902d9f9d Test a LOC record with an invalid direction field 2021-02-19 09:17:32 +11:00
Michal Nowak
fa505bfb0e
Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
Mark Andrews
6293682020 Add the ability select individual tests to rdata_test 2020-10-01 08:21:42 +00:00
Evan Hunt
dcee985b7f update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
Mark Andrews
2ca4d35037 Refactor totext_loc 2020-08-26 15:31:31 +02:00
Mark Andrews
888dfd78c7 Check LOC's altitude field is properly parsed and encoded. 2020-08-26 15:31:31 +02:00
Mark Andrews
9225c67835 Tighten LOC parsing to reject period and/or m as a value. 2020-08-26 15:31:31 +02:00
Mark Andrews
78db46d746 Check walking the hip rendezvous servers.
Also fixes extraneous white space at end of record when
there are no rendezvous servers.
2020-07-24 04:15:56 +00:00
Evan Hunt
ba0313e649 fix spelling errors reported by Fossies. 2020-02-21 15:05:08 +11:00
Evan Hunt
e851ed0bb5 apply the modified style 2020-02-13 15:05:06 -08:00
Ondřej Surý
056e133c4c Use clang-tidy to add curly braces around one-line statements
The command used to reformat the files in this commit was:

./util/run-clang-tidy \
	-clang-tidy-binary clang-tidy-11
	-clang-apply-replacements-binary clang-apply-replacements-11 \
	-checks=-*,readability-braces-around-statements \
	-j 9 \
	-fix \
	-format \
	-style=file \
	-quiet
clang-format -i --style=format $(git ls-files '*.c' '*.h')
uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h')
clang-format -i --style=format $(git ls-files '*.c' '*.h')
2020-02-13 22:07:21 +01:00
Ondřej Surý
f50b1e0685 Use clang-format to reformat the source files 2020-02-12 15:04:17 +01:00
Mark Andrews
b3c1b2a869 exercise dns_rdata_checknames 2020-01-14 15:01:09 +11:00
Mark Andrews
649a34d628 exercise dns_rdata_additionaldata 2020-01-14 03:49:11 +00:00
Mark Andrews
5e74550740 call dns_rdata_towire on valid output from dns_rdata_fromtext and dns_rdata_fromwire 2020-01-14 03:49:11 +00:00
Michał Kępień
59528d0e9d Include <sched.h> where necessary for musl libc
All unit tests define the UNIT_TESTING macro, which causes <cmocka.h> to
replace malloc(), calloc(), realloc(), and free() with its own functions
tracking memory allocations.  In order for this not to break
compilation, the system header declaring the prototypes for these
standard functions must be included before <cmocka.h>.

Normally, these prototypes are only present in <stdlib.h>, so we make
sure it is included before <cmocka.h>.  However, musl libc also defines
the prototypes for calloc() and free() in <sched.h>, which is included
by <pthread.h>, which is included e.g. by <isc/mutex.h>.  Thus, unit
tests including "dnstest.h" (which includes <isc/mem.h>, which includes
<isc/mutex.h>) after <cmocka.h> will not compile with musl libc as for
these programs, <sched.h> will be included after <cmocka.h>.

Always including <cmocka.h> after all other header files is not a
feasible solution as that causes the mock assertion macros defined in
<isc/util.h> to mangle the contents of <cmocka.h>, thus breaking
compilation.  We cannot really use the __noreturn__ or analyzer_noreturn
attributes with cmocka assertion functions because they do return if the
tested condition is true.  The problem is that what BIND unit tests do
is incompatible with Clang Static Analyzer's assumptions: since we use
cmocka, our custom assertion handlers are present in a shared library
(i.e. it is the cmocka library that checks the assertion condition, not
a macro in unit test code).  Redefining cmocka's assertion macros in
<isc/util.h> is an ugly hack to overcome that problem - unfortunately,
this is the only way we can think of to make Clang Static Analyzer
properly process unit test code.  Giving up on Clang Static Analyzer
being able to properly process unit test code is not a satisfactory
solution.

Undefining _GNU_SOURCE for unit test code could work around the problem
(musl libc's <sched.h> only defines the prototypes for calloc() and
free() when _GNU_SOURCE is defined), but doing that could introduce
discrepancies for unit tests including entire *.c files, so it is also
not a good solution.

All in all, including <sched.h> before <cmocka.h> for all affected unit
tests seems to be the most benign way of working around this musl libc
quirk.  While quite an ugly solution, it achieves our goals here, which
are to keep the benefit of proper static analysis of unit test code and
to fix compilation against musl libc.
2019-07-30 21:08:40 +02:00
Ondřej Surý
52f98c5734 Rename mctx in dnstest.c to dt_mctx to prevent any global/local name clashes
The common construct seen in the BIND 9 source is func(isc_mem_t *mctx, ...).
Unfortunately, the dnstest.{h,c} has been using mctx as a global symbol, which
in turn generated a lot of errors when update.c got included in update_test.c.

As a rule of thumb, we should avoid naming global symbols with generic names
(like mctx) and we should prefix them with "namespace" (like dt_mctx).
2019-06-19 13:52:19 +02:00
Mark Andrews
1722728c80 enforce known SSHFP finger print lengths 2019-05-09 08:11:43 +10:00
Mark Andrews
b78e128a2f Add debug printfs 2019-04-11 19:19:46 +10:00
Mark Andrews
e73a5b0ce3 Prevent WIRE_INVALID() being called without a argument 2019-04-11 19:19:46 +10:00
Mark Andrews
b089f43b7a Check multi-line output from dns_rdata_tofmttext()
Check that multi-line output from dns_rdata_tofmttext() can be read
back in by dns_rdata_fromtext().
2019-04-11 19:19:46 +10:00
Mark Andrews
1a75a5cee6 Process master file comments and make input invalid again 2019-04-11 19:19:10 +10:00
Mark Andrews
36f30f5731 Add dns_rdata_totext() and dns_rdata_fromtext() to fromwire
Add dns_rdata_totext() and dns_rdata_fromtext() to fromwire for
valid inputs to ensure that what we accept in dns_rdata_fromwire()
can be written out and read back in.
2019-04-11 18:13:39 +10:00
Mark Andrews
6eb28eda1e add ds unit test 2019-04-10 13:37:03 +10:00
Mark Andrews
7b0a653858 check that from fromtext produces valid towire input 2019-04-10 11:13:52 +10:00
Mark Andrews
82d4931440 for rkey flags MUST be zero 2019-04-09 13:55:30 +10:00
Mark Andrews
2592e91516 check flags for no key in fromwire for *KEY 2019-04-09 13:55:30 +10:00
Mark Andrews
473987d8d9 Disallow empty ZONEMD hashes
This change is the result of discussions with the authors of
draft-wessels-dns-zone-digest.
2019-03-22 06:49:01 +11:00
Ondřej Surý
78d0cb0a7d Use coccinelle to remove explicit '#include <config.h>' from the source files 2019-03-08 15:15:05 +01:00
Mark Andrews
a9fadafecd fix AMTRELAY name 2019-02-08 13:54:13 +11:00
Mark Andrews
8d69e15988 add top of range checks 2019-02-08 09:37:00 +11:00
Evan Hunt
3183663dd4 Add support for ZONEMD 2019-02-07 12:34:14 -08:00
Mark Andrews
66922ee7af Add support for ATMRELAY 2019-02-07 10:28:19 -08:00
Mark Andrews
f2f7711977 add unit tests for dns_rdatatype_atcname, dns_rdatatype_atparent and iszonecutauth 2018-12-14 13:21:35 +11:00
Evan Hunt
bb5ed5a4ac convert rdata_test
- also added code to dnstest.c to optionally suppress printing of errors
  from dns_rdata_fromtxt()
2018-11-14 20:17:04 -08:00
Mark Andrews
cf83016682 compare_nxt compared records with identical next fields case insensitively 2018-10-30 14:51:39 +11:00
Mark Andrews
2ff57d8a39 Record types which support a empty rdata field were not handling the empty rdata field case. 2018-10-30 11:03:02 +11:00
Mark Andrews
fbab100426 Add support for EID and NIMLOC 2018-10-25 15:20:33 -07:00
Mark Andrews
f9ceddd8ca Add support for ATMA 2018-10-25 13:21:49 +11:00
Ondřej Surý
994e656977 Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
Mukund Sivaraman
b0d9198e03 Add NSEC3 fromtext/totext unittests 2018-06-04 12:21:48 +10:00
Michał Kępień
2980cbd55f Rename dns_test_rdata_fromstring() to dns_test_rdatafromstring()
Remove the underscore from "rdata_fromstring" so that all helper
functions for libdns tests use a common naming covention.
2018-05-09 13:14:24 +02:00
Michał Kępień
2a50fc324b Add a release note about dropping support for non-dotted-quad IPv4 addresses in master files
Support for non-dotted-quad IPv4 addresses in master files was dropped
when the inet_aton() call inside getquad() got replaced with a call to
inet_pton(), so a release note should have been added back then to
inform users that such syntax will no longer work.
2018-03-06 09:49:27 +01:00
Ondřej Surý
843d389661 Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00