diff --git a/README b/README index 69163ac048b10c319e6d5ac8c4a9aca853026fa7..d50168ff31d17b9c025c29cb1a8ad48fb52633ef 100644 --- a/README +++ b/README @@ -40,7 +40,7 @@ $ sudo dpkg -i liburcu0_0.5.4-1_amd64.deb $ sudo dpkg -i liburcu-dev_0.5.4-1_amd64.deb # Go for the real thing -$ git clone git://git.nic.cz/knot +$ git clone git://git.nic.cz/knot-dns.git $ cd knot $ autoreconf -if $ ./configure @@ -75,6 +75,10 @@ $ autoreconf -if $ ./configure $ make && sudo make install +It is also present in port tree, so you can install it from there. +$ cd /usr/ports/dns/knot +$ sudo make install + Installation on OpenBSD/NetBSD ============================== Also works for OS X, if you don't want to install gcc from ports. @@ -82,6 +86,7 @@ Prerequisites: - liburcu needs patch for absent compiler TLS capability - patch is located in "scripts/urcu-tls-compat.patch" - patch compatible with liburcu-0.6.7 +- liburcu >= 0.7.0 works out of the box $ mkdir liburcu && cd liburcu $ wget "http://lttng.org/files/urcu/userspace-rcu-0.6.7.tar.bz2" @@ -124,6 +129,10 @@ is '-c' that specifies config file for our server. Compiled zones are saved to storage defined in 'storage' variable in configuration. $ knotc -h # see what it can do + +Copy zone to the specified directory and compile. + +$ mkdir -p /tmp/knot-minimal/samples; cp samples/example.com.zone /tmp/knot-minimal/samples/ $ knotc -c myserver.conf compile # compile zone files to binary format Third, lets load server. You can do this by running 'knotd' directly, or with diff --git a/doc/configuration.texi b/doc/configuration.texi index d9866c5312bbd3e6056166fc8f2a7e55a487ff1f..7c28ef66b77ebd93c59f1b2901212b8a1c34a0c4 100644 --- a/doc/configuration.texi +++ b/doc/configuration.texi @@ -39,7 +39,9 @@ log @{ zones @{ example.com @{ - file "/etc/knot/example.com"; + file "/etc/knot/example.com"; + semantic-checks off; + ixfr-from-differences off; @} @} @@ -65,13 +67,21 @@ port 53, which is the default port for the DNS. The @code{@ref{log}} statement defines the destination where Knot DNS will send it's log messages. In this example we told Knot DNS to send its log messages with priority @code{debug}, @code{warning} and -@code{notice} into the syslog. +@code{notice} into the syslog. If you omit this sections, all levels +will printed to either @code{stdout} or @code{stderr}, and the levels +from the @code{warning} and more serious to syslog. You can find all +possible combinations in the @ref{log}. @item The @code{@ref{zones}} statement is the one probably most important, because it defines the zones Knot DNS will serve. In its most simple form you define zone by it's name and defined the filename where Knot -DNS can find the zone contents. +DNS can find the zone contents. You can turn on more detailed semantic +checks of zone file in this statement. Refer to @code{@ref{zones List of zone semantic checks}} to see +which checks are enabled by default and which are optional. If Knot is +being run as a master server, experimental feature @code{ixfr-from-differences} +can be enabled to create IXFR changesets from changest made to master zone file. +See @ref{Controlling running daemon} for more information. @end enumerate @node Slave configuration diff --git a/doc/installation.texi b/doc/installation.texi index 06cce6b5404fb34f017842df135640b6735aec82..4e07af432c53ca9195a35ea5f0f74e9cbbb818c0 100644 --- a/doc/installation.texi +++ b/doc/installation.texi @@ -20,6 +20,8 @@ Knot DNS build system relies on standard tools: @item make @item +libtool +@item autoconf >= 2.65 @item flex >= 2.5.31 @@ -80,6 +82,9 @@ OpenBSD,NetBSD and OS X platforms are supported from version 0.7.0. @node Installation from the sources @section Installation from the sources +You can find the source files for the latest release on @url{www.knot-dns.cz}. +Alternatively, you can fetch the sources from git repository @url{git://git.nic.cz/knot-dns.git} + After unpacking the sources, the compilation and installation is a quite straightforward process using autotools. @@ -105,13 +110,18 @@ support, you can disable that by @command{./configure --enable-lto=no}. If you want to add debug messages, there are two steps to do that. First you have to enable modules, that you are interested in. -Available are: server, zones, xfr, packet, dname, rr, ns, hash, compiler. +Available are: @code{server, zones, xfr, packet, dname, rr, ns, hash, compiler}. You can combine multiple modules as a comma-separated list. -For example: @command{./configure --enable-debug=server,packet} - Then you can narrow the verbosity of the debugging message by specifying the -verbosity as brief, verbose or details. -For example: @command{./configure --enable-debuglevel=verbose}. +verbosity as @code{brief, verbose, details}. +For example: +@example +$ ./configure --enable-debug=server,packet --enable-debuglevel=brief +$ ./configure --enable-debug=server,packet --enable-debuglevel=verbose +@end example + + +For example: @command{}. In most simple case you can just run configure without any options. @@ -244,12 +254,26 @@ in the future, when new version are released. @node Installing Knot DNS RPMs on Fedora @subsection Installing Knot DNS RPMs on Fedora -There are currently no official RPMs. -[TODO] +There are RPM packages for @code{knot} available for i386 and amd64 targets. +If you want use the Fedora repository, add a file with the +following lines into @file{/etc/yum.repos.d/} + +@example +[knot] +name=Network.CZ Repository +baseurl=ftp://repo.network.cz/pub/redhat/ +enabled=1 +gpgcheck=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-network.cz +@end example @node Installing Knot DNS from ports on FreeBSD @subsection Installing Knot DNS from ports on FreeBSD -There is currently no official port on FreeBSD. -[TODO] +Knot DNS is in ports tree under @code{dns/knot}. + +@example +$ cd /usr/ports/dns/knot +$ sudo make install +@end example diff --git a/doc/introduction.texi b/doc/introduction.texi index 88d1ecc888693d825f2bba51b9b60aad77db8307..e7bb0db718267130a900baa461017f788c394bd8 100644 --- a/doc/introduction.texi +++ b/doc/introduction.texi @@ -6,43 +6,65 @@ Domain Name System. @menu * What is Knot DNS:: -* Scope of Document:: -* Conventions Used in This Document:: +* Knot DNS features:: +* Scope of this document:: @end menu @node What is Knot DNS @section What is Knot DNS -Knot DNS implements a domain name server. It implements only -authoritative domain name service and can be used to serve DNS -zones in the Internet. +Knot DNS is a high-performance open source DNS server. It +implements only authoritative domain name service. Knot DNS +is best suited for use on TLD domains but can reliably serve +any other zone as well. -Knot DNS supports following features: +Knot DNS benefits from its multi-threaded and mostly lock-free +implementation which allow it to scale well on SMP systems and +operate non-stop even when adding or removing zones. -@multitable @columnfractions 1 -@item -TCP/UDP -@item -AXFR -@item -IXFR -@item -TSIG -@item -... -@end multitable +@node Knot DNS features +@section Knot DNS features -@node Scope of Document -@section Scope of Document +Knot DNS supports the following DNS features: -This document covers the basic information on installing, -configuring and troubleshooting the Knot DNS server. We have -also dedicated a chapter for users of other DNS server -implementations where describe how to migrate their -configuration to Knot DNS. +@itemize +@item TCP/UDP protocols +@item AXFR - master, slave +@item IXFR - master (primary master experimental), slave +@item TSIG +@item ENDS0 +@item DNSSEC, including NSEC3 +@item NSID +@item Unknown RR types +@end itemize + +@* +Server features: + +@itemize +@item Adding/removing zones on-the-fly +@item Reconfiguring server instance on-the-fly +@item IPv4 / IPv6 support +@item Semantic checks of zones +@end itemize + +@* +For more info and downloads see +@url{http://www.knot-dns.cz, www.knot-dns.cz}. -@node Conventions Used in This Document -@section Conventions Used in This Document +Git repository: +@url{git://git.nic.cz/knot-dns.git, git://git.nic.cz/knot-dns.git} -[TODO]: +Knot DNS issue tracker: +@url{https://git.nic.cz/redmine/projects/knot-dns, +git.nic.cz/redmine/projects/knot-dns} + +Knot DNS users mailing list: +@url{mailto:knot-dns-users@@lists.nic.cz, knot-dns-users@@lists.nic.cz} + +@node Scope of this document +@section Scope of this document + +This document covers the basic information on installing, +configuring and troubleshooting the Knot DNS server. diff --git a/doc/knot.texi b/doc/knot.texi index 06728e10be23b1c3678c9762198b0e19bc8442f1..95482134c94c1b267eb61db55cc48fa4c7468793 100644 --- a/doc/knot.texi +++ b/doc/knot.texi @@ -4,6 +4,8 @@ @documentencoding utf-8 @settitle Knot DNS @value{VERSION} +@paragraphindent 0 + @defindex st @syncodeindex vr st @@ -38,6 +40,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. @title Knot DNS Reference Manual @subtitle for version @value{VERSION}, @value{UPDATED} @author Ondrej Sury (@email{ondrej@@sury.org}) +@author Marek Vavrusa (@email{marek.vavrusa@@nic.cz}) +@author Lubos Slovak (@email{lubos.slovak@@nic.cz}) +@author Jan Kadlec (@email{jan.kadlec@@nic.cz}) @page @vskip 0pt plus 1filll @insertcopying @@ -58,11 +63,9 @@ This manual is for Knot DNS (version @value{VERSION}, @value{UPDATED}). * Knot DNS Installation:: * Knot DNS Configuration:: * Running Knot DNS:: -* Security Considerations:: * Troubleshooting:: * Statement Index:: * Knot DNS Configuration Reference:: -* Migration for other DNS servers:: @detailmenu --- The Detailed Node Listing --- @@ -70,15 +73,15 @@ This manual is for Knot DNS (version @value{VERSION}, @value{UPDATED}). Introduction * What is Knot DNS:: -* Scope of Document:: -* Conventions Used in This Document:: +* Knot DNS features:: +* Scope of this document:: Knot DNS Resource Requirements -* Hardware Requirements:: -* CPU Requirements:: -* Memory Requirements:: -* Supported Operating System:: +* Hardware requirements:: +* CPU requirements:: +* Memory requirements:: +* Supported operating system:: Knot DNS Installation @@ -124,12 +127,23 @@ Sample Configurations Running Knot DNS -* +* Running a slave server:: +* Running a master server:: +* Controlling running daemon:: Troubleshooting -* General troubleshooting:: -* Generating backtrace:: +* Submitting a bugreport:: +* Generating backtrace:: +* Debug messages:: + +Debug messages + +* Enabling debug messages in server:: + +Enabling debug messages in server + +* Example:: Knot DNS Configuration Reference @@ -184,21 +198,14 @@ Statement Definition and Usage @code{zones} Statement * zones Syntax:: -* zones Semantic checks:: * zones Statement Definition and Grammar:: +* zones List of zone semantic checks:: @code{log} Statement * log Syntax:: * log Statement Definition and Grammar:: -Migration for other DNS servers - -* Knot DNS for BIND users:: -* Knot DNS for NSD users:: -* Knot DNS for PowerDNS users:: -* Knot DNS for djbdns users:: - @end detailmenu @end menu @@ -210,13 +217,11 @@ Migration for other DNS servers @include configuration.texi @include running.texi @include troubleshooting.texi -@include security.texi @c indices @include indices.texi @c appendixes @include reference.texi -@include migration.texi @bye diff --git a/doc/reference.texi b/doc/reference.texi index 7ab812be6d974bae1bee553f874e596ea7bac112..e34fd9a6893bdcfb0856e504f2fa97e824891718 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -1,4 +1,4 @@ -@node Knot DNS Configuration Reference, Migration for other DNS servers, Statement Index, Top +@node Knot DNS Configuration Reference, , Statement Index, Top @appendix Knot DNS Configuration Reference This reference describe every configuration option in Knot DNS. @@ -338,6 +338,7 @@ server for different zone. @menu * remotes Syntax:: * remotes Statement Definition and Grammar:: +* remotes Examples:: @end menu @node remotes Syntax @@ -360,6 +361,70 @@ server for different zone. @node remotes Statement Definition and Grammar @subsection Statement Definition and Grammar +@menu +* remote_id:: +* address:: +* port:: +* key:: +* via:: +@end menu + +@node remote_id +@subsubsection @kbd{remote_id} +@vindex remote_id + +@kbd{remote_id} contains a symbolic name for a remote server. + +@node address +@subsubsection address +@vindex address + +@kbd{address} sets an IPv4 or IPv6 address for this particular @code{remote}. + +@node port +@subsubsection port +@vindex port + +@code{port} section contains a port number for current @code{remote}. This section is optional with default port set to 53. + +@node key +@subsubsection key +@vindex key + +@code{key} section contains a key associated with this @code{remote}. This section is optional. + + +@node via +@subsubsection via +@vindex via + +@code{via} section specifies which interface will be used to comunnicate with this @code{remote}. This section is optional. + +@node remotes Examples +@subsection remotes Examples + +@example + +remotes @{ + + # Format 1: + server0 @{ + address 127.0.0.1; + port 53531; + key key0.server0; + via ipv4; + via 82.35.64.59; # IPv4 + via [::cafe]; # IPv6 + @} + + # Format 2: + server1 @{ + address 127.0.0.1@@53001; + @} +@} + +@end example + @node zones @section @code{zones} Statement @@ -367,8 +432,9 @@ The @code{zones} statement contains definition of zones served by Knot DNS. @menu * zones Syntax:: -* zones Semantic checks:: -* zones Statement Definition and Grammar:: +* zones Statement Definition and Grammar:: +* zones Example:: +* zones List of zone semantic checks:: @end menu @node zones Syntax @@ -389,16 +455,159 @@ The @code{zones} statement contains definition of zones served by Knot DNS. @kbd{zone_options} := [ @code{semantic-checks} @kbd{boolean}@code{;} ] + [ @code{ixfr-from-differences} @kbd{boolean}@code{;} ] [ @code{disable-any} @kbd{boolean}@code{;} ] [ @code{notify-timeout} @kbd{integer}@code{;} ] [ @code{notify-retries} @kbd{integer}@code{;} ] [ @code{zonefile-sync} ( @kbd{integer} | @kbd{integer}(@code{s} | @code{m} | @code{h} | @code{d})@code{;} ) ] [ @code{ixfr-fslimit} ( @kbd{integer} | @kbd{integer}(@code{k} | @code{M} | @code{G}) )@code{;} ] + [ @code{ixfr-from-differences} @kbd{boolean}@code{;} ] +@end example + +@node zones Statement Definition and Grammar +@subsection Statement Definition and Grammar + +@menu +* zone_id:: +* file:: +* xfr-in:: +* xfr-out:: +* notify-in:: +* notify-out:: +* semantic-checks:: +* ixfr-from-differences:: +* disable-any:: +* notify-timeout:: +* notify-retries:: +* zonefile-sync:: +* ixfr-fslimit:: +@end menu + +@node zone_id +@subsubsection @kbd{zone_id} +@vindex zone_id + +@code{zone_id} is zone origin, and as such is a domain name that may or may not end with a ".". +If no $ORIGIN directive is inside actual zone file, this domain name will be used in place of "@@". + +@node file +@subsubsection file +@vindex file + +After @code{file} statement comes path to zone file. You can use either full or relative path, with relative +path's origin in @ref{storage} directory. + +@node xfr-in +@subsubsection xfr-in +@vindex xfr-in + +In @code{xfr-in} statement user specifies which remotes will be permited to perform a zone transfer to update the zone. +Remotes are defined in @ref{remotes}. + +@node xfr-out +@subsubsection xfr-out +@vindex xfr-out + +In @code{xfr-out} statement user specifies which remotes will be permited to obtain zone's contents via zone transfer. +Remotes are defined in @ref{remotes}. + +@node notify-in +@subsubsection notify-in +@vindex notify-in + +@code{notify-in} defines which remotes will be permited to send NOTIFY for this particular zone. + +@node notify-out +@subsubsection notify-out +@vindex notify-out + +@code{notify-out} defines to which remotes will your server send NOTIFYs about this particular zone. +@node semantic-checks +@subsubsection semantic-checks +@vindex semantic-checks + +@code{semantic-checks} statement turns on optional semantic checks for this particular zone. +See @ref{zones List of zone semantic checks} for more information. Possible values are @code{on} and @code{off}. +Disabled by default. + +@node ixfr-from-differences +@subsubsection ixfr-from-differences +@vindex ixfr-from-differences + +EXPERIMENTAL: @code{ixfr-from-differences} is only relevant if you are running Knot as a master for this zone. +By turning this on you will tell Knot to create changesets from changes you made to a zone file upon server reload. +See @ref{Controlling running daemon} for more information. Possible values are @code{on} and @code{off}. Disabled by default. + +@node disable-any +@subsubsection disable-any +@vindex disable-any + +If you enable @code{disable-any}, all ANY queries over UDP will be answered with empty response and with the TC bit set. +Use to minimize risk of DNS replay attack. Disabled by default. + +@node notify-timeout +@subsubsection notify-timeout +@vindex notify-timeout + +@code{notify-timeout} in seconds specifies how long will server wait for NOTIFY response. Possible values are 1 to INT_MAX. +Default value is 60 seconds. + +@node notify-retries +@subsubsection notify-retries +@vindex notify-retries + +@code{notify-retries} tells the server how many times it can retry to send a NOTIFY. Possible values +are 1 to INT_MAX and default value is 5. + +@node zonefile-sync +@subsubsection zonefile-sync +@vindex zonefile-sync + +@code{zonefile-sync} is only relevant in slave server scenario. It is a time after which current zone in memory will be synced +to its file on a disk (as set in @ref{file}). Possible values are 1 to INT_MAX, optionally suffixed by unit size (s/m/h/d) - 1s is one socond, 1m one minute, 1h one hour and 1d one day with default value set to 1h. + +@node ixfr-fslimit +@subsubsection ixfr-fslimit +@vindex ixfr-fslimit + +@code{ixfr-fslimit} sets a maximum size for zone's journal. Possible values are 1 to INT_MAX, with optional suffixes k, m and G. I.e. 1k, 1m and 1G with default value not being set, meaning that journal file can grow without limitations. + +@node zones Example +@subsection zones Example + +@example +@group +zones @{ + + # Shared options for all listed zones + ixfr-from-differences off; + semantic-checks off; + disable-any off; + notify-timeout 60; + notify-retries 5; + zonefile-sync 1h; + ixfr-fslimit 1G; + example.com @{ + file "samples/example.com.zone"; + ixfr-from-differences off; #experimental + disable-any off; + semantic-checks on; + notify-timeout 60; + notify-retries 5; + zonefile-sync 1h; + xfr-in server0; + xfr-out server0, server1; + notify-in server0; + notify-out server0, server1; + @} +@} + +@end group @end example -@node zones Semantic checks -@subsection List of zone semantic checks +@node zones List of zone semantic checks +@subsection List of zone semantic checks The @code{semantic-checks} statement turns on extra zone file semantic checks on. Several checks are enabled on default and cannot be turned @@ -439,27 +648,113 @@ loaded even upon discovering an error: - Wrong key flags or wrong key in RRSIG record @end example -@node zones Statement Definition and Grammar -@subsection Statement Definition and Grammar - @node log @section @code{log} Statement @stindex log @menu * log Syntax:: -* log Statement Definition and Grammar:: +* log Statement Definition and Grammar:: +* log Example:: @end menu @node log Syntax @subsection Syntax +@example +@code{log} @code{@{} + @kbd{log_name} @code{@{} + [ @kbd{category} @kbd{severity} [ @kbd{severity} @dots{} ]@code{;} ] + [ @code{log_file} @kbd{filename} @{ + [ @kbd{category} @kbd{severity} [ @kbd{severity} @dots{} ]@code{;} ] + @} ] + @code{@}} +@code{@}} + +@end example + @node log Statement Definition and Grammar @subsection Statement Definition and Grammar +@menu +* log_name:: +* category:: +* severity:: +* log_file:: +@end menu + The @code{log} statement configures logging output of Knot DNS. You -can configure Knot DNS to log into file or system log. Each log -message has it's priority and you can configure priorities for each +can configure Knot DNS to log into file or system log. There are several +logging categories to choose from. Each log +message has its priority and you can configure priorities for each log destination. +@node log_name +@subsubsection @kbd{log_name} +@vindex @kbd{log_name} + +@kbd{log_name} recognizes 3 symbolic log names : +@itemize +@item @emph{stdout} - logging to standard output +@item @emph{stderr} - logging to standard error output +@item @emph{syslog} - logging to syslog +@end itemize + +@node category +@subsubsection @kbd{category} +@vindex category + +Knot DNS allows user to choose from these logging categories: + +@itemize +@item @emph{server} - Messages related to general operation of the server. +@item @emph{zone} - Messages related to zones, zone parsing and loading. +@item @emph{answering} - Messages regarding query processing and response creation. +@item @emph{any} - All categories. +@end itemize + +@node severity +@subsubsection @kbd{severity} +@vindex severity + +Knot DNS has the following logging severities: +@itemize +@item @emph{debug} - Debug messages, must be turned on at compile time (@pxref{Enabling debug messages in server}). +@item @emph{info} - Informational message. +@item @emph{notice} - Server notices and hints. +@item @emph{warning} - Warnings that might require user action. +@item @emph{error} - Recoverable error. Action should be taken. +@item @emph{all} - All severities. +@end itemize + +@node log_file +@subsubsection @kbd{log_file} +@vindex @kbd{log_file} + +@kbd{log_file} is either absolute or relative path to file user wants to log to. +See following example for clarification. + +@node log Example +@subsection log Example + +@example + +log @{ + + syslog @{ + any error; + zone warning, notice; + server info; + @} + + stderr @{ + any error, warning; + @} + + file "/tmp/knot-sample/knotd.debug" @{ + server debug; + @} +@} + +@end example diff --git a/doc/requirements.texi b/doc/requirements.texi index dd8e442839dd022506724601987c49d10ec2ece3..b030bb2654e61883892e9c7aa41b2f67371c5b80 100644 --- a/doc/requirements.texi +++ b/doc/requirements.texi @@ -2,14 +2,14 @@ @chapter Knot DNS Resource Requirements @menu -* Hardware Requirements:: -* CPU Requirements:: -* Memory Requirements:: -* Supported Operating System:: +* Hardware requirements:: +* CPU requirements:: +* Memory requirements:: +* Supported operating system:: @end menu -@node Hardware Requirements -@section Hardware Requirements +@node Hardware requirements +@section Hardware requirements Knot DNS requirements are not very demanding for typical installations, and a comodity server or virtualized solution @@ -22,16 +22,16 @@ cases include deployment for a large number of zones (DNS hosting), a large number of records in one or more zones (TLD) or large number of requests. -@node CPU Requirements -@section CPU Requirements +@node CPU requirements +@section CPU requirements Knot DNS scales with the processing power and also the nubmer of available cores/CPUs. There is no lower bound on the CPU requirements, but it should support memory barriers and CAS (i586 and newer). -@node Memory Requirements -@section Memory Requirements +@node Memory requirements +@section Memory requirements Knot DNS implementation focuses on the performance and thus can be very demanding for the memory. The rough estimate for memory @@ -44,8 +44,8 @@ Also note that to ensure uninterrupted serving of the zone, Knot DNS employs a Read-Copy-Update mechanism instead of locking and thus requires twice the amount of memory for the duration of the incoming transfers. -@node Supported Operating System -@section Supported Operating System +@node Supported operating system +@section Supported operating system Knot DNS itself is written in a portable way, but it depends on userspace-rcu library, which is the main constraint when it diff --git a/doc/running.texi b/doc/running.texi index f2da8e65263cf92bbbf483291211bf6d1b447b28..fb5c69bb834f0950669ea1c026d32b3446d2acca 100644 --- a/doc/running.texi +++ b/doc/running.texi @@ -1,4 +1,4 @@ -@node Running Knot DNS, Security Considerations, Knot DNS Configuration, Top +@node Running Knot DNS, Troubleshooting, Knot DNS Configuration, Top @chapter Running Knot DNS @menu @@ -7,6 +7,91 @@ * Controlling running daemon:: @end menu +Knot DNS is designed to compile zone files before loading them into server. +The reason for this is to speed up server startup, but requires a bit of user +effort, so each time the zone file changes you need to compile it. +@example +$ knotc -c knot.conf compile +@end example +Or alternatively, you can compile automatically using the @code{-a} flag. +@example +$ knotc -a -c knot.conf start|reload|restart +@end example + +The tool @code{knotc} is designed as a front-end for user, making it easier +to do everything from zone compilation to controlling the server daemon. +To communicate with the binary, it reads the process PID from the @emph{pidfile} specified in the configuration and sends POSIX signals to it. +If you want to control the daemon directly, use @code{SIGINT} to quit the process or @code{SIGHUP} to reload configuration. Signal @code{SIGUSR2} is currently used to refresh slave zones. + +@example +Usage: knotc [parameters] start|stop|restart|reload|running|compile +Parameters: + -c [file], --config=[file] + Select configuration file. + -j [num], --jobs=[num] + Number of parallel tasks to run when compiling. + -f, --force + Force operation - override some checks. + -v, --verbose + Verbose mode - additional runtime information. + -V, --version + Print knot server version. + -w, --wait + Wait for the server to finish start/stop operations. + -i, --interactive + Interactive mode (do not daemonize). + -a, --auto + Enable automatic recompilation (start or reload). + -h, --help + Print help and usage. + +Actions: + start Start knot server zone (no-op if running). + stop Stop knot server (no-op if not running). + restart Stops and then starts knot server. + reload Reload knot configuration and compiled zones. + refresh Refresh all slave zones. + running Check if server is running. + checkconf Check server configuration. + checkzone Check zones (accepts specific zones, + e.g. 'knotc checkzone example1.com example2.com'). + compile Compile zones (accepts specific zones, see above). +@end example + +But if you want to run Knot DNS daemon directly, you can use @code{knotd} binary +to do that. It accepts just configuration file and option to run in background. +@example +Usage: knotd [parameters] + +Parameters: + -c, --config [file] Select configuration file. + -d, --daemonize Run server as a daemon. + -v, --verbose Verbose mode - additional runtime information. + -V, --version Print version of the server. + -h, --help Print help and usage. +@end example + +Also, the server needs to create several files in order to run properly. +All files are placed in the directory described by @ref{storage}. +PID file can be placed elsewhere using the statement @ref{pidfile}. +Slave zones with relative path specified will be placed in the @code{storage} as well. +@itemize @bullet +@item +@emph{Compiled zones} - preprocessed zones, for example zone @code{example.com} will be +placed in @file{STORAGE/example.com.db}. +@item +@emph{Journal files} - each zone has a journal file to store changesets for IXFR and +dynamic updates. Journal for zone @code{example.com} will be +placed in @file{STORAGE/example.com.diff.db}. +@item +@emph{PID file} - unless specified differently by the @ref{pidfile}, it will be placed +in the @file{STORAGE/knot.pid}. +@item +@emph{Checksum files} - in order to identify compiled zone corruption, it +has a separate checksum file. For @code{example.com} will be +placed in @file{STORAGE/example.com.db.crc}. +@end itemize + @node Running a slave server @section Running a slave server @@ -19,6 +104,7 @@ search configuration in default path that is @code{SYSCONFDIR/knot.conf}. The @c depends on what you passed to the @code{./configure}, usually @code{/etc}. @example +$ knotc -c slave.conf checkconf # check configuration $ knotd -c slave.conf @end example @@ -37,6 +123,13 @@ When the server is running, you can control the daemon, see @ref{Controlling run Knot DNS first needs to compile the zones before it can load them, therefore you need to compile them with the @code{knotc compile} action or use flag @code{-a} to compile the zones automatically. + +If you want to just check the zone files first before starting, +you can use @code{knotc checkzone} action. +@example +$ knotc -c master.conf checkzone example.com +@end example + Starting and stopping the daemon is the same as with the slave server in the previous section. @example $ knotc -c master.conf compile @@ -49,12 +142,6 @@ $ knotc -c master.conf checkconf # check configuration $ knotc -a -w -c master.conf start @end example -If you want to just check the zone files first before starting, -you can use @code{knotc checkzone} action. -@example -$ knotc -c master.conf checkzone example.com -@end example - @node Controlling running daemon @section Controlling running daemon @@ -68,7 +155,19 @@ $ knotc -c master.conf compile # compile updated zones $ knotc -c master.conf reload # reconfigure and load updated zones @end example -But you can still tear-down the server fully and restart with the @code{knotc restart} action. +Or use the @code{-a} again. +@example +$ knotc -a -c master.conf reload # compile zones and reconfigure +@end example + +If you want @emph{IXFR-out} changesets created from changes you make to a zone file, enable @code{ixfr-from-differences} +in @ref{zones} statement, then compile the zone and reload your server as seen above. +If @emph{SOA}'s @emph{serial} is not changed no changesets will be created. Please note +that this feature is in @emph{experimental} stage and should be used with care. +If you encounter a bug using this feature, please send it to Knot developers +as explained in @ref{Submitting a bugreport} reporting. + +You can also choose to tear-down the server fully and restart with the @code{knotc restart} action. @example $ knotc -c master.conf running # check if running $ knotc -c master.conf restart # fully restart diff --git a/doc/troubleshooting.texi b/doc/troubleshooting.texi index a5d1717252efb8f82bb79da548c86fc043022ed9..7a9b79bcdf3449eaa0fe38180ba318c491a62f66 100644 --- a/doc/troubleshooting.texi +++ b/doc/troubleshooting.texi @@ -1,26 +1,126 @@ -@node Troubleshooting, Statement Index, Security Considerations, Top +@node Troubleshooting, Statement Index, Running Knot DNS, Top @chapter Troubleshooting @menu -* General troubleshooting:: -* Generating backtrace:: +* Submitting a bugreport:: +* Generating backtrace:: +* Debug messages:: @end menu -@node General troubleshooting -@section General troubleshooting +First of all, check the logs. For logging settings see @ref{log}. +By default, Knot DNS logs all error messages to syslog. Enabling at least +the @code{warning} message severity may help you identify some problems. -Check the LOGS! Enable the debug output. +@node Submitting a bugreport +@section Submitting a bugreport -If you want to add debug messages, there are two steps to do that. -First you have to enable modules, that you are interested in. -Available are: server, zones, xfr, packet, dname, rr, ns, hash, compiler. -You can combine multiple modules as a comma-separated list. -For example: @command{./configure --enable-debug=server,packet} +If you are unable to solve the problem by yourselves, you can submit a +bugreport to the Knot DNS team. For security issues (e.g. crash) do not +use the public mailinglist. Instead, write to +@url{mailto:knot-dns@@labs.nic.cz, knot-dns@@labs.nic.cz}. All other bugs +and questions may be directed to the Knot DNS users mailinglist +(@url{mailto:knot-dns-users@@lists.nic.cz, knot-dns-users@@lists.nic.cz}). -Then you can narrow the verbosity of the debugging message by specifying the -verbosity as brief, verbose or details. -For example: @command{./configure --enable-debuglevel=verbose}. +The bugreport should contain at least: +@itemize +@item Knot DNS version and type of installation (source, package, etc.), +@item type and version of your operating system, +@item basic hardware information, +@item description of the bug, +@item log output of all messages (category @code{any}) with severity Info +and higher (severity @code{info}), +@item steps to reproduce the bug (if known), +@item backtrace (if the bug caused a crash; see next section). +@end itemize +If it is possible, the actual configuration file and/or zone file(s) will +be very useful as well. @node Generating backtrace @section Generating backtrace + +There are several ways to achieve that, the most common is to run +the binary in a @code{gdb} debugger or attach to it. +@example +$ gdb --args knotd -c knot.conf +(gdb) run +... +Program received signal SIGSEGV. +(gdb) bt +(gdb) q +@end example + +Or attach to the running program. +@example +$ knotc -c knot.conf start +$ sudo gdb --pid <KNOT_PID> +(gdb) continue +... +Program received signal SIGSEGV. +(gdb) bt +(gdb) q +@end example + +@node Debug messages +@section Debug messages + +@menu +* Enabling debug messages in server:: +@end menu + +In some cases the aforementioned information may not be enough to find +and fix the bug. In these cases it may be useful to turn on debug messages. + +Two steps are required in order to log debug messages. First you need to +allow the debug messages in the server. Then the logging must be configured +to log debug messages (see @ref{log}). It is recommended to log these +messages to a file. Firstly, the debug output may be rather large and +secondly it is easier to use the data for debugging. + +@node Enabling debug messages in server +@subsection Enabling debug messages in server + +@menu +* Debug messages Example:: +@end menu + +Allowing debug messages in the server is possible only when configuring the +sources. Two @command{configure} options are required to do this: + +@itemize +@item +The @code{--enable-debug} option specifies the server modules for which you +want to enable debug messages. One or more of the following modules may be +listed, separated by commas: + +@itemize +@item @code{server} - Messages related to networking, threads and low-level + journal handling. +@item @code{zones} - All operations with zones - loading, updating, saving, + timers, high-level journal management. +@item @code{xfr} - AXFR, IXFR and NOTIFY handling. +@item @code{packet} - Packet parsing and response creation. +@item @code{dname} - Parsing, comparing and other operations on domain names. +@item @code{rr} - Details of processed resource records. +@item @code{ns} - Query processing, high-level handling of all requests + (transfers, NOTIFY, normal queries). +@item @code{hash} - Details of hash table (the main data structure) operation. +@item @code{compiler} - Zone file compilation. +@end itemize + +@item +The @code{--enable-debuglevel} option is used to specify the verbosity of the +debug output. Be careful with this, as the @code{details} verbosity may produce +really large logs (in order of GBs). There are three levels of verbosity: +@code{brief}, @code{verbose} and @code{details}. + +@end itemize + +@node Debug messages Example +@subsubsection Example + +@example +$ ./configure --enable-debug=server,zones --enable-debuglevel=verbose +@end example + + diff --git a/samples/knot.full.conf b/samples/knot.full.conf index cd1ec7f95e020b530a972ef0bcd3a182cc7887fd..fa2f46120f4b55f6297fffbd0a573d7706404f61 100644 --- a/samples/knot.full.conf +++ b/samples/knot.full.conf @@ -196,7 +196,7 @@ zones { # Possible values: <1..INT_MAX> (seconds) # Default value: inherited from zones.zonefile-sync # It is also possible to suffix with unit size [s/m/h/d] - # f.e. 1s = 1 day, 1m = 1 minute, 1h = 1 hour, 1d = 1 day + # f.e. 1s = 1 second, 1m = 1 minute, 1h = 1 hour, 1d = 1 day zonefile-sync 1h; # XFR master server diff --git a/src/Makefile.am b/src/Makefile.am index 41d639bc0376dcf7a2cefca5ed00a90b2a843c66..eece959dbab708f2a4ecf35dff5b99214edd0c66 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ ACLOCAL_AMFLAGS = -I ../m4 libexec_PROGRAMS = knot-zcompile unittests unittests-zcompile unittests-libknot-realdata unittests-libknot unittests-xfr sbin_PROGRAMS = knotc knotd -MANPAGES = knotc.8 knotd.8 -man8_MANS = knotc.8 knotd.8 +MANPAGES = knotc.8 knotd.8 knot.conf.5 +man8_MANS = knotc.8 knotd.8 knot.conf.5 EXTRA_DIST = $(man8_MANS) # $(YACC) will generate header file diff --git a/src/knot.conf.5 b/src/knot.conf.5 new file mode 100644 index 0000000000000000000000000000000000000000..d0868603267b2602cba66210fd7f933a234226ed --- /dev/null +++ b/src/knot.conf.5 @@ -0,0 +1,296 @@ +.TH "knot.conf" "5" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1" +.SH "NAME" +.LP +.B knot.conf +\- Configuration file manual for Knot DNS server. +.SH "SYNOPSIS" +.LP +.B knot.conf +.SH "DESCRIPTION" +.B knot.conf +serves as an example of the configuration for knotc(8) and knotd(8). +.SH "EXAMPLE" +.LP +# This is a comment. + +# +# There are 4 main sections of this config file: +# system, zones, interfaces and log +# + +# Section 'system' contains general options for the server +system { + + # Identity of the server (see RFC 4892). Not used yet. + identity "I have no mouth and must scream"; + + # Version of the server (see RFC 4892). Not used yet. + version "0.1"; + + # Server identifier + # Use string format "text" + # Or hexstring 0x01ab00 + nsid "myserver0"; + + # Working directory of the server + # Used to store compiled zones and PID file + storage "/tmp/knot-sample"; + + # Custom pidfile path + # default: pidfile is created in 'storage'. + pidfile "/tmp/knot.pid"; + + # Number of workers per interface + # This option is used to force number of threads used per interface + # Default: unset (auto-estimates optimal value from the number of online CPUs) + workers 1; + + # User for running server + # May also specify user.group (f.e. knot.users) + user root; +} + +# Section 'keys' contains list of TSIG keys +keys { + + # TSIG key + # + # format: name key-type "<key>"; + # where key-type may be one of the following: + # hmac-md5 + # hmac-sha1 + # hmac-sha224 + # hmac-sha256 + # hmac-sha384 + # hmac-sha512 + # and <key> is the private key + key0.server0 hmac-md5 "Wg=="; + + # TSIG key for zone + key0.example.com hmac-md5 "==gW"; +} + +# Section 'interfaces' contains definitions of listening interfaces. +interfaces { + + # Interface entry + # + # Format 1: <name> { address <address>; [port <port>;] } + ipv4 { # <name> is an arbitrary symbolic name + address 127.0.0.1; # <address> may be ither IPv4 or IPv6 address + port 53531; # port is required for XFR/IN and NOTIFY/OUT + } + + # Format 2: <name> { address <address>@<port>; } + # shortipv4 { + # address 127.0.0.1@53532; + #} + + # Format 1 (IPv6 interface) + # ipv6 { + # address ::1@53533; + # } + + # Format 2 (IPv6 interface) + # ipv6b { + # address [::1]@53534; + # } + +} + +# Section 'remotes' contains symbolic names for remote servers. +# Syntax for 'remotes' is the same as for 'interfaces'. +remotes { + + # Remote entry + # + # Format 1: <name> { address <address>; [port <port>;] } + server0 { # <name> is an arbitrary symbolic name + address 127.0.0.1; # <address> may be ither IPv4 or IPv6 address + port 53531; # port is optional (default: 53) + key key0.server0; # (optional) specification of TSIG key associated for this remote + via ipv4; # (optional) source interface for queries + via 82.35.64.59; # (optional) source interface for queries, direct IPv4 + via [::cafe]; # (optional) source interface for queries, direct IPv6 + } + + # Format 2: <name> { address <address>@<port>; } + server1 { + address 127.0.0.1@53001; + } +} + +# Section 'zones' contains information about zones to be served. +zones { + + # Shared options for all listed zones + # + + # Build differences from zone file changes + # Possible values: on|off + # Default value: off + ixfr-from-differences off; + + # Enable semantic checks for all zones (if 'on') + # Possible values: on|off + # Default value: off + semantic-checks off; + + # Disable ANY type queries for authoritative answers (if 'on') + # Possible values: on|off + # Default value: off + disable-any off; + + # NOTIFY response timeout + # Possible values: <1,...> (seconds) + # Default value: 60 + notify-timeout 60; + + # Number of retries for NOTIFY + # Possible values: <1,...> + # Default value: 5 + notify-retries 5; + + # Timeout for syncing changes from zone database to zonefile + # Possible values: <1..INT_MAX> (seconds) + # Default value: 1h (1 hour) + # It is also possible to suffix with unit size [s/m/h/d] + # f.e. 1s = 1 day, 1m = 1 minute, 1h = 1 hour, 1d = 1 day + zonefile-sync 1h; + + # File size limit for IXFR journal + # Possible values: <1..INT_MAX> + # Default value: N/A (infinite) + # It is also possible to suffix with unit size [k/M/G] + # f.e. 1k, 100M, 2G + ixfr-fslimit 1G; + + # Zone entry + # + # Format: <zone-name> { file "<path-to-zone-file>"; } + example.com { # <zone-name> is the DNS name of the zone (zone root) + # <path-to-zone-file> may be either absolute or relative, in which case + # it is considered relative to the current directory from which the server + # was started. + file "samples/example.com.zone"; + + # Build differences from zone file changes + # Possible values: on|off + # Default value: off + ixfr-from-differences off; + + # Disable ANY type queries for authoritative answers (if 'on') + # Possible values: on|off + # Default value: off + disable-any off; + + # Enable zone semantic checks + # Possible values: on|off + # Default value: off + semantic-checks on; + + # NOTIFY response timeout (specific for current zone) + # Possible values: <1,...> (seconds) + # Default value: 60 + notify-timeout 60; + + # Number of retries for NOTIFY (specific for current zone) + # Possible values: <1,...> + # Default value: 5 + notify-retries 5; + + # Timeout for syncing changes from zone database to zonefile + # Possible values: <1..INT_MAX> (seconds) + # Default value: inherited from zones.zonefile-sync + # It is also possible to suffix with unit size [s/m/h/d] + # f.e. 1s = 1 day, 1m = 1 minute, 1h = 1 hour, 1d = 1 day + zonefile-sync 1h; + + # XFR master server + xfr-in server0; + + # ACL list of XFR slaves + xfr-out server0, server1; + + # ACL list of servers allowed to send NOTIFY queries + notify-in server0; + + # List of servers to send NOTIFY to + notify-out server0, server1; + } +} + +# Section 'log' configures logging of server messages. +# +# Logging recognizes 3 symbolic names of log devices: +# stdout - Standard output +# stderr - Standard error output +# syslog - Syslog +# +# In addition, arbitrary number of log files may be specified (see below). +# +# Log messages are characterized by severity and category. +# Supported severities: +# debug - Debug messages. Must be turned on at compile time. +# info - Informational messages. +# notice - Notices and hints. +# warning - Warnings. An action from the operator may be required. +# error - Recoverable error. Some action should be taken. +# fatal - Non-recoverable errors resulting in server shutdown. +# (Not supported yet.) +# all - All severities. +# +# Categories designate the source of the log message and roughly correspond +# to server modules +# Supported categories: +# server - Messages related to general operation of the server. +# zone - Messages related to zones, zone parsing and loading. +# answering - Messages regarding query processing and response creation. +# any - All categories +# +# More severities (separated by commas) may be listed for each category. +# All applicable severities must be listed. +# (I.e. specifying 'error' severity does mean: 'log error messages', +# and NOT 'log all messages of severity error and above'.) +# +# Default settings (in case there are no entries in 'log' section or the section +# is missing at all): +# +# stderr { any error; } +# syslog { any error; } +log { + + # Log entry + # + # Format 1: + # <log> { + # <category1> <severity1> [, <severity2> ...]; + # <category2> <severity1> [, <severity2> ...]; + # ... + # } + syslog { # <log> is a symbolic name of a log device (see above) + # log errors of any category + any error; # for <category> and <severity> see above + # log also warnings and notices from category 'zone' + zone warning, notice; + # log info from server + server info; + } + + # Log fatal, warnings and errors to stderr + stderr { + any error, warning; + } + + # Format 2: + # file <path> { + # <category1> <severity1> [, <severity2> ...]; + # <category2> <severity1> [, <severity2> ...]; + # } + file "/tmp/knot-sample/knotd.debug" { # <path> is absolute or relative path to log file + server debug; + } +} +.SH "SEE ALSO" +.LP +knotd(8), knotc(8) diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c index 7f063af50e27b75b146777cf2ce1c3eee64bee01..07a9e38171d809600f23fe5ed25b685871b87439 100644 --- a/src/knot/ctl/knotc_main.c +++ b/src/knot/ctl/knotc_main.c @@ -56,9 +56,9 @@ void help(int argc, char **argv) { printf("Usage: %sc [parameters] start|stop|restart|reload|running|" "compile [additional]\n", PACKAGE_NAME); - printf("Parameters:\n" + printf("\nParameters:\n" " -c [file], --config=[file] Select configuration file.\n" - " -j [num], --jobs=[num] Number of parallel tasks to run (only for 'compile').\n" + " -j [num], --jobs=[num] Number of parallel tasks to run when compiling.\n" " -f, --force Force operation - override some checks.\n" " -v, --verbose Verbose mode - additional runtime information.\n" " -V, --version Print %s server version.\n" @@ -67,7 +67,7 @@ void help(int argc, char **argv) " -a, --auto Enable automatic recompilation (start or reload).\n" " -h, --help Print help and usage.\n", PACKAGE_NAME); - printf("Actions:\n" + printf("\nActions:\n" " start Start %s server zone (no-op if running).\n" " stop Stop %s server (no-op if not running).\n" " restart Stops and then starts %s server.\n" @@ -76,8 +76,8 @@ void help(int argc, char **argv) " running Check if server is running.\n" " checkconf Check server configuration.\n" "\n" - " checkzone Check zones (accepts specific zones, f.e. " - "'knotc checkzone example1.com example2.com').\n" + " checkzone Check zones (accepts specific zones, \n" + " e.g. 'knotc checkzone example1.com example2.com').\n" " compile Compile zones (accepts specific zones, see above).\n", PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME); } diff --git a/src/knot/main.c b/src/knot/main.c index 4723380f9f3a7a71e15eb5af37955fdf326f07e6..4486a1cade8f8f483f7a73f2e0fb61391533a9e3 100644 --- a/src/knot/main.c +++ b/src/knot/main.c @@ -73,7 +73,7 @@ void help(int argc, char **argv) { printf("Usage: %sd [parameters]\n", PACKAGE_NAME); - printf("Parameters:\n" + printf("\nParameters:\n" " -c, --config [file] Select configuration file.\n" " -d, --daemonize Run server as a daemon.\n" " -v, --verbose Verbose mode - additional runtime information.\n" diff --git a/src/knot/zone/zone-load.c b/src/knot/zone/zone-load.c index 7a0324be3ffd0c96daddc38354b1dbc1b2f81480..cc0fd2929d101849992ae410c2ea08cf1723868b 100644 --- a/src/knot/zone/zone-load.c +++ b/src/knot/zone/zone-load.c @@ -384,8 +384,7 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, */ (items[i].dname->node->owner == items[i].dname)) { - knot_node_free(&items[i].dname->node, - 0); + knot_node_free(&items[i].dname->node); assert(items[i].dname->node == NULL); } } @@ -790,7 +789,7 @@ dbg_zload_exec_detail( for (int i = 0; i < rrset_count; i++) { if ((tmp_rrset = knot_load_rrset(f, id_array, 1)) == NULL) { - knot_node_free(&node, 0); + knot_node_free(&node); /*!< \todo #1686 * Refactor freeing, might not be enough. */ @@ -1269,7 +1268,7 @@ knot_zone_t *knot_zload_load(zloader_t *loader) node_count + nsec3_node_count + 1); dbg_zload("zload: load: Failed to create new " "zone from apex!\n"); - knot_node_free(&apex, 0); + knot_node_free(&apex); free(dname_table); return NULL; } diff --git a/src/knotc.8 b/src/knotc.8 index 1e1cc7ebc6138b12888c86565a9540658205c659..9cd3f083d1925ecf4981ff1d0651f724067c3e7f 100644 --- a/src/knotc.8 +++ b/src/knotc.8 @@ -1,6 +1,6 @@ .TH knotc "8" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1" .SH NAME -.B knot +.B knotc \- Knot DNS control utility .SH SYNOPSIS .B knotc @@ -36,13 +36,13 @@ Print help and usage. .SS "Actions:" .TP start -Start knot server zone (no\-op if running). +Start knot server daemon (no\-op if running). .TP stop -Stop knot server (no\-op if not running). +Stop knot server daemon (no\-op if not running). .TP restart -Stops and then starts knot server. +Stops and then starts knot server daemon. .TP reload Reload knot configuration and compiled zones. diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c index e7ae3ebd3b4f878d5fbc60bfde8f160275d3569e..eb5749a194608e90b4e851fdafd238af42d26d22 100644 --- a/src/libknot/updates/xfr-in.c +++ b/src/libknot/updates/xfr-in.c @@ -513,7 +513,7 @@ int xfrin_process_axfr_packet(knot_ns_xfr_t *xfr) dbg_xfrin("No zone created, but the first RR in " "Answer is not a SOA RR.\n"); knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); knot_rrset_deep_free(&rr, 1, 1, 1); /*! \todo Cleanup. */ return KNOT_EMALF; @@ -535,7 +535,7 @@ dbg_xfrin_exec( ); /*! \todo Cleanup. */ knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_EMALF; } @@ -556,7 +556,7 @@ dbg_xfrin_exec( if (*constr == NULL) { dbg_xfrin("Failed to create new constr. zone.\n"); knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_ENOMEM; } @@ -569,7 +569,7 @@ dbg_xfrin_exec( if ((*constr)->contents== NULL) { dbg_xfrin("Failed to create new zone.\n"); knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); knot_rrset_deep_free(&rr, 1, 1, 1); /*! \todo Cleanup. */ return KNOT_ENOMEM; @@ -587,7 +587,7 @@ dbg_xfrin_exec( dbg_xfrin("Failed to add RRSet to zone node: %s.\n", knot_strerror(ret)); knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); knot_rrset_deep_free(&rr, 1, 1, 1); /*! \todo Cleanup. */ return KNOT_ERROR; @@ -692,7 +692,7 @@ dbg_xfrin_exec_detail( dbg_xfrin("Failed to save orphan" " RRSIGs.\n"); knot_packet_free(&packet); - knot_node_free(&node, 0); // ??? + knot_node_free(&node); // ??? knot_rrset_deep_free(&rr, 1, 1, 1); return ret; } @@ -700,7 +700,7 @@ dbg_xfrin_exec_detail( dbg_xfrin("Failed to add RRSIGs (%s).\n", knot_strerror(ret)); knot_packet_free(&packet); - knot_node_free(&node, 0); // ??? + knot_node_free(&node); // ??? knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_ERROR; /*! \todo Other error code. */ } else if (ret == 1) { @@ -739,7 +739,7 @@ dbg_xfrin_exec_verb( // not allowed here dbg_xfrin("TSIG in Answer section.\n"); knot_packet_free(&packet); - knot_node_free(&node, 0); // ??? + knot_node_free(&node); // ??? knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_EMALF; } @@ -782,7 +782,7 @@ dbg_xfrin_exec_verb( dbg_xfrin("Failed to add RRSet to node (%s)\n", knot_strerror(ret)); knot_packet_free(&packet); - knot_node_free(&node, 0); // ??? + knot_node_free(&node); // ??? knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_ERROR; } else if (ret > 0) { @@ -797,7 +797,7 @@ dbg_xfrin_exec_verb( dbg_xfrin("Failed to add node to zone (%s).\n", knot_strerror(ret)); knot_packet_free(&packet); - knot_node_free(&node, 0); // ??? + knot_node_free(&node); // ??? knot_rrset_deep_free(&rr, 1, 1, 1); return KNOT_ERROR; } @@ -834,7 +834,7 @@ dbg_xfrin_exec_verb( knot_packet_free(&packet); if (!in_zone) { - knot_node_free(&node, 0); + knot_node_free(&node); } knot_rrset_deep_free(&rr, 1, 1, 1); @@ -852,7 +852,7 @@ dbg_xfrin_exec_verb( dbg_xfrin("Failed to add last node into zone (%s).\n", knot_strerror(ret)); knot_packet_free(&packet); - knot_node_free(&node, 0); + knot_node_free(&node); return KNOT_ERROR; /*! \todo Other error */ } } @@ -2256,7 +2256,7 @@ dbg_xfrin_exec_detail( (*changes)->old_nodes[i], name); free(name); ); - knot_node_free(&(*changes)->old_nodes[i], 0); + knot_node_free(&(*changes)->old_nodes[i]); } // free empty NSEC3 nodes @@ -2268,7 +2268,7 @@ dbg_xfrin_exec_detail( (*changes)->old_nsec3[i], name); free(name); ); - knot_node_free(&(*changes)->old_nsec3[i], 0); + knot_node_free(&(*changes)->old_nsec3[i]); } // free allocated arrays of nodes and rrsets @@ -2975,11 +2975,13 @@ static int xfrin_remove_empty_nodes(knot_zone_contents_t *contents, zone_node = NULL; hash_item = NULL; +dbg_xfrin_exec_detail( char *name = knot_dname_to_str(knot_node_owner( changes->old_nodes[i])); dbg_xfrin_detail("Old node #%d: %p, %s\n", i, changes->old_nodes[i], name); free(name); +); ret = knot_zone_contents_remove_node( contents, changes->old_nodes[i], &zone_node, @@ -2992,9 +2994,7 @@ static int xfrin_remove_empty_nodes(knot_zone_contents_t *contents, free(hash_item); free(zone_node); - //knot_node_free(&changes->old_nodes[i], 0); } - //changes->old_nodes_count = 0; // remove NSEC3 nodes for (int i = 0; i < changes->old_nsec3_count; ++i) { @@ -3015,9 +3015,7 @@ static int xfrin_remove_empty_nodes(knot_zone_contents_t *contents, } free(zone_node); - //knot_node_free(&changes->old_nsec3[i], 0); } - //changes->old_nsec3_count = 0; return KNOT_EOK; } diff --git a/src/libknot/util/debug.c b/src/libknot/util/debug.c index 64984662eb2004774f27a6f3cbe1b476c6bfaf62..a6555ad3776bad595790bfc75f477fa80d73aacf 100644 --- a/src/libknot/util/debug.c +++ b/src/libknot/util/debug.c @@ -132,11 +132,6 @@ void knot_node_dump(knot_node_t *node, void *loaded_zone) hex_print((char *)node->owner->labels, node->owner->label_count); fprintf(stderr, "node: %p\n", node); fprintf(stderr, "node (in node's owner): %p\n", node->owner->node); - if (loaded_zone && node->prev != NULL) { - name = knot_dname_to_str(node->prev->owner); - fprintf(stderr, "previous node: %s\n", name); - free(name); - } if (knot_node_is_deleg_point(node)) { fprintf(stderr, "delegation point\n"); diff --git a/src/libknot/zone/node.c b/src/libknot/zone/node.c index a17e2a010e1c0dd2aad92e8e8126826c16e3540a..c196f2959f6b848b35e843900ba53ea0d35e6f8b 100644 --- a/src/libknot/zone/node.c +++ b/src/libknot/zone/node.c @@ -430,17 +430,6 @@ knot_node_t *knot_node_get_previous(const knot_node_t *node) /*----------------------------------------------------------------------------*/ -const knot_node_t *knot_node_next(const knot_node_t *node) -{ - if (node == NULL) { - return NULL; - } - - return node->next; -} - -/*----------------------------------------------------------------------------*/ - void knot_node_set_previous(knot_node_t *node, knot_node_t *prev) { if (node == NULL) { @@ -622,8 +611,6 @@ void knot_node_update_refs(knot_node_t *node) { // reference to previous node knot_node_update_ref(&node->prev); - // reference to next node - knot_node_update_ref(&node->next); // reference to parent knot_node_update_ref(&node->parent); // reference to wildcard child @@ -732,7 +719,7 @@ void knot_node_free_rrsets(knot_node_t *node, int free_rdata_dnames) /*----------------------------------------------------------------------------*/ -void knot_node_free(knot_node_t **node, int fix_refs) +void knot_node_free(knot_node_t **node) { if (node == NULL || *node == NULL) { return; @@ -755,46 +742,6 @@ void knot_node_free(knot_node_t **node, int fix_refs) dbg_node_detail("Releasing owner.\n"); knot_dname_release((*node)->owner); - // check nodes referencing this node and fix the references - - if (fix_refs) { - // previous node - dbg_node_detail("Checking previous.\n"); - if ((*node)->prev && (*node)->prev->next == (*node)) { - (*node)->prev->next = (*node)->next; - } - - dbg_node_detail("Checking next.\n"); - if ((*node)->next && (*node)->next->prev == (*node)) { - (*node)->next->prev = (*node)->prev; - } - - // NSEC3 node - dbg_node_detail("Checking NSEC3.\n"); - if ((*node)->nsec3_node - && (*node)->nsec3_node->nsec3_referer == (*node)) { - (*node)->nsec3_node->nsec3_referer = NULL; - } - - dbg_node_detail("Checking NSEC3 ref.\n"); - if ((*node)->nsec3_referer - && (*node)->nsec3_referer->nsec3_node == (*node)) { - (*node)->nsec3_referer->nsec3_node = NULL; - } - - // wildcard child node - dbg_node_detail("Checking parent's wildcard child.\n"); - if ((*node)->parent - && (*node)->parent->wildcard_child == (*node)) { - (*node)->parent->wildcard_child = NULL; - } - - // fix parent's children count - if ((*node)->parent) { - --(*node)->parent->children; - } - } - free(*node); *node = NULL; diff --git a/src/libknot/zone/node.h b/src/libknot/zone/node.h index 787e087a1c55edf291fa813131333c7f880e5fb5..1ab814a1eb3ba247c4cf667b45e4291d43542d8d 100644 --- a/src/libknot/zone/node.h +++ b/src/libknot/zone/node.h @@ -62,8 +62,6 @@ struct knot_node { */ struct knot_node *prev; - struct knot_node *next; - /*! * \brief NSEC3 node corresponding to this node. * @@ -249,8 +247,6 @@ const knot_node_t *knot_node_previous(const knot_node_t *node); */ knot_node_t *knot_node_get_previous(const knot_node_t *node); -const knot_node_t *knot_node_next(const knot_node_t *node); - /*! * \brief Sets the previous node of the given node. * @@ -428,7 +424,7 @@ void knot_node_free_rrsets(knot_node_t *node, int free_rdata_dnames); * * \todo Document missing parameters. */ -void knot_node_free(knot_node_t **node, int fix_refs); +void knot_node_free(knot_node_t **node); /*! * \brief Compares two nodes according to their owner. diff --git a/src/libknot/zone/zone-contents.c b/src/libknot/zone/zone-contents.c index 4d9ecf528cacc83ef1d7de6b55310fdf189eea8b..7e453a5c0be1fcb2673fbd4677d0ee348c7ca75e 100644 --- a/src/libknot/zone/zone-contents.c +++ b/src/libknot/zone/zone-contents.c @@ -139,7 +139,7 @@ static void knot_zone_contents_destroy_node_owner_from_tree( UNUSED(data); /*!< \todo change completely! */ - knot_node_free(&tnode->node, 0); + knot_node_free(&tnode->node); } /*----------------------------------------------------------------------------*/ @@ -605,25 +605,16 @@ static void knot_zone_contents_adjust_node_in_tree( return; } - dbg_zone_exec_verb( - char *name = knot_dname_to_str(node->owner); - dbg_zone_verb("----- Adjusting node %s -----\n", name); - free(name); - ); - - /* - * 1) Set previous node pointer. - */ - knot_node_set_previous(node, args->previous_node); +dbg_zone_exec_verb( + char *name = knot_dname_to_str(node->owner); + dbg_zone_verb("----- Adjusting node %s -----\n", name); + free(name); +); - if (args->first_node == NULL) { - args->first_node = node; - } knot_zone_contents_t *zone = args->zone; /* - * 2) Store domain names to dname table. - * + * 1) Store domain names to dname table. * TODO: make optional! */ assert(zone->dname_table != NULL); @@ -638,13 +629,35 @@ static void knot_zone_contents_adjust_node_in_tree( } /* - * 3) Do other adjusting (flags, closest enclosers, wildcard children, + * 2) Do other adjusting (flags, closest enclosers, wildcard children, * etc.). */ knot_zone_contents_adjust_node(node, zone); +} + +/*----------------------------------------------------------------------------*/ + +static void knot_zone_contents_adjust_node_in_tree_ptr( + knot_zone_tree_node_t *tnode, void *data) +{ + assert(data != NULL); + assert(tnode != NULL); + assert(tnode->node != NULL); + + knot_zone_adjust_arg_t *args = (knot_zone_adjust_arg_t *)data; + knot_node_t *node = tnode->node; + + /* + * 1) Set previous node pointer. + */ + knot_node_set_previous(node, args->previous_node); + + if (args->first_node == NULL) { + args->first_node = node; + } /* - * 4) Store previous node depending on the type of this node. + * 2) Store previous node depending on the type of this node. */ if (!knot_node_is_non_auth(node) && knot_node_rrset_count(node) > 0) { @@ -672,8 +685,11 @@ static void knot_zone_contents_adjust_nsec3_node_in_tree( knot_zone_adjust_arg_t *args = (knot_zone_adjust_arg_t *)data; knot_node_t *node = tnode->node; - // set previous node - knot_node_set_previous(node, args->previous_node); + if (args->err != KNOT_EOK) { + dbg_xfrin_detail("Error during adjusting: %s, skipping node.\n", + knot_strerror(args->err)); + return; + } // assure that owner has proper node if (knot_dname_node(knot_node_owner(node)) == NULL) { @@ -694,6 +710,22 @@ static void knot_zone_contents_adjust_nsec3_node_in_tree( args->err = ret; return; } +} + +/*----------------------------------------------------------------------------*/ + +static void knot_zone_contents_adjust_nsec3_node_in_tree_ptr( + knot_zone_tree_node_t *tnode, void *data) +{ + assert(data != NULL); + assert(tnode != NULL); + assert(tnode->node != NULL); + + knot_zone_adjust_arg_t *args = (knot_zone_adjust_arg_t *)data; + knot_node_t *node = tnode->node; + + // set previous node + knot_node_set_previous(node, args->previous_node); // here is nothing to consider, all nodes are the same args->previous_node = node; @@ -1343,7 +1375,7 @@ dbg_zone_exec_detail( knot_zone_contents_dnames_from_node_to_table( zone->dname_table, next_node); if (ret != KNOT_EOK) { - knot_node_free(&next_node, 0); + knot_node_free(&next_node); knot_dname_release(chopped); return ret; } @@ -1961,8 +1993,8 @@ dbg_zone_exec_detail( char *name_str2 = (*previous != NULL) ? knot_dname_to_str((*previous)->owner) : "(nil)"; - dbg_zone_detail("Search function returned %d, node %s and prev: %s\n", - exact_match, name_str, name_str2); +dbg_zone_detail("Search function returned %d, node %s (%p) and prev: %s (%p)\n", + exact_match, name_str, *node, name_str2, *previous); if (*node) { free(name_str); @@ -2340,20 +2372,16 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone) adjust_arg.err = KNOT_EOK; /* - * Adjust the NSEC3 nodes first. - * There are independent on the normal nodes, but the normal nodes are - * dependent on them. + * First of all we must set node.prev pointers, as these are used in + * the search functions. */ - - dbg_zone("Adjusting NSEC3 nodes.\n"); - int ret = knot_zone_tree_forward_apply_inorder( - zone->nsec3_nodes, - knot_zone_contents_adjust_nsec3_node_in_tree, - &adjust_arg); + dbg_zone("Setting 'prev' pointers to NSEC3 nodes.\n"); + int ret = knot_zone_tree_forward_apply_inorder(zone->nsec3_nodes, + knot_zone_contents_adjust_nsec3_node_in_tree_ptr, &adjust_arg); assert(ret == KNOT_EOK); if (adjust_arg.err != KNOT_EOK) { - dbg_zone("Failed to adjust NSEC3 nodes: %s\n", + dbg_zone("Failed to set 'prev' pointers to NSEC3 nodes: %s\n", knot_strerror(adjust_arg.err)); return adjust_arg.err; } @@ -2361,13 +2389,46 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone) // set the last node as previous of the first node if (adjust_arg.first_node) { knot_node_set_previous(adjust_arg.first_node, - adjust_arg.previous_node); + adjust_arg.previous_node); } dbg_zone("Done.\n"); adjust_arg.first_node = NULL; adjust_arg.previous_node = NULL; + dbg_zone("Setting 'prev' pointers to normal nodes.\n"); + ret = knot_zone_tree_forward_apply_inorder(zone->nodes, + knot_zone_contents_adjust_node_in_tree_ptr, &adjust_arg); + assert(ret == KNOT_EOK); + + if (adjust_arg.err != KNOT_EOK) { + dbg_zone("Failed to set 'prev' pointers to normal nodes: %s\n", + knot_strerror(adjust_arg.err)); + return adjust_arg.err; + } + + // set the last node as previous of the first node + assert(zone->apex == adjust_arg.first_node); + knot_node_set_previous(zone->apex, adjust_arg.previous_node); + dbg_zone("Done.\n"); + + /* + * Adjust the NSEC3 nodes first. + * There are independent on the normal nodes, but the normal nodes are + * dependent on them. + */ + + dbg_zone("Adjusting NSEC3 nodes.\n"); + ret = knot_zone_tree_forward_apply_inorder(zone->nsec3_nodes, + knot_zone_contents_adjust_nsec3_node_in_tree, &adjust_arg); + assert(ret == KNOT_EOK); + + if (adjust_arg.err != KNOT_EOK) { + dbg_zone("Failed to adjust NSEC3 nodes: %s\n", + knot_strerror(adjust_arg.err)); + return adjust_arg.err; + } + dbg_zone("Adjusting normal nodes.\n"); ret = knot_zone_tree_forward_apply_inorder(zone->nodes, knot_zone_contents_adjust_node_in_tree, @@ -2380,9 +2441,6 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone) return adjust_arg.err; } - assert(zone->apex == adjust_arg.first_node); - knot_node_set_previous(zone->apex, adjust_arg.previous_node); - dbg_zone("Done.\n"); return ret; diff --git a/src/libknot/zone/zone-tree.c b/src/libknot/zone/zone-tree.c index a0555cd92fd14413ad28c20bea54699aac0ba02c..7de460a193977c41c47403c323078444258092f3 100644 --- a/src/libknot/zone/zone-tree.c +++ b/src/libknot/zone/zone-tree.c @@ -110,7 +110,7 @@ static void knot_zone_tree_free_node(knot_zone_tree_node_t *node, knot_zone_tree_free_node(node->avl.avl_right, free_data); if (free_data) { - knot_node_free(&node->node, 0); + knot_node_free(&node->node); } free(node); @@ -154,7 +154,7 @@ static int knot_zone_tree_deep_copy_node(knot_zone_tree_node_t *from, dbg_zone_verb("Failed to do shallow copy of right subtree.\n"); knot_zone_tree_free_node((*to)->avl.avl_left, 1); (*to)->avl.avl_left = NULL; - knot_node_free(&(*to)->node, 0); + knot_node_free(&(*to)->node); free(*to); *to = NULL; return ret; @@ -249,7 +249,7 @@ int knot_zone_tree_get(knot_zone_tree_t *tree, const knot_dname_t *owner, knot_zone_tree_node_t *n = TREE_FIND(tree, knot_zone_tree_node, avl, tmp); - knot_node_free(&tmp_data, 0); + knot_node_free(&tmp_data); free(tmp); if (n != NULL) { @@ -312,7 +312,7 @@ int knot_zone_tree_get_less_or_equal(knot_zone_tree_t *tree, int exact_match = TREE_FIND_LESS_EQUAL( tree, knot_zone_tree_node, avl, tmp, &f, &prev); - knot_node_free(&tmp_data, 0); + knot_node_free(&tmp_data); free(tmp); *found = (exact_match > 0) ? f->node : NULL; @@ -355,9 +355,17 @@ dbg_zone_exec_detail( /*! \todo Here we assume that the 'prev' pointer always points * to an empty non-terminal. */ + /*! \todo What did I mean by the previous TODO?? + * Nevertheless, it seems to me that node->prev can be + * an empty non-terminal too, cannot it? + */ + dbg_zone_detail("Previous: %p\n", prev->node); *previous = (knot_node_rrset_count(prev->node) == 0) ? knot_node_get_previous(prev->node) : prev->node; + dbg_zone_detail("Previous: %p, is empty: %d\n", *previous, + (*previous) ? knot_node_is_empty(*previous) + : -1); } assert(exact_match >= 0); @@ -398,7 +406,7 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree, /*! \todo How to know if this was successful? */ TREE_REMOVE(tree, knot_zone_tree_node, avl, tmp); - knot_node_free(&tmp_data, 0); + knot_node_free(&tmp_data); free(tmp); *removed = n; diff --git a/src/tests/libknot/libknot/node_tests.c b/src/tests/libknot/libknot/node_tests.c index 10b01fa18e15954591df6dad37b68cae637dd095..b252982e854d325eb206c443ab98005aec1e4c3b 100644 --- a/src/tests/libknot/libknot/node_tests.c +++ b/src/tests/libknot/libknot/node_tests.c @@ -76,7 +76,7 @@ static int test_node_create() errors++; diag("Failed to create node structure"); } - knot_node_free(&tmp, 0); + knot_node_free(&tmp); } return (errors == 0); } @@ -134,7 +134,7 @@ static int test_node_add_rrset() diag("Values in found rrset are wrong"); } - knot_node_free(&tmp, 0); + knot_node_free(&tmp); } return (errors == 0); @@ -166,7 +166,7 @@ static int test_node_get_rrset() diag("Failed to get proper rrset from node"); } } - knot_node_free(&nodes[i], 0); + knot_node_free(&nodes[i]); } return (errors == 0); @@ -194,7 +194,7 @@ static int test_node_get_parent() errors++; diag("Failed to get proper parent from node"); } - knot_node_free(&nodes[i], 0); + knot_node_free(&nodes[i]); } return (errors == 0); } @@ -230,7 +230,7 @@ static int test_node_sorting() // last = *((uint16_t *)node->key); // } - knot_node_free(&tmp, 0); + knot_node_free(&tmp); return (errors == 0); } @@ -244,7 +244,7 @@ static int test_node_delete() tmp_node = knot_node_new(&test_nodes[i].owner, test_nodes[i].parent, 0); - knot_node_free(&tmp_node, 0); + knot_node_free(&tmp_node); errors += (tmp_node != NULL); } @@ -269,9 +269,9 @@ static int test_node_set_parent() diag("Parent node is wrongly set."); errors++; } - knot_node_free(&tmp_node, 0); + knot_node_free(&tmp_node); } - knot_node_free(&tmp_parent, 0); + knot_node_free(&tmp_parent); return (errors == 0); } @@ -289,7 +289,7 @@ static int test_node_free_rrsets() // errors += (tmp_node->rrsets != NULL); - knot_node_free(&tmp_node, 0); + knot_node_free(&tmp_node); } return (errors == 0); } diff --git a/src/tests/libknot/libknot/zone_tests.c b/src/tests/libknot/libknot/zone_tests.c index 72aae39366a8c27f8c4c253153ee991c991e1b3b..54cd38da90e0ef0b99d837596390b6a12877e67d 100644 --- a/src/tests/libknot/libknot/zone_tests.c +++ b/src/tests/libknot/libknot/zone_tests.c @@ -95,13 +95,13 @@ static int test_zone_create(knot_zone_contents_t **zone) if ((*zone) == NULL) { diag("zone: Failed to create zone."); - knot_node_free(&node, 0); + knot_node_free(&node); return 0; } if ((*zone)->apex != node) { diag("zone: Zone apex not set right."); - knot_node_free(&node, 0); + knot_node_free(&node); return 0; } @@ -133,7 +133,7 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3) : knot_zone_contents_add_node(zone, node, 0, 0, 0))) != 0) { diag("zone: Failed to insert node into zone (returned" " %d).", res); - knot_node_free(&node, 0); + knot_node_free(&node); ++errors; } /* TODO check values in the node as well */ @@ -157,7 +157,7 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3) KNOT_EBADZONE); ++errors; } - knot_node_free(&node, 0); + knot_node_free(&node); } //note("NULL zone"); @@ -179,7 +179,7 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3) ++errors; } - knot_node_free(&node, 0); + knot_node_free(&node); //note("NULL node"); note("Inserting NULL node...\n"); @@ -211,7 +211,7 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3) ++errors; } - knot_node_free(&node, 0); + knot_node_free(&node); } // check if all nodes are inserted diff --git a/src/tests/libknot/realdata/libknot/node_tests_realdata.c b/src/tests/libknot/realdata/libknot/node_tests_realdata.c index b9415efcc0167ac0effa4e0b1b8d1db26521723e..91209c985574ecd823dce34c01d9dcfd376878a9 100644 --- a/src/tests/libknot/realdata/libknot/node_tests_realdata.c +++ b/src/tests/libknot/realdata/libknot/node_tests_realdata.c @@ -94,7 +94,7 @@ static int test_node_create(const list *node_list) errors++; diag("Failed to create node structure"); } - knot_node_free(&tmp, 0); + knot_node_free(&tmp); } return (errors == 0); @@ -168,7 +168,7 @@ static int test_node_add_rrset(list *rrset_list) diag("Values in found rrset are wrong"); } - knot_node_free(&tmp, 0); + knot_node_free(&tmp); } return (errors == 0); diff --git a/src/tests/libknot/realdata/libknot/zone_tests_realdata.c b/src/tests/libknot/realdata/libknot/zone_tests_realdata.c index 2738dabbdd1450f0183c68b8c3710b6f2892918d..4687978dcf1cc5ef950c6511615307cdc8db1b05 100644 --- a/src/tests/libknot/realdata/libknot/zone_tests_realdata.c +++ b/src/tests/libknot/realdata/libknot/zone_tests_realdata.c @@ -77,7 +77,7 @@ static int test_zone_create(list node_list) errors++; } knot_node_free_rrsets(node, 1); - knot_node_free(&node, 0); + knot_node_free(&node); } return (errors == 0); diff --git a/src/zcompile/zcompile.c b/src/zcompile/zcompile.c index d2f4204d6ec7f02feb3af43c70fc45b2f67fedd6..4afb7f19278a462dcbc0d6379dafc0b4f12e9e62 100644 --- a/src/zcompile/zcompile.c +++ b/src/zcompile/zcompile.c @@ -527,7 +527,7 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, knot_dname_t *origin_from_config = knot_dname_new_from_str(name, strlen(name), NULL); if (origin_from_config == NULL) { - knot_node_free(&origin_node, 0); + knot_node_free(&origin_node); return KNOTDZCOMPILE_ENOMEM; } @@ -535,7 +535,7 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, zp_lex_init(&scanner); if (scanner == NULL) { knot_dname_release(origin_from_config); - knot_node_free(&origin_node, 0); + knot_node_free(&origin_node); return KNOTDZCOMPILE_ENOMEM; } diff --git a/src/zcompile/zcompile_main.c b/src/zcompile/zcompile_main.c index 7e3ee862fce298aa6febe25abedcf9e6958ccf95..983376a7e03d32b20ce3c72d0a00ed2d435b74b2 100644 --- a/src/zcompile/zcompile_main.c +++ b/src/zcompile/zcompile_main.c @@ -26,7 +26,7 @@ static void help(int argc, char **argv) { printf("Usage: %s [parameters] origin zonefile\n", argv[0]); - printf("Parameters:\n" + printf("\n:Parameters:\n" " -o <outfile> Override output file.\n" " -v Verbose mode - additional runtime information.\n" " -s Enable semantic checks.\n"