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

46 Commits

Author SHA1 Message Date
Ondřej Surý
a011d42211 Add new isc_managers API to simplify <*>mgr create/destroy
Previously, netmgr, taskmgr, timermgr and socketmgr all had their own
isc_<*>mgr_create() and isc_<*>mgr_destroy() functions.  The new
isc_managers_create() and isc_managers_destroy() fold all four into a
single function and makes sure the objects are created and destroy in
correct order.

Especially now, when taskmgr runs on top of netmgr, the correct order is
important and when the code was duplicated at many places it's easy to
make mistake.

The former isc_<*>mgr_create() and isc_<*>mgr_destroy() functions were
made private and a single call to isc_managers_create() and
isc_managers_destroy() is required at the program startup / shutdown.
2021-05-07 10:19:05 -07:00
Michal Nowak
fa505bfb0e
Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
Evan Hunt
dcee985b7f update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
Witold Kręcicki
4a8d9250cf tests: fix isc/socket_test.c teardown
In case of a test failure we weren't tearing down sockets and tasks
properly, causing the test to hang instead of failing nicely.
2020-06-03 13:16:28 +02:00
Witold Krecicki
0fe149b2fa Fix lib/isc/tests/socket_test hangs 2020-02-20 11:39:15 +01: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
Ondřej Surý
23964dbbbc Change the shared completion->done variable to atomic_bool in socket_test.c 2019-11-17 09:38:36 +08:00
Ondřej Surý
8de64964a3 Refactor the way we use memory context from isctest.c
This commit renames isctest {mctx,lctx} to test_{mctx,lctx} and cleans
up their usage in the individual unit tests.  This allows embedding
library .c files directly into the unit tests.
2019-11-13 14:47:47 +01: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ý
78d0cb0a7d Use coccinelle to remove explicit '#include <config.h>' from the source files 2019-03-08 15:15:05 +01:00
Mark Andrews
76a1c1531a assert result is ISC_R_SUCCESS 2019-02-19 07:57:14 +11:00
Witold Kręcicki
5f81aa10bc Use proper casting in socket unit test 2018-11-19 17:40:34 +01:00
Joey
9eea00cd3c convert socket_test; remove ATF from lib/isc/tests 2018-11-14 20:17:04 -08:00
Ondřej Surý
b2b43fd235 Turn (int & flag) into (int & flag) != 0 when implicitly typed to bool 2018-11-08 12:21:53 +07:00
Ondřej Surý
7b21bbb7c1 Require IPv6 support from the OS 2018-08-28 10:31:47 +02:00
Ondřej Surý
00ca487fec We always want IPv6 2018-08-28 10:31:47 +02:00
Witold Kręcicki
5cdb38c2c7 Remove unthreaded support 2018-08-16 17:18:52 +02:00
Ondřej Surý
994e656977 Replace custom isc_boolean_t with C standard bool type 2018-08-08 09:37:30 +02:00
Mark Andrews
6bff1768cf ISC_SOCKEVENTATTR_TRUNC was not be set 2018-05-18 15:34:48 +10:00
Evan Hunt
e2b8699df9 migrate t_timers to lib/isc/tests/timer_test 2018-03-09 14:12:49 -08: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
Tinderbox User
3d2a6c9949 update copyright notice / whitespace 2018-01-16 23:45:57 +00:00
Michał Kępień
73819362d8 [master] Simplify handling isc_socket_sendto2() return values when flags == 0
4865.	[cleanup]	Simplify handling isc_socket_sendto2() return values.
			[RT #46986]
2018-01-16 08:33:30 +01:00
Evan Hunt
114f95089c [master] cleanup strcat/strcpy
4722.	[cleanup]	Clean up uses of strcpy() and strcat() in favor of
			strlcpy() and strlcat() for safety. [RT #45981]
2017-09-13 00:14:37 -07:00
Evan Hunt
8eb88aafee [master] add libns and remove liblwres
4708.   [cleanup]       Legacy Windows builds (i.e. for XP and earlier)
                        are no longer supported. [RT #45186]

4707.	[func]		The lightweight resolver daemon and library (lwresd
			and liblwres) have been removed. [RT #45186]

4706.	[func]		Code implementing name server query processing has
			been moved from bin/named to a new library "libns".
			Functions remaining in bin/named are now prefixed
			with "named_" rather than "ns_".  This will make it
			easier to write unit tests for name server code, or
			link name server functionality into new tools.
			[RT #45186]
2017-09-08 13:47:34 -07:00
Mark Andrews
0c27b3fe77 4401. [misc] Change LICENSE to MPL 2.0. 2016-06-27 14:56:38 +10:00
Mark Andrews
27deca2bf0 don't mix IPv4 and IPv6 capability bits 2015-12-17 08:17:00 +11:00
Curtis Blackburn
9effea437d [rt41269] additional tests for dig and delv,
fix for --disable-ipv6 on osx,
              fixes for tests with --disable-ipv6
2015-12-15 11:58:28 -08:00
Mark Andrews
94c7301f6f 4279. [test] Don't use fixed ports when unit testing. [RT #41194] 2015-12-15 12:50:32 +11:00
Evan Hunt
bcae9a15c1 [master] s/the the/the/ 2015-08-27 14:11:27 -07:00
Francis Dupont
3759f10fc5 added print.h includes, updated copyrights 2015-05-23 14:21:51 +02:00
Tinderbox User
cc2a515684 update copyright notice 2014-03-04 23:46:15 +00:00
Evan Hunt
b454c03196 [master] use ANSI prototypes, clean up some casts 2014-03-04 10:42:25 -08:00
Mark Andrews
45b727f651 silence coverity warnings 2013-04-11 17:07:50 +10:00
Mark Andrews
22b5363195 printf -> fprintf 2013-03-26 16:40:14 +11:00
Tinderbox User
313b0ea9f2 update copyright notice 2013-03-23 23:46:06 +00:00
Evan Hunt
cd594861c2 [master] add missing include 2013-03-22 14:50:22 -07:00
Evan Hunt
67adc03ef8 [master] add DSCP support
3535.	[func]		Add support for setting Differentiated Services Code
			Point (DSCP) values in named.  Most configuration
			options which take a "port" option (e.g.,
			listen-on, forwarders, also-notify, masters,
			notify-source, etc) can now also take a "dscp"
			option specifying a code point for use with
			outgoing traffic, if supported by the underlying
			OS. [RT #27596]
2013-03-22 14:05:33 -07:00
Tinderbox User
5fa46bc916 update copyright notice 2012-03-10 23:45:53 +00:00
Mark Andrews
28a8f5b0de set $Id$ 2012-03-08 00:21:15 +11:00
Mark Andrews
23daf8948b 3225. [bug] Silence spurious "setsockopt(517, IPV6_V6ONLY) failed"
messages. [RT #26507]
2011-11-29 01:03:47 +00:00
Evan Hunt
8a2ab2b920 3150. [func] Improved startup and reconfiguration time by
enabling zones to load in multiple threads. [RT #25333]
2011-09-02 21:15:39 +00:00
Automatic Updater
2f17ad4545 update copyright notice 2011-07-28 23:47:59 +00:00
Evan Hunt
f07b2fccaf 3137. [func] Improve hardware scalability by allowing multiple
worker threads to process incoming UDP packets.
			This can significantly increase query throughput
			on some systems.  [RT #22992]
2011-07-28 04:04:37 +00:00