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

52 Commits

Author SHA1 Message Date
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
Mark Andrews
1dc8208a89 silence %lu vs size_t warning by casting to (unsigned long) 2017-11-24 10:25:37 +11:00
Michał Kępień
910a01550a [master] Rename nsec3param_salt_totext() to dns_nsec3param_salttotext(), make it public, add unit tests
4786.	[cleanup]	Turn nsec3param_salt_totext() into a public function,
			dns_nsec3param_salttotext(), and add unit tests for it.
			[RT #46289]
2017-10-25 09:46:18 +02:00
Michał Kępień
c0f78692ee [master] Sync draft-durand-doa-over-dns snippet in lib/dns/tests/rdata_test.c with draft version -03 2017-10-09 10:52:50 +02:00
Michał Kępień
417218837e [master] Add support for DOA
4761.	[protocol]	Add support for DOA. [RT #45612]
2017-10-06 12:22:08 +02:00
Tinderbox User
b74e1c3b50 update copyright notice / whitespace 2017-08-01 23:46:29 +00:00
Michał Kępień
712825d755 [master] Refactor RDATA unit tests
4667.	[cleanup]	Refactor RDATA unit tests. [RT #45610]
2017-08-01 12:15:21 +02:00
Mark Andrews
df17290113 4468. [bug] Address ECS option handling issues. [RT #43191] 2016-09-14 08:22:15 +10:00
Mark Andrews
0c27b3fe77 4401. [misc] Change LICENSE to MPL 2.0. 2016-06-27 14:56:38 +10:00
Tinderbox User
a63461cc4b update copyright notice / whitespace 2016-03-23 23:45:22 +00:00
Evan Hunt
05b7b63f17 [master] more ECS handling fixes 2016-03-23 09:59:42 -07:00
Mark Andrews
f6e45a5c54 4217. [protocol] Add support for CSYNC. [RT #40532] 2015-09-18 23:45:12 +10:00
Tinderbox User
9ab5a7d83c update copyright notice / whitespace 2015-07-07 23:45:22 +00:00
Mark Andrews
ce67023ae3 4152. [func] Implement DNS COOKIE option. This replaces the
experimental SIT option of BIND 9.10.  The following
                        named.conf directives are avaliable: send-cookie,
                        cookie-secret, cookie-algorithm and nocookie-udp-size.
                        The following dig options are available:
                        +[no]cookie[=value] and +[no]badcookie.  [RT #39928]
2015-07-06 09:44:24 +10:00
Mark Andrews
2502a568e7 use smaller buffers 2013-10-26 20:36:17 +11:00
Mark Andrews
34416a7954 3663. [bug] Address bugs in dns_rdata_fromstruct and
dns_rdata_tostruct for WKS and ISDN types. [RT #34910]
2013-10-25 13:06:09 +11:00
Tinderbox User
63737247d1 update copyright notice 2013-09-05 23:46:16 +00:00