summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-10-31 10:40:18 +0100
committerOndřej Surý <ondrej@sury.org>2012-10-31 10:40:18 +0100
commitbd498b2139729fa837312740c2f999c729d56c0a (patch)
tree47f22536249385c2b8b16488a924c3098261880c
parent59a52442df1361f428cd7c8a2986eb6e5651f06e (diff)
parent77bfcd8d02fbe5cae75a41017144f15c5d0bc5f4 (diff)
downloadknot-bd498b2139729fa837312740c2f999c729d56c0a.tar.gz
Merge tag 'upstream/1.1.1' into debian-sid
Upstream version 1.1.1
-rw-r--r--[-rwxr-xr-x]AUTHORS0
-rw-r--r--[-rwxr-xr-x]COPYING0
-rw-r--r--[-rwxr-xr-x]ChangeLog0
-rw-r--r--[-rwxr-xr-x]CodingStyle0
-rw-r--r--[-rwxr-xr-x]Doxy.page.h0
-rw-r--r--[-rwxr-xr-x]Doxyfile0
-rw-r--r--[-rwxr-xr-x]Doxyfile.devel0
-rw-r--r--[-rwxr-xr-x]INSTALL0
-rw-r--r--[-rwxr-xr-x]KNOWN_ISSUES0
-rw-r--r--[-rwxr-xr-x]Knot.config0
-rw-r--r--[-rwxr-xr-x]Knot.creator0
-rw-r--r--[-rwxr-xr-x]Knot.files6
-rw-r--r--[-rwxr-xr-x]Knot.includes0
-rw-r--r--[-rwxr-xr-x]Makefile.am0
-rw-r--r--[-rwxr-xr-x]Makefile.in7
-rw-r--r--[-rwxr-xr-x]NEWS0
-rw-r--r--[-rwxr-xr-x]README0
-rw-r--r--[-rwxr-xr-x]RELNOTES28
-rw-r--r--[-rwxr-xr-x]aclocal.m440
-rwxr-xr-xconfigure55
-rw-r--r--[-rwxr-xr-x]configure.ac7
-rw-r--r--[-rwxr-xr-x]doc/.gitignore0
-rw-r--r--[-rwxr-xr-x]doc/Makefile.am0
-rw-r--r--[-rwxr-xr-x]doc/Makefile.in11
-rw-r--r--[-rwxr-xr-x]doc/configuration.texi0
-rw-r--r--[-rwxr-xr-x]doc/indices.texi0
-rw-r--r--[-rwxr-xr-x]doc/installation.texi0
-rw-r--r--[-rwxr-xr-x]doc/introduction.texi0
-rw-r--r--[-rwxr-xr-x]doc/knot.texi0
-rw-r--r--[-rwxr-xr-x]doc/migration.texi0
-rw-r--r--[-rwxr-xr-x]doc/reference.texi0
-rw-r--r--[-rwxr-xr-x]doc/requirements.texi0
-rw-r--r--[-rwxr-xr-x]doc/running.texi0
-rw-r--r--[-rwxr-xr-x]doc/security.texi0
-rw-r--r--[-rwxr-xr-x]doc/texinfo.tex0
-rw-r--r--[-rwxr-xr-x]doc/troubleshooting.texi0
-rw-r--r--[-rwxr-xr-x]knot.sample.conf.in0
-rw-r--r--[-rwxr-xr-x]m4/ax_check_compiler_flags.m40
-rw-r--r--[-rwxr-xr-x]m4/ax_ext.m40
-rw-r--r--[-rwxr-xr-x]m4/ax_gcc_x86_cpuid.m40
-rw-r--r--[-rwxr-xr-x]m4/libtool.m40
-rw-r--r--[-rwxr-xr-x]m4/ltoptions.m40
-rw-r--r--[-rwxr-xr-x]m4/ltsugar.m40
-rw-r--r--[-rwxr-xr-x]m4/ltversion.m40
-rw-r--r--[-rwxr-xr-x]m4/lt~obsolete.m40
-rw-r--r--[-rwxr-xr-x]samples/Makefile.am0
-rw-r--r--[-rwxr-xr-x]samples/Makefile.in7
-rw-r--r--[-rwxr-xr-x]samples/bogus25.com.zone0
-rw-r--r--[-rwxr-xr-x]samples/example.com.zone0
-rw-r--r--[-rwxr-xr-x]samples/example.com.zone.signed0
-rw-r--r--[-rwxr-xr-x]samples/example.com.zone.signed.nsec30
-rw-r--r--[-rwxr-xr-x]samples/knot.full.conf2
-rw-r--r--[-rwxr-xr-x]samples/knot.min.conf0
-rw-r--r--[-rwxr-xr-x]samples/knot.sample.conf.in0
-rw-r--r--[-rwxr-xr-x]scripts/urcu-tls-compat.patch0
-rw-r--r--[-rwxr-xr-x]src/Makefile.am9
-rw-r--r--[-rwxr-xr-x]src/Makefile.in154
-rw-r--r--[-rwxr-xr-x]src/common/LICENSE.txt0
-rw-r--r--[-rwxr-xr-x]src/common/acl.c0
-rw-r--r--[-rwxr-xr-x]src/common/acl.h0
-rw-r--r--[-rwxr-xr-x]src/common/base32.c0
-rw-r--r--[-rwxr-xr-x]src/common/base32.h0
-rw-r--r--[-rwxr-xr-x]src/common/base32hex.c0
-rw-r--r--[-rwxr-xr-x]src/common/base32hex.h0
-rw-r--r--[-rwxr-xr-x]src/common/base64.c0
-rw-r--r--[-rwxr-xr-x]src/common/base64.h0
-rw-r--r--[-rwxr-xr-x]src/common/crc.h0
-rw-r--r--[-rwxr-xr-x]src/common/dSFMT-params.h0
-rw-r--r--[-rwxr-xr-x]src/common/dSFMT-params521.h0
-rw-r--r--[-rwxr-xr-x]src/common/dSFMT.c0
-rw-r--r--[-rwxr-xr-x]src/common/dSFMT.h0
-rw-r--r--[-rwxr-xr-x]src/common/errcode.c (renamed from src/libknot/util/libknot_error.c)38
-rw-r--r--[-rwxr-xr-x]src/common/errcode.h (renamed from src/libknot/util/error.h)63
-rw-r--r--[-rwxr-xr-x]src/common/errors.c2
-rw-r--r--[-rwxr-xr-x]src/common/errors.h0
-rw-r--r--[-rwxr-xr-x]src/common/evqueue.c0
-rw-r--r--[-rwxr-xr-x]src/common/evqueue.h0
-rw-r--r--[-rwxr-xr-x]src/common/evsched.c0
-rw-r--r--[-rwxr-xr-x]src/common/evsched.h0
-rw-r--r--[-rwxr-xr-x]src/common/fdset.c0
-rw-r--r--[-rwxr-xr-x]src/common/fdset.h0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_epoll.c0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_epoll.h0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_kqueue.c0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_kqueue.h0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_poll.c0
-rw-r--r--[-rwxr-xr-x]src/common/fdset_poll.h0
-rw-r--r--[-rwxr-xr-x]src/common/general-tree.c0
-rw-r--r--[-rwxr-xr-x]src/common/general-tree.h0
-rw-r--r--[-rwxr-xr-x]src/common/heap.c0
-rw-r--r--[-rwxr-xr-x]src/common/heap.h0
-rw-r--r--[-rwxr-xr-x]src/common/latency.c0
-rw-r--r--[-rwxr-xr-x]src/common/latency.h0
-rw-r--r--[-rwxr-xr-x]src/common/libtap/README0
-rw-r--r--[-rwxr-xr-x]src/common/libtap/tap.c0
-rw-r--r--[-rwxr-xr-x]src/common/libtap/tap.h0
-rw-r--r--[-rwxr-xr-x]src/common/libtap/tap_unit.h0
-rw-r--r--[-rwxr-xr-x]src/common/lists.c0
-rw-r--r--[-rwxr-xr-x]src/common/lists.h0
-rw-r--r--[-rwxr-xr-x]src/common/log.c44
-rw-r--r--[-rwxr-xr-x]src/common/log.h24
-rw-r--r--[-rwxr-xr-x]src/common/mempattern.c0
-rw-r--r--[-rwxr-xr-x]src/common/mempattern.h0
-rw-r--r--[-rwxr-xr-x]src/common/modified_tree.h0
-rw-r--r--[-rwxr-xr-x]src/common/print.c0
-rw-r--r--[-rwxr-xr-x]src/common/print.h0
-rw-r--r--[-rwxr-xr-x]src/common/prng.c0
-rw-r--r--[-rwxr-xr-x]src/common/prng.h0
-rw-r--r--[-rwxr-xr-x]src/common/ref.c0
-rw-r--r--[-rwxr-xr-x]src/common/ref.h0
-rw-r--r--[-rwxr-xr-x]src/common/skip-list.c0
-rw-r--r--[-rwxr-xr-x]src/common/skip-list.h0
-rw-r--r--[-rwxr-xr-x]src/common/slab/alloc-common.h8
-rw-r--r--[-rwxr-xr-x]src/common/slab/slab.c26
-rw-r--r--[-rwxr-xr-x]src/common/slab/slab.h0
-rw-r--r--[-rwxr-xr-x]src/common/sockaddr.c0
-rw-r--r--[-rwxr-xr-x]src/common/sockaddr.h0
-rw-r--r--[-rwxr-xr-x]src/common/tree.h0
-rw-r--r--[-rwxr-xr-x]src/config.h.in0
-rw-r--r--[-rwxr-xr-x]src/knot.conf.52
-rw-r--r--[-rwxr-xr-x]src/knot.service0
-rw-r--r--[-rwxr-xr-x]src/knot.spec0
-rw-r--r--[-rwxr-xr-x]src/knot.sysconfig0
-rw-r--r--[-rwxr-xr-x]src/knot/common.h9
-rw-r--r--[-rwxr-xr-x]src/knot/conf/cf-lex.l0
-rw-r--r--[-rwxr-xr-x]src/knot/conf/cf-parse.y4
-rw-r--r--[-rwxr-xr-x]src/knot/conf/conf.c62
-rw-r--r--[-rwxr-xr-x]src/knot/conf/conf.h18
-rw-r--r--[-rwxr-xr-x]src/knot/conf/logconf.c5
-rw-r--r--[-rwxr-xr-x]src/knot/conf/logconf.h6
-rw-r--r--[-rwxr-xr-x]src/knot/ctl/knotc_main.c21
-rw-r--r--[-rwxr-xr-x]src/knot/ctl/process.c21
-rw-r--r--[-rwxr-xr-x]src/knot/ctl/process.h18
-rw-r--r--[-rwxr-xr-x]src/knot/main.c17
-rw-r--r--[-rwxr-xr-x]src/knot/other/debug.h0
-rwxr-xr-xsrc/knot/other/error.c48
-rwxr-xr-xsrc/knot/other/error.h101
-rw-r--r--[-rwxr-xr-x]src/knot/server/dthreads.c73
-rw-r--r--[-rwxr-xr-x]src/knot/server/dthreads.h76
-rw-r--r--[-rwxr-xr-x]src/knot/server/journal.c143
-rw-r--r--[-rwxr-xr-x]src/knot/server/journal.h72
-rw-r--r--[-rwxr-xr-x]src/knot/server/notify.c56
-rw-r--r--[-rwxr-xr-x]src/knot/server/notify.h26
-rw-r--r--[-rwxr-xr-x]src/knot/server/server.c38
-rw-r--r--[-rwxr-xr-x]src/knot/server/server.h16
-rw-r--r--[-rwxr-xr-x]src/knot/server/socket.c23
-rw-r--r--[-rwxr-xr-x]src/knot/server/socket.h48
-rw-r--r--[-rwxr-xr-x]src/knot/server/tcp-handler.c76
-rw-r--r--[-rwxr-xr-x]src/knot/server/tcp-handler.h18
-rw-r--r--[-rwxr-xr-x]src/knot/server/udp-handler.c58
-rw-r--r--[-rwxr-xr-x]src/knot/server/udp-handler.h10
-rw-r--r--[-rwxr-xr-x]src/knot/server/xfr-handler.c166
-rw-r--r--[-rwxr-xr-x]src/knot/server/xfr-handler.h46
-rw-r--r--[-rwxr-xr-x]src/knot/server/zones.c448
-rw-r--r--[-rwxr-xr-x]src/knot/server/zones.h74
-rw-r--r--[-rwxr-xr-x]src/knot/stat/gatherer.c0
-rw-r--r--[-rwxr-xr-x]src/knot/stat/gatherer.h0
-rw-r--r--[-rwxr-xr-x]src/knot/stat/stat-common.h0
-rw-r--r--[-rwxr-xr-x]src/knot/stat/stat.c0
-rw-r--r--[-rwxr-xr-x]src/knot/stat/stat.h0
-rw-r--r--[-rwxr-xr-x]src/knot/zone/semantic-check.c9
-rw-r--r--[-rwxr-xr-x]src/knot/zone/semantic-check.h0
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-dump-text.c209
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-dump-text.h2
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-dump.c27
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-dump.h4
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-load.c8
-rw-r--r--[-rwxr-xr-x]src/knot/zone/zone-load.h0
-rw-r--r--[-rwxr-xr-x]src/knotc.82
-rw-r--r--[-rwxr-xr-x]src/knotd.82
-rw-r--r--[-rwxr-xr-x]src/libknot/common.h17
-rw-r--r--[-rwxr-xr-x]src/libknot/consts.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/dname.c9
-rw-r--r--[-rwxr-xr-x]src/libknot/dname.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/edns.c15
-rw-r--r--[-rwxr-xr-x]src/libknot/edns.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/cuckoo-hash-table.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/cuckoo-hash-table.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/hash-functions.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/hash-functions.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/universal-system.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/hash/universal-system.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/libknot.h1
-rw-r--r--[-rwxr-xr-x]src/libknot/nameserver/name-server.c36
-rw-r--r--[-rwxr-xr-x]src/libknot/nameserver/name-server.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/nsec3.c7
-rw-r--r--[-rwxr-xr-x]src/libknot/nsec3.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/packet.c55
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/packet.h12
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/query.c17
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/query.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/response.c89
-rw-r--r--[-rwxr-xr-x]src/libknot/packet/response.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/rdata.c9
-rw-r--r--[-rwxr-xr-x]src/libknot/rdata.h8
-rw-r--r--[-rwxr-xr-x]src/libknot/rrset.c23
-rw-r--r--[-rwxr-xr-x]src/libknot/rrset.h10
-rw-r--r--[-rwxr-xr-x]src/libknot/tsig-op.c85
-rw-r--r--[-rwxr-xr-x]src/libknot/tsig-op.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/tsig.c37
-rw-r--r--[-rwxr-xr-x]src/libknot/tsig.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/changesets.c3
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/changesets.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/ddns.c7
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/ddns.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/xfr-in.c17
-rw-r--r--[-rwxr-xr-x]src/libknot/updates/xfr-in.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/debug.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/debug.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/descriptor.c15
-rw-r--r--[-rwxr-xr-x]src/libknot/util/descriptor.h5
-rw-r--r--[-rwxr-xr-x]src/libknot/util/tolower.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/tolower.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/utils.c0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/utils.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/util/wire.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/dname-table.c5
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/dname-table.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/node.c51
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/node.h2
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-contents.c146
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-contents.h14
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-diff.c29
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-diff.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-tree.c27
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone-tree.h20
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone.c3
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zone.h0
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zonedb.c5
-rw-r--r--[-rwxr-xr-x]src/libknot/zone/zonedb.h0
-rw-r--r--[-rwxr-xr-x]src/tests/README0
-rw-r--r--[-rwxr-xr-x]src/tests/common/acl_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/common/acl_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/common/events_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/common/events_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/common/fdset_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/common/fdset_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/common/skiplist_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/common/skiplist_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/common/slab_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/common/slab_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/files/sample_conf0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/conf_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/conf_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/dthreads_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/dthreads_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/journal_tests.c20
-rw-r--r--[-rwxr-xr-x]src/tests/knot/journal_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/server_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/knot/server_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/files/parsed_databin71188 -> 71188 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/files/parsed_data_queriesbin1325 -> 1325 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/files/raw_databin72100 -> 72100 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/files/raw_data_queriesbin1387 -> 1387 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/cuckoo_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/cuckoo_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/dname_table_tests.c9
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/dname_table_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/dname_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/dname_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/edns_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/edns_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/node_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/node_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/nsec3_tests.c19
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/nsec3_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/packet_tests.c63
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/packet_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/query_tests.c11
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/query_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/rdata_tests.c7
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/rdata_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/response_tests.c57
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/response_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/rrset_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/rrset_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/tsig_tests.c82
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/tsig_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zone_tests.c25
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zone_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zone_tree_tests.c68
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zone_tree_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zonedb_tests.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/libknot/zonedb_tests.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/files/parsed_databin4851 -> 4851 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/files/parsed_data_queriesbin1325 -> 1325 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/files/raw_databin4935 -> 4935 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/files/raw_data_queriesbin1387 -> 1387 bytes
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/dname_tests_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/dname_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/edns_tests_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/edns_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/node_tests_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/node_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/packet_tests_realdata.c1
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/packet_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/rdata_tests_realdata.c1
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/rdata_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/response_tests_realdata.c1
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/response_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/rrset_tests_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/rrset_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/zone_tests_realdata.c1
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/zone_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/zonedb_tests_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot/zonedb_tests_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot_tests_loader_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/libknot_tests_loader_realdata.h0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/realdata/unittests_libknot_realdata.c0
-rw-r--r--[-rwxr-xr-x]src/tests/libknot/unittests_libknot.c0
-rw-r--r--[-rwxr-xr-x]src/tests/unittests_main.c0
-rw-r--r--[-rwxr-xr-x]src/tests/xfr_tests.c13
-rw-r--r--[-rwxr-xr-x]src/tests/xfr_tests.h0
-rw-r--r--[-rwxr-xr-x]src/zcompile/LICENSE0
-rw-r--r--[-rwxr-xr-x]src/zcompile/parser-descriptor.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/parser-descriptor.h0
-rw-r--r--[-rwxr-xr-x]src/zcompile/parser-util.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/parser-util.h0
-rw-r--r--[-rwxr-xr-x]src/zcompile/tests/unittests_zp_main.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/tests/zcompile_tests.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zcompile-error.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zcompile-error.h0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zcompile.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zcompile.h0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zcompile_main.c0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zlexer.l0
-rw-r--r--[-rwxr-xr-x]src/zcompile/zparser.y0
-rw-r--r--[-rwxr-xr-x]tests/querytcp.c0
328 files changed, 1873 insertions, 1887 deletions
diff --git a/AUTHORS b/AUTHORS
index c032e47..c032e47 100755..100644
--- a/AUTHORS
+++ b/AUTHORS
diff --git a/COPYING b/COPYING
index 173ff49..173ff49 100755..100644
--- a/COPYING
+++ b/COPYING
diff --git a/ChangeLog b/ChangeLog
index e69de29..e69de29 100755..100644
--- a/ChangeLog
+++ b/ChangeLog
diff --git a/CodingStyle b/CodingStyle
index 986417c..986417c 100755..100644
--- a/CodingStyle
+++ b/CodingStyle
diff --git a/Doxy.page.h b/Doxy.page.h
index 9d73024..9d73024 100755..100644
--- a/Doxy.page.h
+++ b/Doxy.page.h
diff --git a/Doxyfile b/Doxyfile
index 1a5bb0a..1a5bb0a 100755..100644
--- a/Doxyfile
+++ b/Doxyfile
diff --git a/Doxyfile.devel b/Doxyfile.devel
index 4b73045..4b73045 100755..100644
--- a/Doxyfile.devel
+++ b/Doxyfile.devel
diff --git a/INSTALL b/INSTALL
index 7d1c323..7d1c323 100755..100644
--- a/INSTALL
+++ b/INSTALL
diff --git a/KNOWN_ISSUES b/KNOWN_ISSUES
index fff55a8..fff55a8 100755..100644
--- a/KNOWN_ISSUES
+++ b/KNOWN_ISSUES
diff --git a/Knot.config b/Knot.config
index 8cec188..8cec188 100755..100644
--- a/Knot.config
+++ b/Knot.config
diff --git a/Knot.creator b/Knot.creator
index e94cbbd..e94cbbd 100755..100644
--- a/Knot.creator
+++ b/Knot.creator
diff --git a/Knot.files b/Knot.files
index 99c6d59..903cf79 100755..100644
--- a/Knot.files
+++ b/Knot.files
@@ -49,8 +49,6 @@ src/libknot/util/utils.h
src/libknot/util/utils.c
src/libknot/util/descriptor.h
src/libknot/util/descriptor.c
-src/libknot/util/libknot_error.c
-src/libknot/util/error.h
src/libknot/zone/zonedb.h
src/libknot/zone/zonedb.c
src/libknot/zone/node.h
@@ -91,6 +89,8 @@ src/common/evqueue.c
src/common/evqueue.h
src/common/evsched.c
src/common/evsched.h
+src/common/errcode.h
+src/common/errcode.c
src/common/errors.h
src/common/errors.c
src/common/acl.c
@@ -135,8 +135,6 @@ src/knot/ctl/knotc_main.c
src/knot/ctl/process.c
src/knot/ctl/process.h
src/knot/other/debug.h
-src/knot/other/error.c
-src/knot/other/error.h
src/knot/stat/gatherer.c
src/knot/stat/gatherer.h
src/knot/stat/stat.h
diff --git a/Knot.includes b/Knot.includes
index 8184956..8184956 100755..100644
--- a/Knot.includes
+++ b/Knot.includes
diff --git a/Makefile.am b/Makefile.am
index a3ae405..a3ae405 100755..100644
--- a/Makefile.am
+++ b/Makefile.am
diff --git a/Makefile.in b/Makefile.in
index f8bcf7d..5aa9697 100755..100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -147,7 +147,6 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -233,7 +232,7 @@ all: all-recursive
.SUFFIXES:
am--refresh:
@:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -260,9 +259,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
diff --git a/NEWS b/NEWS
index e69de29..e69de29 100755..100644
--- a/NEWS
+++ b/NEWS
diff --git a/README b/README
index d50168f..d50168f 100755..100644
--- a/README
+++ b/README
diff --git a/RELNOTES b/RELNOTES
index 42e5206..ea54bc5 100755..100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,31 @@
+v1.1.1 - Oct 31, 2012
+---------------------
+
+Bugfixes:
+ * Fixed assertion failing when asking directly for a wildcard name.
+
+
+v1.1.1-rc1 - Oct 23, 2012
+-------------------------
+
+Bugfixes:
+ * Crash after IXFR in certain cases when adding RRSIG in an IXFR.
+ * Fixed behaviour when incoming IXFR removes a zone cut. Previously
+ occluded names now become properly visible. Previously lead to a
+ crash when the server was asked for the previously occluded name.
+ * Fixed handling of zero-length strings in text zone dump. Caused the
+ compilation to fail.
+ * Fixed TSIG algorithm name comparison - the names should be in
+ canonical form.
+ * Fixed handling unknown RR types with type less than 251.
+
+Features:
+ * Improved compression of packets. Out-of-zone dnames present in RDATA
+ were not compressed.
+ * Slave zones are now automatically refreshed after startup.
+ * Proper response to IXFR/UDP query (returns SOA in Authority section).
+
+
v1.1.0 - Aug 31, 2012
---------------------
diff --git a/aclocal.m4 b/aclocal.m4
index 5184c03..ab7b78f 100755..100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -608,46 +608,6 @@ if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi])
-# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
-# From Jim Meyering
-
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 5
-
-# AM_MAINTAINER_MODE([DEFAULT-MODE])
-# ----------------------------------
-# Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well. Anyway, the user
-# can override the default with the --enable/--disable switch.
-AC_DEFUN([AM_MAINTAINER_MODE],
-[m4_case(m4_default([$1], [disable]),
- [enable], [m4_define([am_maintainer_other], [disable])],
- [disable], [m4_define([am_maintainer_other], [enable])],
- [m4_define([am_maintainer_other], [enable])
- m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
- dnl maintainer-mode's default is 'disable' unless 'enable' is passed
- AC_ARG_ENABLE([maintainer-mode],
-[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- [USE_MAINTAINER_MODE=$enableval],
- [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
- AC_MSG_RESULT([$USE_MAINTAINER_MODE])
- AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST([MAINT])dnl
-]
-)
-
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
diff --git a/configure b/configure
index 6cec3a0..8ca5af2 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for knot 1.1.0.
+# Generated by GNU Autoconf 2.68 for knot 1.1.1.
#
# Report bugs to <knot-dns@labs.nic.cz>.
#
@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='knot'
PACKAGE_TARNAME='knot'
-PACKAGE_VERSION='1.1.0'
-PACKAGE_STRING='knot 1.1.0'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='knot 1.1.1'
PACKAGE_BUGREPORT='knot-dns@labs.nic.cz'
PACKAGE_URL=''
@@ -649,9 +649,6 @@ build_vendor
build_cpu
build
LIBTOOL
-MAINT
-MAINTAINER_MODE_FALSE
-MAINTAINER_MODE_TRUE
SIMD_FLAGS
EGREP
GREP
@@ -737,7 +734,6 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_dependency_tracking
-enable_maintainer_mode
enable_shared
enable_static
with_pic
@@ -1304,7 +1300,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures knot 1.1.0 to adapt to many kinds of systems.
+\`configure' configures knot 1.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1374,7 +1370,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of knot 1.1.0:";;
+ short | recursive ) echo "Configuration of knot 1.1.1:";;
esac
cat <<\_ACEOF
@@ -1384,8 +1380,6 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --disable-maintainer-mode disable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
@@ -1494,7 +1488,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-knot configure 1.1.0
+knot configure 1.1.1
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2044,7 +2038,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by knot $as_me 1.1.0, which was
+It was created by knot $as_me 1.1.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2862,7 +2856,7 @@ fi
# Define the identity of the package.
PACKAGE='knot'
- VERSION='1.1.0'
+ VERSION='1.1.1'
cat >>confdefs.h <<_ACEOF
@@ -5443,31 +5437,6 @@ fi
# for automake 1.12
AM_PROG_AR
-# Enable maintainer mode by default for development
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to disable maintainer-specific portions of Makefiles" >&5
-$as_echo_n "checking whether to disable maintainer-specific portions of Makefiles... " >&6; }
- # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then :
- enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
-else
- USE_MAINTAINER_MODE=yes
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
-$as_echo "$USE_MAINTAINER_MODE" >&6; }
- if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
-
- MAINT=$MAINTAINER_MODE_TRUE
-
-
-
# Initialize libtool
case `pwd` in
*\ * | *\ *)
@@ -14730,10 +14699,6 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
- as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
@@ -15143,7 +15108,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by knot $as_me 1.1.0, which was
+This file was extended by knot $as_me 1.1.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15209,7 +15174,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-knot config.status 1.1.0
+knot config.status 1.1.1
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index eeca939..68bc0d5 100755..100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
-AC_PREREQ([2.65])
-AC_INIT([knot], [1.1.0], [knot-dns@labs.nic.cz])
+AC_PREREQ([2.60])
+AC_INIT([knot], [1.1.1], [knot-dns@labs.nic.cz])
AM_INIT_AUTOMAKE([gnu -Wall -Werror])
AC_CONFIG_SRCDIR([src/knot/main.c])
AC_CONFIG_HEADERS([src/config.h])
@@ -14,9 +14,6 @@ AC_PROG_CC
m4_pattern_allow([AM_PROG_AR]) # for automake 1.12
AM_PROG_AR
-# Enable maintainer mode by default for development
-AM_MAINTAINER_MODE([enable])
-
# Initialize libtool
AC_PROG_LIBTOOL
LT_INIT
diff --git a/doc/.gitignore b/doc/.gitignore
index b9dc5b2..b9dc5b2 100755..100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9cec847..9cec847 100755..100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
diff --git a/doc/Makefile.in b/doc/Makefile.in
index b45e192..5e388a2 100755..100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -128,7 +128,6 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -222,7 +221,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .dvi .html .info .pdf .ps .texi
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -247,9 +246,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
@@ -308,7 +307,7 @@ $(srcdir)/knot.info: knot.texi $(srcdir)/version.texi $(knot_TEXINFOS)
knot.dvi: knot.texi $(srcdir)/version.texi $(knot_TEXINFOS)
knot.pdf: knot.texi $(srcdir)/version.texi $(knot_TEXINFOS)
knot.html: knot.texi $(srcdir)/version.texi $(knot_TEXINFOS)
-$(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti
+$(srcdir)/version.texi: $(srcdir)/stamp-vti
$(srcdir)/stamp-vti: knot.texi $(top_srcdir)/configure
@(dir=.; test -f ./knot.texi || dir=$(srcdir); \
set `$(SHELL) $(srcdir)/mdate-sh $$dir/knot.texi`; \
@@ -326,7 +325,7 @@ mostlyclean-vti:
-rm -f vti.tmp
maintainer-clean-vti:
-@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
+ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
.dvi.ps:
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
$(DVIPS) -o $@ $<
diff --git a/doc/configuration.texi b/doc/configuration.texi
index 8b7a1ef..8b7a1ef 100755..100644
--- a/doc/configuration.texi
+++ b/doc/configuration.texi
diff --git a/doc/indices.texi b/doc/indices.texi
index f3a1e88..f3a1e88 100755..100644
--- a/doc/indices.texi
+++ b/doc/indices.texi
diff --git a/doc/installation.texi b/doc/installation.texi
index 0d88f06..0d88f06 100755..100644
--- a/doc/installation.texi
+++ b/doc/installation.texi
diff --git a/doc/introduction.texi b/doc/introduction.texi
index 4217001..4217001 100755..100644
--- a/doc/introduction.texi
+++ b/doc/introduction.texi
diff --git a/doc/knot.texi b/doc/knot.texi
index b0929ae..b0929ae 100755..100644
--- a/doc/knot.texi
+++ b/doc/knot.texi
diff --git a/doc/migration.texi b/doc/migration.texi
index 9d4e0fa..9d4e0fa 100755..100644
--- a/doc/migration.texi
+++ b/doc/migration.texi
diff --git a/doc/reference.texi b/doc/reference.texi
index 9dffd00..9dffd00 100755..100644
--- a/doc/reference.texi
+++ b/doc/reference.texi
diff --git a/doc/requirements.texi b/doc/requirements.texi
index 136f3c6..136f3c6 100755..100644
--- a/doc/requirements.texi
+++ b/doc/requirements.texi
diff --git a/doc/running.texi b/doc/running.texi
index 628cd7d..628cd7d 100755..100644
--- a/doc/running.texi
+++ b/doc/running.texi
diff --git a/doc/security.texi b/doc/security.texi
index 3716521..3716521 100755..100644
--- a/doc/security.texi
+++ b/doc/security.texi
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 9140826..9140826 100755..100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
diff --git a/doc/troubleshooting.texi b/doc/troubleshooting.texi
index 18fee7a..18fee7a 100755..100644
--- a/doc/troubleshooting.texi
+++ b/doc/troubleshooting.texi
diff --git a/knot.sample.conf.in b/knot.sample.conf.in
index db5c587..db5c587 100755..100644
--- a/knot.sample.conf.in
+++ b/knot.sample.conf.in
diff --git a/m4/ax_check_compiler_flags.m4 b/m4/ax_check_compiler_flags.m4
index 05e5c3b..05e5c3b 100755..100644
--- a/m4/ax_check_compiler_flags.m4
+++ b/m4/ax_check_compiler_flags.m4
diff --git a/m4/ax_ext.m4 b/m4/ax_ext.m4
index 898f2bf..898f2bf 100755..100644
--- a/m4/ax_ext.m4
+++ b/m4/ax_ext.m4
diff --git a/m4/ax_gcc_x86_cpuid.m4 b/m4/ax_gcc_x86_cpuid.m4
index e9231b8..e9231b8 100755..100644
--- a/m4/ax_gcc_x86_cpuid.m4
+++ b/m4/ax_gcc_x86_cpuid.m4
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 8ff3c76..8ff3c76 100755..100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index 17cfd51..17cfd51 100755..100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
index 9000a05..9000a05 100755..100644
--- a/m4/ltsugar.m4
+++ b/m4/ltsugar.m4
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
index 9c7b5d4..9c7b5d4 100755..100644
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
index c573da9..c573da9 100755..100644
--- a/m4/lt~obsolete.m4
+++ b/m4/lt~obsolete.m4
diff --git a/samples/Makefile.am b/samples/Makefile.am
index f9aa616..f9aa616 100755..100644
--- a/samples/Makefile.am
+++ b/samples/Makefile.am
diff --git a/samples/Makefile.in b/samples/Makefile.in
index 6abb962..0bc8a32 100755..100644
--- a/samples/Makefile.in
+++ b/samples/Makefile.in
@@ -92,7 +92,6 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -181,7 +180,7 @@ edit = sed \
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -206,9 +205,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
diff --git a/samples/bogus25.com.zone b/samples/bogus25.com.zone
index 5260270..5260270 100755..100644
--- a/samples/bogus25.com.zone
+++ b/samples/bogus25.com.zone
diff --git a/samples/example.com.zone b/samples/example.com.zone
index c6a0aef..c6a0aef 100755..100644
--- a/samples/example.com.zone
+++ b/samples/example.com.zone
diff --git a/samples/example.com.zone.signed b/samples/example.com.zone.signed
index d57b39b..d57b39b 100755..100644
--- a/samples/example.com.zone.signed
+++ b/samples/example.com.zone.signed
diff --git a/samples/example.com.zone.signed.nsec3 b/samples/example.com.zone.signed.nsec3
index 88a28fc..88a28fc 100755..100644
--- a/samples/example.com.zone.signed.nsec3
+++ b/samples/example.com.zone.signed.nsec3
diff --git a/samples/knot.full.conf b/samples/knot.full.conf
index 9aac27b..bb3ba92 100755..100644
--- a/samples/knot.full.conf
+++ b/samples/knot.full.conf
@@ -119,7 +119,7 @@ zones {
# Shared options for all listed zones
#
- # Build differences from zone file changes
+ # Build differences from zone file changes. EXPERIMENTAL feature.
# Possible values: on|off
# Default value: off
ixfr-from-differences off;
diff --git a/samples/knot.min.conf b/samples/knot.min.conf
index 6b7c1af..6b7c1af 100755..100644
--- a/samples/knot.min.conf
+++ b/samples/knot.min.conf
diff --git a/samples/knot.sample.conf.in b/samples/knot.sample.conf.in
index 09da2a8..09da2a8 100755..100644
--- a/samples/knot.sample.conf.in
+++ b/samples/knot.sample.conf.in
diff --git a/scripts/urcu-tls-compat.patch b/scripts/urcu-tls-compat.patch
index cd5ff25..cd5ff25 100755..100644
--- a/scripts/urcu-tls-compat.patch
+++ b/scripts/urcu-tls-compat.patch
diff --git a/src/Makefile.am b/src/Makefile.am
index eece959..1bd26f5 100755..100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,7 @@
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 knot.conf.5
-man8_MANS = knotc.8 knotd.8 knot.conf.5
-EXTRA_DIST = $(man8_MANS)
+dist_man_MANS = knot.conf.5 knotc.8 knotd.8
# $(YACC) will generate header file
AM_CFLAGS = -Wall -Ilibknot -DLIBEXECDIR='"$(libexecdir)"' -DSYSCONFDIR='"$(sysconfdir)"' -DSBINDIR='"$(sbindir)"'
@@ -152,7 +150,6 @@ knotd_SOURCES = \
noinst_LTLIBRARIES = libknot.la libknotd.la libknots.la
libknot_la_SOURCES = \
- libknot/util/libknot_error.c \
libknot/util/utils.c \
libknot/util/debug.c \
libknot/util/debug.h \
@@ -251,6 +248,8 @@ libknots_la_SOURCES = \
common/ref.c \
common/errors.h \
common/errors.c \
+ common/errcode.h \
+ common/errcode.c \
common/dSFMT.h \
common/dSFMT-params.h \
common/dSFMT-params521.h \
@@ -275,8 +274,6 @@ libknotd_la_SOURCES = \
knot/stat/stat.h \
knot/common.h \
knot/other/debug.h \
- knot/other/error.h \
- knot/other/error.c \
knot/conf/cf-parse.y \
knot/conf/cf-lex.l \
knot/conf/conf.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index d20810f..81c5dd1 100755..100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -41,10 +41,10 @@ libexec_PROGRAMS = knot-zcompile$(EXEEXT) unittests$(EXEEXT) \
unittests-xfr$(EXEEXT)
sbin_PROGRAMS = knotc$(EXEEXT) knotd$(EXEEXT)
subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/config.h.in libknotd_la-cf-lex.c \
- libknotd_la-cf-parse.c libknotd_la-cf-parse.h zlexer.c \
- zparser.c zparser.h
+DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ libknotd_la-cf-lex.c libknotd_la-cf-parse.c \
+ libknotd_la-cf-parse.h zlexer.c zparser.c zparser.h
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compiler_flags.m4 \
$(top_srcdir)/m4/ax_ext.m4 \
@@ -60,31 +60,29 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libknot_la_LIBADD =
-am_libknot_la_OBJECTS = libknot_error.lo utils.lo debug.lo \
- descriptor.lo tolower.lo query.lo response.lo packet.lo \
- zone.lo zone-contents.lo zone-tree.lo zonedb.lo node.lo \
- dname-table.lo zone-diff.lo hash-functions.lo \
- cuckoo-hash-table.lo universal-system.lo name-server.lo \
- changesets.lo xfr-in.lo ddns.lo edns.lo rrset.lo dname.lo \
- rdata.lo nsec3.lo tsig.lo tsig-op.lo
+am_libknot_la_OBJECTS = utils.lo debug.lo descriptor.lo tolower.lo \
+ query.lo response.lo packet.lo zone.lo zone-contents.lo \
+ zone-tree.lo zonedb.lo node.lo dname-table.lo zone-diff.lo \
+ hash-functions.lo cuckoo-hash-table.lo universal-system.lo \
+ name-server.lo changesets.lo xfr-in.lo ddns.lo edns.lo \
+ rrset.lo dname.lo rdata.lo nsec3.lo tsig.lo tsig-op.lo
libknot_la_OBJECTS = $(am_libknot_la_OBJECTS)
libknotd_la_DEPENDENCIES = libknot.la libknots.la @LIBOBJS@
-am_libknotd_la_OBJECTS = gatherer.lo stat.lo error.lo \
- libknotd_la-cf-parse.lo libknotd_la-cf-lex.lo conf.lo \
- logconf.lo process.lo dthreads.lo journal.lo socket.lo \
- server.lo udp-handler.lo tcp-handler.lo xfr-handler.lo \
- zones.lo notify.lo zone-load.lo semantic-check.lo zone-dump.lo \
- zone-dump-text.lo
+am_libknotd_la_OBJECTS = gatherer.lo stat.lo libknotd_la-cf-parse.lo \
+ libknotd_la-cf-lex.lo conf.lo logconf.lo process.lo \
+ dthreads.lo journal.lo socket.lo server.lo udp-handler.lo \
+ tcp-handler.lo xfr-handler.lo zones.lo notify.lo zone-load.lo \
+ semantic-check.lo zone-dump.lo zone-dump-text.lo
libknotd_la_OBJECTS = $(am_libknotd_la_OBJECTS)
libknots_la_DEPENDENCIES = @LIBOBJS@
am_libknots_la_OBJECTS = slab.lo tap.lo mempattern.lo lists.lo \
base32.lo base64.lo heap.lo print.lo skip-list.lo base32hex.lo \
general-tree.lo evqueue.lo evsched.lo acl.lo sockaddr.lo \
- ref.lo errors.lo dSFMT.lo prng.lo fdset.lo fdset_poll.lo \
- fdset_kqueue.lo fdset_epoll.lo log.lo
+ ref.lo errors.lo errcode.lo dSFMT.lo prng.lo fdset.lo \
+ fdset_poll.lo fdset_kqueue.lo fdset_epoll.lo log.lo
libknots_la_OBJECTS = $(am_libknots_la_OBJECTS)
am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \
- "$(DESTDIR)$(man8dir)"
+ "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
PROGRAMS = $(libexec_PROGRAMS) $(sbin_PROGRAMS)
am_knot_zcompile_OBJECTS = zcompile_main.$(OBJEXT) \
zcompile-error.$(OBJEXT) zparser.$(OBJEXT) zlexer.$(OBJEXT) \
@@ -156,12 +154,10 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
YLWRAP = $(top_srcdir)/ylwrap
-@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
@@ -198,9 +194,10 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
NROFF = nroff
-MANS = $(man8_MANS)
+MANS = $(dist_man_MANS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -245,7 +242,6 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -325,9 +321,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I ../m4
-MANPAGES = knotc.8 knotd.8 knot.conf.5
-man8_MANS = knotc.8 knotd.8 knot.conf.5
-EXTRA_DIST = $(man8_MANS)
+dist_man_MANS = knot.conf.5 knotc.8 knotd.8
# $(YACC) will generate header file
AM_CFLAGS = -Wall -Ilibknot -DLIBEXECDIR='"$(libexecdir)"' -DSYSCONFDIR='"$(sysconfdir)"' -DSBINDIR='"$(sbindir)"'
@@ -474,7 +468,6 @@ knotd_SOURCES = \
noinst_LTLIBRARIES = libknot.la libknotd.la libknots.la
libknot_la_SOURCES = \
- libknot/util/libknot_error.c \
libknot/util/utils.c \
libknot/util/debug.c \
libknot/util/debug.h \
@@ -573,6 +566,8 @@ libknots_la_SOURCES = \
common/ref.c \
common/errors.h \
common/errors.c \
+ common/errcode.h \
+ common/errcode.c \
common/dSFMT.h \
common/dSFMT-params.h \
common/dSFMT-params521.h \
@@ -597,8 +592,6 @@ libknotd_la_SOURCES = \
knot/stat/stat.h \
knot/common.h \
knot/other/debug.h \
- knot/other/error.h \
- knot/other/error.c \
knot/conf/cf-parse.y \
knot/conf/cf-lex.l \
knot/conf/conf.c \
@@ -650,7 +643,7 @@ all: $(BUILT_SOURCES) config.h
.SUFFIXES:
.SUFFIXES: .c .l .lo .o .obj .y
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -675,9 +668,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
@@ -690,7 +683,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
-$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
@@ -863,7 +856,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edns.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edns_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edns_tests_realdata.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errcode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errors.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/events_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evqueue.Plo@am__quote@
@@ -880,7 +873,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/journal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/journal_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/knotc_main.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libknot_error.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libknot_tests_loader_realdata.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libknotd_la-cf-lex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libknotd_la-cf-parse.Plo@am__quote@
@@ -983,13 +975,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-libknot_error.lo: libknot/util/libknot_error.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libknot_error.lo -MD -MP -MF $(DEPDIR)/libknot_error.Tpo -c -o libknot_error.lo `test -f 'libknot/util/libknot_error.c' || echo '$(srcdir)/'`libknot/util/libknot_error.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libknot_error.Tpo $(DEPDIR)/libknot_error.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libknot/util/libknot_error.c' object='libknot_error.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libknot_error.lo `test -f 'libknot/util/libknot_error.c' || echo '$(srcdir)/'`libknot/util/libknot_error.c
-
utils.lo: libknot/util/utils.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utils.lo -MD -MP -MF $(DEPDIR)/utils.Tpo -c -o utils.lo `test -f 'libknot/util/utils.c' || echo '$(srcdir)/'`libknot/util/utils.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/utils.Tpo $(DEPDIR)/utils.Plo
@@ -1200,13 +1185,6 @@ stat.lo: knot/stat/stat.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stat.lo `test -f 'knot/stat/stat.c' || echo '$(srcdir)/'`knot/stat/stat.c
-error.lo: knot/other/error.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT error.lo -MD -MP -MF $(DEPDIR)/error.Tpo -c -o error.lo `test -f 'knot/other/error.c' || echo '$(srcdir)/'`knot/other/error.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/error.Tpo $(DEPDIR)/error.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='knot/other/error.c' object='error.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o error.lo `test -f 'knot/other/error.c' || echo '$(srcdir)/'`knot/other/error.c
-
conf.lo: knot/conf/conf.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT conf.lo -MD -MP -MF $(DEPDIR)/conf.Tpo -c -o conf.lo `test -f 'knot/conf/conf.c' || echo '$(srcdir)/'`knot/conf/conf.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/conf.Tpo $(DEPDIR)/conf.Plo
@@ -1438,6 +1416,13 @@ errors.lo: common/errors.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errors.lo `test -f 'common/errors.c' || echo '$(srcdir)/'`common/errors.c
+errcode.lo: common/errcode.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errcode.lo -MD -MP -MF $(DEPDIR)/errcode.Tpo -c -o errcode.lo `test -f 'common/errcode.c' || echo '$(srcdir)/'`common/errcode.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/errcode.Tpo $(DEPDIR)/errcode.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common/errcode.c' object='errcode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errcode.lo `test -f 'common/errcode.c' || echo '$(srcdir)/'`common/errcode.c
+
dSFMT.lo: common/dSFMT.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dSFMT.lo -MD -MP -MF $(DEPDIR)/dSFMT.Tpo -c -o dSFMT.lo `test -f 'common/dSFMT.c' || echo '$(srcdir)/'`common/dSFMT.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dSFMT.Tpo $(DEPDIR)/dSFMT.Plo
@@ -2162,11 +2147,51 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-man8: $(man8_MANS)
+install-man5: $(dist_man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
+ @list=''; test -n "$(man5dir)" || exit 0; \
+ { for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.5[a-z]*$$/p'; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man5:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man5dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.5[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
+install-man8: $(dist_man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
- @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
+ @list=''; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -2189,8 +2214,10 @@ install-man8: $(man8_MANS)
uninstall-man8:
@$(NORMAL_UNINSTALL)
- @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
+ @list=''; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
@@ -2297,7 +2324,7 @@ check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) config.h
installdirs:
- for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \
+ for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -2373,7 +2400,7 @@ install-info: install-info-am
install-info-am:
-install-man: install-man8
+install-man: install-man5 install-man8
install-pdf: install-pdf-am
@@ -2406,7 +2433,7 @@ ps-am:
uninstall-am: uninstall-libexecPROGRAMS uninstall-man \
uninstall-sbinPROGRAMS
-uninstall-man: uninstall-man8
+uninstall-man: uninstall-man5 uninstall-man8
.MAKE: all check install install-am install-strip
@@ -2418,13 +2445,14 @@ uninstall-man: uninstall-man8
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
- install-libexecPROGRAMS install-man install-man8 install-pdf \
- install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-libexecPROGRAMS uninstall-man uninstall-man8 \
+ install-libexecPROGRAMS install-man install-man5 install-man8 \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sbinPROGRAMS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-libexecPROGRAMS \
+ uninstall-man uninstall-man5 uninstall-man8 \
uninstall-sbinPROGRAMS
diff --git a/src/common/LICENSE.txt b/src/common/LICENSE.txt
index 15e3bef..15e3bef 100755..100644
--- a/src/common/LICENSE.txt
+++ b/src/common/LICENSE.txt
diff --git a/src/common/acl.c b/src/common/acl.c
index c8e0488..c8e0488 100755..100644
--- a/src/common/acl.c
+++ b/src/common/acl.c
diff --git a/src/common/acl.h b/src/common/acl.h
index 7ce8f26..7ce8f26 100755..100644
--- a/src/common/acl.h
+++ b/src/common/acl.h
diff --git a/src/common/base32.c b/src/common/base32.c
index 43b86c1..43b86c1 100755..100644
--- a/src/common/base32.c
+++ b/src/common/base32.c
diff --git a/src/common/base32.h b/src/common/base32.h
index 45df9fa..45df9fa 100755..100644
--- a/src/common/base32.h
+++ b/src/common/base32.h
diff --git a/src/common/base32hex.c b/src/common/base32hex.c
index cd2d2ce..cd2d2ce 100755..100644
--- a/src/common/base32hex.c
+++ b/src/common/base32hex.c
diff --git a/src/common/base32hex.h b/src/common/base32hex.h
index 9ac4fa8..9ac4fa8 100755..100644
--- a/src/common/base32hex.h
+++ b/src/common/base32hex.h
diff --git a/src/common/base64.c b/src/common/base64.c
index f1f601c..f1f601c 100755..100644
--- a/src/common/base64.c
+++ b/src/common/base64.c
diff --git a/src/common/base64.h b/src/common/base64.h
index aa0b696..aa0b696 100755..100644
--- a/src/common/base64.h
+++ b/src/common/base64.h
diff --git a/src/common/crc.h b/src/common/crc.h
index 7d748be..7d748be 100755..100644
--- a/src/common/crc.h
+++ b/src/common/crc.h
diff --git a/src/common/dSFMT-params.h b/src/common/dSFMT-params.h
index c779d8a..c779d8a 100755..100644
--- a/src/common/dSFMT-params.h
+++ b/src/common/dSFMT-params.h
diff --git a/src/common/dSFMT-params521.h b/src/common/dSFMT-params521.h
index f771dc1..f771dc1 100755..100644
--- a/src/common/dSFMT-params521.h
+++ b/src/common/dSFMT-params521.h
diff --git a/src/common/dSFMT.c b/src/common/dSFMT.c
index 090bb80..090bb80 100755..100644
--- a/src/common/dSFMT.c
+++ b/src/common/dSFMT.c
diff --git a/src/common/dSFMT.h b/src/common/dSFMT.h
index f1aa9bd..f1aa9bd 100755..100644
--- a/src/common/dSFMT.h
+++ b/src/common/dSFMT.h
diff --git a/src/libknot/util/libknot_error.c b/src/common/errcode.c
index dd4280d..9f5aff3 100755..100644
--- a/src/libknot/util/libknot_error.c
+++ b/src/common/errcode.c
@@ -14,28 +14,46 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "util/error.h"
+#include "common/errcode.h"
#include "common/errors.h"
-const error_table_t knot_error_msgs[KNOT_ERROR_COUNT] = {
+const error_table_t knot_error_msgs[] = {
{KNOT_EOK, "OK"},
- {KNOT_ERROR, "General error."},
+
+ /* TSIG errors. */
+ {KNOT_TSIG_EBADSIG, "Failed to verify TSIG MAC." },
+ {KNOT_TSIG_EBADKEY, "TSIG key not recognized or invalid." },
+ {KNOT_TSIG_EBADTIME, "TSIG signing time out of range." },
+
+ /* Directly mapped error codes. */
{KNOT_ENOMEM, "Not enough memory."},
+ {KNOT_EINVAL, "Invalid parameter."},
{KNOT_ENOTSUP, "Operation not supported."},
+ {KNOT_EBUSY, "Requested resource is busy."},
{KNOT_EAGAIN, "OS lacked necessary resources."},
+ {KNOT_EACCES, "Operation not permitted."},
+ {KNOT_ECONNREFUSED, "Connection refused."},
+ {KNOT_EISCONN, "Already connected."},
+ {KNOT_EADDRINUSE, "Address already in use."},
+ {KNOT_ENOENT, "Resource not found."},
{KNOT_ERANGE, "Value is out of range."},
- {KNOT_EBADARG, "Wrong argument supplied."},
+
+ /* General errors. */
+ {KNOT_ERROR, "General error."},
+ {KNOT_ENOTRUNNING, "Resource is not running."},
+ {KNOT_EPARSEFAIL, "Parser failed."},
+ {KNOT_ENOIPV6, "IPv6 support disabled."},
+ {KNOT_EEXPIRED, "Resource is expired."},
+ {KNOT_EUPTODATE, "Zone is up-to-date."},
{KNOT_EFEWDATA, "Not enough data to parse."},
{KNOT_ESPACE, "Not enough space provided."},
{KNOT_EMALF, "Malformed data."},
- {KNOT_ENOENT, "Resource not found."},
- {KNOT_EACCES, "Permission to perform requested operation is denied."},
{KNOT_ECRYPTO, "Error in crypto library."},
{KNOT_ENSEC3PAR, "Missing or wrong NSEC3PARAM record."},
{KNOT_ENSEC3CHAIN, "Missing or wrong NSEC3 chain in the zone."},
- {KNOT_EBADZONE, "Domain name does not belong to the given zone."},
+ {KNOT_EBADZONE, "Name does not belong to the zone."},
{KNOT_EHASH, "Error in hash table."},
- {KNOT_EZONEIN, "Error inserting zone."},
+ {KNOT_EZONEINVAL, "Invalid zone file."},
{KNOT_ENOZONE, "No such zone found."},
{KNOT_ENONODE, "No such node in zone found."},
{KNOT_ENORRSET, "No such RRSet found."},
@@ -47,12 +65,10 @@ const error_table_t knot_error_msgs[KNOT_ERROR_COUNT] = {
{KNOT_ENOIXFR, "Transfer is not IXFR (is in AXFR format)."},
{KNOT_EXFRREFUSED, "Zone transfer refused by the server."},
{KNOT_EXFRDENIED, "Transfer not allowed."},
- {KNOT_TSIG_EBADSIG, "Failed to verify TSIG MAC." },
- {KNOT_TSIG_EBADKEY, "TSIG key not recognized or invalid." },
- {KNOT_TSIG_EBADTIME, "TSIG signing time out of range." },
{KNOT_ECONN, "Connection reset."},
{KNOT_EIXFRSPACE, "IXFR reply did not fit in."},
{KNOT_ECNAME, "CNAME loop found in zone."},
{KNOT_ENODIFF, "Cannot create zone diff."},
+
{KNOT_ERROR, 0}
};
diff --git a/src/libknot/util/error.h b/src/common/errcode.h
index 96eff68..50535ad 100755..100644
--- a/src/libknot/util/error.h
+++ b/src/common/errcode.h
@@ -1,11 +1,12 @@
/*!
- * \file error.h
+ * \file errcode.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
+ * \author Marek Vavrusa <marek.vavrusa@nic.cz>
*
* \brief Error codes and function for getting error message.
*
- * \addtogroup libknot
+ * \addtogroup common_lib
* @{
*/
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
@@ -24,38 +25,49 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _KNOT_ERROR_H_
-#define _KNOT_ERROR_H_
+#ifndef _KNOTD_COMMON_ERRCODE_H_
+#define _KNOTD_COMMON_ERRCODE_H_
#include "common/errors.h"
/*! \brief Error codes used in the library. */
enum knot_error {
- KNOT_EOK = 0, /*!< OK */
+ KNOT_EOK = 0, /*!< OK */
/* TSIG errors. */
- KNOT_TSIG_EBADSIG = -16, /*!< Failed to verify TSIG MAC. */
- KNOT_TSIG_EBADKEY = -17, /*!< TSIG key not recognized or invalid. */
- KNOT_TSIG_EBADTIME = -18,/*!< TSIG signing time out of range. */
+ KNOT_TSIG_EBADSIG = -16, /*!< Failed to verify TSIG MAC. */
+ KNOT_TSIG_EBADKEY = -17, /*!< TSIG key not recognized or invalid. */
+ KNOT_TSIG_EBADTIME = -18, /*!< TSIG signing time out of range. */
+ /* Directly mapped error codes. */
+ KNOT_ENOMEM = -ENOMEM, /*!< Out of memory. */
+ KNOT_EINVAL = -EINVAL, /*!< Invalid parameter passed. */
+ KNOT_ENOTSUP = -ENOTSUP, /*!< Parameter not supported. */
+ KNOT_EBUSY = -EBUSY, /*!< Requested resource is busy. */
+ KNOT_EAGAIN = -EAGAIN, /*!< OS lacked necessary resources. */
+ KNOT_EACCES = -EACCES, /*!< Permission is denied. */
+ KNOT_ECONNREFUSED = -ECONNREFUSED, /*!< Connection is refused. */
+ KNOT_EISCONN = -EISCONN, /*!< Already connected. */
+ KNOT_EADDRINUSE = -EADDRINUSE, /*!< Address already in use. */
+ KNOT_ENOENT = -ENOENT, /*!< Resource not found. */
+ KNOT_ERANGE = -ERANGE, /*!< Value is out of range. */
+
/* General errors. */
KNOT_ERROR = -10000, /*!< General error. */
- KNOT_ENOMEM, /*!< Not enough memory. */
- KNOT_ENOTSUP, /*!< Operation not supported. */
- KNOT_EAGAIN, /*!< OS lacked necessary resources. */
- KNOT_ERANGE, /*!< Value is out of range. */
- KNOT_EBADARG, /*!< Wrong argument supported. */
+ KNOT_ENOTRUNNING, /*!< Resource is not running. */
+ KNOT_EPARSEFAIL, /*!< Parser fail. */
+ KNOT_ENOIPV6, /*!< No IPv6 support. */
+ KNOT_EEXPIRED, /*!< Resource is expired. */
+ KNOT_EUPTODATE, /*!< Zone is up-to-date. */
KNOT_EFEWDATA, /*!< Not enough data to parse. */
KNOT_ESPACE, /*!< Not enough space provided. */
KNOT_EMALF, /*!< Malformed data. */
- KNOT_ENOENT, /*!< Resource not found. */
- KNOT_EACCES, /*!< Permission is denied. */
KNOT_ECRYPTO, /*!< Error in crypto library. */
KNOT_ENSEC3PAR, /*!< Missing or wrong NSEC3PARAM record. */
KNOT_ENSEC3CHAIN, /*!< Missing or wrong NSEC3 chain in the zone. */
KNOT_EBADZONE, /*!< Domain name does not belong to the zone. */
KNOT_EHASH, /*!< Error in hash table. */
- KNOT_EZONEIN, /*!< Error inserting zone. */
+ KNOT_EZONEINVAL, /*!< Invalid zone file. */
KNOT_ENOZONE, /*!< No such zone found. */
KNOT_ENONODE, /*!< No such node in zone found. */
KNOT_ENORRSET, /*!< No such RRSet found. */
@@ -70,12 +82,11 @@ enum knot_error {
KNOT_ECONN, /*!< Connection reset. */
KNOT_EIXFRSPACE, /*!< IXFR reply did not fit in. */
KNOT_ECNAME, /*!< CNAME loop found in zone. */
- KNOT_ENODIFF, /*!< No zone diff can be created. */
- KNOT_ERROR_COUNT = 37
+ KNOT_ENODIFF /*!< No zone diff can be created. */
};
/*! \brief Table linking error messages to error codes. */
-extern const error_table_t knot_error_msgs[KNOT_ERROR_COUNT];
+extern const error_table_t knot_error_msgs[];
/*!
* \brief Returns error message for the given error code.
@@ -89,6 +100,18 @@ static inline const char *knot_strerror(int code)
return error_to_str((const error_table_t*)knot_error_msgs, code);
}
-#endif /* _KNOT_ERROR_H_ */
+/*!
+ * \brief errno mapper that automatically prepends fallback value.
+ *
+ * \see map_errno()
+ *
+ * \param err POSIX errno.
+ * \param ... List of handled codes.
+ *
+ * \return Mapped error code.
+ */
+#define knot_map_errno(err...) map_errno(KNOT_ERROR, err);
+
+#endif /* _KNOTD_COMMON_ERRCODE_H_ */
/*! @} */
diff --git a/src/common/errors.c b/src/common/errors.c
index 3b770e9..11aff95 100755..100644
--- a/src/common/errors.c
+++ b/src/common/errors.c
@@ -58,7 +58,7 @@ int _map_errno(int fallback_value, int arg0, ...)
va_list ap;
va_start(ap, arg0);
- /* KNOTD_ERROR serves as a sentinel. */
+ /* KNOT_ERROR serves as a sentinel. */
for (int c = arg0; c != 0; c = va_arg(ap, int)) {
/* Error code matches with mapped. */
diff --git a/src/common/errors.h b/src/common/errors.h
index a2773ac..a2773ac 100755..100644
--- a/src/common/errors.h
+++ b/src/common/errors.h
diff --git a/src/common/evqueue.c b/src/common/evqueue.c
index 240ced6..240ced6 100755..100644
--- a/src/common/evqueue.c
+++ b/src/common/evqueue.c
diff --git a/src/common/evqueue.h b/src/common/evqueue.h
index ffb3860..ffb3860 100755..100644
--- a/src/common/evqueue.h
+++ b/src/common/evqueue.h
diff --git a/src/common/evsched.c b/src/common/evsched.c
index 8b6f721..8b6f721 100755..100644
--- a/src/common/evsched.c
+++ b/src/common/evsched.c
diff --git a/src/common/evsched.h b/src/common/evsched.h
index 47bf672..47bf672 100755..100644
--- a/src/common/evsched.h
+++ b/src/common/evsched.h
diff --git a/src/common/fdset.c b/src/common/fdset.c
index c915e01..c915e01 100755..100644
--- a/src/common/fdset.c
+++ b/src/common/fdset.c
diff --git a/src/common/fdset.h b/src/common/fdset.h
index 4038083..4038083 100755..100644
--- a/src/common/fdset.h
+++ b/src/common/fdset.h
diff --git a/src/common/fdset_epoll.c b/src/common/fdset_epoll.c
index d4481b5..d4481b5 100755..100644
--- a/src/common/fdset_epoll.c
+++ b/src/common/fdset_epoll.c
diff --git a/src/common/fdset_epoll.h b/src/common/fdset_epoll.h
index 58f25f8..58f25f8 100755..100644
--- a/src/common/fdset_epoll.h
+++ b/src/common/fdset_epoll.h
diff --git a/src/common/fdset_kqueue.c b/src/common/fdset_kqueue.c
index 108c572..108c572 100755..100644
--- a/src/common/fdset_kqueue.c
+++ b/src/common/fdset_kqueue.c
diff --git a/src/common/fdset_kqueue.h b/src/common/fdset_kqueue.h
index 4b650a7..4b650a7 100755..100644
--- a/src/common/fdset_kqueue.h
+++ b/src/common/fdset_kqueue.h
diff --git a/src/common/fdset_poll.c b/src/common/fdset_poll.c
index 9b1c135..9b1c135 100755..100644
--- a/src/common/fdset_poll.c
+++ b/src/common/fdset_poll.c
diff --git a/src/common/fdset_poll.h b/src/common/fdset_poll.h
index 68e9e69..68e9e69 100755..100644
--- a/src/common/fdset_poll.h
+++ b/src/common/fdset_poll.h
diff --git a/src/common/general-tree.c b/src/common/general-tree.c
index e1048e7..e1048e7 100755..100644
--- a/src/common/general-tree.c
+++ b/src/common/general-tree.c
diff --git a/src/common/general-tree.h b/src/common/general-tree.h
index 552638a..552638a 100755..100644
--- a/src/common/general-tree.h
+++ b/src/common/general-tree.h
diff --git a/src/common/heap.c b/src/common/heap.c
index 6fefb11..6fefb11 100755..100644
--- a/src/common/heap.c
+++ b/src/common/heap.c
diff --git a/src/common/heap.h b/src/common/heap.h
index d6f8a0b..d6f8a0b 100755..100644
--- a/src/common/heap.h
+++ b/src/common/heap.h
diff --git a/src/common/latency.c b/src/common/latency.c
index a563f58..a563f58 100755..100644
--- a/src/common/latency.c
+++ b/src/common/latency.c
diff --git a/src/common/latency.h b/src/common/latency.h
index d965c56..d965c56 100755..100644
--- a/src/common/latency.h
+++ b/src/common/latency.h
diff --git a/src/common/libtap/README b/src/common/libtap/README
index d57b81d..d57b81d 100755..100644
--- a/src/common/libtap/README
+++ b/src/common/libtap/README
diff --git a/src/common/libtap/tap.c b/src/common/libtap/tap.c
index d6bb995..d6bb995 100755..100644
--- a/src/common/libtap/tap.c
+++ b/src/common/libtap/tap.c
diff --git a/src/common/libtap/tap.h b/src/common/libtap/tap.h
index 89484f4..89484f4 100755..100644
--- a/src/common/libtap/tap.h
+++ b/src/common/libtap/tap.h
diff --git a/src/common/libtap/tap_unit.h b/src/common/libtap/tap_unit.h
index c248fde..c248fde 100755..100644
--- a/src/common/libtap/tap_unit.h
+++ b/src/common/libtap/tap_unit.h
diff --git a/src/common/lists.c b/src/common/lists.c
index 9a93733..9a93733 100755..100644
--- a/src/common/lists.c
+++ b/src/common/lists.c
diff --git a/src/common/lists.h b/src/common/lists.h
index 897b1a9..897b1a9 100755..100644
--- a/src/common/lists.h
+++ b/src/common/lists.h
diff --git a/src/common/log.c b/src/common/log.c
index c70f739..5267d2d 100755..100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -26,7 +26,6 @@
#include "common/log.h"
#include "common/lists.h"
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/conf/conf.h"
/*! Log source table. */
@@ -43,7 +42,7 @@ int log_setup(int logfiles)
{
/* Check facilities count. */
if (logfiles < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Ensure minimum facilities count. */
@@ -57,7 +56,7 @@ int log_setup(int logfiles)
LOG_FCL_SIZE = 0;
LOG_FCL = malloc(new_size);
if (!LOG_FCL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Reserve space for logfiles. */
@@ -66,14 +65,14 @@ int log_setup(int logfiles)
if (!LOG_FDS) {
free(LOG_FCL);
LOG_FCL = 0;
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
memset(LOG_FDS, 0, sizeof(FILE*) * logfiles);
}
memset(LOG_FCL, 0, new_size);
LOG_FCL_SIZE = new_size; // Assign only when all is set
- return KNOTD_EOK;
+ return KNOT_EOK;
}
@@ -87,7 +86,7 @@ int log_init()
LOG_FDS_OPEN = 0;
/* Setup initial state. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
int emask = LOG_MASK(LOG_WARNING)|LOG_MASK(LOG_ERR)|LOG_MASK(LOG_FATAL);
int imask = LOG_MASK(LOG_INFO)|LOG_MASK(LOG_NOTICE);
@@ -138,14 +137,14 @@ int log_isopen()
int log_open_file(const char* filename)
{
// Check facility
- if (unlikely(!LOG_FCL_SIZE || LOGT_FILE + LOG_FDS_OPEN >= LOG_FCL_SIZE)) {
- return KNOTD_ERROR;
+ if (knot_unlikely(!LOG_FCL_SIZE || LOGT_FILE + LOG_FDS_OPEN >= LOG_FCL_SIZE)) {
+ return KNOT_ERROR;
}
// Open file
LOG_FDS[LOG_FDS_OPEN] = fopen(filename, "a");
if (!LOG_FDS[LOG_FDS_OPEN]) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Disable buffering
@@ -157,7 +156,7 @@ int log_open_file(const char* filename)
uint8_t log_levels(int facility, logsrc_t src)
{
// Check facility
- if (unlikely(!LOG_FCL_SIZE || facility >= LOG_FCL_SIZE)) {
+ if (knot_unlikely(!LOG_FCL_SIZE || facility >= LOG_FCL_SIZE)) {
return 0;
}
@@ -167,8 +166,8 @@ uint8_t log_levels(int facility, logsrc_t src)
int log_levels_set(int facility, logsrc_t src, uint8_t levels)
{
// Check facility
- if (unlikely(!LOG_FCL_SIZE || facility >= LOG_FCL_SIZE)) {
- return KNOTD_EINVAL;
+ if (knot_unlikely(!LOG_FCL_SIZE || facility >= LOG_FCL_SIZE)) {
+ return KNOT_EINVAL;
}
// Get facility pointer from offset
@@ -184,7 +183,7 @@ int log_levels_set(int facility, logsrc_t src, uint8_t levels)
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int log_levels_add(int facility, logsrc_t src, uint8_t levels)
@@ -196,7 +195,7 @@ int log_levels_add(int facility, logsrc_t src, uint8_t levels)
static int _log_msg(logsrc_t src, int level, const char *msg)
{
if(!log_isopen()) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
int ret = 0;
@@ -250,7 +249,7 @@ static int _log_msg(logsrc_t src, int level, const char *msg)
}
if (ret < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
return ret;
@@ -278,7 +277,7 @@ int log_msg(logsrc_t src, int level, const char *msg, ...)
/* Prepend prefix. */
int plen = strlen(prefix);
if (plen > buflen) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
if (plen > 0) {
strncpy(buf, prefix, plen + 1);
@@ -317,9 +316,18 @@ int log_vmsg(logsrc_t src, int level, const char *msg, va_list ap)
void hex_log(int source, const char *data, int length)
{
int ptr = 0;
+ char lbuf[512]={0}; int llen = 0;
for (; ptr < length; ptr++) {
- log_msg(source, LOG_DEBUG, "0x%02x ",
+ if (ptr > 0 && ptr % 16 == 0) {
+ lbuf[llen] = '\0';
+ log_msg(source, LOG_DEBUG, "%s\n", lbuf);
+ llen = 0;
+ }
+ int n = sprintf(lbuf + llen, "0x%02x ",
(unsigned char)*(data + ptr));
+ llen += n;
+ }
+ if (llen > 0) {
+ log_msg(source, LOG_DEBUG, "%s\n", lbuf);
}
- log_msg(source, LOG_DEBUG, "\n");
}
diff --git a/src/common/log.h b/src/common/log.h
index 305020c..8b9e311 100755..100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -73,8 +73,8 @@ typedef enum {
*
* \param logfiles Number of extra logfiles.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid number of logfiles (negative).
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid number of logfiles (negative).
*/
int log_setup(int logfiles);
@@ -83,8 +83,8 @@ int log_setup(int logfiles);
*
* \see syslog.h
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ENOMEM out of memory error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ENOMEM out of memory error.
*/
int log_init();
@@ -112,8 +112,8 @@ int log_isopen();
* \param filename File path.
*
* \retval associated facility index on success.
- * \retval KNOTD_EINVAL filename cannot be opened for writing.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EINVAL filename cannot be opened for writing.
+ * \retval KNOT_ERROR unspecified error.
*/
int log_open_file(const char* filename);
@@ -135,8 +135,8 @@ uint8_t log_levels(int facility, logsrc_t src);
* \param src Logging source (LOG_SERVER...LOG_ANY).
* \param levels Bitmask of specified log levels.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters (facility out of range).
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters (facility out of range).
*/
int log_levels_set(int facility, logsrc_t src, uint8_t levels);
@@ -150,8 +150,8 @@ int log_levels_set(int facility, logsrc_t src, uint8_t levels);
* \param src Logging source (LOG_SERVER...LOG_ANY).
* \param levels Bitmask of specified log levels.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters (facility out of range).
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters (facility out of range).
*/
int log_levels_add(int facility, logsrc_t src, uint8_t levels);
@@ -166,8 +166,8 @@ int log_levels_add(int facility, logsrc_t src, uint8_t levels);
*
* \retval Number of logged bytes on success.
* \retval 0 When the message is ignored.
- * \retval KNOTD_EINVAL invalid parameters.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EINVAL invalid parameters.
+ * \retval KNOT_ERROR unspecified error.
*/
int log_msg(logsrc_t src, int level, const char *msg, ...)
__attribute__((format(printf, 3, 4)));
diff --git a/src/common/mempattern.c b/src/common/mempattern.c
index 5982e18..5982e18 100755..100644
--- a/src/common/mempattern.c
+++ b/src/common/mempattern.c
diff --git a/src/common/mempattern.h b/src/common/mempattern.h
index ae1fa78..ae1fa78 100755..100644
--- a/src/common/mempattern.h
+++ b/src/common/mempattern.h
diff --git a/src/common/modified_tree.h b/src/common/modified_tree.h
index 9ceddd1..9ceddd1 100755..100644
--- a/src/common/modified_tree.h
+++ b/src/common/modified_tree.h
diff --git a/src/common/print.c b/src/common/print.c
index 9764568..9764568 100755..100644
--- a/src/common/print.c
+++ b/src/common/print.c
diff --git a/src/common/print.h b/src/common/print.h
index 482f55e..482f55e 100755..100644
--- a/src/common/print.h
+++ b/src/common/print.h
diff --git a/src/common/prng.c b/src/common/prng.c
index 250a506..250a506 100755..100644
--- a/src/common/prng.c
+++ b/src/common/prng.c
diff --git a/src/common/prng.h b/src/common/prng.h
index a64eabb..a64eabb 100755..100644
--- a/src/common/prng.h
+++ b/src/common/prng.h
diff --git a/src/common/ref.c b/src/common/ref.c
index 3b9c033..3b9c033 100755..100644
--- a/src/common/ref.c
+++ b/src/common/ref.c
diff --git a/src/common/ref.h b/src/common/ref.h
index 13a7037..13a7037 100755..100644
--- a/src/common/ref.h
+++ b/src/common/ref.h
diff --git a/src/common/skip-list.c b/src/common/skip-list.c
index cde08d7..cde08d7 100755..100644
--- a/src/common/skip-list.c
+++ b/src/common/skip-list.c
diff --git a/src/common/skip-list.h b/src/common/skip-list.h
index 784f366..784f366 100755..100644
--- a/src/common/skip-list.h
+++ b/src/common/skip-list.h
diff --git a/src/common/slab/alloc-common.h b/src/common/slab/alloc-common.h
index 32878ab..e15008a 100755..100644
--- a/src/common/slab/alloc-common.h
+++ b/src/common/slab/alloc-common.h
@@ -42,11 +42,11 @@
#endif
/* Optimisation macros. */
-#ifndef likely
-#define likely(x) __builtin_expect((x),1)
+#ifndef knot_likely
+#define knot_likely(x) __builtin_expect((x),1)
#endif
-#ifndef unlikely
-#define unlikely(x) __builtin_expect((x),0)
+#ifndef knot_unlikely
+#define knot_unlikely(x) __builtin_expect((x),0)
#endif
#ifdef MEM_DEBUG
diff --git a/src/common/slab/slab.c b/src/common/slab/slab.c
index 9a3e8de..b581c42 100755..100644
--- a/src/common/slab/slab.c
+++ b/src/common/slab/slab.c
@@ -338,7 +338,7 @@ slab_t* slab_create(slab_cache_t* cache)
slab_t* slab = slab_depot_alloc(cache->bufsize);
- if (unlikely(slab == 0)) {
+ if (knot_unlikely(slab == 0)) {
dbg_mem("%s: failed to allocate aligned memory block\n",
__func__);
return 0;
@@ -361,7 +361,7 @@ slab_t* slab_create(slab_cache_t* cache)
/* Ensure the item size can hold at least a size of ptr. */
size_t item_size = slab->bufsize;
- if (unlikely(item_size < SLAB_MIN_BUFLEN)) {
+ if (knot_unlikely(item_size < SLAB_MIN_BUFLEN)) {
item_size = SLAB_MIN_BUFLEN;
}
@@ -369,7 +369,7 @@ slab_t* slab_create(slab_cache_t* cache)
size_t data_size = size - sizeof(slab_t);
#ifdef MEM_COLORING
size_t free_space = data_size % item_size;
- if (unlikely(free_space < SLAB_MINCOLOR)) {
+ if (knot_unlikely(free_space < SLAB_MINCOLOR)) {
free_space = SLAB_MINCOLOR;
}
@@ -439,12 +439,12 @@ void* slab_alloc(slab_t* slab)
#endif
// Move to full?
- if (unlikely(slab->bufs_free == 0)) {
+ if (knot_unlikely(slab->bufs_free == 0)) {
slab_list_move(&slab->cache->slabs_full, slab);
} else {
#ifdef MEM_SLAB_CAP
// Mark not empty?
- if (unlikely(slab->bufs_free == slab->bufs_count - 1)) {
+ if (knot_unlikely(slab->bufs_free == slab->bufs_count - 1)) {
--slab->cache->empty;
}
#endif
@@ -456,7 +456,7 @@ void* slab_alloc(slab_t* slab)
void slab_free(void* ptr)
{
// Null pointer check
- if (unlikely(!ptr)) {
+ if (knot_unlikely(!ptr)) {
return;
}
@@ -478,12 +478,12 @@ void slab_free(void* ptr)
#endif
// Return to partial
- if(unlikely(slab->bufs_free == 1)) {
+ if(knot_unlikely(slab->bufs_free == 1)) {
slab_list_move(&slab->cache->slabs_free, slab);
} else {
#ifdef MEM_SLAB_CAP
// Recycle if empty
- if(unlikely(slab_isempty(slab))) {
+ if(knot_unlikely(slab_isempty(slab))) {
if(slab->cache->empty == MEM_SLAB_CAP) {
slab_destroy(&slab);
} else {
@@ -513,7 +513,7 @@ void slab_free(void* ptr)
int slab_cache_init(slab_cache_t* cache, size_t bufsize)
{
- if (unlikely(!bufsize)) {
+ if (knot_unlikely(!bufsize)) {
return -1;
}
@@ -609,7 +609,7 @@ void slab_alloc_destroy(slab_alloc_t* alloc)
void* slab_alloc_alloc(slab_alloc_t* alloc, size_t size)
{
// Invalid size check
- if (unlikely(!size)) {
+ if (knot_unlikely(!size)) {
return 0;
}
@@ -618,7 +618,7 @@ void* slab_alloc_alloc(slab_alloc_t* alloc, size_t size)
size += sizeof(int);
#endif
// Directly map large block
- if (unlikely(size > SLAB_SIZE/2)) {
+ if (knot_unlikely(size > SLAB_SIZE/2)) {
// Map block
size += sizeof(slab_obj_t);
@@ -649,10 +649,10 @@ void* slab_alloc_alloc(slab_alloc_t* alloc, size_t size)
unsigned cache_id = slab_cache_id(size);
// Check if associated cache exists
- if (unlikely(alloc->caches[cache_id] == 0)) {
+ if (knot_unlikely(alloc->caches[cache_id] == 0)) {
// Assert minimum cache size
- if (unlikely(size < SLAB_MIN_BUFLEN)) {
+ if (knot_unlikely(size < SLAB_MIN_BUFLEN)) {
size = SLAB_MIN_BUFLEN;
}
diff --git a/src/common/slab/slab.h b/src/common/slab/slab.h
index 4ea7e31..4ea7e31 100755..100644
--- a/src/common/slab/slab.h
+++ b/src/common/slab/slab.h
diff --git a/src/common/sockaddr.c b/src/common/sockaddr.c
index b4e75ee..b4e75ee 100755..100644
--- a/src/common/sockaddr.c
+++ b/src/common/sockaddr.c
diff --git a/src/common/sockaddr.h b/src/common/sockaddr.h
index 52e621c..52e621c 100755..100644
--- a/src/common/sockaddr.h
+++ b/src/common/sockaddr.h
diff --git a/src/common/tree.h b/src/common/tree.h
index efea65b..efea65b 100755..100644
--- a/src/common/tree.h
+++ b/src/common/tree.h
diff --git a/src/config.h.in b/src/config.h.in
index b711d4f..b711d4f 100755..100644
--- a/src/config.h.in
+++ b/src/config.h.in
diff --git a/src/knot.conf.5 b/src/knot.conf.5
index d086860..e778553 100755..100644
--- a/src/knot.conf.5
+++ b/src/knot.conf.5
@@ -1,4 +1,4 @@
-.TH "knot.conf" "5" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1"
+.TH "knot.conf" "5" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1.1"
.SH "NAME"
.LP
.B knot.conf
diff --git a/src/knot.service b/src/knot.service
index 36864d0..36864d0 100755..100644
--- a/src/knot.service
+++ b/src/knot.service
diff --git a/src/knot.spec b/src/knot.spec
index 5856aab..5856aab 100755..100644
--- a/src/knot.spec
+++ b/src/knot.spec
diff --git a/src/knot.sysconfig b/src/knot.sysconfig
index 99daeba..99daeba 100755..100644
--- a/src/knot.sysconfig
+++ b/src/knot.sysconfig
diff --git a/src/knot/common.h b/src/knot/common.h
index ddf24b1..ec70f4a 100755..100644
--- a/src/knot/common.h
+++ b/src/knot/common.h
@@ -80,19 +80,20 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
#include "common/latency.h"
#include "common/print.h"
#include "common/log.h"
+#include "common/errcode.h"
#include "knot/other/debug.h"
/*! \brief Eliminate compiler warning with unused parameters. */
#define UNUSED(param) (void)(param)
/* Optimisation macros. */
-#ifndef likely
+#ifndef knot_likely
/*! \brief Optimize for x to be true value. */
-#define likely(x) __builtin_expect((x),1)
+#define knot_likely(x) __builtin_expect((x),1)
#endif
-#ifndef unlikely
+#ifndef knot_unlikely
/*! \brief Optimize for x to be false value. */
-#define unlikely(x) __builtin_expect((x),0)
+#define knot_unlikely(x) __builtin_expect((x),0)
#endif
/*! \todo Refactor theese. We should have an allocator function handling this.*/
diff --git a/src/knot/conf/cf-lex.l b/src/knot/conf/cf-lex.l
index 58d1f4b..58d1f4b 100755..100644
--- a/src/knot/conf/cf-lex.l
+++ b/src/knot/conf/cf-lex.l
diff --git a/src/knot/conf/cf-parse.y b/src/knot/conf/cf-parse.y
index 69a5415..7a18e6e 100755..100644
--- a/src/knot/conf/cf-parse.y
+++ b/src/knot/conf/cf-parse.y
@@ -57,7 +57,7 @@ static void conf_start_remote(void *scanner, char *remote)
}
static void conf_remote_set_via(void *scanner, char *item) {
- /* Find existing node in remotes. */
+ /* Find existing node in interfaces. */
node* r = 0; conf_iface_t* found = 0;
WALK_LIST (r, new_config->ifaces) {
if (strcmp(((conf_iface_t*)r)->name, item) == 0) {
@@ -69,7 +69,7 @@ static void conf_remote_set_via(void *scanner, char *item) {
/* Check */
if (!found) {
char buf[512];
- snprintf(buf, sizeof(buf), "remote '%s' is not defined", item);
+ snprintf(buf, sizeof(buf), "interface '%s' is not defined", item);
cf_error(scanner, buf);
} else {
sockaddr_set(&this_remote->via, found->family, found->address, 0);
diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c
index e0bd0ea..0583c88 100755..100644
--- a/src/knot/conf/conf.c
+++ b/src/knot/conf/conf.c
@@ -26,7 +26,6 @@
#include <urcu.h>
#include "knot/conf/conf.h"
#include "knot/common.h"
-#include "knot/other/error.h"
/*
* Defaults.
@@ -70,7 +69,7 @@ void cf_error(void *scanner, const char *msg)
new_config->filename, msg, lineno, text);
- _parser_res = KNOTD_EPARSEFAIL;
+ _parser_res = KNOT_EPARSEFAIL;
}
/*!
@@ -107,7 +106,7 @@ static int conf_process(conf_t *conf)
if (conf->storage == NULL) {
conf->storage = strdup("/var/lib/"PROJECT_EXEC);
if (conf->storage == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
}
@@ -119,25 +118,25 @@ static int conf_process(conf_t *conf)
if (stat(conf->storage, &st) == -1) {
log_server_error("Could not open storage directory '%s'\n", conf->storage);
// I assume that conf->* is freed elsewhere
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Storage directory is a directory?
if (S_ISDIR(st.st_mode) == 0) {
log_server_error("Configured storage '%s' not a directory\n", conf->storage);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Create PID file
if (conf->pidfile == NULL) {
conf->pidfile = strcdup(conf->storage, "/" PID_FILE);
if (conf->pidfile == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
}
// Postprocess zones
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
node *n = 0;
WALK_LIST (n, conf->zones) {
conf_zone_t *zone = (conf_zone_t*)n;
@@ -177,6 +176,11 @@ static int conf_process(conf_t *conf)
zone->ixfr_fslimit = conf->ixfr_fslimit;
}
+ // Default zone file
+ if (zone->file == NULL) {
+ zone->file = strcdup(zone->name, ".zone");
+ }
+
// Relative zone filenames should be relative to storage
if (zone->file[0] != '/') {
size_t prefix_len = strlen(conf->storage) + 1; // + '\0'
@@ -189,7 +193,7 @@ static int conf_process(conf_t *conf)
free(zone->file);
zone->file = ap;
} else {
- ret = KNOTD_ENOMEM;
+ ret = KNOT_ENOMEM;
continue;
}
}
@@ -198,7 +202,7 @@ static int conf_process(conf_t *conf)
zone->file = strcpath(zone->file);
if (zone->file == NULL) {
zone->db = NULL;
- ret = KNOTD_ENOMEM;
+ ret = KNOT_ENOMEM;
continue;
}
@@ -209,7 +213,7 @@ static int conf_process(conf_t *conf)
char *dest = malloc(size);
if (dest == NULL) {
zone->db = NULL; /* Not enough memory. */
- ret = KNOTD_ENOMEM; /* Error report. */
+ ret = KNOT_ENOMEM; /* Error report. */
continue;
}
char *dpos = dest;
@@ -238,7 +242,7 @@ static int conf_process(conf_t *conf)
dest = malloc(size);
if (dest == NULL) {
zone->ixfr_db = NULL; /* Not enough memory. */
- ret = KNOTD_ENOMEM; /* Error report. */
+ ret = KNOT_ENOMEM; /* Error report. */
continue;
}
dpos = dest;
@@ -337,10 +341,10 @@ void __attribute__ ((destructor)) conf_deinit()
static int conf_fparser(conf_t *conf)
{
if (!conf->filename) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
pthread_mutex_lock(&_parser_lock);
// {
// Hook new configuration
@@ -348,11 +352,11 @@ static int conf_fparser(conf_t *conf)
FILE *f = fopen(conf->filename, "r");
if (f == 0) {
pthread_mutex_unlock(&_parser_lock);
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
// Parse config
- _parser_res = KNOTD_EOK;
+ _parser_res = KNOT_EOK;
new_config->filename = conf->filename;
void *sc = NULL;
cf_lex_init(&sc);
@@ -372,17 +376,17 @@ static int conf_fparser(conf_t *conf)
static int conf_strparser(conf_t *conf, const char *src)
{
if (!src) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
pthread_mutex_lock(&_parser_lock);
// {
// Hook new configuration
new_config = conf;
// Parse config
- _parser_res = KNOTD_EOK;
+ _parser_res = KNOT_EOK;
char *oldfn = new_config->filename;
new_config->filename = "(stdin)";
void *sc = NULL;
@@ -437,7 +441,7 @@ int conf_add_hook(conf_t * conf, int sections,
{
conf_hook_t *hook = malloc(sizeof(conf_hook_t));
if (!hook) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
hook->sections = sections;
@@ -446,7 +450,7 @@ int conf_add_hook(conf_t * conf, int sections,
add_tail(&conf->hooks, &hook->n);
++conf->hooks_count;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int conf_parse(conf_t *conf)
@@ -462,10 +466,10 @@ int conf_parse(conf_t *conf)
}
if (ret < 0) {
- return KNOTD_EPARSEFAIL;
+ return KNOT_EPARSEFAIL;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int conf_parse_str(conf_t *conf, const char* src)
@@ -480,10 +484,10 @@ int conf_parse_str(conf_t *conf, const char* src)
conf_update_hooks(conf);
if (ret < 0) {
- return KNOTD_EPARSEFAIL;
+ return KNOT_EPARSEFAIL;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
void conf_truncate(conf_t *conf, int unload_hooks)
@@ -608,13 +612,13 @@ int conf_open(const char* path)
{
/* Check path. */
if (!path) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check if exists. */
struct stat st;
if (stat(path, &st) != 0) {
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Create new config. */
@@ -622,12 +626,12 @@ int conf_open(const char* path)
/* Parse config. */
int ret = conf_fparser(nconf);
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
/* Postprocess config. */
ret = conf_process(nconf);
}
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
conf_free(nconf);
return ret;
}
@@ -656,7 +660,7 @@ int conf_open(const char* path)
/* Update hooks. */
conf_update_hooks(nconf);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
char* strcdup(const char *s1, const char *s2)
diff --git a/src/knot/conf/conf.h b/src/knot/conf/conf.h
index ae41454..391a85f 100755..100644
--- a/src/knot/conf/conf.h
+++ b/src/knot/conf/conf.h
@@ -239,8 +239,8 @@ conf_t *conf_new(const char* path);
* \param on_update Callback.
* \param data User specified data for hook.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ENOMEM out of memory error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ENOMEM out of memory error.
*/
int conf_add_hook(conf_t * conf, int sections,
int (*on_update)(const conf_t*, void*), void *data);
@@ -252,8 +252,8 @@ int conf_add_hook(conf_t * conf, int sections,
*
* \param conf Configuration context.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EPARSEFAIL on parser error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EPARSEFAIL on parser error.
*/
int conf_parse(conf_t *conf);
@@ -265,8 +265,8 @@ int conf_parse(conf_t *conf);
* \param conf Configuration context.
* \param src Source string.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EPARSEFAIL on parser error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EPARSEFAIL on parser error.
*/
int conf_parse_str(conf_t *conf, const char* src);
@@ -307,9 +307,9 @@ char* conf_find_default();
*
* \param path Path to configuration file.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on null path.
- * \retval KNOTD_ENOENT if the path doesn't exist.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on null path.
+ * \retval KNOT_ENOENT if the path doesn't exist.
*/
int conf_open(const char* path);
diff --git a/src/knot/conf/logconf.c b/src/knot/conf/logconf.c
index 4d7334f..0d2b7da 100755..100644
--- a/src/knot/conf/logconf.c
+++ b/src/knot/conf/logconf.c
@@ -24,7 +24,6 @@
#include "knot/conf/logconf.h"
#include "knot/conf/conf.h"
#include "common/log.h"
-#include "knot/other/error.h"
#include "common/lists.h"
#include "knot/common.h"
@@ -36,7 +35,7 @@ int log_conf_hook(const struct conf_t *conf, void *data)
// Check if log declaration exists, otherwise ignore
if (conf->logs_count < 1) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Find maximum log facility id
@@ -97,6 +96,6 @@ int log_conf_hook(const struct conf_t *conf, void *data)
log_levels_set(LOGT_STDERR, LOG_ANY, bmask);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/conf/logconf.h b/src/knot/conf/logconf.h
index 7b9e054..37ca2c4 100755..100644
--- a/src/knot/conf/logconf.h
+++ b/src/knot/conf/logconf.h
@@ -34,9 +34,9 @@ struct conf_t;
*
* \see syslog.h
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOMEM out of memory error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOMEM out of memory error.
*/
int log_conf_hook(const struct conf_t *conf, void *data);
diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c
index 07a9e38..dd9a8e7 100755..100644
--- a/src/knot/ctl/knotc_main.c
+++ b/src/knot/ctl/knotc_main.c
@@ -26,7 +26,6 @@
#include <getopt.h>
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
#include "knot/zone/zone-load.h"
@@ -88,8 +87,8 @@ void help(int argc, char **argv)
* \param db Path to zone db file.
* \param source Path to zone source file.
*
- * \retval KNOTD_EOK if up to date.
- * \retval KNOTD_ERROR if needs recompilation.
+ * \retval KNOT_EOK if up to date.
+ * \retval KNOT_ERROR if needs recompilation.
*/
int check_zone(const char *db, const char* source)
{
@@ -111,21 +110,21 @@ int check_zone(const char *db, const char* source)
}
log_zone_error(emsg, source);
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Read zonedb header. */
zloader_t *zl = 0;
knot_zload_open(&zl, db);
if (!zl) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Check source files and mtime. */
- int ret = KNOTD_ERROR;
+ int ret = KNOT_ERROR;
int src_changed = strcmp(source, zl->source) != 0;
if (!src_changed && !knot_zload_needs_update(zl)) {
- ret = KNOTD_EOK;
+ ret = KNOT_EOK;
}
knot_zload_close(zl);
@@ -554,7 +553,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid,
// Check source files and mtime
int zone_status = check_zone(zone->db, zone->file);
- if (zone_status == KNOTD_EOK && !is_checkzone) {
+ if (zone_status == KNOT_EOK && !is_checkzone) {
log_zone_info("Zone '%s' is up-to-date.\n",
zone->name);
@@ -567,7 +566,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid,
}
// Check for not existing source
- if (zone_status == KNOTD_ENOENT) {
+ if (zone_status == KNOT_ENOENT) {
continue;
}
@@ -700,8 +699,8 @@ int main(int argc, char **argv)
// Open configuration
int conf_ret = conf_open(config_fn);
- if (conf_ret != KNOTD_EOK) {
- if (conf_ret == KNOTD_ENOENT) {
+ if (conf_ret != KNOT_EOK) {
+ if (conf_ret == KNOT_ENOENT) {
log_server_error("Couldn't open configuration file "
"'%s'.\n", config_fn);
} else {
diff --git a/src/knot/ctl/process.c b/src/knot/ctl/process.c
index d3fa2fc..5eb5c2d 100755..100644
--- a/src/knot/ctl/process.c
+++ b/src/knot/ctl/process.c
@@ -28,7 +28,6 @@
#include "knot/common.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
-#include "knot/other/error.h"
char* pid_filename()
{
@@ -52,7 +51,7 @@ pid_t pid_read(const char* fn)
if (fn) {
FILE *fp = fopen(fn, "r");
if (!fp) {
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
int readb = 0;
@@ -68,26 +67,26 @@ pid_t pid_read(const char* fn)
// Check read result
if (readb < 1) {
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
// Convert pid
char* ep = 0;
unsigned long pid = strtoul(buf, &ep, 10);
if ((errno == ERANGE) || (*ep && !isspace(*ep))) {
- return KNOTD_ERANGE;
+ return KNOT_ERANGE;
}
return (pid_t)pid;
}
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int pid_write(const char* fn)
{
if (!fn) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Convert
@@ -95,7 +94,7 @@ int pid_write(const char* fn)
int wbytes = 0;
wbytes = snprintf(buf, sizeof(buf), "%lu", (unsigned long) getpid());
if (wbytes < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Write
@@ -104,23 +103,23 @@ int pid_write(const char* fn)
int rc = fwrite(buf, wbytes, 1, fp);
fclose(fp);
if (rc < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
return 0;
}
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
int pid_remove(const char* fn)
{
if (unlink(fn) < 0) {
perror("unlink");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int pid_running(pid_t pid)
diff --git a/src/knot/ctl/process.h b/src/knot/ctl/process.h
index a387add..b993f72 100755..100644
--- a/src/knot/ctl/process.h
+++ b/src/knot/ctl/process.h
@@ -43,9 +43,9 @@ char* pid_filename();
* \param fn Filename containing PID.
*
* \retval PID on success (positive integer).
- * \retval KNOTD_EINVAL on null path.
- * \retval KNOTD_ENOENT if the filename content cannot be read.
- * \retval KNOTD_ERANGE if the stored PID is out of range.
+ * \retval KNOT_EINVAL on null path.
+ * \retval KNOT_ENOENT if the filename content cannot be read.
+ * \retval KNOT_ERANGE if the stored PID is out of range.
*/
pid_t pid_read(const char* fn);
@@ -54,10 +54,10 @@ pid_t pid_read(const char* fn);
*
* \param fn Filename containing PID.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on null path.
- * \retval KNOTD_ENOENT filename cannot be opened for writing.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on null path.
+ * \retval KNOT_ENOENT filename cannot be opened for writing.
+ * \retval KNOT_ERROR unspecified error.
*/
int pid_write(const char* fn);
@@ -68,8 +68,8 @@ int pid_write(const char* fn);
*
* \warning Filename content won't be checked.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL failed to remove filename.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL failed to remove filename.
*/
int pid_remove(const char* fn);
diff --git a/src/knot/main.c b/src/knot/main.c
index 4486a1c..de37de4 100755..100644
--- a/src/knot/main.c
+++ b/src/knot/main.c
@@ -28,7 +28,6 @@
#include "common.h"
#include "common/evqueue.h"
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/server/server.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
@@ -225,8 +224,8 @@ int main(int argc, char **argv)
// Open configuration
log_server_info("Reading configuration '%s' ...\n", config_fn);
int conf_ret = conf_open(config_fn);
- if (conf_ret != KNOTD_EOK) {
- if (conf_ret == KNOTD_ENOENT) {
+ if (conf_ret != KNOT_EOK) {
+ if (conf_ret == KNOT_ENOENT) {
log_server_error("Couldn't open configuration file "
"'%s'.\n", config_fn);
} else {
@@ -255,7 +254,7 @@ int main(int argc, char **argv)
int has_pid = 0;
char* pidfile = pid_filename();
log_server_info("Starting server...\n");
- if ((server_start(server)) == KNOTD_EOK) {
+ if ((server_start(server)) == KNOT_EOK) {
// Save PID
has_pid = 1;
@@ -318,11 +317,11 @@ int main(int argc, char **argv)
sig_req_reload = 0;
int cf_ret = conf_open(config_fn);
switch (cf_ret) {
- case KNOTD_EOK:
+ case KNOT_EOK:
log_server_info("Configuration "
"reloaded.\n");
break;
- case KNOTD_ENOENT:
+ case KNOT_ENOENT:
log_server_error("Configuration "
"file '%s' "
"not found.\n",
@@ -338,10 +337,10 @@ int main(int argc, char **argv)
log_server_info("Refreshing slave zones...\n");
sig_req_reload = 0;
int cf_ret = server_refresh(server);
- if (cf_ret != KNOTD_EOK) {
+ if (cf_ret != KNOT_EOK) {
log_server_error("Couldn't refresh "
"slave zones - %s",
- knotd_strerror(cf_ret));
+ knot_strerror(cf_ret));
}
}
@@ -360,7 +359,7 @@ int main(int argc, char **argv)
}
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
- if ((server_wait(server)) != KNOTD_EOK) {
+ if ((server_wait(server)) != KNOT_EOK) {
log_server_error("An error occured while "
"waiting for server to finish.\n");
res = 1;
diff --git a/src/knot/other/debug.h b/src/knot/other/debug.h
index 1a8698e..1a8698e 100755..100644
--- a/src/knot/other/debug.h
+++ b/src/knot/other/debug.h
diff --git a/src/knot/other/error.c b/src/knot/other/error.c
deleted file mode 100755
index 7f005e7..0000000
--- a/src/knot/other/error.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "knot/other/error.h"
-#include "common/errors.h"
-
-const error_table_t knotd_error_msgs[] = {
-
- /* Mapped errors. */
- {KNOTD_EOK, "OK"},
- {KNOTD_ENOMEM, "Not enough memory."},
- {KNOTD_EINVAL, "Invalid parameter passed."},
- {KNOTD_ENOTSUP, "Parameter not supported."},
- {KNOTD_EBUSY, "Requested resource is busy."},
- {KNOTD_EAGAIN, "The system lacked the necessary resource, try again."},
- {KNOTD_EACCES, "Operation not permitted."},
- {KNOTD_ECONNREFUSED, "Connection refused."},
- {KNOTD_EISCONN, "Already connected."},
- {KNOTD_EADDRINUSE, "Address already in use."},
- {KNOTD_ENOENT, "Resource not found."},
- {KNOTD_ERANGE, "Value is out of range."},
-
- /* Custom errors. */
- {KNOTD_ERROR, "Generic error."},
- {KNOTD_EZONEINVAL, "Invalid zone file."},
- {KNOTD_ENOTRUNNING, "Resource is not running."},
- {KNOTD_EPARSEFAIL, "Parser failed."},
- {KNOTD_ENOIPV6, "IPv6 support disabled."},
- {KNOTD_EMALF, "Malformed data."},
- {KNOTD_ESPACE, "Not enough space provided."},
- {KNOTD_EEXPIRED, "Resource is expired."},
- {KNOTD_ENODIFF, "Cannot create zone diff."},
- {KNOTD_EUPTODATE, "Zone is up-to-date."},
- {KNOTD_ERROR, 0}
-};
diff --git a/src/knot/other/error.h b/src/knot/other/error.h
deleted file mode 100755
index 4b9efee..0000000
--- a/src/knot/other/error.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-/*!
- * \file other/error.h
- *
- * \author Lubos Slovak <lubos.slovak@nic.cz>
- * \author Marek Vavrusa <marek.vavrusa@nic.cz>
- *
- * \brief Error codes and function for getting error message.
- *
- * \addtogroup utils
- * @{
- */
-
-#ifndef _KNOTD__ERROR_H_
-#define _KNOTD__ERROR_H_
-
-#include <errno.h>
-
-#include "common/errors.h"
-
-/*!
- * \brief Error codes used in the server.
- *
- * Some viable errors are directly mapped
- * to libc errno codes.
- */
-enum knot_error_t {
-
- /* Directly mapped error codes. */
- KNOTD_EOK = 0,
- KNOTD_ENOMEM = -ENOMEM, /*!< \brief Out of memory. */
- KNOTD_EINVAL = -EINVAL, /*!< \brief Invalid parameter passed. */
- KNOTD_ENOTSUP = -ENOTSUP, /*!< \brief Parameter not supported. */
- KNOTD_EBUSY = -EBUSY, /*!< \brief Requested resource is busy. */
- KNOTD_EAGAIN = -EAGAIN, /*!< \brief OS lacked necessary resources. */
- KNOTD_EACCES = -EACCES, /*!< \brief Permission is denied. */
- KNOTD_ECONNREFUSED = -ECONNREFUSED, /*!< \brief Connection is refused. */
- KNOTD_EISCONN = -EISCONN, /*!< \brief Already connected. */
- KNOTD_EADDRINUSE = -EADDRINUSE, /*!< \brief Address already in use. */
- KNOTD_ENOENT = -ENOENT, /*!< \brief Resource not found. */
- KNOTD_ERANGE = -ERANGE, /*!< \brief Value is out of range. */
-
- /* Custom error codes. */
- KNOTD_ERROR = -16384, /*!< \brief Generic error. */
- KNOTD_EZONEINVAL, /*!< \brief Invalid zone file. */
- KNOTD_ENOTRUNNING, /*!< \brief Resource is not running. */
- KNOTD_EPARSEFAIL, /*!< \brief Parser fail. */
- KNOTD_ENOIPV6, /*!< \brief No IPv6 support. */
- KNOTD_EMALF, /*!< \brief Malformed data. */
- KNOTD_ESPACE, /*!< \brief Not enough space provided. */
- KNOTD_EEXPIRED, /*!< \brief Resource is expired. */
- KNOTD_ENODIFF, /*!< \brief Cannot create zone diff. */
- KNOTD_EUPTODATE, /*!< \brief Zone is up-to-date. */
-
- KNOTD_ERROR_COUNT = 23
-};
-
-/*! \brief Table linking error messages to error codes. */
-extern const error_table_t knotd_error_msgs[KNOTD_ERROR_COUNT];
-
-/*!
- * \brief Returns error message for the given error code.
- *
- * \param code Error code.
- *
- * \return String containing the error message.
- */
-static inline const char *knotd_strerror(int code)
-{
- return error_to_str((const error_table_t*)knotd_error_msgs, code);
-}
-
-/*!
- * \brief errno mapper that automatically prepends fallback value.
- *
- * \see map_errno()
- *
- * \param err POSIX errno.
- * \param ... List of handled codes.
- *
- * \return Mapped error code.
- */
-#define knot_map_errno(err...) map_errno(KNOTD_ERROR, err);
-
-#endif /* _KNOTD__ERROR_H_ */
-
-/*! @} */
diff --git a/src/knot/server/dthreads.c b/src/knot/server/dthreads.c
index 0c38cfc..4e3bee9 100755..100644
--- a/src/knot/server/dthreads.c
+++ b/src/knot/server/dthreads.c
@@ -33,7 +33,6 @@
#include "knot/common.h"
#include "knot/server/dthreads.h"
#include "common/log.h"
-#include "knot/other/error.h"
/* BSD cpu set compatibility. */
#if defined(HAVE_CPUSET_BSD)
@@ -70,13 +69,13 @@ static inline int dt_update_thread(dthread_t *thread, int state)
{
// Check
if (thread == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Cancel with lone thread
dt_unit_t *unit = thread->unit;
if (unit == 0) {
- return KNOTD_ENOTSUP;
+ return KNOT_ENOTSUP;
}
// Cancel current runnable if running
@@ -96,10 +95,10 @@ static inline int dt_update_thread(dthread_t *thread, int state)
/* Unable to update thread, it is already dead. */
unlock_thread_rw(thread);
pthread_mutex_unlock(&unit->_notify_mx);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -451,7 +450,7 @@ int dt_resize(dt_unit_t *unit, int size)
{
// Check input
if (unit == 0 || size <= 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Evaluate delta
@@ -505,7 +504,7 @@ int dt_resize(dt_unit_t *unit, int size)
// New threads vector
dthread_t **threads = malloc(size * sizeof(dthread_t *));
if (threads == 0) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
// Lock unit
@@ -623,7 +622,7 @@ int dt_start(dt_unit_t *unit)
{
// Check input
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Lock unit
@@ -655,7 +654,7 @@ int dt_start_id(dthread_t *thread)
{
// Check input
if (thread == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
lock_thread_rw(thread);
@@ -691,29 +690,29 @@ int dt_signalize(dthread_t *thread, int signum)
{
// Check input
if (thread == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = pthread_kill(thread->_thr, signum);
/* Not thread id found or invalid signum. */
if (ret == EINVAL || ret == ESRCH) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Generic error. */
if (ret < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_join(dt_unit_t *unit)
{
// Check input
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
for (;;) {
@@ -763,14 +762,14 @@ int dt_join(dt_unit_t *unit)
pthread_mutex_unlock(&unit->_report_mx);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_stop_id(dthread_t *thread)
{
// Check input
if (thread == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Signalize active thread to stop
@@ -789,14 +788,14 @@ int dt_stop_id(dthread_t *thread)
pthread_mutex_unlock(&unit->_notify_mx);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_stop(dt_unit_t *unit)
{
// Check unit
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Lock unit
@@ -825,14 +824,14 @@ int dt_stop(dt_unit_t *unit)
pthread_cond_broadcast(&unit->_notify);
pthread_mutex_unlock(&unit->_notify_mx);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
//int dt_setprio(dthread_t *thread, int prio)
//{
// // Check input
// if (thread == 0) {
-// return KNOTD_EINVAL;
+// return KNOT_EINVAL;
// }
// // Clamp priority
@@ -857,13 +856,13 @@ int dt_stop(dt_unit_t *unit)
// /* Map "not supported". */
// if (errno == ENOTSUP) {
-// return KNOTD_ENOTSUP;
+// return KNOT_ENOTSUP;
// }
-// return KNOTD_EINVAL;
+// return KNOT_EINVAL;
// }
-// return KNOTD_EOK;
+// return KNOT_EOK;
//}
@@ -871,7 +870,7 @@ int dt_stop(dt_unit_t *unit)
int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count)
{
if (thread == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
#ifdef HAVE_PTHREAD_SETAFFINITY_NP
@@ -889,7 +888,7 @@ int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count)
#elif defined(HAVE_CPUSET_NETBSD)
cpuset_t *set = cpuset_create();
if (set == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
cpuset_zero(set);
for (unsigned i = 0; i < cpu_count; ++i) {
@@ -900,21 +899,21 @@ int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count)
#endif /* interface */
if (ret < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
#else /* HAVE_PTHREAD_SETAFFINITY_NP */
- return KNOTD_ENOTSUP;
+ return KNOT_ENOTSUP;
#endif
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data)
{
// Check
if (thread == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Stop here if thread isn't a member of a unit
@@ -923,7 +922,7 @@ int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data)
lock_thread_rw(thread);
thread->state = ThreadActive | ThreadCancelled;
unlock_thread_rw(thread);
- return KNOTD_ENOTSUP;
+ return KNOT_ENOTSUP;
}
// Lock thread state changes
@@ -949,7 +948,7 @@ int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data)
pthread_mutex_unlock(&unit->_notify_mx);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_activate(dthread_t *thread)
@@ -966,7 +965,7 @@ int dt_compact(dt_unit_t *unit)
{
// Check input
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// Lock unit
@@ -1016,7 +1015,7 @@ int dt_compact(dt_unit_t *unit)
// Unlock unit
dt_unit_unlock(unit);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_online_cpus()
@@ -1086,7 +1085,7 @@ int dt_unit_lock(dt_unit_t *unit)
{
// Check input
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = pthread_mutex_lock(&unit->_mx);
@@ -1096,14 +1095,14 @@ int dt_unit_lock(dt_unit_t *unit)
return knot_map_errno(EINVAL, EAGAIN);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int dt_unit_unlock(dt_unit_t *unit)
{
// Check input
if (unit == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = pthread_mutex_unlock(&unit->_mx);
@@ -1113,5 +1112,5 @@ int dt_unit_unlock(dt_unit_t *unit)
return knot_map_errno(EINVAL, EAGAIN);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/server/dthreads.h b/src/knot/server/dthreads.h
index 758bc28..374e399 100755..100644
--- a/src/knot/server/dthreads.h
+++ b/src/knot/server/dthreads.h
@@ -159,9 +159,9 @@ void dt_delete(dt_unit_t **unit);
* \param unit Unit to be resized.
* \param size New unit size.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOMEM out of memory error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOMEM out of memory error.
*/
int dt_resize(dt_unit_t *unit, int size);
@@ -170,8 +170,8 @@ int dt_resize(dt_unit_t *unit, int size);
*
* \param unit Unit to be started.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters (unit is null).
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters (unit is null).
*/
int dt_start(dt_unit_t *unit);
@@ -180,8 +180,8 @@ int dt_start(dt_unit_t *unit);
*
* \param thread Target thread instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_start_id(dthread_t *thread);
@@ -195,9 +195,9 @@ int dt_start_id(dthread_t *thread);
* \param thread Target thread instance.
* \param signum Signal code.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ERROR unspecified error.
*/
int dt_signalize(dthread_t *thread, int signum);
@@ -206,8 +206,8 @@ int dt_signalize(dthread_t *thread, int signum);
*
* \param unit Unit to be joined.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_join(dt_unit_t *unit);
@@ -218,8 +218,8 @@ int dt_join(dt_unit_t *unit);
*
* \param thread Target thread instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_stop_id(dthread_t *thread);
@@ -230,8 +230,8 @@ int dt_stop_id(dthread_t *thread);
*
* \param unit Unit to be stopped.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_stop(dt_unit_t *unit);
@@ -245,8 +245,8 @@ int dt_stop(dt_unit_t *unit);
* has significant performance deficiencies (SCHED_OTHER).
* (issue #1809)
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
//int dt_setprio(dthread_t *thread, int prio);
@@ -257,8 +257,8 @@ int dt_stop(dt_unit_t *unit);
* \param cpu_id Array of CPU IDs to set affinity to.
* \param cpu_count Number of CPUs in the array, set to 0 for no CPU.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count);
@@ -269,9 +269,9 @@ int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count);
* \param runnable Runnable function for target thread.
* \param data Data passed to target thread.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOTSUP operation not supported.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOTSUP operation not supported.
*/
int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data);
@@ -286,9 +286,9 @@ int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data);
*
* \param thread Target thread instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOTSUP operation not supported.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOTSUP operation not supported.
*/
int dt_activate(dthread_t *thread);
@@ -303,8 +303,8 @@ int dt_activate(dthread_t *thread);
*
* \param thread Target thread instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_cancel(dthread_t *thread);
@@ -313,8 +313,8 @@ int dt_cancel(dthread_t *thread);
*
* \param unit Target unit instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int dt_compact(dt_unit_t *unit);
@@ -366,10 +366,10 @@ unsigned dt_get_id(dthread_t *thread);
*
* \param unit Target unit instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_EAGAIN lack of resources to lock unit, try again.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_EAGAIN lack of resources to lock unit, try again.
+ * \retval KNOT_ERROR unspecified error.
*/
int dt_unit_lock(dt_unit_t *unit);
@@ -380,10 +380,10 @@ int dt_unit_lock(dt_unit_t *unit);
*
* \param unit Target unit instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_EAGAIN lack of resources to unlock unit, try again.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_EAGAIN lack of resources to unlock unit, try again.
+ * \retval KNOT_ERROR unspecified error.
*/
int dt_unit_unlock(dt_unit_t *unit);
diff --git a/src/knot/server/journal.c b/src/knot/server/journal.c
index fa84021..dc20e41 100755..100644
--- a/src/knot/server/journal.c
+++ b/src/knot/server/journal.c
@@ -24,7 +24,6 @@
#include <sys/mman.h>
#include "common/crc.h"
-#include "knot/other/error.h"
#include "knot/other/debug.h"
#include "knot/zone/zone-dump.h"
#include "journal.h"
@@ -63,7 +62,7 @@ static inline int journal_cmp_eq(uint64_t k1, uint64_t k2)
static int journal_recover(journal_t *j)
{
if (j == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Attempt to recover queue. */
@@ -113,14 +112,14 @@ static int journal_recover(journal_t *j)
/* Evaluate */
if (qstate[0] < 0 || qstate[1] < 0) {
- return KNOTD_ERANGE;
+ return KNOT_ERANGE;
}
/* Write back. */
int seek_ret = lseek(j->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET);
if (seek_ret < 0 || !sfwrite(qstate, 2 * sizeof(uint16_t), j->fd)) {
dbg_journal("journal: failed to write back queue state\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Reset queue state. */
@@ -130,7 +129,7 @@ static int journal_recover(journal_t *j)
qstate[0], qstate[1]);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_write_in(journal_t *j, journal_node_t **rn, uint64_t id, size_t len)
@@ -189,14 +188,14 @@ int journal_write_in(journal_t *j, journal_node_t **rn, uint64_t id, size_t len)
/* Check if it has been synced to disk. */
if (head->flags & JOURNAL_DIRTY) {
- return KNOTD_EAGAIN;
+ return KNOT_EAGAIN;
}
/* Write back evicted node. */
head->flags = JOURNAL_FREE;
seek_ret = lseek(j->fd, JOURNAL_HSIZE + (j->qhead + 1) * node_len, SEEK_SET);
if (seek_ret < 0 || !sfwrite(head, node_len, j->fd)) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
dbg_journal("journal: * evicted node=%u, growing by +%u\n",
@@ -207,7 +206,7 @@ int journal_write_in(journal_t *j, journal_node_t **rn, uint64_t id, size_t len)
uint16_t qstate[2] = {j->qhead, j->qtail};
seek_ret = lseek(j->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET);
if (seek_ret < 0 || !sfwrite(qstate, 2 * sizeof(uint16_t), j->fd)) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Increase free segment. */
@@ -222,7 +221,7 @@ int journal_write_in(journal_t *j, journal_node_t **rn, uint64_t id, size_t len)
n->next = jnext;
journal_update(j, n);
*rn = n;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_write_out(journal_t *journal, journal_node_t *n)
@@ -268,7 +267,7 @@ int journal_write_out(journal_t *journal, journal_node_t *n)
*/
dbg_journal("journal: failed to write back "
"free segment descriptor\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Node write successful. */
@@ -282,43 +281,43 @@ int journal_write_out(journal_t *journal, journal_node_t *n)
seek_ret = lseek(journal->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET);
if (seek_ret < 0 || !sfwrite(qstate, 2 * sizeof(uint16_t), journal->fd)) {
dbg_journal("journal: failed to write back queue state\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Recalculate CRC. */
int journal_update_crc(int fd)
{
if (fcntl(fd, F_GETFL) < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
char buf[4096];
ssize_t rb = 0;
crc_t crc = crc_init();
if (lseek(fd, MAGIC_LENGTH + sizeof(crc_t), SEEK_SET) < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
while((rb = read(fd, buf, sizeof(buf))) > 0) {
crc = crc_update(crc, (const unsigned char *)buf, rb);
}
if (lseek(fd, MAGIC_LENGTH, SEEK_SET) < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
if (!sfwrite(&crc, sizeof(crc_t), fd)) {
dbg_journal("journal: couldn't write CRC to fd=%d\n", fd);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_create(const char *fn, uint16_t max_nodes)
{
if (fn == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* File lock. */
@@ -348,20 +347,20 @@ int journal_create(const char *fn, uint16_t max_nodes)
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
crc_t crc = crc_init();
if (!sfwrite(&crc, sizeof(crc_t), fd)) {
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
if (!sfwrite(&max_nodes, sizeof(uint16_t), fd)) {
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Create node queue head + tail.
@@ -374,14 +373,14 @@ int journal_create(const char *fn, uint16_t max_nodes)
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
if (!sfwrite(&zval, sizeof(uint16_t), fd)) {
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
dbg_journal_verb("journal: creating free segment descriptor\n");
@@ -397,7 +396,7 @@ int journal_create(const char *fn, uint16_t max_nodes)
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Create nodes. */
@@ -408,16 +407,16 @@ int journal_create(const char *fn, uint16_t max_nodes)
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
}
/* Recalculate CRC. */
- if (journal_update_crc(fd) != KNOTD_EOK) {
+ if (journal_update_crc(fd) != KNOT_EOK) {
fcntl(fd, F_SETLK, &fl);
close(fd);
remove(fn);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Unlock and close. */
@@ -426,7 +425,7 @@ int journal_create(const char *fn, uint16_t max_nodes)
/* Journal file created. */
dbg_journal("journal: file '%s' initialized\n", fn);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflags)
@@ -440,7 +439,7 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag
int fd = open(fn, O_RDWR);
if (fd < 0) {
if (errno == ENOENT) {
- if(journal_create(fn, JOURNAL_NCOUNT) == KNOTD_EOK) {
+ if(journal_create(fn, JOURNAL_NCOUNT) == KNOT_EOK) {
return journal_open(fn, fslimit, mode, bflags);
}
}
@@ -490,7 +489,7 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag
"it will be flushed.\n", fn);
fcntl(fd, F_SETLK, &fl);
close(fd);
- if (journal_create(fn, JOURNAL_NCOUNT) == KNOTD_EOK) {
+ if (journal_create(fn, JOURNAL_NCOUNT) == KNOT_EOK) {
return journal_open(fn, fslimit, mode, bflags);
}
return NULL;
@@ -524,7 +523,7 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag
"it will be flushed.\n", fn);
fcntl(fd, F_SETLK, &fl);
close(fd);
- if (journal_create(fn, JOURNAL_NCOUNT) == KNOTD_EOK) {
+ if (journal_create(fn, JOURNAL_NCOUNT) == KNOT_EOK) {
return journal_open(fn, fslimit, mode, bflags);
}
return NULL;
@@ -658,10 +657,10 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag
"after crash.\n",
fn);
ret = journal_recover(j);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_server_error("Journal file '%s' is unrecoverable, "
"metadata corrupted - %s\n",
- fn, knotd_strerror(ret));
+ fn, knot_strerror(ret));
fcntl(fd, F_SETLK, &fl);
close(fd);
free(j);
@@ -680,7 +679,7 @@ int journal_fetch(journal_t *journal, uint64_t id,
journal_cmp_t cf, journal_node_t** dst)
{
if (journal == NULL || dst == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check compare function. */
@@ -696,31 +695,31 @@ int journal_fetch(journal_t *journal, uint64_t id,
journal_node_t *n = journal->nodes + i;
if (!(n->flags & JOURNAL_TRANS) && cf(n->id, id) == 0) {
*dst = journal->nodes + i;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
}
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst)
{
if (journal == NULL || dst == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
journal_node_t *n = 0;
if(journal_fetch(journal, id, cf, &n) != 0) {
dbg_journal("journal: failed to fetch node with id=%llu\n",
(unsigned long long)id);
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Check valid flag. */
if (!(n->flags & JOURNAL_VALID)) {
dbg_journal("journal: node with id=%llu is invalid "
"(flags=0x%hx)\n", (unsigned long long)id, n->flags);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
dbg_journal("journal: reading node with id=%llu, data=<%u, %u>, flags=0x%hx\n",
@@ -731,29 +730,29 @@ int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst)
/* Read journal node content. */
if (seek_ret < 0 || !sfread(dst, n->len, journal->fd)) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size)
{
if (journal == NULL || src == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Prepare journal write. */
journal_node_t *n = NULL;
int ret = journal_write_in(journal, &n, id, size);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
/* Write data to permanent storage. */
int seek_ret = lseek(journal->fd, n->pos, SEEK_SET);
if (seek_ret < 0 || !sfwrite(src, size, journal->fd)) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Finalize journal write. */
@@ -763,20 +762,20 @@ int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size)
int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size)
{
if (journal == NULL || dst == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Prepare journal write. */
journal_node_t *n = NULL;
int ret = journal_write_in(journal, &n, id, size);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
/* Reserve data in permanent storage. */
/*! \todo This is only needed when inflating journal file. */
if (lseek(journal->fd, n->pos, SEEK_SET) < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
char nbuf[4096] = {0};
size_t wb = sizeof(nbuf);
@@ -785,7 +784,7 @@ int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size)
wb = size;
}
if (!sfwrite(nbuf, wb, journal->fd)) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
size -= wb;
}
@@ -801,7 +800,7 @@ int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size)
if (*dst == ((void*)-1)) {
dbg_journal("journal: couldn't mmap() fd=%d <%u,%u> %d\n",
journal->fd, n->pos, n->pos+n->len, errno);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Advise usage of memory. */
@@ -811,13 +810,13 @@ int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size)
/* Correct dst pointer to alignment. */
*dst += ps_delta;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize)
{
if (journal == NULL || ptr == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Mapped node is on tail. */
@@ -825,7 +824,7 @@ int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize)
if(n->id != id) {
dbg_journal("journal: failed to find mmap node with id=%llu\n",
(unsigned long long)id);
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Realign memory. */
@@ -837,11 +836,11 @@ int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize)
if (munmap(ptr, n->len + ps_delta) != 0) {
dbg_journal("journal: couldn't munmap() fd=%d <%u,%u> %d\n",
journal->fd, n->pos, n->pos+n->len, errno);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Finalize. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
if (finalize) {
ret = journal_write_out(journal, n);
}
@@ -850,7 +849,7 @@ int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize)
int journal_walk(journal_t *journal, journal_apply_t apply)
{
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
size_t i = journal->qhead;
for(; i != journal->qtail; i = (i + 1) % journal->max_nodes) {
/* Apply function. */
@@ -863,14 +862,14 @@ int journal_walk(journal_t *journal, journal_apply_t apply)
int journal_update(journal_t *journal, journal_node_t *n)
{
if (journal == NULL || n == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Calculate node offset. */
const size_t node_len = sizeof(journal_node_t);
size_t i = n - journal->nodes;
if (i > journal->max_nodes) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Calculate node position in permanent storage. */
@@ -884,21 +883,21 @@ int journal_update(journal_t *journal, journal_node_t *n)
if (seek_ret < 0 || !sfwrite(n, node_len, journal->fd)) {
dbg_journal("journal: failed to writeback node=%llu to %ld\n",
(unsigned long long)n->id, jn_fpos);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_trans_begin(journal_t *journal)
{
if (journal == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Already pending transactions. */
if (journal->bflags & JOURNAL_TRANS) {
- return KNOTD_EBUSY;
+ return KNOT_EBUSY;
}
journal->bflags |= JOURNAL_TRANS;
@@ -906,25 +905,25 @@ int journal_trans_begin(journal_t *journal)
dbg_journal("journal: starting transaction at qtail=%hu\n",
journal->tmark);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_trans_commit(journal_t *journal)
{
if (journal == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
if ((journal->bflags & JOURNAL_TRANS) == 0) {
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Mark affected nodes as commited. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
size_t i = journal->tmark;
for(; i != journal->qtail; i = (i + 1) % journal->max_nodes) {
journal->nodes[i].flags &= (~JOURNAL_TRANS);
ret = journal_update(journal, journal->nodes + i);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_journal("journal: failed to clear TRANS flag from "
"node %zu\n", i);
return ret;
@@ -934,16 +933,16 @@ int journal_trans_commit(journal_t *journal)
/* Clear in-transaction flags. */
journal->tmark = 0;
journal->bflags &= (~JOURNAL_TRANS);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_trans_rollback(journal_t *journal)
{
if (journal == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
if ((journal->bflags & JOURNAL_TRANS) == 0) {
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Expand free space and rewind node queue tail. */
@@ -963,18 +962,18 @@ int journal_trans_rollback(journal_t *journal)
journal->tmark = 0;
journal->bflags &= (~JOURNAL_TRANS);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int journal_close(journal_t *journal)
{
/* Check journal. */
if (journal == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check if lazy. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
if (journal->fd < 0) {
free(journal->path);
} else {
diff --git a/src/knot/server/journal.h b/src/knot/server/journal.h
index fd0e3a6..f6716ae 100755..100644
--- a/src/knot/server/journal.h
+++ b/src/knot/server/journal.h
@@ -137,9 +137,9 @@ typedef int (*journal_apply_t)(journal_t *j, journal_node_t *n);
* \param fn Journal file name, will be created if not exist.
* \param max_nodes Maximum number of nodes in journal.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EINVAL if the file with given name cannot be created.
- * \retval KNOTD_ERROR on I/O error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EINVAL if the file with given name cannot be created.
+ * \retval KNOT_ERROR on I/O error.
*/
int journal_create(const char *fn, uint16_t max_nodes);
@@ -164,8 +164,8 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag
* \param cf Compare function (NULL for equality).
* \param dst Destination for journal entry.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_ENOENT if not found.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_ENOENT if not found.
*/
int journal_fetch(journal_t *journal, uint64_t id,
journal_cmp_t cf, journal_node_t** dst);
@@ -178,10 +178,10 @@ int journal_fetch(journal_t *journal, uint64_t id,
* \param cf Compare function (NULL for equality).
* \param dst Pointer to destination memory.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_ENOENT if the entry cannot be found.
- * \retval KNOTD_EINVAL if the entry is invalid.
- * \retval KNOTD_ERROR on I/O error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_ENOENT if the entry cannot be found.
+ * \retval KNOT_EINVAL if the entry is invalid.
+ * \retval KNOT_ERROR on I/O error.
*/
int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst);
@@ -192,9 +192,9 @@ int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst);
* \param id Entry identifier.
* \param src Pointer to source data.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EAGAIN if no free node is available, need to remove dirty nodes.
- * \retval KNOTD_ERROR on I/O error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EAGAIN if no free node is available, need to remove dirty nodes.
+ * \retval KNOT_ERROR on I/O error.
*/
int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size);
@@ -207,9 +207,9 @@ int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size)
* \param id Entry identifier.
* \param dst Will contain mapped memory.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EAGAIN if no free node is available, need to remove dirty nodes.
- * \retval KNOTD_ERROR on I/O error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EAGAIN if no free node is available, need to remove dirty nodes.
+ * \retval KNOT_ERROR on I/O error.
*/
int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size);
@@ -221,10 +221,10 @@ int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size);
* \param ptr Mapped memory.
* \param finalize Set to true to finalize node or False to discard it.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_ENOENT if the entry cannot be found.
- * \retval KNOTD_EAGAIN if no free node is available, need to remove dirty nodes.
- * \retval KNOTD_ERROR on I/O error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_ENOENT if the entry cannot be found.
+ * \retval KNOT_EAGAIN if no free node is available, need to remove dirty nodes.
+ * \retval KNOT_ERROR on I/O error.
*/
int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize);
@@ -258,8 +258,8 @@ static inline journal_node_t *journal_end(journal_t *journal) {
* \param journal Associated journal.
* \param apply Function to apply to each node.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int journal_walk(journal_t *journal, journal_apply_t apply);
@@ -271,8 +271,8 @@ int journal_walk(journal_t *journal, journal_apply_t apply);
* \param journal Associated journal.
* \param n Pointer to node (must belong to associated journal).
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int journal_update(journal_t *journal, journal_node_t *n);
@@ -283,9 +283,9 @@ int journal_update(journal_t *journal, journal_node_t *n);
*
* \param journal Associated journal.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_EBUSY if transaction is already pending.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_EBUSY if transaction is already pending.
*/
int journal_trans_begin(journal_t *journal);
@@ -296,9 +296,9 @@ int journal_trans_begin(journal_t *journal);
*
* \param journal Associated journal.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT if no transaction is pending.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT if no transaction is pending.
*/
int journal_trans_commit(journal_t *journal);
@@ -309,9 +309,9 @@ int journal_trans_commit(journal_t *journal);
*
* \param journal Associated journal.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT if no transaction is pending.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT if no transaction is pending.
*/
int journal_trans_rollback(journal_t *journal);
@@ -320,8 +320,8 @@ int journal_trans_rollback(journal_t *journal);
*
* \param journal Associated journal.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameter.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameter.
*/
int journal_close(journal_t *journal);
@@ -353,8 +353,8 @@ void journal_release(journal_t *journal);
*
* \param fd Open journal file.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL if not valid fd.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL if not valid fd.
*/
int journal_update_crc(int fd);
diff --git a/src/knot/server/notify.c b/src/knot/server/notify.c
index d0292e8..381b1b2 100755..100644
--- a/src/knot/server/notify.c
+++ b/src/knot/server/notify.c
@@ -24,10 +24,8 @@
#include "libknot/packet/response.h"
#include "libknot/packet/query.h"
#include "libknot/consts.h"
-#include "knot/other/error.h"
#include "libknot/zone/zonedb.h"
#include "libknot/common.h"
-#include "libknot/util/error.h"
#include "libknot/util/wire.h"
#include "knot/server/zones.h"
#include "common/acl.h"
@@ -43,19 +41,19 @@ static int notify_request(const knot_rrset_t *rrset,
uint8_t *buffer, size_t *size)
{
knot_packet_t *pkt = knot_packet_new(KNOT_PACKET_PREALLOC_QUERY);
- CHECK_ALLOC_LOG(pkt, KNOTD_ENOMEM);
+ CHECK_ALLOC_LOG(pkt, KNOT_ENOMEM);
/*! \todo Get rid of the numeric constant. */
int rc = knot_packet_set_max_size(pkt, 512);
if (rc != KNOT_EOK) {
knot_packet_free(&pkt);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
rc = knot_query_init(pkt);
if (rc != KNOT_EOK) {
knot_packet_free(&pkt);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
knot_question_t question;
@@ -68,7 +66,7 @@ static int notify_request(const knot_rrset_t *rrset,
rc = knot_query_set_question(pkt, &question);
if (rc != KNOT_EOK) {
knot_packet_free(&pkt);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Set random query ID. */
@@ -95,12 +93,12 @@ static int notify_request(const knot_rrset_t *rrset,
rc = knot_packet_to_wire(pkt, &wire, &wire_size);
if (rc != KNOT_EOK) {
knot_packet_free(&pkt);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
if (wire_size > *size) {
knot_packet_free(&pkt);
- return KNOTD_ESPACE;
+ return KNOT_ESPACE;
}
memcpy(buffer, wire, wire_size);
@@ -110,7 +108,7 @@ static int notify_request(const knot_rrset_t *rrset,
knot_packet_free(&pkt);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -120,7 +118,7 @@ int notify_create_response(knot_packet_t *request, uint8_t *buffer,
{
knot_packet_t *response =
knot_packet_new(KNOT_PACKET_PREALLOC_QUERY);
- CHECK_ALLOC_LOG(response, KNOTD_ENOMEM);
+ CHECK_ALLOC_LOG(response, KNOT_ENOMEM);
/* Set maximum packet size. */
int rc = knot_packet_set_max_size(response, *size);
@@ -133,7 +131,7 @@ int notify_create_response(knot_packet_t *request, uint8_t *buffer,
dbg_notify("%s: failed to init response packet: %s",
"notify_create_response", knot_strerror(rc));
knot_packet_free(&response);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
// TODO: copy the SOA in Answer section
@@ -147,7 +145,7 @@ int notify_create_response(knot_packet_t *request, uint8_t *buffer,
if (wire_size > *size) {
knot_packet_free(&response);
- return KNOTD_ESPACE;
+ return KNOT_ESPACE;
}
memcpy(buffer, wire, wire_size);
@@ -156,7 +154,7 @@ int notify_create_response(knot_packet_t *request, uint8_t *buffer,
knot_packet_dump(response);
knot_packet_free(&response);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -169,7 +167,7 @@ int notify_create_request(const knot_zone_contents_t *zone, uint8_t *buffer,
const knot_rrset_t *soa_rrset = knot_node_rrset(
knot_zone_contents_apex(zone), KNOT_RRTYPE_SOA);
if (soa_rrset == NULL) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
return notify_request(soa_rrset, buffer, size);
@@ -182,7 +180,7 @@ static int notify_check_and_schedule(knot_nameserver_t *nameserver,
sockaddr_t *from)
{
if (zone == NULL || from == NULL || knot_zone_data(zone) == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check ACL for notify-in. */
@@ -215,7 +213,7 @@ static int notify_check_and_schedule(knot_nameserver_t *nameserver,
evsched_schedule(sched, refresh_ev, 0);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -233,10 +231,10 @@ int notify_process_request(knot_nameserver_t *ns,
|| size == NULL || from == NULL) {
dbg_notify("notify: invalid parameters for %s()\n",
"notify_process_request");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
dbg_notify("notify: parsing rest of the packet\n");
if (notify->parsed < notify->size) {
@@ -245,7 +243,7 @@ int notify_process_request(knot_nameserver_t *ns,
knot_ns_error_response_from_query(ns, notify,
KNOT_RCODE_FORMERR,
buffer, size);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
}
@@ -255,18 +253,18 @@ int notify_process_request(knot_nameserver_t *ns,
knot_ns_error_response_from_query(ns, notify,
KNOT_RCODE_FORMERR, buffer,
size);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
// create NOTIFY response
dbg_notify("notify: creating response\n");
ret = notify_create_response(notify, buffer, size);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_notify("notify: failed to create NOTIFY response\n");
knot_ns_error_response_from_query(ns, notify,
KNOT_RCODE_SERVFAIL, buffer,
size);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
// find the zone
@@ -280,12 +278,12 @@ int notify_process_request(knot_nameserver_t *ns,
knot_ns_error_response_from_query(ns, notify,
KNOT_RCODE_FORMERR, buffer,
size);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
notify_check_and_schedule(ns, z, from);
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -297,7 +295,7 @@ int notify_process_response(knot_nameserver_t *nameserver,
{
if (nameserver == NULL || notify == NULL || from == NULL
|| buffer == NULL || size == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Assert no response size. */
@@ -310,11 +308,11 @@ int notify_process_response(knot_nameserver_t *nameserver,
zone_name);
if (!zone) {
rcu_read_unlock();
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
if (!knot_zone_data(zone)) {
rcu_read_unlock();
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Match ID against awaited. */
@@ -333,7 +331,7 @@ int notify_process_response(knot_nameserver_t *nameserver,
if (!match) {
rcu_read_unlock();
pthread_mutex_unlock(&zd->lock);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* NOTIFY is now finished. */
@@ -344,6 +342,6 @@ int notify_process_response(knot_nameserver_t *nameserver,
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/server/notify.h b/src/knot/server/notify.h
index a9ba807..91b47d9 100755..100644
--- a/src/knot/server/notify.h
+++ b/src/knot/server/notify.h
@@ -60,9 +60,9 @@ typedef struct notify_ev_t {
* \param size In: available space in the buffer. Out: actual size of the
* message in bytes.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_ESPACE
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK
+ * \retval KNOT_ESPACE
+ * \retval KNOT_ERROR
*/
int notify_create_request(const knot_zone_contents_t *zone, uint8_t *buffer,
size_t *size);
@@ -80,9 +80,9 @@ int notify_create_request(const knot_zone_contents_t *zone, uint8_t *buffer,
* \param rsize Input: maximum acceptable size of the response. Output: real
* size of the response.
*
- * \retval KNOTD_EOK if a valid response was created.
- * \retval KNOTD_EACCES sender is not authorized to request NOTIFY.
- * \retval KNOTD_EMALF if an error occured and the response is not valid.
+ * \retval KNOT_EOK if a valid response was created.
+ * \retval KNOT_EACCES sender is not authorized to request NOTIFY.
+ * \retval KNOT_EMALF if an error occured and the response is not valid.
*/
/*!
* \brief Evaluates incoming NOTIFY request and produces a reply.
@@ -95,10 +95,10 @@ int notify_create_request(const knot_zone_contents_t *zone, uint8_t *buffer,
* \param size In: available space in the buffer. Out: actual size of the
* response message in bytes.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_EINVAL
- * \retval KNOTD_EMALF
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK
+ * \retval KNOT_EINVAL
+ * \retval KNOT_EMALF
+ * \retval KNOT_ERROR
*/
int notify_process_request(knot_nameserver_t *nameserver,
knot_packet_t *notify,
@@ -115,9 +115,9 @@ int notify_process_request(knot_nameserver_t *nameserver,
* \param rsize Input: maximum acceptable size of the response. Output: real
* size of the response.
*
- * \retval KNOTD_EOK if a valid response was created.
- * \retval KNOTD_EINVAL on invalid parameters or packet.
- * \retval KNOTD_EMALF if an error occured and the response is not valid.
+ * \retval KNOT_EOK if a valid response was created.
+ * \retval KNOT_EINVAL on invalid parameters or packet.
+ * \retval KNOT_EMALF if an error occured and the response is not valid.
*/
int notify_process_response(knot_nameserver_t *nameserver,
knot_packet_t *notify,
diff --git a/src/knot/server/server.c b/src/knot/server/server.c
index 06f89b5..5a792c7 100755..100644
--- a/src/knot/server/server.c
+++ b/src/knot/server/server.c
@@ -25,7 +25,6 @@
#include "common/prng.h"
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/server/server.h"
#include "knot/server/udp-handler.h"
#include "knot/server/tcp-handler.h"
@@ -43,7 +42,7 @@ static int evsched_run(dthread_t *thread)
iohandler_t *sched_h = (iohandler_t *)thread->data;
evsched_t *s = (evsched_t*)sched_h->data;
if (!s) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Run event loop. */
@@ -72,7 +71,7 @@ static int evsched_run(dthread_t *thread)
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*! \brief List item for generic pointers. */
@@ -201,7 +200,7 @@ static int server_init_iface(iface_t *new_if, conf_iface_t *cfg_if)
new_if->type[TCP_ID] = cfg_if->family;
new_if->port = cfg_if->port;
new_if->addr = strdup(cfg_if->address);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -268,6 +267,8 @@ static int server_bind_sockets(server_t *server)
if (found_match) {
rem_node(m);
} else {
+ log_server_info("Binding to interface %s port %d.\n",
+ cfg_if->address, cfg_if->port);
/* Create new interface. */
m = malloc(sizeof(iface_t));
@@ -275,9 +276,6 @@ static int server_bind_sockets(server_t *server)
free(m);
m = 0;
}
-
- log_server_info("Binding to interface %s port %d.\n",
- cfg_if->address, cfg_if->port);
}
/* Move to new list. */
@@ -325,7 +323,7 @@ static int server_bind_sockets(server_t *server)
static int server_bind_handlers(server_t *server)
{
if (!server || !server->ifaces) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Lock config. */
@@ -388,7 +386,7 @@ static int server_bind_handlers(server_t *server)
/* Unlock config. */
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
server_t *server_create()
@@ -482,7 +480,7 @@ int server_remove_handler(server_t *server, iohandler_t *h)
{
// Check
if (h == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Lock RCU. */
@@ -534,14 +532,14 @@ int server_remove_handler(server_t *server, iohandler_t *h)
// Destroy dispatcher and worker
dt_delete(&h->unit);
free(h);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int server_start(server_t *server)
{
// Check server
if (server == 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
dbg_server("server: starting server instance\n");
@@ -553,7 +551,7 @@ int server_start(server_t *server)
rcu_read_lock();
// Start dispatchers
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
server->state |= ServerRunning;
iohandler_t *h = 0;
WALK_LIST(h, server->handlers) {
@@ -614,7 +612,7 @@ int server_wait(server_t *server)
int server_refresh(server_t *server)
{
if (server == NULL || server->nameserver == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Lock RCU and fetch zones. */
@@ -624,7 +622,7 @@ int server_refresh(server_t *server)
const knot_zone_t **zones = knot_zonedb_zones(ns->zone_db);
if (zones == NULL) {
rcu_read_unlock();
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* REFRESH zones. */
@@ -644,7 +642,7 @@ int server_refresh(server_t *server)
/* Unlock RCU. */
rcu_read_unlock();
free(zones);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
void server_stop(server_t *server)
@@ -723,11 +721,11 @@ int server_conf_hook(const struct conf_t *conf, void *data)
server_t *server = (server_t *)data;
if (!server) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Update bound sockets. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
if ((ret = server_bind_sockets(server)) < 0) {
log_server_error("Failed to bind configured "
"interfaces.\n");
@@ -740,8 +738,8 @@ int server_conf_hook(const struct conf_t *conf, void *data)
}
/* Exit if the server is not running. */
- if (ret != KNOTD_EOK || !(server->state & ServerRunning)) {
- return KNOTD_ENOTRUNNING;
+ if (ret != KNOT_EOK || !(server->state & ServerRunning)) {
+ return KNOT_ENOTRUNNING;
}
/* Start new handlers. */
diff --git a/src/knot/server/server.h b/src/knot/server/server.h
index 79a4729..a28be63 100755..100644
--- a/src/knot/server/server.h
+++ b/src/knot/server/server.h
@@ -152,8 +152,8 @@ iohandler_t *server_create_handler(server_t *server, int fd, dt_unit_t *unit);
* \param server Server structure to be used for operation.
* \param ref I/O handler instance.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*/
int server_remove_handler(server_t *server, iohandler_t *ref);
@@ -162,8 +162,8 @@ int server_remove_handler(server_t *server, iohandler_t *ref);
*
* \param server Server structure to be used for operation.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
*
*/
int server_start(server_t *server);
@@ -207,10 +207,10 @@ void server_destroy(server_t **server);
*
* Routine for dynamic server reconfiguration.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ENOTRUNNING if the server is not running.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ENOTRUNNING if the server is not running.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ERROR unspecified error.
*/
int server_conf_hook(const struct conf_t *conf, void *data);
diff --git a/src/knot/server/socket.c b/src/knot/server/socket.c
index 1e79f89..5f4f936 100755..100644
--- a/src/knot/server/socket.c
+++ b/src/knot/server/socket.c
@@ -31,7 +31,6 @@
#include <netinet/ip.h>
#include <arpa/inet.h>
-#include "knot/other/error.h"
#include "knot/common.h"
#include "knot/server/socket.h"
@@ -54,12 +53,12 @@ int socket_connect(int fd, const char *addr, unsigned short port)
}
/* Resolve address. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
struct addrinfo hints, *res;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ((ret = getaddrinfo(addr, NULL, &hints, &res)) != 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Evaluate address type. */
@@ -113,7 +112,7 @@ int socket_bind(int socket, int family, const char *addr, unsigned short port)
paddr = (struct sockaddr*)&saddr;
addrlen = sizeof(saddr);
if (getsockname(socket, paddr, &addrlen) < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Set address and port. */
@@ -132,13 +131,13 @@ int socket_bind(int socket, int family, const char *addr, unsigned short port)
#ifdef DISABLE_IPV6
log_server_error("ipv6 support disabled\n");
- return KNOTD_ENOIPV6;
+ return KNOT_ENOIPV6;
#else
/* Initialize socket address. */
paddr = (struct sockaddr*)&saddr6;
addrlen = sizeof(saddr6);
if (getsockname(socket, paddr, &addrlen) < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Set address and port. */
@@ -160,7 +159,7 @@ int socket_bind(int socket, int family, const char *addr, unsigned short port)
ret = setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY,
&flag, sizeof(flag));
if (ret < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
}
#endif /* IPV6_V6ONLY */
@@ -171,7 +170,7 @@ int socket_bind(int socket, int family, const char *addr, unsigned short port)
ret = setsockopt(socket, SOL_SOCKET, SO_REUSEADDR,
&flag, sizeof(flag));
if (ret < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Bind to specified address. */
@@ -182,7 +181,7 @@ int socket_bind(int socket, int family, const char *addr, unsigned short port)
return knot_map_errno(EADDRINUSE, EINVAL, EACCES, ENOMEM);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int socket_listen(int socket, int backlog_size)
@@ -192,15 +191,15 @@ int socket_listen(int socket, int backlog_size)
return knot_map_errno(EADDRINUSE);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int socket_close(int socket)
{
if (close(socket) < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/server/socket.h b/src/knot/server/socket.h
index 2185f03..1266c53 100755..100644
--- a/src/knot/server/socket.h
+++ b/src/knot/server/socket.h
@@ -49,10 +49,10 @@ typedef enum {
* \param type Socket type (SOCK_STREAM, SOCK_DGRAM, SOCK_RAW).
*
* \retval new socket filedescriptor on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOMEM out of memory error.
- * \retval KNOTD_EACCES process does not have appropriate privileges.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOMEM out of memory error.
+ * \retval KNOT_EACCES process does not have appropriate privileges.
+ * \retval KNOT_ERROR unspecified error.
*/
int socket_create(int family, int type);
@@ -63,14 +63,14 @@ int socket_create(int family, int type);
* \param addr Requested address.
* \param port Requested port.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
- * \retval KNOTD_EACCES process does not have appropriate privileges.
- * \retval KNOTD_EAGAIN lack of resources, try again.
- * \retval KNOTD_EADDRINUSE address already in use.
- * \retval KNOTD_ECONNREFUSED connection refused.
- * \retval KNOTD_EISCONN already connected.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
+ * \retval KNOT_EACCES process does not have appropriate privileges.
+ * \retval KNOT_EAGAIN lack of resources, try again.
+ * \retval KNOT_EADDRINUSE address already in use.
+ * \retval KNOT_ECONNREFUSED connection refused.
+ * \retval KNOT_EISCONN already connected.
+ * \retval KNOT_ERROR unspecified error.
*/
int socket_connect(int fd, const char *addr, unsigned short port);
@@ -82,13 +82,13 @@ int socket_connect(int fd, const char *addr, unsigned short port);
* \param addr Requested address.
* \param port Requested port.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
- * \retval KNOTD_EACCES process does not have appropriate privileges.
- * \retval KNOTD_EADDRINUSE address already in use.
- * \retval KNOTD_ENOMEM out of memory error.
- * \retval KNOTD_ENOIPV6 IPv6 support is not available.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
+ * \retval KNOT_EACCES process does not have appropriate privileges.
+ * \retval KNOT_EADDRINUSE address already in use.
+ * \retval KNOT_ENOMEM out of memory error.
+ * \retval KNOT_ENOIPV6 IPv6 support is not available.
+ * \retval KNOT_ERROR unspecified error.
*/
int socket_bind(int fd, int family, const char *addr, unsigned short port);
@@ -98,9 +98,9 @@ int socket_bind(int fd, int family, const char *addr, unsigned short port);
* \param fd Socket filedescriptor.
* \param backlog_size Requested TCP backlog size.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EADDRINUSE address already in use.
- * \retval KNOTD_ERROR unspecified error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EADDRINUSE address already in use.
+ * \retval KNOT_ERROR unspecified error.
*/
int socket_listen(int fd, int backlog_size);
@@ -109,8 +109,8 @@ int socket_listen(int fd, int backlog_size);
*
* \param fd Socket filedescriptor.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int socket_close(int fd);
diff --git a/src/knot/server/tcp-handler.c b/src/knot/server/tcp-handler.c
index 60f4301..11628bc 100755..100644
--- a/src/knot/server/tcp-handler.c
+++ b/src/knot/server/tcp-handler.c
@@ -36,8 +36,6 @@
#include "knot/server/xfr-handler.h"
#include "knot/server/zones.h"
#include "libknot/nameserver/name-server.h"
-#include "knot/other/error.h"
-#include "libknot/util/error.h"
#include "libknot/util/wire.h"
/* Defines */
@@ -147,7 +145,7 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
{
if (fd < 0 || !w || !w->ioh) {
dbg_net("tcp: tcp_handle(%p, %d) - invalid parameters\n", w, fd);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
dbg_net("tcp: handling TCP event on fd=%d in thread %p.\n",
@@ -157,18 +155,18 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
/* Check address type. */
sockaddr_t addr;
- if (sockaddr_init(&addr, w->ioh->type) != KNOTD_EOK) {
+ if (sockaddr_init(&addr, w->ioh->type) != KNOT_EOK) {
log_server_error("Socket type %d is not supported, "
"IPv6 support is probably disabled.\n",
w->ioh->type);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Receive data. */
int n = tcp_recv(fd, qbuf, qbuf_maxlen, &addr);
if (n <= 0) {
dbg_net("tcp: client on fd=%d disconnected\n", fd);
- if (n == KNOTD_EAGAIN) {
+ if (n == KNOT_EAGAIN) {
char r_addr[SOCKADDR_STRLEN];
sockaddr_tostr(&addr, r_addr, sizeof(r_addr));
int r_port = sockaddr_portnum(&addr);
@@ -176,7 +174,7 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
" within the time limit of %ds.\n",
r_addr, r_port, TCP_ACTIVITY_WD);
}
- return KNOTD_ECONNREFUSED;
+ return KNOT_ECONNREFUSED;
}
/* Parse query. */
@@ -193,11 +191,11 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
tcp_reply(fd, qbuf, resp_len);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int parse_res = knot_ns_parse_packet(qbuf, n, packet, &qtype);
- if (unlikely(parse_res != KNOT_EOK)) {
+ if (knot_unlikely(parse_res != KNOT_EOK)) {
if (parse_res > 0) { /* Returned RCODE */
int ret = knot_ns_error_response_from_query(ns, packet,
parse_res, qbuf, &resp_len);
@@ -207,13 +205,13 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
}
}
knot_packet_free(&packet);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Handle query. */
int xfrt = -1;
knot_ns_xfr_t xfr;
- int res = KNOTD_ERROR;
+ int res = KNOT_ERROR;
switch(qtype) {
/* Query types. */
@@ -222,7 +220,7 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
if (zones_normal_query_answer(ns, packet, &addr,
qbuf, &resp_len,
NS_TRANSPORT_TCP) == KNOT_EOK) {
- res = KNOTD_EOK;
+ res = KNOT_EOK;
}
break;
case KNOT_QUERY_AXFR:
@@ -235,11 +233,11 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
/* Prepare context. */
res = xfr_request_init(&xfr, xfrt, XFR_FLAG_TCP, packet);
- if (res != KNOTD_EOK) {
+ if (res != KNOT_EOK) {
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_SERVFAIL,
qbuf, &resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
}
xfr.send = xfr_send_cb;
@@ -255,7 +253,7 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_NOTIMPL,
qbuf, &resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
case KNOT_QUERY_NOTIFY:
@@ -271,7 +269,7 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_REFUSED,
qbuf, &resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
/* Unknown opcodes. */
@@ -279,18 +277,18 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_FORMERR,
qbuf, &resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
}
knot_packet_free(&packet);
/* Send answer. */
- if (res == KNOTD_EOK) {
+ if (res == KNOT_EOK) {
tcp_reply(fd, qbuf, resp_len);
} else {
dbg_net("tcp: failed to respond to query type=%d on fd=%d - %s\n",
- qtype, fd, knotd_strerror(res));;
+ qtype, fd, knot_strerror(res));;
}
return res;
@@ -400,13 +398,13 @@ int tcp_send(int fd, uint8_t *msg, size_t msglen)
unsigned short pktsize = htons(msglen);
int sent = send(fd, &pktsize, sizeof(pktsize), 0);
if (sent < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Send message data. */
sent = send(fd, msg, msglen, 0);
if (sent < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
#ifdef TCP_CORK
@@ -426,9 +424,9 @@ int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr)
int n = recv(fd, &pktsize, sizeof(unsigned short), MSG_WAITALL);
if (n < 0) {
if (errno == EAGAIN) {
- return KNOTD_EAGAIN;
+ return KNOT_EAGAIN;
} else {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
}
@@ -436,7 +434,7 @@ int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr)
// Check packet size for NULL
if (pktsize == 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
dbg_net("tcp: incoming packet size=%hu on fd=%d\n",
@@ -444,14 +442,14 @@ int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr)
// Check packet size
if (len < pktsize) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Get peer name. */
if (addr) {
socklen_t alen = addr->len;
if (getpeername(fd, addr->ptr, &alen) < 0) {
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
}
@@ -459,9 +457,9 @@ int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr)
n = recv(fd, buf, pktsize, MSG_WAITALL);
if (n < 0) {
if (errno == EAGAIN) {
- return KNOTD_EAGAIN;
+ return KNOT_EAGAIN;
} else {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
}
dbg_net("tcp: received packet size=%d on fd=%d\n",
@@ -478,7 +476,7 @@ int tcp_loop_master(dthread_t *thread)
/* Check socket. */
if (!handler || handler->fd < 0 || handler->data == NULL) {
dbg_net("tcp: failed to initialize master thread\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
tcp_worker_t **workers = handler->data;
@@ -512,21 +510,21 @@ int tcp_loop_master(dthread_t *thread)
dbg_net("tcp: master thread finished\n");
free(workers);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int tcp_loop_worker(dthread_t *thread)
{
tcp_worker_t *w = thread->data;
if (!w) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Allocate buffer for requests. */
uint8_t *qbuf = malloc(TCP_BUFFER_SIZE);
if (qbuf == NULL) {
dbg_net("tcp: failed to allocate buffers for TCP worker\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Drop all capabilities on workers. */
@@ -583,7 +581,7 @@ int tcp_loop_worker(dthread_t *thread)
/* Handle other events. */
int ret = tcp_handle(w, it.fd, qbuf,
TCP_BUFFER_SIZE);
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
fdset_set_watchdog(w->fdset, it.fd,
TCP_ACTIVITY_WD);
dbg_net("tcp: watchdog for fd=%d "
@@ -591,7 +589,7 @@ int tcp_loop_worker(dthread_t *thread)
it.fd, TCP_ACTIVITY_WD);
}
/*! \todo Refactor to allow erase on iterator.*/
- if (ret == KNOTD_ECONNREFUSED) {
+ if (ret == KNOT_ECONNREFUSED) {
fdset_remove(w->fdset, it.fd);
close(it.fd);
break;
@@ -620,13 +618,13 @@ int tcp_loop_worker(dthread_t *thread)
free(qbuf);
dbg_net_verb("tcp: worker %p finished\n", w);
tcp_worker_free(w);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int tcp_loop_unit(iohandler_t *ioh, dt_unit_t *unit)
{
if (unit->size < 1) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Create unit data. */
@@ -634,7 +632,7 @@ int tcp_loop_unit(iohandler_t *ioh, dt_unit_t *unit)
sizeof(tcp_worker_t *));
if (!workers) {
dbg_net("tcp: cannot allocate list of workers\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Prepare worker data. */
@@ -656,7 +654,7 @@ int tcp_loop_unit(iohandler_t *ioh, dt_unit_t *unit)
free(workers);
dbg_net("tcp: cannot create workers\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Store worker data. */
@@ -670,5 +668,5 @@ int tcp_loop_unit(iohandler_t *ioh, dt_unit_t *unit)
/* Repurpose first thread as master (unit controller). */
dt_repurpose(unit->threads[0], tcp_loop_master, ioh);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/server/tcp-handler.h b/src/knot/server/tcp-handler.h
index ab6baab..17a7293 100755..100644
--- a/src/knot/server/tcp-handler.h
+++ b/src/knot/server/tcp-handler.h
@@ -50,7 +50,7 @@
* \param msglen Buffer maximum size.
*
* \retval Number of sent data on success.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_ERROR on error.
*/
int tcp_send(int fd, uint8_t *msg, size_t msglen);
@@ -63,8 +63,8 @@ int tcp_send(int fd, uint8_t *msg, size_t msglen);
* \param addr Source address.
*
* \retval Number of read bytes on success.
- * \retval KNOTD_ERROR on error.
- * \retval KNOTD_ENOMEM on potential buffer overflow.
+ * \retval KNOT_ERROR on error.
+ * \retval KNOT_ENOMEM on potential buffer overflow.
*/
int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr);
@@ -73,8 +73,8 @@ int tcp_recv(int fd, uint8_t *buf, size_t len, sockaddr_t *addr);
*
* \param thread Associated thread from DThreads unit.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int tcp_loop_master(dthread_t *thread);
@@ -83,8 +83,8 @@ int tcp_loop_master(dthread_t *thread);
*
* \param thread Associated thread from DThreads unit.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int tcp_loop_worker(dthread_t *thread);
@@ -96,8 +96,8 @@ int tcp_loop_worker(dthread_t *thread);
* \param ioh Associated I/O handler.
* \param thread Associated thread from DThreads unit.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int tcp_loop_unit(iohandler_t *ioh, dt_unit_t *unit);
diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c
index fc4e9b1..d0a21bb 100755..100644
--- a/src/knot/server/udp-handler.c
+++ b/src/knot/server/udp-handler.c
@@ -37,7 +37,6 @@
#include "common/sockaddr.h"
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/server/udp-handler.h"
#include "libknot/nameserver/name-server.h"
#include "knot/stat/stat.h"
@@ -47,7 +46,6 @@
#include "libknot/packet/packet.h"
#include "knot/server/zones.h"
#include "knot/server/notify.h"
-#include "libknot/util/error.h"
/* Check for sendmmsg syscall. */
#ifdef HAVE_SENDMMSG
@@ -90,15 +88,15 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
qbuf, resp_len);
if (ret != KNOT_EOK) {
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
- return KNOTD_EOK; /* Created error response. */
+ return KNOT_EOK; /* Created error response. */
}
/* Parse query. */
int res = knot_ns_parse_packet(qbuf, qbuflen, packet, &qtype);
- if (unlikely(res != KNOTD_EOK)) {
+ if (knot_unlikely(res != KNOT_EOK)) {
dbg_net("udp: failed to parse packet on fd=%d\n", fd);
if (res > 0) { /* Returned RCODE */
// int ret = knot_ns_error_response_from_query_wire(ns,
@@ -108,7 +106,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
if (ret != KNOT_EOK) {
knot_packet_free(&packet);
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
} else {
assert(res < 0);
@@ -123,13 +121,13 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
}
knot_packet_free(&packet);
- return KNOTD_EOK; /* Created error response. */
+ return KNOT_EOK; /* Created error response. */
}
/* Handle query. */
// server_t *srv = (server_t *)knot_ns_get_data(ns);
// knot_ns_xfr_t xfr;
- res = KNOTD_ERROR;
+ res = KNOT_ERROR;
switch(qtype) {
/* Query types. */
@@ -145,7 +143,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_FORMERR, qbuf,
resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
case KNOT_QUERY_IXFR:
/* According to RFC1035, respond with SOA.
@@ -168,7 +166,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_NOTIMPL, qbuf,
resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
/* Unhandled opcodes. */
@@ -177,7 +175,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_REFUSED, qbuf,
resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
/* Unknown opcodes */
@@ -185,7 +183,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
knot_ns_error_response_from_query(ns, packet,
KNOT_RCODE_FORMERR, qbuf,
resp_len);
- res = KNOTD_EOK;
+ res = KNOT_EOK;
break;
}
@@ -199,7 +197,7 @@ static inline int udp_master_recvfrom(dthread_t *thread, stat_t *thread_stat)
iohandler_t *h = (iohandler_t *)thread->data;
if (h == NULL || h->server == NULL || h->server->nameserver == NULL) {
dbg_net("udp: invalid parameters for udp_master_recvfrom\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Set CPU affinity to improve load distribution on multicore systems.
@@ -218,18 +216,18 @@ static inline int udp_master_recvfrom(dthread_t *thread, stat_t *thread_stat)
/* Initialize remote party address. */
sockaddr_t addr;
- if (sockaddr_init(&addr, h->type) != KNOTD_EOK) {
+ if (sockaddr_init(&addr, h->type) != KNOT_EOK) {
log_server_error("Socket type %d is not supported, "
"IPv6 support is probably disabled.\n",
h->type);
- return KNOTD_ENOTSUP;
+ return KNOT_ENOTSUP;
}
/* Allocate buffer for answering. */
uint8_t *qbuf = malloc(SOCKET_MTU_SZ);
if (qbuf == NULL) {
dbg_net("udp: out of memory when allocating buffer.\n");
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Duplicate socket for performance reasons on some OS's */
@@ -254,7 +252,7 @@ static inline int udp_master_recvfrom(dthread_t *thread, stat_t *thread_stat)
}
/* Error and interrupt handling. */
- if (unlikely(n <= 0)) {
+ if (knot_unlikely(n <= 0)) {
if (errno != EINTR && errno != 0) {
dbg_net("udp: recvmsg() failed: %d\n",
errno);
@@ -272,7 +270,7 @@ static inline int udp_master_recvfrom(dthread_t *thread, stat_t *thread_stat)
int rc = udp_handle(sock, qbuf, n, &resp_len, &addr, ns);
/* Send response. */
- if (rc == KNOTD_EOK && resp_len > 0) {
+ if (rc == KNOT_EOK && resp_len > 0) {
dbg_net("udp: on fd=%d, sending answer size=%zd.\n",
sock, resp_len);
@@ -296,7 +294,7 @@ static inline int udp_master_recvfrom(dthread_t *thread, stat_t *thread_stat)
free(qbuf);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
#ifdef ENABLE_RECVMMSG
@@ -333,7 +331,7 @@ int udp_sendto(int sock, sockaddr_t * addrs, struct mmsghdr *msgs, size_t count)
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
#ifdef ENABLE_SENDMMSG
@@ -356,10 +354,10 @@ int udp_sendmmsg(int sock, sockaddr_t *_, struct mmsghdr *msgs, size_t count)
UNUSED(_);
dbg_net("udp: sending multiple responses\n");
if (sendmmsg(sock, msgs, count, 0) < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
#endif
@@ -372,7 +370,7 @@ static inline int udp_master_recvmmsg(dthread_t *thread, stat_t *thread_stat)
/* Check socket. */
if (sock < 0) {
dbg_net("udp: unable to dup() socket, finishing.\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Allocate batch for N packets. */
@@ -388,7 +386,7 @@ static inline int udp_master_recvmmsg(dthread_t *thread, stat_t *thread_stat)
free(iov);
free(msgs);
close(sock);
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Prepare batch. */
@@ -428,7 +426,7 @@ static inline int udp_master_recvmmsg(dthread_t *thread, stat_t *thread_stat)
}
/* Error and interrupt handling. */
- if (unlikely(n <= 0)) {
+ if (knot_unlikely(n <= 0)) {
if (errno != EINTR && errno != 0 && n < 0) {
log_server_error("I/O failure in UDP - errno %d "
"(Linux/recvmmsg)", errno);
@@ -450,7 +448,7 @@ static inline int udp_master_recvmmsg(dthread_t *thread, stat_t *thread_stat)
size_t resp_len = msgs[i].msg_len;
ret = udp_handle(sock, cvec->iov_base, resp_len, &resp_len,
addrs + i, ns);
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
msgs[i].msg_len = resp_len;
iov[i].iov_len = resp_len;
} else {
@@ -475,7 +473,7 @@ static inline int udp_master_recvmmsg(dthread_t *thread, stat_t *thread_stat)
free(iov);
free(msgs);
close(sock);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
#endif
#endif
@@ -518,7 +516,7 @@ int udp_master(dthread_t *thread)
/* Check socket. */
if (sock < 0) {
dbg_net("udp: null socket recevied, finishing.\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Set socket options. */
@@ -564,10 +562,10 @@ int udp_master(dthread_t *thread)
/* Execute proper handler. */
dbg_net_verb("udp: thread started (worker %p).\n", thread);
int ret = _udp_master(thread, thread_stat);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_server_warning("UDP answering module finished "
"with an error (%s).\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
}
stat_free(thread_stat);
diff --git a/src/knot/server/udp-handler.h b/src/knot/server/udp-handler.h
index f5fcd04..073a4d8 100755..100644
--- a/src/knot/server/udp-handler.h
+++ b/src/knot/server/udp-handler.h
@@ -48,9 +48,9 @@
* \param addr
* \param ns
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ERROR
- * \retval KNOTD_ENOMEM
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ERROR
+ * \retval KNOT_ENOMEM
*/
int udp_handle(int sock, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
sockaddr_t* addr, knot_nameserver_t *ns);
@@ -64,8 +64,8 @@ int udp_handle(int sock, uint8_t *qbuf, size_t qbuflen, size_t *resp_len,
*
* \param thread Associated thread from DThreads unit.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int udp_master(dthread_t *thread);
diff --git a/src/knot/server/xfr-handler.c b/src/knot/server/xfr-handler.c
index 7863c9a..5e8c31a 100755..100644
--- a/src/knot/server/xfr-handler.c
+++ b/src/knot/server/xfr-handler.c
@@ -30,13 +30,11 @@
#include "knot/common.h"
#include "knot/server/xfr-handler.h"
#include "libknot/nameserver/name-server.h"
-#include "knot/other/error.h"
#include "knot/server/socket.h"
#include "knot/server/udp-handler.h"
#include "knot/server/tcp-handler.h"
#include "libknot/updates/xfr-in.h"
#include "knot/server/zones.h"
-#include "libknot/util/error.h"
#include "libknot/tsig-op.h"
#include "common/evsched.h"
#include "common/prng.h"
@@ -75,7 +73,7 @@ static void xfr_request_deinit(knot_ns_xfr_t *r)
*/
static int xfr_xfrin_cleanup(xfrworker_t *w, knot_ns_xfr_t *data)
{
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
knot_changesets_t *chs = 0;
dbg_xfr_verb("Cleaning up after XFR-in.\n");
@@ -229,7 +227,7 @@ static int xfr_udp_timeout(knot_ns_xfr_t *data)
/* Invalidate pending query. */
xfr_free_task(data);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -244,11 +242,11 @@ static int xfr_udp_timeout(knot_ns_xfr_t *data)
static int xfr_process_udp_resp(xfrworker_t *w, int fd, knot_ns_xfr_t *data)
{
/* Check if zone is valid. */
- int ret = KNOTD_ECONNREFUSED;
+ int ret = KNOT_ECONNREFUSED;
rcu_read_lock();
if (knot_zone_flags(data->zone) & KNOT_ZONE_DISCARDED) {
rcu_read_unlock();
- return ret;
+ return KNOT_ECONNREFUSED;
}
rcu_read_unlock();
@@ -263,25 +261,25 @@ static int xfr_process_udp_resp(xfrworker_t *w, int fd, knot_ns_xfr_t *data)
// parse packet
knot_packet_t *re = knot_packet_new(KNOT_PACKET_PREALLOC_RESPONSE);
if (re == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
knot_packet_type_t rt = KNOT_RESPONSE_NORMAL;
ret = knot_ns_parse_packet(data->wire, n, re, &rt);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
knot_packet_free(&re);
- return KNOTD_EOK; /* Ignore */
+ return KNOT_EOK; /* Ignore */
}
/* Ignore other packets. */
if (rt != KNOT_RESPONSE_NORMAL && rt != KNOT_RESPONSE_NOTIFY) {
knot_packet_free(&re);
- return KNOTD_EOK; /* Ignore */
+ return KNOT_EOK; /* Ignore */
}
ret = knot_packet_parse_rest(re);
if (ret != KNOT_EOK) {
knot_packet_free(&re);
- return KNOTD_EOK; /* Ignore */
+ return KNOT_EOK; /* Ignore */
}
// check TSIG
@@ -298,7 +296,7 @@ static int xfr_process_udp_resp(xfrworker_t *w, int fd, knot_ns_xfr_t *data)
log_server_error("%s %s\n",
data->msgpref, knot_strerror(ret));
knot_packet_free(&re);
- return KNOTD_ECONNREFUSED;
+ return KNOT_ECONNREFUSED;
}
}
@@ -320,14 +318,14 @@ static int xfr_process_udp_resp(xfrworker_t *w, int fd, knot_ns_xfr_t *data)
knot_packet_free(&re);
/* Check up-to-date zone. */
- if (ret == KNOTD_EUPTODATE) {
- log_server_info("%s %s\n", data->msgpref, knotd_strerror(ret));
- ret = KNOTD_ECONNREFUSED;
+ if (ret == KNOT_EUPTODATE) {
+ log_server_info("%s %s\n", data->msgpref, knot_strerror(ret));
+ ret = KNOT_ECONNREFUSED;
}
/* Invalidate pending query. */
- if (ret == KNOTD_EOK) {
- ret = KNOTD_ECONNREFUSED;
+ if (ret == KNOT_EOK) {
+ ret = KNOT_ECONNREFUSED;
}
return ret;
}
@@ -415,13 +413,13 @@ static knot_ns_xfr_t *xfr_register_task(xfrworker_t *w, const knot_ns_xfr_t *req
* \param w XFR worker.
* \param data Associated data.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ERROR
*/
static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
{
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
int apply_ret = KNOT_EOK;
int switch_ret = KNOT_EOK;
knot_changesets_t *chs = NULL;
@@ -431,10 +429,10 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
case XFR_TYPE_AIN:
dbg_xfr("xfr: %s Saving new zone file.\n", data->msgpref);
ret = zones_save_zone(data);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
xfr_xfrin_cleanup(w, data);
log_zone_error("%s Failed to save transferred zone - %s\n",
- data->msgpref, knotd_strerror(ret));
+ data->msgpref, knot_strerror(ret));
} else {
dbg_xfr("xfr: %s New zone saved.\n", data->msgpref);
switch_ret = knot_ns_switch_zone(w->ns, data);
@@ -443,10 +441,10 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
"zone - %s\n", data->msgpref,
knot_strerror(switch_ret));
xfr_xfrin_cleanup(w, data);
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
}
}
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
log_zone_info("%s Finished.\n", data->msgpref);
}
break;
@@ -459,12 +457,12 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
if (transaction != NULL) {
ret = zones_store_changesets(data);
} else {
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
}
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_zone_error("%s Failed to serialize and store "
"changesets - %s\n", data->msgpref,
- knotd_strerror(ret));
+ knot_strerror(ret));
/* Free changesets, but not the data. */
knot_free_changesets(&chs);
data->data = NULL;
@@ -484,13 +482,13 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
/* Free changesets, but not the data. */
knot_free_changesets(&chs);
data->data = NULL;
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
break;
}
/* Commit transaction. */
ret = zones_store_changesets_commit(transaction);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_zone_error("%s Failed to commit stored changesets "
"- %s\n",
data->msgpref,
@@ -517,7 +515,7 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
/* Free changesets, but not the data. */
knot_free_changesets(&chs);
data->data = NULL;
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
break;
}
@@ -526,11 +524,11 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data)
/* Free changesets, but not the data. */
knot_free_changesets(&chs);
data->data = NULL;
- assert(ret == KNOTD_EOK);
+ assert(ret == KNOT_EOK);
log_zone_info("%s Finished.\n", data->msgpref);
break;
default:
- ret = KNOTD_EINVAL;
+ ret = KNOT_EINVAL;
break;
}
@@ -717,7 +715,7 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf,
ret = knot_ns_process_ixfrin(w->ns, data);
break;
default:
- ret = KNOT_EBADARG;
+ ret = KNOT_EINVAL;
break;
}
}
@@ -759,7 +757,7 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf,
xfr_xfrin_cleanup(w, data);
data->type = XFR_TYPE_AIN;
data->msgpref[XFR_MSG_DLTTR] = 'A';
- return KNOTD_EOK;
+ return KNOT_EOK;
}
}
}
@@ -778,7 +776,7 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf,
}
/* Check finished zone. */
- int result = KNOTD_EOK;
+ int result = KNOT_EOK;
if (xfer_finished) {
/* Close early to free up fd for storing zone. */
@@ -799,7 +797,7 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf,
ret = xfr_xfrin_finalize(w, data);
/* AXFR bootstrap timeout. */
- if (ret != KNOTD_EOK && !knot_zone_contents(zone)) {
+ if (ret != KNOT_EOK && !knot_zone_contents(zone)) {
/* Schedule request (60 - 90s random delay). */
int tmr_s = AXFR_BOOTSTRAP_RETRY;
tmr_s += (30.0 * 1000) * (tls_rand());
@@ -818,7 +816,7 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf,
}
/* Disconnect. */
- result = KNOTD_ECONNREFUSED; /* Make it disconnect. */
+ result = KNOT_ECONNREFUSED; /* Make it disconnect. */
}
return result;
@@ -838,13 +836,13 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
/* Fetch associated zone. */
knot_zone_t *zone = (knot_zone_t *)data->zone;
if (!zone) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check if not already processing. */
zonedata_t *zd = (zonedata_t *)knot_zone_data(zone);
if (!zd) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Enqueue to worker that has zone locked for XFR/IN. */
@@ -867,11 +865,11 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
dbg_xfr("xfr: couldn't write request to evqueue: %s\n",
ebuf);
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
} else {
zd->xfr_in.wrkr = w;
--zd->xfr_in.scheduled;
@@ -903,7 +901,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
if (fd >= 0) {
close(fd);
}
- return KNOTD_ECONNREFUSED;
+ return KNOT_ECONNREFUSED;
}
/* Store new socket descriptor. */
@@ -916,7 +914,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
pthread_mutex_unlock(&zd->xfr_in.lock);
log_server_warning("Not enough memory to duplicate \n"
"sockets.\n");
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
}
@@ -929,7 +927,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
"contents.\n", data->msgpref);
close(data->session);
data->session = -1;
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Prepare TSIG key if set. */
@@ -960,7 +958,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
ret = xfrin_create_ixfr_query(contents, data, &bufsize, add_tsig);
break;
default:
- ret = KNOT_EBADARG;
+ ret = KNOT_EINVAL;
break;
}
@@ -972,7 +970,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
data->type, knot_strerror(ret));
close(data->session);
data->session = -1;
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Unlock zone contents. */
@@ -988,7 +986,7 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
pthread_mutex_unlock(&zd->xfr_in.lock);
close(data->session);
data->session = -1;
- return KNOTD_ECONNREFUSED;
+ return KNOT_ECONNREFUSED;
}
/* Add to pending transfers. */
@@ -998,12 +996,12 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data)
data->msgpref);
close(data->session);
data->session = -1;
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Send XFR query. */
log_server_info("%s Started.\n", data->msgpref);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -1051,9 +1049,9 @@ static int xfr_answer_ixfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
/* Load changesets from journal. */
int chsload = zones_xfr_load_changesets(xfr, serial_from, serial_to);
- if (chsload != KNOTD_EOK) {
+ if (chsload != KNOT_EOK) {
/* History cannot be reconstructed, fallback to AXFR. */
- if (chsload == KNOTD_ERANGE || chsload == KNOTD_ENOENT) {
+ if (chsload == KNOT_ERANGE || chsload == KNOT_ENOENT) {
log_server_info("%s Failed to load data from journal: "
" Incomplete history. "
"Fallback to AXFR.\n",
@@ -1061,7 +1059,7 @@ static int xfr_answer_ixfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
xfr->type = XFR_TYPE_AOUT;
xfr->msgpref[XFR_MSG_DLTTR] = 'A';
return xfr_answer_axfr(ns, xfr);
- } else if (chsload == KNOTD_EMALF) {
+ } else if (chsload == KNOT_EMALF) {
xfr->rcode = KNOT_RCODE_FORMERR;
} else {
xfr->rcode = KNOT_RCODE_SERVFAIL;
@@ -1072,7 +1070,7 @@ static int xfr_answer_ixfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
}
/* Finally, answer. */
- if (chsload == KNOTD_EOK) {
+ if (chsload == KNOT_EOK) {
ret = knot_ns_answer_ixfr(ns, xfr);
dbg_xfr("xfr: ns_answer_ixfr() = %s.\n", knot_strerror(ret));
}
@@ -1085,7 +1083,7 @@ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag)
{
/* Check */
if (req == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -1121,7 +1119,7 @@ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag)
if (zd == NULL) {
free(r_key);
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
} else {
zname = zd->conf->name;
}
@@ -1168,7 +1166,7 @@ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag)
rcu_read_unlock();
free(r_key);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*! \brief Create XFR worker. */
@@ -1286,7 +1284,7 @@ xfrhandler_t *xfr_create(size_t thrcount, knot_nameserver_t *ns)
int xfr_free(xfrhandler_t *handler)
{
if (!handler) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Free RR mutex. */
@@ -1307,14 +1305,14 @@ int xfr_free(xfrhandler_t *handler)
dt_delete(&handler->unit);
free(handler);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int xfr_stop(xfrhandler_t *handler)
{
/* Break loop. */
dt_stop(handler->unit);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int xfr_join(xfrhandler_t *handler) {
@@ -1324,7 +1322,7 @@ int xfr_join(xfrhandler_t *handler) {
int xfr_request_init(knot_ns_xfr_t *r, int type, int flags, knot_packet_t *pkt)
{
if (!r || type < 0 || flags < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Blank and init. */
@@ -1337,20 +1335,20 @@ int xfr_request_init(knot_ns_xfr_t *r, int type, int flags, knot_packet_t *pkt)
uint8_t *wire_copy = malloc(sizeof(uint8_t) * pkt->size);
if (!wire_copy) {
ERR_ALLOC_FAILED;
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
memcpy(wire_copy, pkt->wireformat, pkt->size);
pkt->wireformat = wire_copy;
r->query = pkt;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int xfr_request(xfrhandler_t *handler, knot_ns_xfr_t *req)
{
if (!handler || !req) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Assign UDP requests to handler 0. */
@@ -1366,16 +1364,16 @@ int xfr_request(xfrhandler_t *handler, knot_ns_xfr_t *req)
/* Delegate request. */
int ret = evqueue_write(q, req, sizeof(knot_ns_xfr_t));
if (ret < 0) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
{
if (ns == NULL || xfr == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -1396,8 +1394,8 @@ int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
/* Check requested zone. */
if (!xfr_failed) {
int zcheck_ret = zones_xfr_check_zone(xfr, &xfr->rcode);
- xfr_failed = (zcheck_ret != KNOTD_EOK);
- errstr = knotd_strerror(zcheck_ret);
+ xfr_failed = (zcheck_ret != KNOT_EOK);
+ errstr = knot_strerror(zcheck_ret);
}
/* Check TSIG. */
@@ -1408,7 +1406,7 @@ int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
errstr = knot_strerror(ret);
}
- if (xfr_update_msgpref(xfr, keytag) != KNOTD_EOK) {
+ if (xfr_update_msgpref(xfr, keytag) != KNOT_EOK) {
xfr->msgpref = strdup("XFR:");
}
free(keytag);
@@ -1486,10 +1484,10 @@ int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *xfr)
knot_free_changesets((knot_changesets_t **)(&xfr->data));
free(xfr->zname);
if (xfr_failed) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
@@ -1499,7 +1497,7 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
int ret = evqueue_read(w->q, &xfr, sizeof(knot_ns_xfr_t));
if (ret != sizeof(knot_ns_xfr_t)) {
dbg_xfr_verb("xfr: evqueue_read() returned %d.\n", ret);
- return KNOTD_ENOTRUNNING;
+ return KNOT_ENOTRUNNING;
}
rcu_read_lock();
@@ -1519,7 +1517,7 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
xfr_request_deinit(&xfr);
knot_zone_release(xfr.zone);
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Handle request. */
@@ -1532,7 +1530,7 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
ret = xfr_client_start(w, &xfr);
/* Report. */
- if (ret != KNOTD_EOK && ret != KNOTD_EACCES) {
+ if (ret != KNOT_EOK && ret != KNOT_EACCES) {
if (zd != NULL && !knot_zone_contents(xfr.zone)) {
/* Reschedule request (120 - 240s random delay). */
int tmr_s = AXFR_BOOTSTRAP_RETRY * 2; /* Malus x2 */
@@ -1547,7 +1545,7 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
xfr.msgpref, tmr_s / 1000);
} else {
log_server_error("%s %s\n",
- xfr.msgpref, knotd_strerror(ret));
+ xfr.msgpref, knot_strerror(ret));
}
knot_zone_release(xfr.zone); /* No further access to zone. */
}
@@ -1559,12 +1557,12 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen)
task = xfr_register_task(w, &xfr);
if (!task) {
knot_zone_release(xfr.zone); /* No further access to zone. */
- ret = KNOTD_ENOMEM;
+ ret = KNOT_ENOMEM;
} else {
/* Add timeout. */
fdset_set_watchdog(w->fdset, task->session, XFR_QUERY_WD);
log_server_info("%s Query issued.\n", xfr.msgpref);
- ret = KNOTD_EOK;
+ ret = KNOT_EOK;
}
break;
default:
@@ -1589,7 +1587,7 @@ int xfr_worker(dthread_t *thread)
/* Check data. */
if (w < 0) {
dbg_xfr("xfr: NULL worker data, worker cancelled\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Buffer for answering. */
@@ -1597,7 +1595,7 @@ int xfr_worker(dthread_t *thread)
uint8_t* buf = malloc(buflen);
if (buf == NULL) {
dbg_xfr("xfr: failed to allocate buffer for XFR worker\n");
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Next sweep time. */
@@ -1651,7 +1649,7 @@ int xfr_worker(dthread_t *thread)
"fd=%d data=%p.\n",
w, it.fd, data);
ret = xfr_process_event(w, it.fd, data, buf, buflen);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
xfr_free_task(data);
/*! \todo Refactor to allow erase on iterator.*/
break;
@@ -1681,7 +1679,7 @@ int xfr_worker(dthread_t *thread)
}
/* Check for interrupt request. */
- if (ret == KNOTD_ENOTRUNNING) {
+ if (ret == KNOT_ENOTRUNNING) {
break;
}
}
@@ -1690,13 +1688,13 @@ int xfr_worker(dthread_t *thread)
free(buf);
dbg_xfr_verb("xfr: worker=%p finished.\n", w);
thread->data = 0;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int xfr_prepare_tsig(knot_ns_xfr_t *xfr, knot_key_t *key)
{
if (xfr == NULL || key == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = KNOT_EOK;
@@ -1709,7 +1707,7 @@ int xfr_prepare_tsig(knot_ns_xfr_t *xfr, knot_key_t *key)
xfr->tsig_key = NULL;
xfr->tsig_size = 0;
xfr->digest_max_size = 0;
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
memset(xfr->digest, 0 , xfr->digest_max_size);
dbg_xfr("xfr: found TSIG key (MAC len=%zu), adding to transfer\n",
diff --git a/src/knot/server/xfr-handler.h b/src/knot/server/xfr-handler.h
index e2f5643..581f47f 100755..100644
--- a/src/knot/server/xfr-handler.h
+++ b/src/knot/server/xfr-handler.h
@@ -81,9 +81,9 @@ xfrhandler_t *xfr_create(size_t thrcount, knot_nameserver_t *ns);
*
* \param handler XFR handler.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on NULL handler.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on NULL handler.
+ * \retval KNOT_ERROR on error.
*/
int xfr_free(xfrhandler_t *handler);
@@ -92,8 +92,8 @@ int xfr_free(xfrhandler_t *handler);
*
* \param handler XFR handler.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ERROR on error.
*/
static inline int xfr_start(xfrhandler_t *handler) {
return dt_start(handler->unit);
@@ -104,8 +104,8 @@ static inline int xfr_start(xfrhandler_t *handler) {
*
* \param handler XFR handler.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ERROR on error.
*/
int xfr_stop(xfrhandler_t *handler);
@@ -114,8 +114,8 @@ int xfr_stop(xfrhandler_t *handler);
*
* \param handler XFR handler.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_ERROR on error.
*/
int xfr_join(xfrhandler_t *handler);
@@ -127,9 +127,9 @@ int xfr_join(xfrhandler_t *handler);
* \param flags Request flags.
* \param pkt Query packet or NULL.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_ENOMEM
- * \retval KNOTD_EINVAL
+ * \retval KNOT_EOK
+ * \retval KNOT_ENOMEM
+ * \retval KNOT_EINVAL
*/
int xfr_request_init(knot_ns_xfr_t *r, int type, int flags, knot_packet_t *pkt);
@@ -139,9 +139,9 @@ int xfr_request_init(knot_ns_xfr_t *r, int type, int flags, knot_packet_t *pkt);
* \param handler XFR handler instance.
* \param req XFR request.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on NULL handler or request.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on NULL handler or request.
+ * \retval KNOT_ERROR on error.
*/
int xfr_request(xfrhandler_t *handler, knot_ns_xfr_t *req);
@@ -151,9 +151,9 @@ int xfr_request(xfrhandler_t *handler, knot_ns_xfr_t *req);
* \param ns Nameserver instance.
* \param req XFR request.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on NULL handler or request.
- * \retval KNOTD_ERROR on error.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on NULL handler or request.
+ * \retval KNOT_ERROR on error.
*/
int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *req);
@@ -165,8 +165,8 @@ int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *req);
*
* \param thread Associated thread from DThreads unit.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL invalid parameters.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL invalid parameters.
*/
int xfr_worker(dthread_t *thread);
@@ -175,9 +175,9 @@ int xfr_worker(dthread_t *thread);
* \param xfr XFR request.
* \param key Used TSIG key.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on NULL parameters.
- * \retval KNOTD_ENOMEM when out of memory.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on NULL parameters.
+ * \retval KNOT_ENOMEM when out of memory.
*/
int xfr_prepare_tsig(knot_ns_xfr_t *xfr, knot_key_t *key);
diff --git a/src/knot/server/zones.c b/src/knot/server/zones.c
index 95ab2b1..4b5ad38 100755..100644
--- a/src/knot/server/zones.c
+++ b/src/knot/server/zones.c
@@ -27,13 +27,11 @@
#include "libknot/zone/zonedb.h"
#include "knot/conf/conf.h"
#include "knot/other/debug.h"
-#include "knot/other/error.h"
#include "common/log.h"
#include "knot/server/notify.h"
#include "knot/server/server.h"
#include "libknot/updates/xfr-in.h"
#include "knot/server/zones.h"
-#include "libknot/util/error.h"
#include "knot/zone/zone-dump.h"
#include "libknot/nameserver/name-server.h"
#include "libknot/updates/changesets.h"
@@ -67,14 +65,14 @@ static int zones_send_cb(int fd, sockaddr_t *addr, uint8_t *msg, size_t msglen)
static int zonedata_destroy(knot_zone_t *zone)
{
if (zone == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
dbg_zones_verb("zones: zonedata_destroy(%p) called\n", zone);
zonedata_t *zd = (zonedata_t *)knot_zone_data(zone);
if (!zd) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Cancel REFRESH timer. */
@@ -129,18 +127,18 @@ static int zonedata_destroy(knot_zone_t *zone)
/* Invalidate. */
zone->data = 0;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*! \brief Zone data constructor function. */
static int zonedata_init(conf_zone_t *cfg, knot_zone_t *zone)
{
if (cfg == NULL || zone == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
zonedata_t *zd = malloc(sizeof(zonedata_t));
if (!zd) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
memset(zd, 0, sizeof(zonedata_t));
@@ -163,7 +161,8 @@ static int zonedata_init(conf_zone_t *cfg, knot_zone_t *zone)
zd->xfr_in.next_id = -1;
zd->xfr_in.acl = 0;
zd->xfr_in.wrkr = 0;
- zd->xfr_in.bootstrap_retry = XFRIN_BOOTSTRAP_DELAY * 1000 * tls_rand();
+ zd->xfr_in.bootstrap_retry = (XFRIN_BOOTSTRAP_DELAY * tls_rand() + 5)
+ * 1000;
pthread_mutex_init(&zd->xfr_in.lock, 0);
/* Initialize NOTIFY. */
@@ -202,11 +201,11 @@ static int zonedata_init(conf_zone_t *cfg, knot_zone_t *zone)
int64_t serial = knot_rdata_soa_serial(soa_rr);
zd->zonefile_serial = (uint32_t)serial;
if (serial < 0) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -304,7 +303,7 @@ static int zones_expire_ev(event_t *e)
dbg_zones("zones: EXPIRE timer event\n");
knot_zone_t *zone = (knot_zone_t *)e->data;
if (zone == NULL || zone->data == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
zonedata_t *zd = (zonedata_t *)zone->data;
@@ -313,7 +312,7 @@ static int zones_expire_ev(event_t *e)
/* Check if zone is not discarded. */
if (knot_zone_flags(zone) & KNOT_ZONE_DISCARDED) {
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Do not issue SOA query if transfer is pending. */
@@ -331,7 +330,7 @@ static int zones_expire_ev(event_t *e)
/* Unlock RCU. */
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
dbg_zones_verb("zones: zone %s locked, no xfers are running\n",
zd->conf->name);
@@ -347,7 +346,7 @@ static int zones_expire_ev(event_t *e)
pthread_mutex_unlock(&zd->xfr_in.lock);
log_server_warning("Non-existent zone expired. Ignoring.\n");
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Publish expired zone. */
@@ -384,7 +383,7 @@ static int zones_expire_ev(event_t *e)
/* Release holding reference. */
knot_zone_release(zone);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -397,7 +396,7 @@ static int zones_refresh_ev(event_t *e)
knot_zone_t *zone = (knot_zone_t *)e->data;
if (zone == NULL || zone->data == NULL) {
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Cancel pending timers. */
@@ -406,7 +405,7 @@ static int zones_refresh_ev(event_t *e)
/* Check if zone is not discarded. */
if (knot_zone_flags(zone) & KNOT_ZONE_DISCARDED) {
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Check for contents. */
@@ -435,7 +434,7 @@ static int zones_refresh_ev(event_t *e)
dbg_zones("zones: already bootstrapping '%s'\n",
zd->conf->name);
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
if (zd->xfr_in.scheduled > 0) {
@@ -444,7 +443,7 @@ static int zones_refresh_ev(event_t *e)
dbg_zones("zones: already bootstrapping '%s' (q'd)\n",
zd->conf->name);
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
// log_zone_info("Attempting to bootstrap zone %s from master\n",
@@ -461,7 +460,7 @@ static int zones_refresh_ev(event_t *e)
/* Mark as finished to prevent stalling. */
evsched_event_finished(e->parent);
int ret = xfr_request(zd->server->xfr_h, &xfr_req);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
knot_zone_release(xfr_req.zone); /* Discard */
}
return ret;
@@ -483,7 +482,7 @@ static int zones_refresh_ev(event_t *e)
/* Unlock RCU. */
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
} else {
pthread_mutex_unlock(&zd->xfr_in.lock);
}
@@ -510,7 +509,7 @@ static int zones_refresh_ev(event_t *e)
if (qbuf == NULL) {
log_zone_error("Not enough memory to allocate SOA query.\n");
rcu_read_unlock();
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
size_t buflen = SOCKET_MTU_SZ;
@@ -549,14 +548,14 @@ static int zones_refresh_ev(event_t *e)
}
/* Send query. */
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
if (sock > -1) {
int sent = sendto(sock, qbuf, buflen, 0,
master->ptr, master->len);
/* Store ID of the awaited response. */
if (sent == buflen) {
- ret = KNOTD_EOK;
+ ret = KNOT_EOK;
} else {
strbuf[0] = '\0';
strerror_r(errno, strbuf, sizeof(strbuf));
@@ -566,14 +565,14 @@ static int zones_refresh_ev(event_t *e)
}
/* Check result. */
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
zd->xfr_in.next_id = knot_wire_get_id(qbuf);
dbg_zones("zones: expecting SOA response "
"ID=%d for '%s'\n",
zd->xfr_in.next_id, zd->conf->name);
}
} else {
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
errstr = "Couldn't create SOA query";
}
@@ -594,10 +593,10 @@ static int zones_refresh_ev(event_t *e)
/* Retain pointer to zone and issue. */
knot_zone_retain(req.zone);
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
ret = xfr_request(zd->server->xfr_h, &req);
}
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
free(req.digest);
knot_zone_release(req.zone); /* Discard */
log_server_warning("Failed to issue SOA query for zone '%s' (%s).\n",
@@ -623,7 +622,7 @@ static int zones_notify_send(event_t *e)
if (ev == NULL) {
rcu_read_unlock();
log_zone_error("NOTIFY invalid event received\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
knot_zone_t *zone = ev->zone;
@@ -632,13 +631,13 @@ static int zones_notify_send(event_t *e)
log_zone_error("NOTIFY invalid event data received\n");
evsched_event_free(e->parent, e);
free(ev);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check if zone is not discarded. */
if (knot_zone_flags(zone) & KNOT_ZONE_DISCARDED) {
rcu_read_unlock(); /* Event will be freed on zonedata_destroy.*/
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Check for answered/cancelled query. */
@@ -659,7 +658,7 @@ static int zones_notify_send(event_t *e)
evsched_event_free(e->parent, e);
free(ev);
pthread_mutex_unlock(&zd->lock);
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
/* RFC suggests 60s, but it is configurable. */
@@ -675,14 +674,14 @@ static int zones_notify_send(event_t *e)
if (qbuf == NULL) {
log_zone_error("Not enough memory to allocate NOTIFY query.\n");
rcu_read_unlock();
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
size_t buflen = SOCKET_MTU_SZ;
/* Create query. */
int ret = notify_create_request(contents, qbuf, &buflen);
- if (ret == KNOTD_EOK && zd->server) {
+ if (ret == KNOT_EOK && zd->server) {
/* Create socket on random port. */
int sock = socket_create(ev->addr.family, SOCK_DGRAM);
@@ -724,7 +723,7 @@ static int zones_notify_send(event_t *e)
/* Retain pointer to zone and issue request. */
knot_zone_retain(req.zone);
ret = xfr_request(zd->server->xfr_h, &req);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
knot_zone_release(req.zone); /* Discard */
}
}
@@ -749,7 +748,7 @@ static int zones_ixfrdb_sync_apply(journal_t *j, journal_node_t *n)
journal_update(j, n);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -762,13 +761,13 @@ static int zones_zonefile_sync_ev(event_t *e)
/* Fetch zone. */
knot_zone_t *zone = (knot_zone_t *)e->data;
if (!zone) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Fetch zone data. */
zonedata_t *zd = (zonedata_t *)zone->data;
if (!zd) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Execute zonefile sync. */
@@ -777,10 +776,10 @@ static int zones_zonefile_sync_ev(event_t *e)
journal_release(j);
rcu_read_lock();
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
log_zone_info("Applied differences of '%s' to zonefile.\n",
zd->conf->name);
- } else if (ret != KNOTD_ERANGE) {
+ } else if (ret != KNOT_ERANGE) {
log_zone_warning("Failed to apply differences of '%s' "
"to zonefile.\n",
zd->conf->name);
@@ -803,14 +802,14 @@ static int zones_zonefile_sync_ev(event_t *e)
* \param acl Pointer to existing or NULL ACL.
* \param acl_list List of remotes from configuration.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOMEM on failed memory allocation.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOMEM on failed memory allocation.
*/
static int zones_set_acl(acl_t **acl, list* acl_list)
{
if (!acl || !acl_list) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Truncate old ACL. */
@@ -819,7 +818,7 @@ static int zones_set_acl(acl_t **acl, list* acl_list)
/* Create new ACL. */
*acl = acl_new(ACL_DENY, 0);
if (*acl == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Load ACL rules. */
@@ -849,7 +848,7 @@ static int zones_set_acl(acl_t **acl, list* acl_list)
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -860,15 +859,15 @@ static int zones_set_acl(acl_t **acl, list* acl_list)
* \param source Path to zone file source.
* \param filename Path to requested compiled zone file.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_EINVAL
- * \retval KNOTD_EZONEINVAL
+ * \retval KNOT_EOK
+ * \retval KNOT_EINVAL
+ * \retval KNOT_EZONEINVAL
*/
static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
const char *source, const char *filename)
{
if (dst == NULL || zone_name == NULL || source == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
*dst = NULL;
@@ -877,16 +876,16 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
char *zname = NULL;
if (zlen > 0) {
if ((zname = strdup(zone_name)) == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
} else {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
zname[zlen - 1] = '\0'; /* Trim last dot */
if (filename == NULL) {
log_server_error("No file name for zone '%s'.\n", zname);
free(zname);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
@@ -898,11 +897,11 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
log_server_warning("Failed to open zone file '%s' (%s).\n",
zname, reason);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
}
/* Attempt to open compiled zone for loading. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
zloader_t *zl = NULL;
dbg_zones("zones: parsing zone database '%s'\n", filename);
switch(knot_zload_open(&zl, filename)) {
@@ -913,25 +912,25 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
log_server_error("Failed to open compiled zone '%s' "
"(Permission denied).\n", filename);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
case KNOT_ENOENT:
log_server_error("Couldn't find compiled zone. "
"Please recompile '%s'.\n", zname);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
case KNOT_ECRC:
log_server_error("Compiled zone db CRC mismatch, "
"db is corrupted or .crc file is "
"deleted. Please recompile '%s'.\n",
zname);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
case KNOT_EMALF:
log_server_error("Compiled db '%s' is too old. "
"Please recompile '%s'.\n",
filename, zname);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
case KNOT_EFEWDATA:
case KNOT_ERROR:
case KNOT_ENOMEM:
@@ -939,7 +938,7 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
log_server_error("Failed to load compiled zone file "
"'%s'.\n", filename);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
}
/* Check the source file */
@@ -957,7 +956,7 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
filename, zname);
knot_zload_close(zl);
free(zname);
- return KNOTD_EZONEINVAL;
+ return KNOT_EZONEINVAL;
}
/* Check if loaded origin matches. */
@@ -969,14 +968,14 @@ static int zones_load_zone(knot_zone_t **dst, const char *zone_name,
"different than '%s'\n",
zone_name);
knot_zone_deep_free(dst, 0);
- ret = KNOTD_EZONEINVAL;
+ ret = KNOT_EZONEINVAL;
} else {
/* Save the timestamp from the zone db file. */
if (stat(filename, &st) < 0) {
dbg_zones("zones: failed to stat() zone db, "
"something is seriously wrong\n");
knot_zone_deep_free(dst, 0);
- ret = KNOTD_EZONEINVAL;
+ ret = KNOT_EZONEINVAL;
} else {
knot_zone_set_version(*dst, st.st_mtime);
}
@@ -1068,7 +1067,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
if (ret != KNOT_EOK) {
dbg_xfr("xfr: SOA: failed to deserialize data "
"from changeset, %s\n", knot_strerror(ret));
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
/* in this special case (changesets loaded
@@ -1095,7 +1094,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
dbg_xfr("xfr: failed to deserialize data "
"from changeset, %s\n",
knot_strerror(ret));
- return KNOTD_EMALF;
+ return KNOT_EMALF;
}
/* Check for next SOA. */
@@ -1139,7 +1138,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
dbg_xfr("xfr: failed to add/remove "
"RRSet to changeset: %s\n",
knot_strerror(ret));
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
}
}
@@ -1147,7 +1146,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
dbg_xfr_verb("xfr: read all RRSets in changeset\n");
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -1158,18 +1157,18 @@ static int zones_load_changesets(const knot_zone_t *zone,
{
if (!zone || !dst) {
dbg_zones_detail("Bad arguments: zone=%p, dst=%p\n", zone, dst);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
if (!zone->data) {
dbg_zones_detail("Bad arguments: zone->data=%p\n", zone->data);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Fetch zone-specific data. */
zonedata_t *zd = (zonedata_t *)knot_zone_data(zone);
if (!zd->ixfr_db) {
dbg_zones_detail("Bad arguments: zd->ixfr_db=%p\n", zone->data);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -1180,16 +1179,16 @@ static int zones_load_changesets(const knot_zone_t *zone,
/* Retain journal for changeset loading. */
journal_t *j = journal_retain(zd->ixfr_db);
if (j == NULL) {
- return KNOTD_EBUSY;
+ return KNOT_EBUSY;
}
/* Read entries from starting serial until finished. */
uint32_t found_to = from;
journal_node_t *n = 0;
int ret = journal_fetch(j, from, ixfrdb_key_from_cmp, &n);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_xfr("xfr: failed to fetch starting changeset: %s\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
journal_release(j);
return ret;
}
@@ -1212,7 +1211,7 @@ static int zones_load_changesets(const knot_zone_t *zone,
dbg_xfr("xfr: failed to check changesets size: %s\n",
knot_strerror(ret));
journal_release(j);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Initialize changeset. */
@@ -1224,16 +1223,16 @@ static int zones_load_changesets(const knot_zone_t *zone,
chs->data = malloc(n->len);
if (!chs->data) {
journal_release(j);
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Read journal entry. */
ret = journal_read(j, n->id, 0, (char*)chs->data);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_xfr("xfr: failed to read data from journal\n");
free(chs->data);
journal_release(j);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Update changeset binary size. */
@@ -1252,21 +1251,21 @@ static int zones_load_changesets(const knot_zone_t *zone,
/* Unpack binary data. */
int unpack_ret = zones_changesets_from_binary(dst);
- if (unpack_ret != KNOTD_EOK) {
+ if (unpack_ret != KNOT_EOK) {
dbg_xfr("xfr: failed to unpack changesets "
- "from binary, %s\n", knotd_strerror(unpack_ret));
+ "from binary, %s\n", knot_strerror(unpack_ret));
return unpack_ret;
}
/* Check for complete history. */
if (to != found_to) {
dbg_xfr_detail("xfr: load changesets finished, ERANGE\n");
- return KNOTD_ERANGE;
+ return KNOT_ERANGE;
}
/* History reconstructed. */
dbg_xfr_detail("xfr: load changesets finished, EOK\n");
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -1276,16 +1275,16 @@ static int zones_load_changesets(const knot_zone_t *zone,
*
* \param zone Specified zone.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT if zone has no contents.
- * \retval KNOTD_ERROR on unspecified error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT if zone has no contents.
+ * \retval KNOT_ERROR on unspecified error.
*/
static int zones_journal_apply(knot_zone_t *zone)
{
/* Fetch zone. */
if (!zone) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -1294,7 +1293,7 @@ static int zones_journal_apply(knot_zone_t *zone)
zonedata_t *zd = (zonedata_t *)knot_zone_data(zone);
if (!contents || !zd) {
rcu_read_unlock();
- return KNOTD_ENOENT;
+ return KNOT_ENOENT;
}
/* Fetch SOA serial. */
@@ -1307,7 +1306,7 @@ static int zones_journal_apply(knot_zone_t *zone)
int64_t serial_ret = knot_rdata_soa_serial(soa_rr);
if (serial_ret < 0) {
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
uint32_t serial = (uint32_t)serial_ret;
@@ -1318,7 +1317,7 @@ static int zones_journal_apply(knot_zone_t *zone)
memset(chsets, 0, sizeof(knot_changesets_t));
/*! \todo Check what should be the upper bound. */
int ret = zones_load_changesets(zone, chsets, serial, serial - 1);
- if (ret == KNOTD_EOK || ret == KNOTD_ERANGE) {
+ if (ret == KNOT_EOK || ret == KNOT_ERANGE) {
if (chsets->count > 0) {
/* Apply changesets. */
log_server_info("Applying '%zu' changesets from journal "
@@ -1332,7 +1331,7 @@ static int zones_journal_apply(knot_zone_t *zone)
" '%s' - Apply failed: %s\n",
zd->conf->name,
knot_strerror(apply_ret));
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
// Cleanup old and new contents
xfrin_rollback_update(zone->contents,
@@ -1352,7 +1351,7 @@ static int zones_journal_apply(knot_zone_t *zone)
"changesets to '%s' - Switch failed: "
"%s\n", zd->conf->name,
knot_strerror(apply_ret));
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
// Cleanup old and new contents
xfrin_rollback_update(zone->contents,
@@ -1363,7 +1362,7 @@ static int zones_journal_apply(knot_zone_t *zone)
}
} else {
dbg_zones("zones: failed to load changesets - %s\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
}
/* Free changesets and return. */
@@ -1385,16 +1384,16 @@ static int zones_journal_apply(knot_zone_t *zone)
* \param ns Name server instance.
* \param db_old Old zone database.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT if zone has no contents.
- * \retval KNOTD_ERROR on unspecified error.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT if zone has no contents.
+ * \retval KNOT_ERROR on unspecified error.
*/
static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
knot_nameserver_t *ns)
{
if (z == NULL || dst == NULL || ns == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Convert the zone name into a domain name. */
@@ -1404,7 +1403,7 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
if (dname == NULL) {
log_server_error("Error creating domain name from zone"
" name\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Try to find the zone in the current zone db. */
@@ -1428,8 +1427,9 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
}
/* Reload zone file. */
+ int is_new = 0;
int is_bootstrapped = 0;
- int ret = KNOTD_ERROR;
+ int ret = KNOT_ERROR;
if (zone_changed) {
/* Zone file not exists and has master set. */
if (stat_ret < 0 && !EMPTY_LIST(z->acl.xfr_in)) {
@@ -1441,12 +1441,12 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
knot_dname_t *owner = knot_dname_deep_copy(dname);
zone = knot_zone_new_empty(owner);
if (zone != NULL) {
- ret = KNOTD_EOK;
+ ret = KNOT_EOK;
is_bootstrapped = 1;
} else {
dbg_zones("zones: failed to create "
"stub zone '%s'.\n", z->name);
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
}
} else {
dbg_zones_verb("zones: loading zone '%s' from '%s'\n",
@@ -1454,7 +1454,7 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
ret = zones_load_zone(&zone, z->name, z->file, z->db);
const knot_node_t *apex = NULL;
const knot_rrset_t *soa = NULL;
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
apex = knot_zone_contents_apex(
knot_zone_contents(zone));
soa = knot_node_rrset(apex,
@@ -1467,11 +1467,12 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
}
log_server_info("Loaded zone '%s' serial %u\n",
z->name, (uint32_t)sn);
+ is_new = 1;
}
}
/* Evaluate. */
- if (ret == KNOTD_EOK && zone != NULL) {
+ if (ret == KNOT_EOK && zone != NULL) {
dbg_zones_verb("zones: inserted '%s' into "
"database, initializing data\n",
z->name);
@@ -1488,7 +1489,7 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
"for reload.\n", z->name);
}
*dst = zone;
- ret = KNOTD_EOK;
+ ret = KNOT_EOK;
}
/* Update zone data. */
@@ -1551,10 +1552,10 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
/* Apply changesets from journal. */
int ar = zones_journal_apply(zone);
- if (ar != KNOTD_EOK && ar != KNOTD_ERANGE && ar != KNOTD_ENOENT) {
+ if (ar != KNOT_EOK && ar != KNOT_ERANGE && ar != KNOT_ENOENT) {
log_server_warning("Failed to apply changesets "
"for zone '%s': %s\n",
- z->name, knotd_strerror(ar));
+ z->name, knot_strerror(ar));
}
@@ -1562,6 +1563,12 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
evsched_t *sch = ((server_t *)knot_ns_get_data(ns))->sched;
zones_timers_update(zone, z, sch);
+ /* Refresh new slave zones (almost) immediately. */
+ if(is_new && zd->xfr_in.timer) {
+ evsched_schedule(sch, zd->xfr_in.timer,
+ zd->xfr_in.bootstrap_retry / 2);
+ }
+
/* Schedule IXFR database syncing. */
/*! \note This has to remain separate as it must not be
* triggered by a zone update or SOA response.
@@ -1606,15 +1613,15 @@ static int zones_insert_zone(conf_zone_t *z, knot_zone_t **dst,
knot_zone_contents_t *zc_old = knot_zone_get_contents(z_old);
if (z->build_diffs && zc != NULL && zc_old != NULL && zone_changed) {
int bd = zones_create_and_save_changesets(z_old, zone);
- if (bd == KNOTD_ENODIFF) {
+ if (bd == KNOT_ENODIFF) {
log_zone_warning("Zone file for '%s' changed, "
"but serial didn't - "
"won't create changesets.\n",
z->name);
- } else if (bd != KNOTD_EOK) {
+ } else if (bd != KNOT_EOK) {
log_zone_warning("Failed to calculate differences"
" from the zone file update: "
- "%s\n", knotd_strerror(bd));
+ "%s\n", knot_strerror(bd));
}
}
rcu_read_unlock();
@@ -1644,12 +1651,12 @@ struct zonewalk_t {
static int zonewalker(dthread_t *thread)
{
if (thread == NULL) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
struct zonewalk_t *zw = (struct zonewalk_t *)thread->data;
if (zw == NULL) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
unsigned i = 0;
@@ -1673,7 +1680,7 @@ static int zonewalker(dthread_t *thread)
}
int ret = zones_insert_zone(zw->q[i], zones + inserted, zw->ns);
- if (ret == KNOTD_EOK) {
+ if (ret == KNOT_EOK) {
++inserted;
}
}
@@ -1696,7 +1703,7 @@ static int zonewalker(dthread_t *thread)
pthread_mutex_unlock(&zw->lock);
free(zones);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*!
@@ -1751,7 +1758,7 @@ static int zones_insert_zones(knot_nameserver_t *ns,
/* Single-thread fallback. */
if (unit == NULL) {
log_server_error("Couldn't initialize zone loading - %s\n",
- knotd_strerror(KNOTD_ENOMEM));
+ knot_strerror(KNOT_ENOMEM));
return 0;
}
@@ -1779,15 +1786,15 @@ static int zones_insert_zones(knot_nameserver_t *ns,
* \param zone_conf Zone configuration.
* \param db_old Old zone database to remove zones from.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK
+ * \retval KNOT_ERROR
*/
static int zones_remove_zones(const knot_zonedb_t *db_new,
knot_zonedb_t *db_old)
{
const knot_zone_t **new_zones = knot_zonedb_zones(db_new);
if (new_zones == NULL) {
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
for (int i = 0; i < knot_zonedb_zone_count(db_new); ++i) {
@@ -1824,7 +1831,7 @@ dbg_zones_exec(
free(new_zones);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -1983,7 +1990,7 @@ static int zones_check_tsig_query(const knot_zone_t *zone,
/* Accept found OR unknown key results. */
- if (ret == KNOTD_EOK || ret == KNOTD_EACCES) {
+ if (ret == KNOT_EOK || ret == KNOT_EACCES) {
if (*tsig_key_zone != NULL) {
// everything OK, so check TSIG
dbg_zones_verb("Verifying TSIG.\n");
@@ -2014,7 +2021,7 @@ int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
{
/* Check parameters */
if (conf == NULL || ns == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Lock RCU to ensure none will deallocate any data under our hands. */
@@ -2025,14 +2032,14 @@ int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
rcu_read_unlock();
log_server_error("Missing zone database in nameserver structure"
".\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
rcu_read_unlock();
/* Create new zone DB */
knot_zonedb_t *db_new = knot_zonedb_new();
if (db_new == NULL) {
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
log_server_info("Loading %d compiled zones...\n", conf->zones_count);
@@ -2075,27 +2082,27 @@ int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
/* Unlock RCU, messing with any data will not affect us now */
rcu_read_unlock();
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
{
if (!zone) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
if (!zone->data) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
if (journal == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Fetch zone data. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
zonedata_t *zd = (zonedata_t *)zone->data;
/* Lock zone data. */
@@ -2108,7 +2115,7 @@ int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
if (!contents) {
pthread_mutex_unlock(&zd->lock);
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Latest zone serial. */
@@ -2123,7 +2130,7 @@ int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
if (serial_ret < 0) {
pthread_mutex_unlock(&zd->lock);
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
uint32_t serial_to = (uint32_t)serial_ret;
@@ -2135,7 +2142,7 @@ int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
"(SOA serial %u)\n",
zd->conf->name, zd->conf->file, serial_to);
ret = zones_dump_zone_text(contents, zd->conf->file);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_zone_warning("Failed to apply differences "
"'%s' to '%s'\n",
zd->conf->name, zd->conf->file);
@@ -2146,13 +2153,13 @@ int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
/* Save zone to binary db file. */
ret = zones_dump_zone_binary(contents, zd->conf->db, zd->conf->file);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
log_zone_warning("Failed to apply differences "
"'%s' to '%s'\n",
zd->conf->name, zd->conf->db);
pthread_mutex_unlock(&zd->lock);
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Update journal entries. */
@@ -2168,7 +2175,7 @@ int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal)
} else {
dbg_zones("zones: '%s' zonefile is in sync "
"with differences\n", zd->conf->name);
- ret = KNOTD_ERANGE;
+ ret = KNOT_ERANGE;
}
/* Unlock zone data. */
@@ -2191,7 +2198,7 @@ int zones_query_check_zone(const knot_zone_t *zone, const sockaddr_t *addr,
if (rcode != NULL) {
*rcode = KNOT_RCODE_SERVFAIL;
}
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check zone data. */
@@ -2199,17 +2206,18 @@ int zones_query_check_zone(const knot_zone_t *zone, const sockaddr_t *addr,
if (zd == NULL) {
dbg_zones("zones: invalid zone data for zone %p\n", zone);
*rcode = KNOT_RCODE_SERVFAIL;
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Check xfr-out ACL */
acl_key_t *match = NULL;
if (acl_match(zd->xfr_out, addr, &match) == ACL_DENY) {
*rcode = KNOT_RCODE_REFUSED;
- return KNOTD_EACCES;
+ return KNOT_EACCES;
} else {
- dbg_zones("zones: authorized query or request for XFR "
- "'%s/OUT'. match=%p\n", zd->conf->name, match);
+ dbg_zones("zones: authorized query or request for "
+ "'%s %s'. match=%p\n", zd->conf->name, match,
+ q_opcode == KNOT_OPCODE_UPDATE ? "UPDATE":"XFR/OUT");
if (match) {
/* Save configured TSIG key for comparison. */
conf_iface_t *iface = (conf_iface_t*)(match->val);
@@ -2218,7 +2226,7 @@ int zones_query_check_zone(const knot_zone_t *zone, const sockaddr_t *addr,
*tsig_key = iface->key;
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -2226,13 +2234,13 @@ int zones_query_check_zone(const knot_zone_t *zone, const sockaddr_t *addr,
int zones_xfr_check_zone(knot_ns_xfr_t *xfr, knot_rcode_t *rcode)
{
if (xfr == NULL || rcode == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Check if the zone is found. */
if (xfr->zone == NULL) {
*rcode = KNOT_RCODE_REFUSED;
- return KNOTD_EACCES;
+ return KNOT_EACCES;
}
/* Check zone contents. */
@@ -2240,7 +2248,7 @@ int zones_xfr_check_zone(knot_ns_xfr_t *xfr, knot_rcode_t *rcode)
dbg_zones("zones: invalid zone contents for zone %p\n",
xfr->zone);
*rcode = KNOT_RCODE_SERVFAIL;
- return KNOTD_EEXPIRED;
+ return KNOT_EEXPIRED;
}
return zones_query_check_zone(xfr->zone, &xfr->addr, &xfr->tsig_key,
@@ -2508,7 +2516,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
{
if (!packet || !rsize || nameserver == NULL || from == NULL ||
response_wire == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Declare no response. */
@@ -2522,7 +2530,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
if (knot_packet_rcode(packet) != KNOT_RCODE_NOERROR) {
/*! \todo Handle error response. */
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Find matching zone and ID. */
@@ -2539,7 +2547,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
if (!zone || !knot_zone_data(zone) || !contents) {
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Match ID against awaited. */
@@ -2547,7 +2555,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
uint16_t pkt_id = knot_packet_id(packet);
if ((int)pkt_id != zd->xfr_in.next_id) {
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Check SOA SERIAL. */
@@ -2557,7 +2565,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
if (ret < 0) {
/* RETRY/EXPIRE timers running, do not interfere. */
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* No updates available. */
@@ -2567,7 +2575,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
/* Reinstall timers. */
zones_timers_update(zone, zd->conf, sched);
rcu_read_unlock();
- return KNOTD_EUPTODATE;
+ return KNOT_EUPTODATE;
}
assert(ret > 0);
@@ -2580,7 +2588,7 @@ int zones_process_response(knot_nameserver_t *nameserver,
"being transferred, refusing to start another "
"transfer\n");
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
} else {
++zd->xfr_in.scheduled;
pthread_mutex_unlock(&zd->xfr_in.lock);
@@ -2609,12 +2617,12 @@ int zones_process_response(knot_nameserver_t *nameserver,
knot_zone_retain(xfr_req.zone);
ret = xfr_request(((server_t *)knot_ns_get_data(
nameserver))->xfr_h, &xfr_req);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
knot_zone_release(xfr_req.zone); /* Discard */
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -2664,7 +2672,7 @@ static int zones_dump_zone_text(knot_zone_contents_t *zone, const char *fname)
if (fd < 0) {
log_zone_warning("Failed to find filename for temporary "
"storage of the transferred zone.\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
FILE *f = fdopen(fd, "w");
@@ -2672,16 +2680,16 @@ static int zones_dump_zone_text(knot_zone_contents_t *zone, const char *fname)
log_zone_warning("Failed to open file descriptor for text zone.\n");
unlink(new_fname);
free(new_fname);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
- if (zone_dump_text(zone, f) != KNOTD_EOK) {
+ if (zone_dump_text(zone, f) != KNOT_EOK) {
log_zone_warning("Failed to save the transferred zone to '%s'.\n",
new_fname);
fclose(f);
unlink(new_fname);
free(new_fname);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Set zone file rights to 0640. */
@@ -2695,11 +2703,11 @@ static int zones_dump_zone_text(knot_zone_contents_t *zone, const char *fname)
" zone file '%s'.\n", fname, new_fname);
unlink(new_fname);
free(new_fname);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
free(new_fname);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -2716,7 +2724,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
dbg_zones("zones: failed to find free filename for temporary "
"storage of the zone binary file '%s'\n",
zonedb);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
crc_t crc_value = 0;
@@ -2724,7 +2732,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
close(fd);
unlink(new_zonedb);
free(new_zonedb);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* Set compiled zone rights to 0640. */
@@ -2738,7 +2746,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
if (zonedb_crc == NULL) {
unlink(new_zonedb);
free(new_zonedb);
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
remove(zonedb_crc);
@@ -2750,7 +2758,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
free(zonedb_crc);
unlink(new_zonedb);
free(new_zonedb);
- return KNOTD_ENOMEM;
+ return KNOT_ENOMEM;
}
/* Write CRC value to CRC file. */
@@ -2761,7 +2769,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
free(zonedb_crc);
unlink(new_zonedb);
free(new_zonedb);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
} else {
fprintf(f_crc, "%lu\n",
(unsigned long)crc_value);
@@ -2772,7 +2780,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
chmod(new_zonedb_crc, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
/* Swap CRC files. */
- int ret = KNOTD_EOK;
+ int ret = KNOT_EOK;
if (rename(new_zonedb_crc, zonedb_crc) < 0) {
dbg_zdump("Failed to replace old zonedb CRC %s "
"with new CRC zone file %s.\n",
@@ -2780,7 +2788,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
new_zonedb_crc);
unlink(new_zonedb);
unlink(new_zonedb_crc);
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
} else {
/* Swap zone databases. */
int swap_res = rename(new_zonedb, zonedb);
@@ -2789,7 +2797,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
"with new zone file %s.\n",
new_zonedb,
zonedb);
- ret = KNOTD_ERROR;
+ ret = KNOT_ERROR;
unlink(new_zonedb);
} else {
@@ -2809,7 +2817,7 @@ static int zones_dump_zone_binary(knot_zone_contents_t *zone,
int zones_save_zone(const knot_ns_xfr_t *xfr)
{
if (xfr == NULL || xfr->new_contents == NULL || xfr->zone == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -2830,27 +2838,27 @@ int zones_save_zone(const knot_ns_xfr_t *xfr)
knot_dname_free(&cur_name);
if (r != 0) {
rcu_read_unlock();
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
assert(zonefile != NULL && zonedb != NULL);
/* dump the zone into text zone file */
int ret = zones_dump_zone_text(new_zone, zonefile);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
/* dump the zone into binary db file */
ret = zones_dump_zone_binary(new_zone, zonedb, zonefile);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
rcu_read_unlock();
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -2866,7 +2874,7 @@ int zones_ns_conf_hook(const struct conf_t *conf, void *data)
knot_zonedb_t *old_db = 0;
int ret = zones_update_db_from_config(conf, ns, &old_db);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
/* Wait until all readers finish with reading the zones. */
@@ -2878,7 +2886,7 @@ int zones_ns_conf_hook(const struct conf_t *conf, void *data)
/* Delete all deprecated zones and delete the old database. */
knot_zonedb_deep_free(&old_db);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -2959,7 +2967,7 @@ static size_t zones_rrset_binary_size(const knot_rrset_t *rrset)
int zones_changeset_binary_size(const knot_changeset_t *chgset, size_t *size)
{
if (chgset == NULL || size == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
size_t soa_from_size = zones_rrset_binary_size(chgset->soa_from);
@@ -3009,7 +3017,7 @@ static int zones_serialize_and_store_chgset(const knot_changeset_t *chs,
if (ret != KNOT_EOK) {
dbg_zones("knot_zdump_rrset_serialize() returned %s\n",
knot_strerror(ret));
- return KNOTD_ERROR; /*! \todo Other code? */
+ return KNOT_ERROR; /*! \todo Other code? */
}
/* Serialize RRSets from the 'remove' section. */
@@ -3018,7 +3026,7 @@ static int zones_serialize_and_store_chgset(const knot_changeset_t *chs,
if (ret != KNOT_EOK) {
dbg_zones("knot_zdump_rrset_serialize() returned %s\n",
knot_strerror(ret));
- return KNOTD_ERROR; /*! \todo Other code? */
+ return KNOT_ERROR; /*! \todo Other code? */
}
}
@@ -3027,7 +3035,7 @@ static int zones_serialize_and_store_chgset(const knot_changeset_t *chs,
if (ret != KNOT_EOK) {
dbg_zones("knot_zdump_rrset_serialize() returned %s\n",
knot_strerror(ret));
- return KNOTD_ERROR; /*! \todo Other code? */
+ return KNOT_ERROR; /*! \todo Other code? */
}
/* Serialize RRSets from the 'add' section. */
@@ -3036,13 +3044,13 @@ static int zones_serialize_and_store_chgset(const knot_changeset_t *chs,
if (ret != KNOT_EOK) {
dbg_zones("knot_zdump_rrset_serialize() returned %s\n",
knot_strerror(ret));
- return KNOTD_ERROR; /*! \todo Other code? */
+ return KNOT_ERROR; /*! \todo Other code? */
}
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -3062,7 +3070,7 @@ static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j,
size_t entry_size = 0;
int ret = zones_changeset_binary_size(chs, &entry_size);
- assert(ret == KNOTD_EOK);
+ assert(ret == KNOT_EOK);
dbg_xfr_verb("Size in serialized form: %zu\n", entry_size);
@@ -3071,7 +3079,7 @@ static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j,
ret = journal_map(j, k, &journal_entry, entry_size);
/* Sync to zonefile may be needed. */
- while (ret == KNOTD_EAGAIN) {
+ while (ret == KNOT_EAGAIN) {
/* Cancel sync timer. */
event_t *tmr = zd->ixfr_dbsync;
if (tmr) {
@@ -3086,7 +3094,7 @@ static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j,
"of '%s'\n",
zd->conf->name);
ret = zones_zonefile_sync(zone, j);
- if (ret != KNOTD_EOK && ret != KNOTD_ERANGE) {
+ if (ret != KNOT_EOK && ret != KNOT_ERANGE) {
continue;
}
@@ -3111,9 +3119,9 @@ static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j,
ret = journal_map(j, k, &journal_entry, entry_size);
}
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_xfr("Failed to map space for journal entry: %s.\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
return ret;
}
@@ -3122,14 +3130,14 @@ static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j,
/* Serialize changeset, saving it bit by bit. */
ret = zones_serialize_and_store_chgset(chs, journal_entry, entry_size);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_xfr("Failed to serialize and store changeset: %s\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
}
/* Unmap the journal entry.
If successfuly written changeset to journal, validate the entry. */
- ret = journal_unmap(j, k, journal_entry, ret == KNOTD_EOK);
+ ret = journal_unmap(j, k, journal_entry, ret == KNOT_EOK);
return ret;
}
@@ -3151,7 +3159,7 @@ journal_t *zones_store_changesets_begin(knot_ns_xfr_t *xfr)
/* Begin transaction, will be release on commit/rollback. */
journal_t *j = journal_retain(zd->ixfr_db);
- if (journal_trans_begin(j) != KNOTD_EOK) {
+ if (journal_trans_begin(j) != KNOT_EOK) {
journal_release(j);
j = NULL;
}
@@ -3164,7 +3172,7 @@ journal_t *zones_store_changesets_begin(knot_ns_xfr_t *xfr)
int zones_store_changesets_commit(journal_t *j)
{
if (j == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = journal_trans_commit(j);
@@ -3177,7 +3185,7 @@ int zones_store_changesets_commit(journal_t *j)
int zones_store_changesets_rollback(journal_t *j)
{
if (j == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
int ret = journal_trans_rollback(j);
@@ -3190,7 +3198,7 @@ int zones_store_changesets_rollback(journal_t *j)
int zones_store_changesets(knot_ns_xfr_t *xfr)
{
if (xfr == NULL || xfr->data == NULL || xfr->zone == NULL) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
knot_zone_t *zone = xfr->zone;
@@ -3199,13 +3207,13 @@ int zones_store_changesets(knot_ns_xfr_t *xfr)
/* Fetch zone-specific data. */
zonedata_t *zd = (zonedata_t *)zone->data;
if (!zd->ixfr_db) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Retain journal for changeset writing. */
journal_t *j = journal_retain(zd->ixfr_db);
if (j == NULL) {
- return KNOTD_EBUSY;
+ return KNOT_EBUSY;
}
int ret = 0;
@@ -3215,7 +3223,7 @@ int zones_store_changesets(knot_ns_xfr_t *xfr)
knot_changeset_t* chs = src->sets + i;
ret = zones_store_changeset(chs, j, zone, zd);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
journal_release(j);
return ret;
}
@@ -3225,7 +3233,7 @@ int zones_store_changesets(knot_ns_xfr_t *xfr)
journal_release(j);
/* Written changesets to journal. */
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -3236,12 +3244,12 @@ int zones_xfr_load_changesets(knot_ns_xfr_t *xfr, uint32_t serial_from,
if (!xfr || !xfr->zone || !knot_zone_contents(xfr->zone)) {
dbg_zones_detail("Wrong parameters: xfr=%p,"
" xfr->zone = %p\n", xfr, xfr->zone);
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
knot_changesets_t *chgsets = (knot_changesets_t *)
calloc(1, sizeof(knot_changesets_t));
- CHECK_ALLOC_LOG(chgsets, KNOTD_ENOMEM);
+ CHECK_ALLOC_LOG(chgsets, KNOT_ENOMEM);
int ret = ns_serial_compare(serial_to, serial_from);
dbg_zones_verb("Compared serials, result: %d\n", ret);
@@ -3249,21 +3257,21 @@ int zones_xfr_load_changesets(knot_ns_xfr_t *xfr, uint32_t serial_from,
/* if serial_to is not larger than serial_from, do not load anything */
if (ret <= 0) {
xfr->data = chgsets;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
dbg_xfr_verb("xfr: loading changesets\n");
ret = zones_load_changesets(xfr->zone, chgsets,
serial_from, serial_to);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_xfr("xfr: failed to load changesets: %s\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
knot_free_changesets(&chgsets);
return ret;
}
xfr->data = chgsets;
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -3275,7 +3283,7 @@ int zones_create_and_save_changesets(const knot_zone_t *old_zone,
|| new_zone == NULL || new_zone->contents == NULL) {
dbg_zones("zones: create_changesets: "
"NULL arguments.\n");
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
knot_ns_xfr_t xfr;
@@ -3291,19 +3299,19 @@ int zones_create_and_save_changesets(const knot_zone_t *old_zone,
"New serial was lower than the old "
"one.\n");
knot_free_changesets(&changesets);
- return KNOTD_ERANGE;
+ return KNOT_ERANGE;
} else if (ret == KNOT_ENODIFF) {
dbg_zones_detail("zones: create_changesets: "
"New serial was the same as the old "
"one.\n");
knot_free_changesets(&changesets);
- return KNOTD_ENODIFF;
+ return KNOT_ENODIFF;
} else {
dbg_zones("zones: create_changesets: "
"Could not create changesets. Reason: %s\n",
knot_strerror(ret));
knot_free_changesets(&changesets);
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
}
@@ -3312,31 +3320,31 @@ int zones_create_and_save_changesets(const knot_zone_t *old_zone,
if (journal == NULL) {
dbg_zones("zones: create_changesets: "
"Could not start journal operation.\n");
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
ret = zones_store_changesets(&xfr);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
zones_store_changesets_rollback(journal);
dbg_zones("zones: create_changesets: "
"Could not store in the journal. Reason: %s.\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
return ret;
}
ret = zones_store_changesets_commit(journal);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
dbg_zones("zones: create_changesets: "
"Could not commit to journal. Reason: %s.\n",
- knotd_strerror(ret));
+ knot_strerror(ret));
return ret;
}
knot_free_changesets(&changesets);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
@@ -3344,13 +3352,13 @@ int zones_create_and_save_changesets(const knot_zone_t *old_zone,
int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch)
{
if (!sch || !zone) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Fetch zone data. */
zonedata_t *zd = (zonedata_t *)zone->data;
if (!zd) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Cancel REFRESH timer. */
@@ -3395,7 +3403,7 @@ int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch)
/* Do not issue NOTIFY queries if stub. */
if (!knot_zone_contents(zone)) {
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
/* Schedule NOTIFY to slaves. */
@@ -3454,13 +3462,13 @@ int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch)
rcu_read_unlock();
- return KNOTD_EOK;
+ return KNOT_EOK;
}
int zones_cancel_notify(zonedata_t *zd, notify_ev_t *ev)
{
if (!zd || !ev || !ev->timer) {
- return KNOTD_EINVAL;
+ return KNOT_EINVAL;
}
/* Wait for event to finish running. */
@@ -3491,7 +3499,7 @@ int zones_cancel_notify(zonedata_t *zd, notify_ev_t *ev)
dbg_notify("notify: NOTIFY event for query ID=%u was "
"deleted before cancellation.\n",
pkt_id);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
@@ -3501,5 +3509,5 @@ int zones_cancel_notify(zonedata_t *zd, notify_ev_t *ev)
rem_node(&ev->n);
evsched_event_free(tmr->parent, tmr);
free(ev);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
diff --git a/src/knot/server/zones.h b/src/knot/server/zones.h
index 65e5a61..33b3d70 100755..100644
--- a/src/knot/server/zones.h
+++ b/src/knot/server/zones.h
@@ -110,9 +110,9 @@ typedef struct zonedata_t
* \param[out] db_old Old database, containing only zones which should be
* deleted afterwards.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_EINVAL
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK
+ * \retval KNOT_EINVAL
+ * \retval KNOT_ERROR
*/
int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
knot_zonedb_t **db_old);
@@ -128,10 +128,10 @@ int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
* \param zone Evaluated zone.
* \param journal Journal to sync.
*
- * \retval KNOTD_EOK if successful.
- * \retval KNOTD_ERANGE if zonefile is in sync with journal.
- * \retval KNOTD_EINVAL on invalid parameter.
- * \retval KNOTD_ERROR on unspecified error during processing.
+ * \retval KNOT_EOK if successful.
+ * \retval KNOT_ERANGE if zonefile is in sync with journal.
+ * \retval KNOT_EINVAL on invalid parameter.
+ * \retval KNOT_ERROR on unspecified error during processing.
*/
int zones_zonefile_sync(knot_zone_t *zone, journal_t *journal);
@@ -164,9 +164,9 @@ int zones_normal_query_answer(knot_nameserver_t *nameserver,
* \param rsize Input: maximum acceptable size of the response. Output: real
* size of the response.
*
- * \retval KNOTD_EOK if a valid response was created.
- * \retval KNOTD_EINVAL on invalid parameters or packet.
- * \retval KNOTD_EMALF if an error occured and the response is not valid.
+ * \retval KNOT_EOK if a valid response was created.
+ * \retval KNOT_EINVAL on invalid parameters or packet.
+ * \retval KNOT_EMALF if an error occured and the response is not valid.
*/
int zones_process_response(knot_nameserver_t *nameserver,
sockaddr_t *from,
@@ -192,9 +192,9 @@ int zones_save_zone(const knot_ns_xfr_t *xfr);
* \param conf Current configuration.
* \param data Instance of the nameserver structure to update.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL
+ * \retval KNOT_ERROR
*/
int zones_ns_conf_hook(const struct conf_t *conf, void *data);
@@ -207,9 +207,9 @@ int zones_ns_conf_hook(const struct conf_t *conf, void *data);
* \param zone Zone associated with the changeset.
* \param src Changesets.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_EAGAIN if journal needs to be synced with zonefile first.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_EAGAIN if journal needs to be synced with zonefile first.
*
* \todo Expects the xfr structure to be initialized in some way.
* \todo Update documentation!!!
@@ -227,18 +227,18 @@ journal_t *zones_store_changesets_begin(knot_ns_xfr_t *xfr);
/*!
* \brief Commit stored changesets.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT when no transaction is pending.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT when no transaction is pending.
*/
int zones_store_changesets_commit(journal_t *j);
/*!
* \brief Rollback stored changesets.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ENOENT when no transaction is pending.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ENOENT when no transaction is pending.
*/
int zones_store_changesets_rollback(journal_t *j);
@@ -254,7 +254,7 @@ int zones_changesets_to_binary(knot_changesets_t *chgsets);
* Changesets will be stored on a permanent storage.
* Journal may be compacted, resulting in flattening changeset history.
*
- * In case of KNOTD_ERANGE error, whole zone content should be sent instead,
+ * In case of KNOT_ERANGE error, whole zone content should be sent instead,
* as the changeset history cannot be recovered.
*
* \param zone Zone containing a changeset journal.
@@ -262,9 +262,9 @@ int zones_changesets_to_binary(knot_changesets_t *chgsets);
* \param from Starting SOA serial (oldest).
* \param to Ending SOA serial (newest).
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid parameters.
- * \retval KNOTD_ERANGE when changeset history cannot be reconstructed.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid parameters.
+ * \retval KNOT_ERANGE when changeset history cannot be reconstructed.
*
* \todo Expects the xfr structure to be initialized in some way.
*/
@@ -279,11 +279,11 @@ int zones_xfr_load_changesets(knot_ns_xfr_t *xfr, uint32_t serial_from,
* \param old_zone Old zone, previously served by server.
* \param new_zone New zone, to be served by server, after creating changesets.
*
- * \retval KNOTD_EOK on success.
- * \retval KNOTD_EINVAL on invalid arguments.
- * \retval KNOTD_ERANGE when new serial is lower than the old one.
- * \retval KNOTD_ENODIFF when new zone's serial are equal.
- * \retval KNOTD_ERROR when there was error creating changesets.
+ * \retval KNOT_EOK on success.
+ * \retval KNOT_EINVAL on invalid arguments.
+ * \retval KNOT_ERANGE when new serial is lower than the old one.
+ * \retval KNOT_ENODIFF when new zone's serial are equal.
+ * \retval KNOT_ERROR when there was error creating changesets.
*/
int zones_create_and_save_changesets(const knot_zone_t *old_zone,
const knot_zone_t *new_zone);
@@ -298,9 +298,9 @@ int zones_create_and_save_changesets(const knot_zone_t *old_zone,
* \param cfzone Related zone contents. If NULL, configuration is
* reused.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_EINVAL
- * \retval KNOTD_ERROR
+ * \retval KNOT_EOK
+ * \retval KNOT_EINVAL
+ * \retval KNOT_ERROR
*/
int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch);
@@ -312,9 +312,9 @@ int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch);
* \param zd Zone data.
* \param ev NOTIFY event.
*
- * \retval KNOTD_EOK
- * \retval KNOTD_ERROR
- * \retval KNOTD_EINVAL
+ * \retval KNOT_EOK
+ * \retval KNOT_ERROR
+ * \retval KNOT_EINVAL
*/
int zones_cancel_notify(zonedata_t *zd, notify_ev_t *ev);
diff --git a/src/knot/stat/gatherer.c b/src/knot/stat/gatherer.c
index 5b8eab6..5b8eab6 100755..100644
--- a/src/knot/stat/gatherer.c
+++ b/src/knot/stat/gatherer.c
diff --git a/src/knot/stat/gatherer.h b/src/knot/stat/gatherer.h
index 62b3939..62b3939 100755..100644
--- a/src/knot/stat/gatherer.h
+++ b/src/knot/stat/gatherer.h
diff --git a/src/knot/stat/stat-common.h b/src/knot/stat/stat-common.h
index 032e32b..032e32b 100755..100644
--- a/src/knot/stat/stat-common.h
+++ b/src/knot/stat/stat-common.h
diff --git a/src/knot/stat/stat.c b/src/knot/stat/stat.c
index a473085..a473085 100755..100644
--- a/src/knot/stat/stat.c
+++ b/src/knot/stat/stat.c
diff --git a/src/knot/stat/stat.h b/src/knot/stat/stat.h
index 0cf1454..0cf1454 100755..100644
--- a/src/knot/stat/stat.h
+++ b/src/knot/stat/stat.h
diff --git a/src/knot/zone/semantic-check.c b/src/knot/zone/semantic-check.c
index 20043df..abc83eb 100755..100644
--- a/src/knot/zone/semantic-check.c
+++ b/src/knot/zone/semantic-check.c
@@ -4,7 +4,6 @@
#include "knot/common.h"
#include "knot/zone/zone-dump.h"
-#include "knot/other/error.h"
#include "knot/other/debug.h"
#include "libknot/libknot.h"
#include "common/base32hex.h"
@@ -165,12 +164,12 @@ int err_handler_handle_error(err_handler_t *handler,
assert(handler && node);
if ((error != 0) &&
(error > ZC_ERR_GLUE_GENERAL_ERROR)) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*!< \todo #1886 this is so wrong! Should not even return anything. */
if (error == ZC_ERR_ALLOC || error == 0) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* missing SOA can only occur once, so there
@@ -252,7 +251,7 @@ static int check_cname_cycles_in_zone(knot_zone_contents_t *zone,
{
if (rrset->type != KNOT_RRTYPE_CNAME &&
rrset->type != KNOT_RRTYPE_DNAME) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_rrset_t *next_rrset = rrset;
@@ -1450,7 +1449,7 @@ int zone_do_sem_checks(knot_zone_contents_t *zone, char do_checks,
knot_node_t **last_node)
{
if (!handler) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
arg_t arguments;
arguments.arg1 = zone;
diff --git a/src/knot/zone/semantic-check.h b/src/knot/zone/semantic-check.h
index 2f6dad7..2f6dad7 100755..100644
--- a/src/knot/zone/semantic-check.h
+++ b/src/knot/zone/semantic-check.h
diff --git a/src/knot/zone/zone-dump-text.c b/src/knot/zone/zone-dump-text.c
index 8f428a5..bf02ea1 100755..100644
--- a/src/knot/zone/zone-dump-text.c
+++ b/src/knot/zone/zone-dump-text.c
@@ -49,7 +49,6 @@
#include <netdb.h>
#include "libknot/libknot.h"
-#include "knot/other/error.h"
#include "libknot/common.h"
#include "common/skip-list.h"
#include "common/base32hex.h"
@@ -339,97 +338,100 @@ static char *rdata_dns_name_to_string(knot_rdata_item_t item)
return knot_dname_to_str(item.dname);
}
-static char *rdata_txt_data_to_string(const uint8_t *data)
+static char *rdata_txt_data_to_string(const uint8_t *data, uint32_t *count)
{
- uint8_t length = data[0];
- size_t i = 0;
- if (length == 0) {
- return NULL;
- }
-
- /*
- * 3 because: opening '"', closing '"', and \0 at the end.
- * Times 2 because string can be all "double chars".
- */
- size_t current_length = sizeof(char) * (length * 2 + 4);
- char *ret = malloc(current_length);
- if (ret == NULL) {
- ERR_ALLOC_FAILED;
- return NULL;
- }
- memset(ret, 0, current_length);
-
- strncat(ret, "\"", 2);
-
- for (i = 1; i <= length; i++) {
- char ch = (char) data[i];
- if (isprint((int)ch)) {
- if (ch == '"' || ch == '\\') {
- strncat(ret, "\"", 2);
- }
- char tmp_str[2];
- tmp_str[0] = ch;
- tmp_str[1] = '\0';
- strncat(ret, tmp_str, 2);
- } else {
- strncat(ret, "\\", 2);
- char tmp_str[2];
- tmp_str[0] = ch - '0';
- tmp_str[1] = '\0';
- strncat(ret, tmp_str, 2);
- }
- }
- strncat(ret, "\"", 2);
-
- return ret;
+ uint8_t length = data[0];
+ uint32_t i = 0;
+ /*
+ * * 4 because: unprintable chars look like \123.
+ * + 3 because: opening '"', closing '"' and \0 at the end.
+ * + 1 because: malloc + gcc optimization requires out_length >= 4.
+ *
+ * NOTE: length can be 0.
+ */
+ uint32_t out_length = length * 4 + 3 + 1;
+
+ char *ret = malloc(out_length);
+ if (ret == NULL) {
+ ERR_ALLOC_FAILED;
+ return NULL;
+ }
+ memset(ret, 0, out_length);
+
+ // Opening '"'
+ strcat(ret, "\"");
+
+ for (i = 1; i <= length; i++) {
+ char ch = (char) data[i];
+ char tmp_str[5];
+
+ if (isprint((int)ch)) {
+ if (ch == '"' || ch == '\\') {
+ strcat(ret, "\\");
+ }
+ tmp_str[0] = ch;
+ tmp_str[1] = 0;
+ strcat(ret, tmp_str);
+ } else {
+ sprintf(tmp_str, "\\%03u", ch);
+ strcat(ret, tmp_str);
+ }
+ }
+
+ // Closing '"'
+ strcat(ret, "\"");
+
+ *count = length + 1; // 1 - leading length byte.
+
+ return ret;
}
-static char *rdata_text_to_string(knot_rdata_item_t item)
+static char *rdata_text_array_to_string(knot_rdata_item_t item)
{
- uint16_t size = item.raw_data[0];
- /*
- * Times two because they can all be one char long
- * and then it would be as much chars as spaces (and one final space).
- */
- size_t txt_size = size * 2 + 1;
- /* + 1 ... space for (hypothetical) last \0. */
- char *ret = malloc(txt_size + 1);
- if (ret == NULL) {
- ERR_ALLOC_FAILED;
- return NULL;
- }
- memset(ret, 0, sizeof(char) * size);
- const uint8_t *data = (uint8_t *)(item.raw_data + 1);
- size_t read_count = 0;
- size_t tmp_str_current_length = 0; // Will be used with strncat.
- while (read_count < size) {
- assert(read_count <= size);
- char *txt = rdata_txt_data_to_string(data + read_count);
- if (txt == NULL) {
- free(ret);
- return NULL;
- }
- /*
- * We can trust this strlen, as
- * it is created in internal function.
- */
- read_count += strlen(txt) - 1;
- /* Create delimiter. */
- char del[2];
- del[0] = ' ';
- del[1] = '\0';
-
- /* We can only write to the remainder of string. */
- strncat(ret, txt, txt_size - tmp_str_current_length);
- /* Increase length of tmp string. */
- tmp_str_current_length += strlen(txt);
- strncat(ret, del, txt_size - tmp_str_current_length);
- /* Increase length of tmp string by 1 ... space. */
- tmp_str_current_length += + 1;
- free(txt);
- }
-
- return ret;
+ /* Create delimiter. */
+ char *del = " ";
+
+ uint16_t size = item.raw_data[0];
+ /*
+ * * 6 because: item can consists of one length unprintable char strings
+ * "\123" "\123" ...
+ * + 1 because: ending \0.
+ *
+ * NOTE: txt_size is always bigger than 4 bytes (zero string has size = 1).
+ */
+ uint32_t txt_size = size * 6 + 1;
+
+ char *ret = malloc(txt_size);
+ if (ret == NULL) {
+ ERR_ALLOC_FAILED;
+ return NULL;
+ }
+ memset(ret, 0, txt_size);
+
+ const uint8_t *data = (uint8_t *)(item.raw_data + 1);
+ uint32_t read_count = 0;
+
+ while (read_count < size) {
+ uint32_t txt_count = 0;
+
+ char *txt = rdata_txt_data_to_string(data + read_count, &txt_count);
+ if (txt == NULL) {
+ free(ret);
+ return NULL;
+ }
+
+ /* Append text string to output. */
+ strcat(ret, txt);
+ read_count += txt_count;
+
+ if (read_count < size) {
+ strcat(ret, del);
+ }
+
+ free(txt);
+ }
+
+ return ret;
}
static char *rdata_byte_to_string(knot_rdata_item_t item)
@@ -874,7 +876,8 @@ typedef char * (*item_to_string_t)(knot_rdata_item_t);
static item_to_string_t item_to_string_table[KNOT_RDATA_ZF_UNKNOWN + 1] = {
rdata_dname_to_string,
rdata_dns_name_to_string,
- rdata_text_to_string,
+ rdata_text_array_to_string,
+ rdata_text_array_to_string,
rdata_byte_to_string,
rdata_short_to_string,
rdata_long_to_string,
@@ -909,7 +912,7 @@ int rdata_dump_text(const knot_rdata_t *rdata, uint16_t type, FILE *f,
const knot_rrset_t *rrset)
{
if (rdata == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrtype_descriptor_t *desc =
@@ -933,7 +936,7 @@ int rdata_dump_text(const knot_rdata_t *rdata, uint16_t type, FILE *f,
if (item_str == NULL) {
/* Fatal error. */
- return KNOTD_ERROR;
+ return KNOT_ERROR;
}
if (i != rdata->count - 1) {
@@ -946,7 +949,7 @@ int rdata_dump_text(const knot_rdata_t *rdata, uint16_t type, FILE *f,
}
fprintf(f, "\n");
- return KNOTD_EOK;
+ return KNOT_EOK;
}
void dump_rrset_header(const knot_rrset_t *rrset, FILE *f)
@@ -966,8 +969,8 @@ int rrsig_set_dump_text(knot_rrset_t *rrsig, FILE *f)
while (tmp->next != rrsig->rdata) {
int ret = rdata_dump_text(tmp, KNOT_RRTYPE_RRSIG, f, rrsig);
- if (ret != KNOTD_EOK) {
- return KNOTD_ERROR;
+ if (ret != KNOT_EOK) {
+ return KNOT_ERROR;
}
dump_rrset_header(rrsig, f);
@@ -975,11 +978,11 @@ int rrsig_set_dump_text(knot_rrset_t *rrsig, FILE *f)
}
int ret = rdata_dump_text(tmp, KNOT_RRTYPE_RRSIG, f, rrsig);
- if (ret != KNOTD_EOK) {
- return KNOTD_ERROR;
+ if (ret != KNOT_EOK) {
+ return KNOT_ERROR;
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
@@ -992,7 +995,7 @@ int rrset_dump_text(const knot_rrset_t *rrset, FILE *f)
while (tmp->next != rrset->rdata) {
int ret = rdata_dump_text(tmp, rrset->type, f, rrset);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
dump_rrset_header(rrset, f);
@@ -1007,7 +1010,7 @@ int rrset_dump_text(const knot_rrset_t *rrset, FILE *f)
rrsig_set_dump_text(rrsig_set, f);
}
- return KNOTD_EOK;
+ return KNOT_EOK;
}
struct dump_param {
@@ -1024,7 +1027,7 @@ int apex_node_dump_text(knot_node_t *node, FILE *f)
&dummy_rrset);
assert(tmp_rrset);
int ret = rrset_dump_text(tmp_rrset, f);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
@@ -1034,7 +1037,7 @@ int apex_node_dump_text(knot_node_t *node, FILE *f)
for (int i = 0; i < node->rrset_count; i++) {
if (rrsets[i]->type != KNOT_RRTYPE_SOA) {
ret = rrset_dump_text(rrsets[i], f);
- if (ret != KNOTD_EOK) {
+ if (ret != KNOT_EOK) {
return ret;
}
}
@@ -1042,7 +1045,7 @@ int apex_node_dump_text(knot_node_t *node, FILE *f)
free(rrsets);
- return KNOTD_EOK;
+ return KNOT_EOK;
}
void node_dump_text(knot_node_t *node, void *data)
@@ -1071,7 +1074,7 @@ void node_dump_text(knot_node_t *node, void *data)
int zone_dump_text(knot_zone_contents_t *zone, FILE *f)
{
if (f == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
fprintf(f, ";Dumped using %s v. %s\n", PACKAGE_NAME, PACKAGE_VERSION);
diff --git a/src/knot/zone/zone-dump-text.h b/src/knot/zone/zone-dump-text.h
index c55f712..3d26742 100755..100644
--- a/src/knot/zone/zone-dump-text.h
+++ b/src/knot/zone/zone-dump-text.h
@@ -37,7 +37,7 @@
* \param File file to write to.
*
* \retval KNOT_EOK on success.
- * \retval KNOT_EBADARG if the specified file is not valid for writing.
+ * \retval KNOT_EINVAL if the specified file is not valid for writing.
*/
int zone_dump_text(knot_zone_contents_t *zone, FILE *f);
diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c
index 708cd2b..b9c7bc2 100755..100644
--- a/src/knot/zone/zone-dump.c
+++ b/src/knot/zone/zone-dump.c
@@ -29,7 +29,6 @@
#include "common/crc.h"
#include "knot/other/debug.h"
#include "common/skip-list.h"
-#include "libknot/util/error.h"
#include "semantic-check.h"
#define ZONECHECKS_VERBOSE
@@ -58,7 +57,7 @@ static inline int write_to_file_crc(const void *src,
crc_t *crc)
{
if (src == NULL || fd < 0) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
ssize_t rc = write(fd, src, size * n);
if (rc != size * n) {
@@ -82,7 +81,7 @@ static inline int write_to_stream(const void *src,
size_t *written_bytes)
{
if (src == NULL || stream == NULL || written_bytes == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Check that the stream boundary will not be crossed. */
@@ -108,7 +107,7 @@ static int write_wrapper(const void *src,
{
if (src == NULL) {
dbg_zdump("zdump: write_wrapper: NULL source.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zdump_detail("zdump: write_wrapper: Writing %d bytes to fd: %d.\n",
@@ -233,7 +232,7 @@ static int knot_labels_dump_binary(const knot_dname_t *dname, int fd,
{
if (dname == NULL) {
dbg_zdump("zdump: dump_labels: NULL dname.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
uint16_t label_count = dname->label_count;
@@ -266,7 +265,7 @@ static int knot_dname_dump_binary(const knot_dname_t *dname, int fd,
{
if (dname == NULL) {
dbg_zdump("zdump: dump_dname: NULL dname.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*! \todo too big */
@@ -295,7 +294,7 @@ static int dump_dname_with_id(const knot_dname_t *dname, int fd,
{
if (dname == NULL) {
dbg_zdump("zdump: dump_dname: NULL dname.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
uint32_t id = dname->id;
@@ -323,7 +322,7 @@ static int knot_rdata_dump_binary(knot_rdata_t *rdata,
{
if (rdata == NULL) {
dbg_zdump("zdump: dump_rdata: NULL rdata.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrtype_descriptor_t *desc =
knot_rrtype_descriptor_by_type(type);
@@ -494,7 +493,7 @@ static int knot_rrsig_set_dump_binary(knot_rrset_t *rrsig, int fd,
{
if (rrsig == NULL) {
dbg_zdump("zdump: dump_rrsig: NULL RRSIG.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zdump_exec_detail(
@@ -570,7 +569,7 @@ static int knot_rrset_dump_binary(const knot_rrset_t *rrset, int fd,
{
if (rrset == NULL) {
dbg_zdump("zdump: dump_rrset: NULL RRSet.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zdump_exec_detail(
@@ -698,7 +697,7 @@ static int knot_node_dump_binary(knot_node_t *node, int fd,
{
if (node == NULL) {
dbg_zdump("zdump: dump_node: NULL node.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* first write dname */
@@ -827,7 +826,7 @@ static void dump_dname_from_tree(knot_dname_t *dname,
fd = *fd_pointer;
} else {
dbg_zdump("zdump: dump_dname_from_tree: Bad fd.\n");
- arg->error_code = KNOT_EBADARG;
+ arg->error_code = KNOT_EINVAL;
return;
}
@@ -923,7 +922,7 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd,
if (fd < 0 || sfilename == NULL) {
dbg_zdump("zdump: Bad arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zdump("zdump: Dumping zone %p.\n", zone);
@@ -1101,7 +1100,7 @@ int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t *stream,
if (stream == NULL || rrset == NULL ||
written_bytes == NULL) {
dbg_zdump("zdump: rrset_serialize: Bad arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
*written_bytes = 0;
diff --git a/src/knot/zone/zone-dump.h b/src/knot/zone/zone-dump.h
index 02d0298..538cb87 100755..100644
--- a/src/knot/zone/zone-dump.h
+++ b/src/knot/zone/zone-dump.h
@@ -50,7 +50,7 @@ enum {
* \param crc Returns a calculated CRC.
*
* \retval KNOT_EOK on success.
- * \retval KNOT_EBADARG if the file cannot be opened for writing.
+ * \retval KNOT_EINVAL if the file cannot be opened for writing.
*/
int knot_zdump_binary(knot_zone_contents_t *zone, int fd,
int do_checks, const char *sfilename,
@@ -66,7 +66,7 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd,
* \param bytes_written Actually written data.
*
* \retval KNOT_EOK on success.
- * \retval KNOT_EBADARG if wrong arguments are supplied.
+ * \retval KNOT_EINVAL if wrong arguments are supplied.
* \retval KNOT_ENOMEM on memory error.
*/
int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t *stream,
diff --git a/src/knot/zone/zone-load.c b/src/knot/zone/zone-load.c
index fedd38b..28195f8 100755..100644
--- a/src/knot/zone/zone-load.c
+++ b/src/knot/zone/zone-load.c
@@ -938,7 +938,7 @@ int knot_zload_open(zloader_t **dst, const char *filename)
if (!dst || !filename) {
dbg_zload("zload: open: Bad arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int (*fread_wrapper)(void *dst, size_t size, size_t n, void *source);
@@ -948,7 +948,7 @@ int knot_zload_open(zloader_t **dst, const char *filename)
/* Open file for binary read. */
FILE *f = fopen(filename, "rb");
- if (unlikely(!f)) {
+ if (knot_unlikely(!f)) {
int reason = errno;
dbg_zload("knot_zload_open: failed to open '%s'\n",
filename);
@@ -978,7 +978,7 @@ int knot_zload_open(zloader_t **dst, const char *filename)
char *crc_path =
malloc(sizeof(char) *
(strlen(filename) + 4 /* strlen(".crc") */ + 1));
- if (unlikely(!crc_path)) {
+ if (knot_unlikely(!crc_path)) {
fclose(f);
ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
@@ -1462,7 +1462,7 @@ int knot_zload_rrset_deserialize(knot_rrset_t **rrset,
{
if (stream == NULL || size == 0) {
dbg_zload("zload: rrset_deserialize: Bad arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
load_stream_t data;
diff --git a/src/knot/zone/zone-load.h b/src/knot/zone/zone-load.h
index 837d5f2..837d5f2 100755..100644
--- a/src/knot/zone/zone-load.h
+++ b/src/knot/zone/zone-load.h
diff --git a/src/knotc.8 b/src/knotc.8
index 9cd3f08..5b83f49 100755..100644
--- a/src/knotc.8
+++ b/src/knotc.8
@@ -1,4 +1,4 @@
-.TH knotc "8" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1"
+.TH knotc "8" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1.1"
.SH NAME
.B knotc
\- Knot DNS control utility
diff --git a/src/knotd.8 b/src/knotd.8
index cdc450a..9ae9eba 100755..100644
--- a/src/knotd.8
+++ b/src/knotd.8
@@ -1,4 +1,4 @@
-.TH "knotd" "8" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1"
+.TH "knotd" "8" "August 2012" "CZ.NIC Labs" "Knot DNS, version 1.1.1"
.SH NAME
.B knotd
\- Knot DNS daemon
diff --git a/src/libknot/common.h b/src/libknot/common.h
index 9b2d8ae..0bff97e 100755..100644
--- a/src/libknot/common.h
+++ b/src/libknot/common.h
@@ -25,6 +25,7 @@
*/
#include <config.h>
+#include "common/errcode.h"
#ifdef HAVE_LIBLDNS
#define TEST_WITH_LDNS
@@ -56,23 +57,23 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
({ typeof (a) _a = (a); typeof (b) _b = (b); _a > _b ? _a : _b; })
/* Optimisation macros. */
-#ifndef likely
+#ifndef knot_likely
/*! \brief Optimize for x to be true value. */
-#define likely(x) __builtin_expect((x),1)
+#define knot_likely(x) __builtin_expect((x),1)
#endif
-#ifndef unlikely
+#ifndef knot_unlikely
/*! \brief Optimize for x to be false value. */
-#define unlikely(x) __builtin_expect((x),0)
+#define knot_unlikely(x) __builtin_expect((x),0)
#endif
/* Optimisation macros. */
-#ifndef likely
+#ifndef knot_likely
/*! \brief Optimize for x to be true value. */
-#define likely(x) __builtin_expect((x),1)
+#define knot_likely(x) __builtin_expect((x),1)
#endif
-#ifndef unlikely
+#ifndef knot_unlikely
/*! \brief Optimize for x to be false value. */
-#define unlikely(x) __builtin_expect((x),0)
+#define knot_unlikely(x) __builtin_expect((x),0)
#endif
/*! \todo Refactor theese. We should have an allocator function handling this.*/
diff --git a/src/libknot/consts.h b/src/libknot/consts.h
index 4249763..4249763 100755..100644
--- a/src/libknot/consts.h
+++ b/src/libknot/consts.h
diff --git a/src/libknot/dname.c b/src/libknot/dname.c
index 7d59b6b..eed2fd6 100755..100644
--- a/src/libknot/dname.c
+++ b/src/libknot/dname.c
@@ -22,7 +22,6 @@
#include <ctype.h> // tolower()
#include "common.h"
-#include "util/error.h"
#include "dname.h"
#include "consts.h"
#include "util/tolower.h"
@@ -86,7 +85,7 @@ static knot_dname_t* knot_dname_alloc()
/* Create cache if not exists. */
slab_cache_t* cache = pthread_getspecific(dname_ckey);
- if (unlikely(!cache)) {
+ if (knot_unlikely(!cache)) {
cache = malloc(sizeof(slab_cache_t));
if (!cache) {
return 0;
@@ -579,7 +578,7 @@ int knot_dname_from_wire(const uint8_t *name, uint size,
struct knot_node *node, knot_dname_t *target)
{
if (name == NULL || target == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
memcpy(target->name, name, size);
@@ -682,7 +681,7 @@ char *knot_dname_to_str(const knot_dname_t *dname)
int knot_dname_to_lower(knot_dname_t *dname)
{
if (dname == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
for (int i = 0; i < dname->size; ++i) {
@@ -697,7 +696,7 @@ int knot_dname_to_lower_copy(const knot_dname_t *dname, char *name,
size_t size)
{
if (dname == NULL || name == NULL || size < dname->size) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
for (int i = 0; i < dname->size; ++i) {
diff --git a/src/libknot/dname.h b/src/libknot/dname.h
index 43bc4d2..347e699 100755..100644
--- a/src/libknot/dname.h
+++ b/src/libknot/dname.h
@@ -143,7 +143,7 @@ knot_dname_t *knot_dname_parse_from_wire(const uint8_t *wire,
*
* \retval KNOT_EOK on success.
* \retval KNOT_ENOMEM if allocation of labels info failed.
- * \retval KNOT_EBADARG if name or target is null.
+ * \retval KNOT_EINVAL if name or target is null.
*
* \todo This function does not check if the given data is in correct wire
* format at all. It thus creates a invalid domain name, which if passed
diff --git a/src/libknot/edns.c b/src/libknot/edns.c
index 8e1efcc..a71c4eb 100755..100644
--- a/src/libknot/edns.c
+++ b/src/libknot/edns.c
@@ -22,7 +22,6 @@
#include "common.h"
#include "util/descriptor.h"
#include "util/debug.h"
-#include "util/error.h"
/*! \brief Various EDNS constatns. */
enum knot_edns_consts {
@@ -60,7 +59,7 @@ int knot_edns_new_from_wire(knot_opt_rr_t *opt_rr, const uint8_t *wire,
int parsed = 0;
if (pos == NULL || max_size == 0 || opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (max_size < KNOT_EDNS_MIN_SIZE) {
@@ -140,7 +139,7 @@ int knot_edns_new_from_rr(knot_opt_rr_t *opt_rr,
{
if (opt_rr == NULL || rrset == NULL
|| knot_rrset_type(rrset) != KNOT_RRTYPE_OPT) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_edns_verb("Parsing payload.\n");
@@ -273,7 +272,7 @@ uint16_t knot_edns_get_flags(const knot_opt_rr_t *opt_rr)
int knot_edns_do(const knot_opt_rr_t *opt_rr)
{
if (opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_edns("Flags: %u\n", opt_rr->flags);
@@ -297,7 +296,7 @@ int knot_edns_add_option(knot_opt_rr_t *opt_rr, uint16_t code,
uint16_t length, const uint8_t *data)
{
if (opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (opt_rr->option_count == opt_rr->options_max) {
@@ -338,7 +337,7 @@ int knot_edns_add_option(knot_opt_rr_t *opt_rr, uint16_t code,
int knot_edns_has_option(const knot_opt_rr_t *opt_rr, uint16_t code)
{
if (opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int i = 0;
@@ -357,7 +356,7 @@ short knot_edns_to_wire(const knot_opt_rr_t *opt_rr, uint8_t *wire,
size_t max_size)
{
if (opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(KNOT_EDNS_MIN_SIZE <= max_size);
@@ -415,7 +414,7 @@ short knot_edns_to_wire(const knot_opt_rr_t *opt_rr, uint8_t *wire,
short knot_edns_size(knot_opt_rr_t *opt_rr)
{
if (opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return opt_rr->size;
diff --git a/src/libknot/edns.h b/src/libknot/edns.h
index 022ac36..d59050e 100755..100644
--- a/src/libknot/edns.h
+++ b/src/libknot/edns.h
@@ -101,7 +101,7 @@ knot_opt_rr_t *knot_edns_new();
* than acutal size of the OPT RR).
*
* \return Size of the parserd OPT RR in bytes if successful (always > 0).
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EFEWDATA
* \retval KNOT_EMALF
* \retval KNOT_ENOMEM
diff --git a/src/libknot/hash/cuckoo-hash-table.c b/src/libknot/hash/cuckoo-hash-table.c
index 7358e14..7358e14 100755..100644
--- a/src/libknot/hash/cuckoo-hash-table.c
+++ b/src/libknot/hash/cuckoo-hash-table.c
diff --git a/src/libknot/hash/cuckoo-hash-table.h b/src/libknot/hash/cuckoo-hash-table.h
index c0fe9cc..c0fe9cc 100755..100644
--- a/src/libknot/hash/cuckoo-hash-table.h
+++ b/src/libknot/hash/cuckoo-hash-table.h
diff --git a/src/libknot/hash/hash-functions.c b/src/libknot/hash/hash-functions.c
index a33dd6b..a33dd6b 100755..100644
--- a/src/libknot/hash/hash-functions.c
+++ b/src/libknot/hash/hash-functions.c
diff --git a/src/libknot/hash/hash-functions.h b/src/libknot/hash/hash-functions.h
index f23730b..f23730b 100755..100644
--- a/src/libknot/hash/hash-functions.h
+++ b/src/libknot/hash/hash-functions.h
diff --git a/src/libknot/hash/universal-system.c b/src/libknot/hash/universal-system.c
index 096974c..096974c 100755..100644
--- a/src/libknot/hash/universal-system.c
+++ b/src/libknot/hash/universal-system.c
diff --git a/src/libknot/hash/universal-system.h b/src/libknot/hash/universal-system.h
index 25330de..25330de 100755..100644
--- a/src/libknot/hash/universal-system.h
+++ b/src/libknot/hash/universal-system.h
diff --git a/src/libknot/libknot.h b/src/libknot/libknot.h
index a401be7..287233d 100755..100644
--- a/src/libknot/libknot.h
+++ b/src/libknot/libknot.h
@@ -41,7 +41,6 @@
#include "util/utils.h"
#include "zone/zone.h"
#include "zone/zonedb.h"
-#include "util/error.h"
#endif
diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c
index 6924f44..10d8671 100755..100644
--- a/src/libknot/nameserver/name-server.c
+++ b/src/libknot/nameserver/name-server.c
@@ -23,7 +23,6 @@
#include "nameserver/name-server.h"
#include "updates/xfr-in.h"
-#include "util/error.h"
#include "libknot.h"
#include "util/debug.h"
#include "packet/packet.h"
@@ -1613,10 +1612,14 @@ static int ns_put_nsec_nsec3_wildcard_answer(const knot_node_t *node,
const knot_dname_t *qname,
knot_packet_t *resp)
{
+ // if wildcard answer, add NSEC / NSEC3
+
int ret = KNOT_EOK;
if (DNSSEC_ENABLED
&& knot_query_dnssec_requested(knot_packet_query(resp))
- && knot_dname_is_wildcard(knot_node_owner(node))) {
+ && knot_dname_is_wildcard(knot_node_owner(node))
+ && knot_dname_compare(qname, knot_node_owner(node)) != 0) {
+ dbg_ns_verb("Adding NSEC/NSEC3 for wildcard answer.\n");
if (knot_zone_contents_nsec3_enabled(zone)) {
ret = ns_put_nsec3_wildcard(zone, closest_encloser,
qname, resp);
@@ -1861,12 +1864,10 @@ static int ns_answer_from_node(const knot_node_t *node,
}
}
} else { // else put authority NS
- // if wildcard answer, add NSEC / NSEC3
- dbg_ns_verb("Adding NSEC/NSEC3 for wildcard answer.\n");
-
assert(previous == NULL);
assert(closest_encloser == knot_node_parent(node)
- || !knot_dname_is_wildcard(knot_node_owner(node)));
+ || !knot_dname_is_wildcard(knot_node_owner(node))
+ || knot_dname_compare(qname, knot_node_owner(node)) == 0);
ret = ns_put_nsec_nsec3_wildcard_answer(node, closest_encloser,
previous, zone, qname, resp);
@@ -2099,7 +2100,7 @@ search:
closest_encloser = knot_node_current(closest_encloser);
previous = knot_node_current(previous);
#endif
- if (find_ret == KNOT_EBADARG) {
+ if (find_ret == KNOT_EINVAL) {
return NS_ERR_SERVFAIL;
}
@@ -3155,7 +3156,7 @@ int knot_ns_parse_packet(const uint8_t *query_wire, size_t qsize,
{
if (packet == NULL || query_wire == NULL || type == NULL) {
dbg_ns("Missing parameter to query parsing.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_ns_verb("ns_parse_packet() called with query size %zu.\n", qsize);
@@ -3347,7 +3348,7 @@ int knot_ns_prep_normal_response(knot_nameserver_t *nameserver,
if (nameserver == NULL || query == NULL || resp == NULL
|| zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// first, parse the rest of the packet
@@ -3373,7 +3374,8 @@ int knot_ns_prep_normal_response(knot_nameserver_t *nameserver,
* FORMERR
*/
if (knot_packet_ancount(query) > 0
- || knot_packet_nscount(query) > 0
+ || (knot_packet_nscount(query) > 0
+ && (knot_packet_qtype(query) != KNOT_RRTYPE_IXFR))
|| knot_packet_qdcount(query) != 1) {
dbg_ns("ANCOUNT or NSCOUNT not 0 in query, "
"or QDCOUNT != 1. Reply FORMERR.\n");
@@ -3682,19 +3684,19 @@ int ns_ixfr_load_serials(const knot_ns_xfr_t *xfr, uint32_t *serial_from,
|| serial_to == NULL) {
dbg_ns("Wrong parameters: xfr=%p,"
" xfr->zone = %p\n", xfr, xfr->zone);
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_zone_t *zone = xfr->zone;
const knot_zone_contents_t *contents = knot_zone_contents(zone);
if (!contents) {
dbg_ns("Missing contents\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (knot_zone_contents_apex(contents) == NULL) {
dbg_ns("No apex.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_rrset_t *zone_soa =
@@ -3702,7 +3704,7 @@ int ns_ixfr_load_serials(const knot_ns_xfr_t *xfr, uint32_t *serial_from,
KNOT_RRTYPE_SOA);
if (zone_soa == NULL) {
dbg_ns("No SOA.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (knot_packet_nscount(xfr->query) < 1) {
@@ -3749,7 +3751,7 @@ int knot_ns_xfr_send_error(const knot_nameserver_t *nameserver,
int knot_ns_answer_axfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
{
if (xfr == NULL || nameserver == NULL || xfr->zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
rcu_read_lock();
@@ -3810,7 +3812,7 @@ int knot_ns_answer_ixfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
{
if (nameserver == NULL || xfr == NULL || xfr->zone == NULL
|| xfr->response == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// parse rest of the packet (we need the Authority record)
@@ -3925,7 +3927,7 @@ int knot_ns_switch_zone(knot_nameserver_t *nameserver,
knot_ns_xfr_t *xfr)
{
if (xfr == NULL || nameserver == NULL || xfr->new_contents == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_contents_t *zone = (knot_zone_contents_t *)xfr->new_contents;
diff --git a/src/libknot/nameserver/name-server.h b/src/libknot/nameserver/name-server.h
index 3fe1210..3fe1210 100755..100644
--- a/src/libknot/nameserver/name-server.h
+++ b/src/libknot/nameserver/name-server.h
diff --git a/src/libknot/nsec3.c b/src/libknot/nsec3.c
index 9cab4be..23130ba 100755..100644
--- a/src/libknot/nsec3.c
+++ b/src/libknot/nsec3.c
@@ -27,7 +27,6 @@
#include "util/descriptor.h"
#include "util/utils.h"
#include "util/tolower.h"
-#include "util/error.h"
#include "util/debug.h"
/*----------------------------------------------------------------------------*/
@@ -36,7 +35,7 @@ int knot_nsec3_params_from_wire(knot_nsec3_params_t *params,
const knot_rrset_t *nsec3param)
{
if (params == NULL || nsec3param == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rrset_type(nsec3param) == KNOT_RRTYPE_NSEC3PARAM);
@@ -105,7 +104,7 @@ int knot_nsec3_sha1(const knot_nsec3_params_t *params,
size_t *digest_size)
{
if (digest == NULL || digest_size == NULL || data == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
uint8_t *salt = params->salt;
@@ -187,7 +186,7 @@ int knot_nsec3_sha1(const knot_nsec3_params_t *params,
{
if (params == NULL || digest == NULL || digest_size == NULL
|| data == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
uint8_t *salt = params->salt;
diff --git a/src/libknot/nsec3.h b/src/libknot/nsec3.h
index 0ce6899..7efd229 100755..100644
--- a/src/libknot/nsec3.h
+++ b/src/libknot/nsec3.h
@@ -72,7 +72,7 @@ int knot_nsec3_params_from_wire(knot_nsec3_params_t *params,
*
* \retval KNOT_EOK if successful.
* \retval KNOT_ENOMEM
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ECRYPTO
*/
int knot_nsec3_sha1(const knot_nsec3_params_t *params, const uint8_t *data,
diff --git a/src/libknot/packet/packet.c b/src/libknot/packet/packet.c
index 6c7fd02..6a047fb 100755..100644
--- a/src/libknot/packet/packet.c
+++ b/src/libknot/packet/packet.c
@@ -17,7 +17,6 @@
#include <assert.h>
#include "packet/packet.h"
-#include "util/error.h"
#include "util/debug.h"
#include "common.h"
#include "util/descriptor.h"
@@ -106,9 +105,12 @@ static void knot_packet_init_pointers_response(knot_packet_t *pkt)
pos += DEFAULT_DOMAINS_IN_RESPONSE * sizeof(const knot_dname_t *);
pkt->compression.offsets = (size_t *)pos;
pos += DEFAULT_DOMAINS_IN_RESPONSE * sizeof(size_t);
+ pkt->compression.to_free = (int *)pos;
+ pos += DEFAULT_DOMAINS_IN_RESPONSE * sizeof(int);
dbg_packet_detail("Compression dnames: %p\n", pkt->compression.dnames);
dbg_packet_detail("Compression offsets: %p\n", pkt->compression.offsets);
+ dbg_packet_detail("Compression to_free: %p\n", pkt->compression.to_free);
pkt->compression.max = DEFAULT_DOMAINS_IN_RESPONSE;
pkt->compression.default_count = DEFAULT_DOMAINS_IN_RESPONSE;
@@ -299,7 +301,7 @@ static int knot_packet_parse_question(const uint8_t *wire, size_t *pos,
int res = knot_dname_from_wire(wire + *pos, i - *pos + 1,
NULL, question->qname);
if (res != KNOT_EOK) {
- assert(res != KNOT_EBADARG);
+ assert(res != KNOT_EINVAL);
return res;
}
}
@@ -638,6 +640,7 @@ static void knot_packet_free_allocated_space(knot_packet_t *pkt)
if (pkt->compression.max > pkt->compression.default_count) {
free(pkt->compression.dnames);
free(pkt->compression.offsets);
+ free(pkt->compression.to_free);
}
if (pkt->wildcard_nodes.max > pkt->wildcard_nodes.default_count) {
@@ -780,7 +783,7 @@ int knot_packet_parse_from_wire(knot_packet_t *packet,
int question_only)
{
if (packet == NULL || wireformat == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int err;
@@ -848,7 +851,7 @@ dbg_packet_exec_detail(
int knot_packet_parse_rest(knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (packet->header.ancount == packet->parsed_an
@@ -875,7 +878,7 @@ int knot_packet_parse_next_rr_answer(knot_packet_t *packet,
knot_rrset_t **rr)
{
if (packet == NULL || rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
*rr = NULL;
@@ -926,7 +929,7 @@ int knot_packet_parse_next_rr_additional(knot_packet_t *packet,
{
/*! \todo Implement. */
if (packet == NULL || rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
*rr = NULL;
@@ -995,7 +998,7 @@ size_t knot_packet_parsed(const knot_packet_t *packet)
int knot_packet_set_max_size(knot_packet_t *packet, int max_size)
{
if (packet == NULL || max_size <= 0) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (packet->max_size < max_size) {
@@ -1102,7 +1105,7 @@ uint16_t knot_packet_qclass(const knot_packet_t *packet)
int knot_packet_is_query(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return (knot_wire_flags_get_qr(packet->header.flags1) == 0);
@@ -1124,7 +1127,7 @@ const knot_packet_t *knot_packet_query(const knot_packet_t *packet)
int knot_packet_rcode(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_wire_flags_get_rcode(packet->header.flags2);
@@ -1135,7 +1138,7 @@ int knot_packet_rcode(const knot_packet_t *packet)
int knot_packet_tc(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_wire_flags_get_tc(packet->header.flags1);
@@ -1146,7 +1149,7 @@ int knot_packet_tc(const knot_packet_t *packet)
int knot_packet_qdcount(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->header.qdcount;
@@ -1157,7 +1160,7 @@ int knot_packet_qdcount(const knot_packet_t *packet)
int knot_packet_ancount(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->header.ancount;
@@ -1168,7 +1171,7 @@ int knot_packet_ancount(const knot_packet_t *packet)
int knot_packet_nscount(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->header.nscount;
@@ -1179,7 +1182,7 @@ int knot_packet_nscount(const knot_packet_t *packet)
int knot_packet_arcount(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->header.arcount;
@@ -1211,7 +1214,7 @@ void knot_packet_set_tsig(knot_packet_t *packet, const knot_rrset_t *tsig_rr)
short knot_packet_answer_rrset_count(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->an_rrsets;
@@ -1222,7 +1225,7 @@ short knot_packet_answer_rrset_count(const knot_packet_t *packet)
short knot_packet_authority_rrset_count(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->ns_rrsets;
@@ -1233,7 +1236,7 @@ short knot_packet_authority_rrset_count(const knot_packet_t *packet)
short knot_packet_additional_rrset_count(const knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return packet->ar_rrsets;
@@ -1282,7 +1285,7 @@ int knot_packet_contains(const knot_packet_t *packet,
knot_rrset_compare_type_t cmp)
{
if (packet == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
for (int i = 0; i < packet->an_rrsets; ++i) {
@@ -1312,7 +1315,7 @@ int knot_packet_add_tmp_rrset(knot_packet_t *packet,
knot_rrset_t *tmp_rrset)
{
if (packet == NULL || tmp_rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (packet->tmp_rrsets_count == packet->tmp_rrsets_max
@@ -1388,7 +1391,7 @@ void knot_packet_header_to_wire(const knot_header_t *header,
int knot_packet_question_to_wire(knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (packet->size > KNOT_WIRE_HEADER_SIZE) {
@@ -1421,7 +1424,7 @@ int knot_packet_question_to_wire(knot_packet_t *packet)
int knot_packet_edns_to_wire(knot_packet_t *packet)
{
if (packet == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
packet->size += knot_edns_to_wire(&packet->opt_rr,
@@ -1440,7 +1443,7 @@ int knot_packet_to_wire(knot_packet_t *packet,
{
if (packet == NULL || wire == NULL || wire_size == NULL
|| *wire != NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(packet->size <= packet->max_size);
@@ -1486,6 +1489,14 @@ void knot_packet_free(knot_packet_t **packet)
dbg_packet("Freeing tmp RRSets...\n");
knot_packet_free_tmp_rrsets(*packet);
+ dbg_packet("Freeing copied dnames for compression...\n");
+ for (int i = 0; i < (*packet)->compression.count; ++i) {
+ if ((*packet)->compression.to_free[i]) {
+ knot_dname_release(
+ (knot_dname_t *)(*packet)->compression.dnames[i]);
+ }
+ }
+
/*! \note The above code will free the domain names pointed to by
* the list of wildcard nodes. It should not matter, however.
*/
diff --git a/src/libknot/packet/packet.h b/src/libknot/packet/packet.h
index d76209a..522ae8e 100755..100644
--- a/src/libknot/packet/packet.h
+++ b/src/libknot/packet/packet.h
@@ -47,6 +47,7 @@
struct knot_compressed_dnames {
const knot_dname_t **dnames; /*!< Domain names present in packet. */
size_t *offsets; /*!< Offsets of domain names in the packet. */
+ int *to_free; /*< Indices of dnames to free. */
short count; /*!< Count of items in the previous arrays. */
short max; /*!< Capacity of the structure (allocated). */
short default_count;
@@ -233,7 +234,12 @@ enum {
/*! \brief Space for other part of the compression table (offsets). */
PREALLOC_OFFSETS =
DEFAULT_DOMAINS_IN_RESPONSE * sizeof(size_t),
- PREALLOC_COMPRESSION = PREALLOC_DOMAINS + PREALLOC_OFFSETS,
+
+ PREALLOC_TO_FREE =
+ DEFAULT_DOMAINS_IN_RESPONSE * sizeof(int),
+
+ PREALLOC_COMPRESSION = PREALLOC_DOMAINS + PREALLOC_OFFSETS
+ + PREALLOC_TO_FREE,
PREALLOC_WC_NODES =
DEFAULT_WILDCARD_NODES * sizeof(knot_node_t *),
@@ -318,7 +324,7 @@ size_t knot_packet_parsed(const knot_packet_t *packet);
* \param max_size Maximum size of the packet in bytes.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*
* \todo Needs test.
@@ -530,7 +536,7 @@ int knot_packet_edns_to_wire(knot_packet_t *packet);
* \param wire_size The size of the packet in wire format will be stored here.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_packet_to_wire(knot_packet_t *packet, uint8_t **wire,
size_t *wire_size);
diff --git a/src/libknot/packet/query.c b/src/libknot/packet/query.c
index bc3a4db..8f4cf18 100755..100644
--- a/src/libknot/packet/query.c
+++ b/src/libknot/packet/query.c
@@ -16,9 +16,8 @@
#include <stdlib.h>
#include "packet/query.h"
-
-#include "util/error.h"
#include "util/wire.h"
+#include "libknot/common.h"
/*----------------------------------------------------------------------------*/
@@ -93,7 +92,7 @@ int knot_query_rr_to_wire(const knot_rrset_t *rrset, const knot_rdata_t *rdata,
int knot_query_dnssec_requested(const knot_packet_t *query)
{
if (query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return ((knot_edns_get_version(&query->opt_rr) != EDNS_NOT_SUPPORTED)
@@ -105,7 +104,7 @@ int knot_query_dnssec_requested(const knot_packet_t *query)
int knot_query_nsid_requested(const knot_packet_t *query)
{
if (query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return ((knot_edns_get_version(&query->opt_rr) != EDNS_NOT_SUPPORTED)
@@ -117,7 +116,7 @@ int knot_query_nsid_requested(const knot_packet_t *query)
int knot_query_edns_supported(const knot_packet_t *query)
{
if (query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return (knot_edns_get_version(&query->opt_rr) != EDNS_NOT_SUPPORTED);
@@ -128,7 +127,7 @@ int knot_query_edns_supported(const knot_packet_t *query)
int knot_query_init(knot_packet_t *query)
{
if (query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// set the qr bit to 0
knot_wire_flags_clear_qr(&query->header.flags1);
@@ -145,7 +144,7 @@ int knot_query_set_question(knot_packet_t *query,
const knot_question_t *question)
{
if (query == NULL || question == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
query->question.qname = question->qname;
@@ -164,7 +163,7 @@ int knot_query_set_question(knot_packet_t *query,
int knot_query_set_opcode(knot_packet_t *query, uint8_t opcode)
{
if (query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// set the OPCODE in the structure
knot_wire_flags_set_opcode(&query->header.flags1, opcode);
@@ -180,7 +179,7 @@ int knot_query_add_rrset_authority(knot_packet_t *query,
const knot_rrset_t *rrset)
{
if (query == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (query->ns_rrsets == query->max_ns_rrsets) {
diff --git a/src/libknot/packet/query.h b/src/libknot/packet/query.h
index cda72b9..cda72b9 100755..100644
--- a/src/libknot/packet/query.h
+++ b/src/libknot/packet/query.h
diff --git a/src/libknot/packet/response.c b/src/libknot/packet/response.c
index bb4d0f2..c6a1a09 100755..100644
--- a/src/libknot/packet/response.c
+++ b/src/libknot/packet/response.c
@@ -20,11 +20,12 @@
#include "util/wire.h"
#include "util/descriptor.h"
#include "common.h"
-#include "util/error.h"
#include "util/debug.h"
#include "packet/packet.h"
#include "edns.h"
+#define COMPRESSION_PEDANTIC
+
/*----------------------------------------------------------------------------*/
/*!
* \brief Holds information about compressed domain name.
@@ -78,6 +79,7 @@ static int knot_response_realloc_compr(knot_compressed_dnames_t *table)
{
int free_old = table->max != table->default_count;
size_t *old_offsets = table->offsets;
+ int *old_to_free = table->to_free;
const knot_dname_t **old_dnames = table->dnames;
short new_max_count = table->max + STEP_DOMAINS;
@@ -85,24 +87,35 @@ static int knot_response_realloc_compr(knot_compressed_dnames_t *table)
size_t *new_offsets = (size_t *)malloc(new_max_count * sizeof(size_t));
CHECK_ALLOC_LOG(new_offsets, -1);
+ int *new_to_free = (int *)malloc(new_max_count * sizeof(int));
+ if (new_to_free == NULL) {
+ ERR_ALLOC_FAILED;
+ free(new_offsets);
+ return KNOT_ENOMEM;
+ }
+
const knot_dname_t **new_dnames = (const knot_dname_t **)malloc(
new_max_count * sizeof(knot_dname_t *));
if (new_dnames == NULL) {
ERR_ALLOC_FAILED;
free(new_offsets);
+ free(new_to_free);
return KNOT_ENOMEM;
}
memcpy(new_offsets, table->offsets, table->max * sizeof(size_t));
+ memcpy(new_to_free, table->to_free, table->max * sizeof(int));
memcpy(new_dnames, table->dnames,
table->max * sizeof(knot_dname_t *));
table->offsets = new_offsets;
+ table->to_free = new_to_free;
table->dnames = new_dnames;
table->max = new_max_count;
if (free_old) {
free(old_offsets);
+ free(old_to_free);
free(old_dnames);
}
@@ -121,7 +134,8 @@ static int knot_response_realloc_compr(knot_compressed_dnames_t *table)
* \param pos Position of the domain name in the packet's wire format.
*/
static void knot_response_compr_save(knot_compressed_dnames_t *table,
- const knot_dname_t *dname, size_t pos)
+ const knot_dname_t *dname, size_t pos,
+ int copied_dname)
{
assert(table->count < table->max);
@@ -134,6 +148,7 @@ static void knot_response_compr_save(knot_compressed_dnames_t *table,
table->dnames[table->count] = dname;
table->offsets[table->count] = pos;
+ table->to_free[table->count] = copied_dname;
++table->count;
}
@@ -197,9 +212,10 @@ dbg_response_exec(
*/
const knot_dname_t *to_save = dname;
size_t parent_pos = pos;
- int i = 0;
+ int i = 0, copied = 0;
- while (to_save != NULL && i < knot_dname_label_count(dname)) {
+ while (to_save != NULL && i < knot_dname_label_count(dname)
+ && parent_pos <= KNOT_RESPONSE_MAX_PTR) {
if (i == not_matched) {
parent_pos = unmatched_offset;
}
@@ -218,7 +234,7 @@ dbg_response_exec_detail(
return KNOT_ENOMEM;
}
- knot_response_compr_save(table, to_save, parent_pos);
+ knot_response_compr_save(table, to_save, parent_pos, copied);
/*! \todo Remove '!compr_cs'. */
// This is a temporary hack to avoid the wrong behaviour
@@ -233,7 +249,8 @@ dbg_response_exec_detail(
/*! \todo The whole compression requires a serious refactoring.
* Or better - a rewrite!
*/
- to_save = (!compr_cs && knot_dname_node(to_save) != NULL
+ const knot_dname_t *to_save_new =
+ (!compr_cs && knot_dname_node(to_save) != NULL
&& knot_node_owner(knot_dname_node(to_save))
!= to_save
&& knot_node_parent(knot_dname_node(to_save))
@@ -242,11 +259,29 @@ dbg_response_exec_detail(
knot_dname_node(to_save)))
: NULL;
+#ifdef COMPRESSION_PEDANTIC
+ if (to_save_new == NULL) {
+ // copied name - must be freed later
+ to_save_new = knot_dname_left_chop(to_save);
+ copied = 1;
+ } else {
+ copied = 0;
+ }
+#endif
+
+ to_save = to_save_new;
+
dbg_response("i: %d\n", i);
parent_pos += knot_dname_label_size(dname, i) + 1;
++i;
}
+ if (copied == 1 && to_save != NULL) {
+ // The last name was not used, free it
+ dbg_response("Freeing last chopped dname.\n");
+ knot_dname_release((knot_dname_t *)to_save);
+ }
+
return KNOT_EOK;
}
@@ -370,10 +405,14 @@ dbg_response_exec_detail(
knot_dname_left_chop_no_copy(to_find);
}
} else {
- assert(to_find->node != to_find->node->parent);
- assert(to_find != to_find->node->parent->owner);
- to_find = to_find->node->parent->owner;
+ assert(knot_dname_node(to_find) !=
+ knot_node_parent(knot_dname_node(to_find)));
+ assert(to_find != knot_node_owner(
+ knot_node_parent(knot_dname_node(to_find))));
+ to_find = knot_node_get_owner(
+ knot_node_parent(knot_dname_node(to_find)));
}
+ dbg_response_detail("New to_find: %p\n", to_find);
#else
// if case-sensitive comparation, we cannot just take the parent
if (compr_cs || knot_dname_node(to_find) == NULL
@@ -414,7 +453,10 @@ dbg_response_exec_detail(
dbg_response_detail("Max size available for domain name: %zu\n", max);
- if (offset > 0) { // found such dname somewhere in the packet
+ if (offset > 0) {
+ // found such dname somewhere in the packet
+ // the pointer should be legal as no illegal pointers are stored
+ assert(offset <= KNOT_RESPONSE_MAX_PTR);
dbg_response_detail("Found name in the compression table.\n");
assert(offset >= KNOT_WIRE_HEADER_SIZE);
size = knot_response_put_dname_ptr(dname, not_matched, offset,
@@ -438,9 +480,9 @@ dbg_response_exec_detail(
* It is meaningful only if the found name is the one from QNAME
* and thus its parents are not stored yet.
*/
-
+ // only put legal pointers (#2131)
if (knot_response_store_dname_pos(compr->table, dname, not_matched,
- compr->wire_pos, offset, compr_cs)
+ compr->wire_pos, offset, compr_cs)
!= 0) {
dbg_response_detail("Compression info could not be stored.\n");
}
@@ -841,7 +883,7 @@ static int knot_response_realloc_wc_nodes(const knot_node_t ***nodes,
int knot_response_init(knot_packet_t *response)
{
if (response == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (response->max_size < KNOT_WIRE_HEADER_SIZE) {
@@ -865,7 +907,7 @@ int knot_response_init_from_query(knot_packet_t *response,
{
if (response == NULL || query == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// copy the header from the query
@@ -935,6 +977,13 @@ void knot_response_clear(knot_packet_t *resp, int clear_question)
resp->ns_rrsets = 0;
resp->ar_rrsets = 0;
+ // free copied names for compression
+ for (int i = 0; i < resp->compression.count; ++i) {
+ if (resp->compression.to_free[i]) {
+ knot_dname_release(
+ (knot_dname_t *)resp->compression.dnames[i]);
+ }
+ }
resp->compression.count = 0;
/*! \todo Temporary RRSets are not deallocated, which may potentially
@@ -961,7 +1010,7 @@ int knot_response_add_opt(knot_packet_t *resp,
int add_nsid)
{
if (resp == NULL || opt_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// copy the OPT RR
@@ -1032,7 +1081,7 @@ int knot_response_add_rrset_answer(knot_packet_t *response,
int rotate)
{
if (response == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_response_verb("add_rrset_answer()\n");
@@ -1085,7 +1134,7 @@ int knot_response_add_rrset_authority(knot_packet_t *response,
int rotate)
{
if (response == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(response->header.arcount == 0);
@@ -1134,7 +1183,7 @@ int knot_response_add_rrset_additional(knot_packet_t *response,
int rotate)
{
if (response == NULL || rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret;
@@ -1223,7 +1272,7 @@ int knot_response_add_nsid(knot_packet_t *response, const uint8_t *data,
uint16_t length)
{
if (response == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_edns_add_option(&response->opt_rr,
@@ -1237,7 +1286,7 @@ int knot_response_add_wildcard_node(knot_packet_t *response,
const knot_dname_t *sname)
{
if (response == NULL || node == NULL || sname == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (response->wildcard_nodes.count == response->wildcard_nodes.max
diff --git a/src/libknot/packet/response.h b/src/libknot/packet/response.h
index d3e66f3..beb1a59 100755..100644
--- a/src/libknot/packet/response.h
+++ b/src/libknot/packet/response.h
@@ -89,7 +89,7 @@ void knot_response_clear(knot_packet_t *resp, int clear_question);
* \param opt_rr OPT RR to set.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*
* \todo Needs test.
diff --git a/src/libknot/rdata.c b/src/libknot/rdata.c
index 1cdd339..9bcdbe5 100755..100644
--- a/src/libknot/rdata.c
+++ b/src/libknot/rdata.c
@@ -25,7 +25,6 @@
#include "rdata.h"
#include "util/descriptor.h"
#include "dname.h"
-#include "util/error.h"
#include "zone/node.h"
#include "util/utils.h"
#include "util/debug.h"
@@ -408,7 +407,7 @@ int knot_rdata_set_item(knot_rdata_t *rdata, uint pos,
knot_rdata_item_t item)
{
if (pos >= rdata->count) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*! \todo As in set_items() we should increment refcounter for dnames,
@@ -433,7 +432,7 @@ int knot_rdata_set_items(knot_rdata_t *rdata,
{
if (rdata == NULL || items == NULL || count == 0 ||
rdata->items != NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(rdata->count == 0);
@@ -483,7 +482,7 @@ int knot_rdata_item_set_dname(knot_rdata_t *rdata, uint pos,
knot_dname_t *dname)
{
if (pos >= rdata->count) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Retain dname. */
@@ -500,7 +499,7 @@ int knot_rdata_item_set_raw_data(knot_rdata_t *rdata, uint pos,
uint16_t *raw_data)
{
if (pos >= rdata->count) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
rdata->items[pos].raw_data = raw_data;
diff --git a/src/libknot/rdata.h b/src/libknot/rdata.h
index acd678f..57517bd 100755..100644
--- a/src/libknot/rdata.h
+++ b/src/libknot/rdata.h
@@ -131,7 +131,7 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
* \param item RDATA item value to be set.
*
* \retval KNOT_EOK if successful.
- * \retval KNOT_EBADARG if \a pos is not a valid position.
+ * \retval KNOT_EINVAL if \a pos is not a valid position.
*
* \todo Use the union or a pointer to it as parameter? IMHO there is always
* only one pointer that is copied, so it doesn't matter.
@@ -152,7 +152,7 @@ int knot_rdata_set_item(knot_rdata_t *rdata, unsigned int pos,
* \param count Count of RDATA items to be stored.
*
* \retval 0 if successful.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_rdata_set_items(knot_rdata_t *rdata,
@@ -202,7 +202,7 @@ const knot_rdata_item_t *knot_rdata_item(const knot_rdata_t *rdata,
* \param dname Domain name to set to the item.
*
* \retval KNOT_EOK if successful.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_rdata_item_set_dname(knot_rdata_t *rdata, unsigned int pos,
knot_dname_t *dname);
@@ -215,7 +215,7 @@ int knot_rdata_item_set_dname(knot_rdata_t *rdata, unsigned int pos,
* \param raw_data Raw data to set to the item.
*
* \retval KNOT_EOK if successful.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_rdata_item_set_raw_data(knot_rdata_t *rdata, unsigned int pos,
uint16_t *raw_data);
diff --git a/src/libknot/rrset.c b/src/libknot/rrset.c
index ef7fce8..d8b10ce 100755..100644
--- a/src/libknot/rrset.c
+++ b/src/libknot/rrset.c
@@ -23,7 +23,6 @@
#include "common.h"
#include "rrset.h"
#include "util/descriptor.h"
-#include "util/error.h"
#include "util/debug.h"
#include "util/utils.h"
@@ -91,7 +90,7 @@ knot_rrset_t *knot_rrset_new(knot_dname_t *owner, uint16_t type,
int knot_rrset_add_rdata(knot_rrset_t *rrset, knot_rdata_t *rdata)
{
if (rrset == NULL || rdata == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (rrset->rdata == NULL) {
@@ -117,7 +116,7 @@ int knot_rrset_add_rdata_order(knot_rrset_t *rrset, knot_rdata_t *rdata)
{
if (rrset == NULL || rdata == NULL) {
dbg_rrset("rrset: add_rdata_order: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (rrset->rdata == NULL) {
@@ -194,7 +193,7 @@ knot_rdata_t *knot_rrset_remove_rdata(knot_rrset_t *rrset,
int knot_rrset_set_rrsigs(knot_rrset_t *rrset, knot_rrset_t *rrsigs)
{
if (rrset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
rrset->rrsigs = rrsigs;
@@ -208,7 +207,7 @@ int knot_rrset_add_rrsigs(knot_rrset_t *rrset, knot_rrset_t *rrsigs,
{
if (rrset == NULL || rrsigs == NULL
|| knot_dname_compare(rrset->owner, rrsigs->owner) != 0) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int rc;
@@ -393,13 +392,13 @@ knot_rrset_t *knot_rrset_get_rrsigs(knot_rrset_t *rrset)
int knot_rrset_compare_rdata(const knot_rrset_t *r1, const knot_rrset_t *r2)
{
if (r1 == NULL || r2 == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrtype_descriptor_t *desc =
knot_rrtype_descriptor_by_type(r1->type);
if (desc == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// compare RDATA sets (order is not significant)
@@ -634,7 +633,7 @@ int knot_rrset_deep_copy(const knot_rrset_t *from, knot_rrset_t **to,
int copy_rdata_dnames)
{
if (from == NULL || to == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret;
@@ -774,7 +773,7 @@ int knot_rrset_merge(void **r1, void **r2)
if ((knot_dname_compare(rrset1->owner, rrset2->owner) != 0)
|| rrset1->rclass != rrset2->rclass
|| rrset1->type != rrset2->type) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// add all RDATAs from rrset2 to rrset1 (i.e. concatenate linked lists)
@@ -814,14 +813,14 @@ int knot_rrset_merge_no_dupl(void **r1, void **r2)
{
if (r1 == NULL || r2 == NULL) {
dbg_rrset("rrset: merge_no_dupl: NULL arguments.");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrset_t *rrset1 = (knot_rrset_t *)(*r1);
knot_rrset_t *rrset2 = (knot_rrset_t *)(*r2);
if (rrset1 == NULL || rrset2 == NULL) {
dbg_rrset("rrset: merge_no_dupl: NULL arguments.");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_rrset_exec_detail(
@@ -835,7 +834,7 @@ dbg_rrset_exec_detail(
|| rrset1->type != rrset2->type) {
dbg_rrset("rrset: merge_no_dupl: Trying to merge "
"different RRs.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *walk2 = rrset2->rdata;
diff --git a/src/libknot/rrset.h b/src/libknot/rrset.h
index 36d8da5..b5b62db 100755..100644
--- a/src/libknot/rrset.h
+++ b/src/libknot/rrset.h
@@ -99,7 +99,7 @@ knot_rrset_t *knot_rrset_new(knot_dname_t *owner, uint16_t type,
* \param rdata RDATA to add to the RRSet.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*
* \todo Provide some function for comparing RDATAs.
*/
@@ -114,7 +114,7 @@ int knot_rrset_add_rdata(knot_rrset_t *rrset, knot_rdata_t *rdata);
* \param rdata RDATA to add to the RRSet.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*
* \todo Provide some function for comparing RDATAs.
*/
@@ -130,7 +130,7 @@ knot_rdata_t * knot_rrset_remove_rdata(knot_rrset_t *rrset,
* \param rrsigs Set of RRSIGs covering this RRSet.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_rrset_set_rrsigs(knot_rrset_t *rrset, knot_rrset_t *rrsigs);
@@ -322,7 +322,7 @@ void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
* \param r2 Poitner to RRSet to be merged.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG if the RRSets could not be merged, because their
+ * \retval KNOT_EINVAL if the RRSets could not be merged, because their
* Owner, Type, Class or TTL does not match.
*/
int knot_rrset_merge(void **r1, void **r2);
@@ -342,7 +342,7 @@ int knot_rrset_merge(void **r1, void **r2);
* \param r2 Poitner to RRSet to be merged.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG if the RRSets could not be merged, because their
+ * \retval KNOT_EINVAL if the RRSets could not be merged, because their
* Owner, Type, Class or TTL does not match.
*/
int knot_rrset_merge_no_dupl(void **r1, void **r2);
diff --git a/src/libknot/tsig-op.c b/src/libknot/tsig-op.c
index 173538c..cb280ab 100755..100644
--- a/src/libknot/tsig-op.c
+++ b/src/libknot/tsig-op.c
@@ -25,7 +25,6 @@
#include "tsig.h"
#include "tsig-op.h"
#include "util/wire.h"
-#include "util/error.h"
#include "util/debug.h"
#include "consts.h"
@@ -39,7 +38,7 @@ enum b64_const {
static int knot_tsig_check_algorithm(const knot_rrset_t *tsig_rr)
{
if (tsig_rr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_dname_t *alg_name = tsig_rdata_alg_name(tsig_rr);
@@ -61,7 +60,7 @@ static int knot_tsig_check_key(const knot_rrset_t *tsig_rr,
const knot_key_t *tsig_key)
{
if (tsig_rr == NULL || tsig_key == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_dname_t *tsig_name = knot_rrset_owner(tsig_rr);
@@ -91,7 +90,7 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
{
if (!wire || !digest || !digest_len || !key) {
dbg_tsig("TSIG: digest: bad args.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (!key->name) {
@@ -107,6 +106,7 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
/* Decode key from Base64. */
char decoded_key[B64BUFSIZE];
+ memset(decoded_key, 0, sizeof(decoded_key));
size_t decoded_key_size = B64BUFSIZE;
int ret = base64_decode(key->secret, strlen(key->secret),
@@ -123,7 +123,8 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
}
dbg_tsig_detail("TSIG: decoded key size: %d\n", decoded_key_size);
- dbg_tsig_detail("TSIG: decoded key: '%*s'\n", decoded_key_size, decoded_key);
+ dbg_tsig_detail("TSIG: decoded key:\n");
+ dbg_tsig_hex_detail(decoded_key, decoded_key_size);
dbg_tsig_detail("Wire for signing is %zu bytes long.\n", wire_len);
/* Compute digest. */
@@ -161,7 +162,7 @@ static int knot_tsig_check_time_signed(const knot_rrset_t *tsig_rr,
{
if (!tsig_rr) {
dbg_tsig("TSIG: check_time_signed: NULL argument.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Get the time signed and fudge values. */
@@ -194,18 +195,18 @@ static int knot_tsig_check_time_signed(const knot_rrset_t *tsig_rr,
}
static int knot_tsig_write_tsig_variables(uint8_t *wire,
- const knot_rrset_t *tsig_rr)
+ const knot_rrset_t *tsig_rr)
{
if (wire == NULL || tsig_rr == NULL) {
dbg_tsig("TSIG: write tsig variables: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Copy TSIG variables - starting with key name. */
const knot_dname_t *tsig_owner = knot_rrset_owner(tsig_rr);
if (!tsig_owner) {
dbg_tsig("TSIG: write variables: no owner.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int offset = 0;
@@ -236,20 +237,34 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
const knot_dname_t *alg_name = tsig_rdata_alg_name(tsig_rr);
if (!alg_name) {
dbg_tsig("TSIG: write variables: no algorithm name.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
- memcpy(wire + offset, knot_dname_name(alg_name),
- sizeof(uint8_t) * knot_dname_size(alg_name));
- offset += knot_dname_size(alg_name);
+ /* The algorithm name must be in canonical form, i.e. in lowercase. */
+ if (knot_dname_to_lower_copy(alg_name, (char *)(wire + offset),
+ knot_dname_size(alg_name)) != KNOT_EOK)
+ {
+ dbg_tsig("TSIG: write variables: cannot convert algorithm "
+ "to lowercase.\n");
+ return KNOT_EINVAL;
+ }
+
+#if defined(KNOT_TSIG_DEBUG) && defined(DEBUG_ENABLE_VERBOSE)
+// char *_algstr = knot_dname_to_str(alg_name);
dbg_tsig_verb("TSIG: write variables: written alg name: %s\n",
- knot_dname_to_str(alg_name));
+ wire + offset);
+// free(_algstr);
+#endif
+
+// memcpy(wire + offset, knot_dname_name(alg_name),
+// sizeof(uint8_t) * knot_dname_size(alg_name));
+ offset += knot_dname_size(alg_name);
/* Following data are written in network order. */
/* Time signed. */
knot_wire_write_u48(wire + offset, tsig_rdata_time_signed(tsig_rr));
offset += 6;
- dbg_tsig_verb("TSIG: write variables: time signed: %llu - ",
+ dbg_tsig_verb("TSIG: write variables: time signed: %llu \n",
tsig_rdata_time_signed(tsig_rr));
dbg_tsig_hex_detail(wire + offset - 6, 6);
/* Fudge. */
@@ -266,7 +281,7 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
const uint8_t *other_data = tsig_rdata_other_data(tsig_rr);
if (!other_data) {
dbg_tsig("TSIG: write variables: no other data.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
@@ -288,7 +303,7 @@ static int knot_tsig_wire_write_timers(uint8_t *wire,
{
if (wire == NULL || tsig_rr == NULL) {
dbg_tsig("TSIG: write timers: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
//write time signed
@@ -308,7 +323,7 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
{
if (!msg || !key || digest_len == NULL) {
dbg_tsig("TSIG: create wire: bad args.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Create tmp TSIG. */
@@ -343,7 +358,7 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
}
dbg_tsig_verb("Copying request mac.\n");
memcpy(pos, request_mac, sizeof(uint8_t) * request_mac_len);
- dbg_tsig_detail("TSIG: create wire: request mac: ");
+ dbg_tsig_detail("TSIG: create wire: request mac:\n");
dbg_tsig_hex_detail(pos, request_mac_len);
pos += request_mac_len;
/* Copy the original message. */
@@ -361,8 +376,7 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
}
/* Compute digest. */
- ret = knot_tsig_compute_digest(wire, wire_len,
- digest, digest_len, key);
+ ret = knot_tsig_compute_digest(wire, wire_len, digest, digest_len, key);
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: create wire: failed to compute digest: %s\n",
knot_strerror(ret));
@@ -385,7 +399,7 @@ static int knot_tsig_create_sign_wire_next(const uint8_t *msg, size_t msg_len,
{
if (!msg || !key || digest_len == NULL) {
dbg_tsig("TSIG: create wire: bad args.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Create tmp TSIG. */
@@ -414,7 +428,7 @@ static int knot_tsig_create_sign_wire_next(const uint8_t *msg, size_t msg_len,
knot_wire_write_u16(wire, prev_mac_len);
dbg_tsig_verb("Copying request mac.\n");
memcpy(wire + 2, prev_mac, sizeof(uint8_t) * prev_mac_len);
- dbg_tsig_detail("TSIG: create wire: request mac: ");
+ dbg_tsig_detail("TSIG: create wire: request mac:\n");
dbg_tsig_hex_detail(wire + 2, prev_mac_len);
/* Copy the original message. */
dbg_tsig_verb("Copying original message.\n");
@@ -455,7 +469,7 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
uint64_t request_time_signed)
{
if (!msg || !msg_len || !key || digest == NULL || digest_len == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_dname_t *key_name_copy = knot_dname_deep_copy(key->name);
@@ -555,14 +569,14 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: could not create wire or sign wire: %s\n",
knot_strerror(ret));
- knot_rrset_free(&tmp_tsig);
- knot_rdata_free(&rdata);
-
+ knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
return ret;
}
/* Set the digest. */
size_t tsig_wire_len = msg_max_len - *msg_len;
+ dbg_tsig("TSIG: msg_len=%zu, msg_max_len=%zu, tsig_max_len=%zu\n",
+ *msg_len, msg_max_len, tsig_wire_len);
int rr_count = 0;
tsig_rdata_set_mac(tmp_tsig, digest_tmp_len, digest_tmp);
@@ -572,8 +586,7 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: rrset_to_wire = %s\n", knot_strerror(ret));
*digest_len = 0;
- knot_rrset_free(&tmp_tsig);
- knot_rdata_free(&rdata);
+ knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
return ret;
}
@@ -598,7 +611,7 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
size_t to_sign_len)
{
if (!msg || !msg_len || !key || !key || !digest || !digest_len) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
uint8_t digest_tmp[KNOT_TSIG_MAX_DIGEST_SIZE];
@@ -737,7 +750,7 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
/* This should not happen, at least one rr has to be converted. */
if (rr_count == 0) {
knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
@@ -761,7 +774,7 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
int use_times)
{
if (!tsig_rr || !wire || !tsig_key) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Check time signed. */
@@ -906,7 +919,7 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
/*! \todo Revise!! */
if (!msg || !msg_len || !tsig_rr) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*! \todo What key to use, when we do not sign? Does this even work? */
@@ -924,6 +937,9 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
knot_dname_free(&key_name);
return KNOT_ENOMEM;
}
+
+ /* Already referenced in tmp_tsig, release. */
+ knot_dname_release(key_name);
/* Create rdata for TSIG RR. */
knot_rdata_t *rdata = knot_rdata_new();
@@ -944,7 +960,6 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
malloc(sizeof(knot_rdata_item_t) * desc->length);
if (items == NULL) {
dbg_tsig("TSIG: items = NULL\n");
- ERR_ALLOC_FAILED;
knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
return KNOT_ENOMEM;
}
@@ -1000,8 +1015,8 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
return ret;
}
+ /* key_name already referenced in RRSet, no need to free separately. */
knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
- knot_dname_release(key_name);
*msg_len += tsig_wire_len;
diff --git a/src/libknot/tsig-op.h b/src/libknot/tsig-op.h
index 07a84a8..07a84a8 100755..100644
--- a/src/libknot/tsig-op.h
+++ b/src/libknot/tsig-op.h
diff --git a/src/libknot/tsig.c b/src/libknot/tsig.c
index 86b7f9d..a4a8f1b 100755..100644
--- a/src/libknot/tsig.c
+++ b/src/libknot/tsig.c
@@ -21,7 +21,6 @@
#include <time.h>
#include "tsig.h"
-#include "util/error.h"
#include "util/debug.h"
#include "common.h"
#include "util/utils.h"
@@ -45,7 +44,7 @@ static knot_lookup_table_t tsig_alg_table[TSIG_ALG_TABLE_SIZE] = {
int tsig_rdata_init(knot_rrset_t *tsig)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Initializes rdata. */
@@ -69,12 +68,12 @@ int tsig_rdata_init(knot_rrset_t *tsig)
int tsig_rdata_set_alg_name(knot_rrset_t *tsig, knot_dname_t *alg_name)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 1);
@@ -94,12 +93,12 @@ int tsig_rdata_set_alg_name(knot_rrset_t *tsig, knot_dname_t *alg_name)
int tsig_rdata_set_alg(knot_rrset_t *tsig, tsig_algorithm_t alg)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 1);
@@ -122,12 +121,12 @@ int tsig_rdata_set_alg(knot_rrset_t *tsig, tsig_algorithm_t alg)
int tsig_rdata_set_time_signed(knot_rrset_t *tsig, uint64_t time)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 2);
@@ -150,12 +149,12 @@ int tsig_rdata_set_time_signed(knot_rrset_t *tsig, uint64_t time)
int tsig_rdata_set_fudge(knot_rrset_t *tsig, uint16_t fudge)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 3);
@@ -178,12 +177,12 @@ int tsig_rdata_set_fudge(knot_rrset_t *tsig, uint16_t fudge)
int tsig_rdata_set_mac(knot_rrset_t *tsig, uint16_t length, const uint8_t *mac)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 4);
@@ -207,12 +206,12 @@ int tsig_rdata_set_mac(knot_rrset_t *tsig, uint16_t length, const uint8_t *mac)
int tsig_rdata_set_orig_id(knot_rrset_t *tsig, uint16_t id)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 5);
@@ -235,12 +234,12 @@ int tsig_rdata_set_orig_id(knot_rrset_t *tsig, uint16_t id)
int tsig_rdata_set_tsig_error(knot_rrset_t *tsig, uint16_t tsig_error)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 6);
@@ -264,12 +263,12 @@ int tsig_rdata_set_other_data(knot_rrset_t *tsig, uint16_t length,
const uint8_t *other_data)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rdata_t *rdata = knot_rrset_get_rdata(tsig);
if (!rdata) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
assert(knot_rdata_item_count(rdata) >= 6);
@@ -587,7 +586,7 @@ size_t tsig_rdata_tsig_timers_length()
int tsig_rdata_store_current_time(knot_rrset_t *tsig)
{
if (!tsig) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
time_t curr_time = time(NULL);
/*! \todo bleeding eyes. */
diff --git a/src/libknot/tsig.h b/src/libknot/tsig.h
index 249184d..cd5910f 100755..100644
--- a/src/libknot/tsig.h
+++ b/src/libknot/tsig.h
@@ -78,7 +78,7 @@ enum tsig_consts {
+ 6 // time signed
};
-/*! TSIG errors are defined in util/error.h
+/*! TSIG errors are defined in common/errcode.h
* and present negative value of the TSIG error to
* comply with other parts of the library.
*
diff --git a/src/libknot/updates/changesets.c b/src/libknot/updates/changesets.c
index 502a858..ab83b07 100755..100644
--- a/src/libknot/updates/changesets.c
+++ b/src/libknot/updates/changesets.c
@@ -19,9 +19,8 @@
#include <assert.h>
#include "updates/changesets.h"
-
+#include "libknot/common.h"
#include "rrset.h"
-#include "util/error.h"
static const size_t KNOT_CHANGESET_COUNT = 5;
static const size_t KNOT_CHANGESET_STEP = 5;
diff --git a/src/libknot/updates/changesets.h b/src/libknot/updates/changesets.h
index 642b155..642b155 100755..100644
--- a/src/libknot/updates/changesets.h
+++ b/src/libknot/updates/changesets.h
diff --git a/src/libknot/updates/ddns.c b/src/libknot/updates/ddns.c
index 905c44b..72a1be9 100755..100644
--- a/src/libknot/updates/ddns.c
+++ b/src/libknot/updates/ddns.c
@@ -20,7 +20,6 @@
#include "updates/changesets.h"
#include "util/debug.h"
#include "packet/packet.h"
-#include "util/error.h"
#include "consts.h"
/*----------------------------------------------------------------------------*/
@@ -410,7 +409,7 @@ int knot_ddns_check_zone(const knot_zone_t *zone, knot_packet_t *query,
uint8_t *rcode)
{
if (zone == NULL || query == NULL || rcode == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (knot_packet_qtype(query) != KNOT_RRTYPE_SOA) {
@@ -448,7 +447,7 @@ int knot_ddns_process_prereqs(knot_packet_t *query,
*/
if (query == NULL || prereqs == NULL || rcode == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// allocate space for the prerequisities
@@ -573,7 +572,7 @@ int knot_ddns_process_update(knot_packet_t *query,
// it will be distinguished when applying to the zone
if (query == NULL || changeset == NULL || rcode == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
*changeset = (knot_changeset_t *)calloc(1, sizeof(knot_changeset_t));
diff --git a/src/libknot/updates/ddns.h b/src/libknot/updates/ddns.h
index 35dfcb7..35dfcb7 100755..100644
--- a/src/libknot/updates/ddns.h
+++ b/src/libknot/updates/ddns.h
diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c
index c870ece..7d3ffdf 100755..100644
--- a/src/libknot/updates/xfr-in.c
+++ b/src/libknot/updates/xfr-in.c
@@ -26,7 +26,6 @@
#include "dname.h"
#include "zone/zone.h"
#include "packet/query.h"
-#include "util/error.h"
#include "updates/changesets.h"
#include "tsig.h"
#include "tsig-op.h"
@@ -447,7 +446,7 @@ int xfrin_process_axfr_packet(knot_ns_xfr_t *xfr)
(xfrin_constructed_zone_t **)(&xfr->data);
if (pkt == NULL || constr == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_xfrin_verb("Processing AXFR packet of size %zu.\n", size);
@@ -923,7 +922,7 @@ int xfrin_process_ixfr_packet(knot_ns_xfr_t *xfr)
if (pkt == NULL || chs == NULL) {
dbg_xfrin("Wrong parameters supported.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// check if the response is OK
@@ -1015,7 +1014,7 @@ int xfrin_process_ixfr_packet(knot_ns_xfr_t *xfr)
if ((*chs)->first_soa == NULL) {
dbg_xfrin("Changesets don't contain SOA first!\n");
knot_rrset_deep_free(&rr, 1, 1, 1);
- ret = KNOT_EBADARG;
+ ret = KNOT_EINVAL;
goto cleanup;
}
dbg_xfrin_detail("Changesets present.\n");
@@ -1239,6 +1238,9 @@ static int xfrin_changes_check_rrsets(knot_rrset_t ***rrsets,
}
int new_count = (*allocated == 0) ? 2 : *allocated * 2;
+ while (new_count < *count + to_add) {
+ new_count *= 2;
+ }
/* Allocate new memory block. */
knot_rrset_t **rrsets_new = malloc(new_count * sizeof(knot_rrset_t *));
@@ -3073,12 +3075,13 @@ int xfrin_apply_changesets(knot_zone_t *zone,
{
if (zone == NULL || chsets == NULL || chsets->count == 0
|| new_contents == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_contents_t *old_contents = knot_zone_get_contents(zone);
if (!old_contents) {
- return KNOT_EBADARG;
+ dbg_xfrin("Cannot apply changesets to empty zone.\n");
+ return KNOT_EINVAL;
}
dbg_xfrin("Applying changesets to zone...\n");
@@ -3219,7 +3222,7 @@ int xfrin_switch_zone(knot_zone_t *zone,
int transfer_type)
{
if (zone == NULL || new_contents == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_xfrin("Switching zone contents.\n");
diff --git a/src/libknot/updates/xfr-in.h b/src/libknot/updates/xfr-in.h
index a762b81..a762b81 100755..100644
--- a/src/libknot/updates/xfr-in.h
+++ b/src/libknot/updates/xfr-in.h
diff --git a/src/libknot/util/debug.c b/src/libknot/util/debug.c
index a6555ad..a6555ad 100755..100644
--- a/src/libknot/util/debug.c
+++ b/src/libknot/util/debug.c
diff --git a/src/libknot/util/debug.h b/src/libknot/util/debug.h
index 731fed8..731fed8 100755..100644
--- a/src/libknot/util/debug.h
+++ b/src/libknot/util/debug.h
diff --git a/src/libknot/util/descriptor.c b/src/libknot/util/descriptor.c
index 35ae77e..1588a2e 100755..100644
--- a/src/libknot/util/descriptor.c
+++ b/src/libknot/util/descriptor.c
@@ -118,7 +118,7 @@ static knot_rrtype_descriptor_t
/* 13 */
{ KNOT_RRTYPE_HINFO, "HINFO", 2,
{ KNOT_RDATA_WF_TEXT_SINGLE, KNOT_RDATA_WF_TEXT_SINGLE },
- { KNOT_RDATA_ZF_TEXT, KNOT_RDATA_ZF_TEXT }, true },
+ { KNOT_RDATA_ZF_TEXT_SINGLE, KNOT_RDATA_ZF_TEXT_SINGLE }, true },
/* 14 */
{ KNOT_RRTYPE_MINFO, "MINFO", 2,
{ KNOT_RDATA_WF_COMPRESSED_DNAME,
@@ -145,11 +145,11 @@ static knot_rrtype_descriptor_t
/* 19 */
{ KNOT_RRTYPE_X25, "X25", 1,
{ KNOT_RDATA_WF_TEXT_SINGLE },
- { KNOT_RDATA_ZF_TEXT }, true },
+ { KNOT_RDATA_ZF_TEXT_SINGLE }, true },
/* 20 */
{ KNOT_RRTYPE_ISDN, "ISDN", 2,
{ KNOT_RDATA_WF_TEXT_SINGLE, KNOT_RDATA_WF_TEXT_SINGLE },
- { KNOT_RDATA_ZF_TEXT, KNOT_RDATA_ZF_TEXT }, false },
+ { KNOT_RDATA_ZF_TEXT_SINGLE, KNOT_RDATA_ZF_TEXT_SINGLE }, false },
/* 21 */
{ KNOT_RRTYPE_RT, "RT", 2,
{ KNOT_RDATA_WF_SHORT, KNOT_RDATA_WF_COMPRESSED_DNAME },
@@ -214,8 +214,9 @@ static knot_rrtype_descriptor_t
{ KNOT_RDATA_WF_SHORT, KNOT_RDATA_WF_SHORT, KNOT_RDATA_WF_TEXT_SINGLE,
KNOT_RDATA_WF_TEXT_SINGLE, KNOT_RDATA_WF_TEXT_SINGLE,
KNOT_RDATA_WF_UNCOMPRESSED_DNAME },
- { KNOT_RDATA_ZF_SHORT, KNOT_RDATA_ZF_SHORT, KNOT_RDATA_ZF_TEXT, KNOT_RDATA_ZF_TEXT,
- KNOT_RDATA_ZF_TEXT, KNOT_RDATA_ZF_DNAME }, true },
+ { KNOT_RDATA_ZF_SHORT, KNOT_RDATA_ZF_SHORT, KNOT_RDATA_ZF_TEXT_SINGLE,
+ KNOT_RDATA_ZF_TEXT_SINGLE, KNOT_RDATA_ZF_TEXT_SINGLE,
+ KNOT_RDATA_ZF_DNAME }, true },
/* 36 */
{ KNOT_RRTYPE_KX, "KX", 2,
{ KNOT_RDATA_WF_SHORT,
@@ -387,12 +388,14 @@ static knot_rrtype_descriptor_t
/* it is indeed needed, in rrtype_from_string */
/* There's a GNU extension that works like this: [first ... last] = value */
-
+
+ [53 ... 98] = { 0, NULL, 1, { KNOT_RDATA_WF_BINARY }, { KNOT_RDATA_ZF_UNKNOWN }, true },
/* 99 */
[99] = { KNOT_RRTYPE_SPF, "SPF", 1,
{ KNOT_RDATA_WF_TEXT },
{ KNOT_RDATA_ZF_TEXT }, false },
/* TSIG pseudo RR. */
+ [100 ... 249] = { 0, NULL, 1, { KNOT_RDATA_WF_BINARY }, { KNOT_RDATA_ZF_UNKNOWN }, true },
[250] = { KNOT_RRTYPE_TSIG, "TSIG", 7,
{ KNOT_RDATA_WF_UNCOMPRESSED_DNAME, KNOT_RDATA_WF_UINT48,
KNOT_RDATA_WF_SHORT, KNOT_RDATA_WF_BINARYWITHSHORT,
diff --git a/src/libknot/util/descriptor.h b/src/libknot/util/descriptor.h
index b7e4a53..6364e5b 100755..100644
--- a/src/libknot/util/descriptor.h
+++ b/src/libknot/util/descriptor.h
@@ -186,7 +186,7 @@ enum knot_rdata_wireformat {
KNOT_RDATA_WF_SHORT = 2, /*!< 16-bit integer. */
KNOT_RDATA_WF_LONG = 4, /*!< 32-bit integer. */
KNOT_RDATA_WF_UINT48 = 8, /*!< 48-bit integer. */
- KNOT_RDATA_WF_TEXT = 53, /*!< Text string. */
+ KNOT_RDATA_WF_TEXT = 53, /*!< Array of text strings. */
KNOT_RDATA_WF_A = 58, /*!< 32-bit IPv4 address. */
KNOT_RDATA_WF_AAAA = 16, /*!< 128-bit IPv6 address. */
KNOT_RDATA_WF_BINARY = 54, /*!< Binary data (unknown length). */
@@ -205,7 +205,8 @@ enum knot_rdata_zoneformat
{
KNOT_RDATA_ZF_DNAME, /* Domain name. */
KNOT_RDATA_ZF_LITERAL_DNAME, /* DNS name (not lowercased domain name). */
- KNOT_RDATA_ZF_TEXT, /* Text string. */
+ KNOT_RDATA_ZF_TEXT, /* Array of text strings. */
+ KNOT_RDATA_ZF_TEXT_SINGLE, /* Text string. */
KNOT_RDATA_ZF_BYTE, /* 8-bit integer. */
KNOT_RDATA_ZF_SHORT, /* 16-bit integer. */
KNOT_RDATA_ZF_LONG, /* 32-bit integer. */
diff --git a/src/libknot/util/tolower.c b/src/libknot/util/tolower.c
index d71c467..d71c467 100755..100644
--- a/src/libknot/util/tolower.c
+++ b/src/libknot/util/tolower.c
diff --git a/src/libknot/util/tolower.h b/src/libknot/util/tolower.h
index 2e92258..2e92258 100755..100644
--- a/src/libknot/util/tolower.h
+++ b/src/libknot/util/tolower.h
diff --git a/src/libknot/util/utils.c b/src/libknot/util/utils.c
index 04e12c5..04e12c5 100755..100644
--- a/src/libknot/util/utils.c
+++ b/src/libknot/util/utils.c
diff --git a/src/libknot/util/utils.h b/src/libknot/util/utils.h
index fd275b3..fd275b3 100755..100644
--- a/src/libknot/util/utils.h
+++ b/src/libknot/util/utils.h
diff --git a/src/libknot/util/wire.h b/src/libknot/util/wire.h
index 0a24ff1..0a24ff1 100755..100644
--- a/src/libknot/util/wire.h
+++ b/src/libknot/util/wire.h
diff --git a/src/libknot/zone/dname-table.c b/src/libknot/zone/dname-table.c
index d2d97c2..f86bb90 100755..100644
--- a/src/libknot/zone/dname-table.c
+++ b/src/libknot/zone/dname-table.c
@@ -21,7 +21,6 @@
#include <stddef.h>
#include "zone/dname-table.h"
-#include "util/error.h"
/*!< Tree functions. */
TREE_DEFINE(dname_table_node, avl);
@@ -167,7 +166,7 @@ int knot_dname_table_add_dname(knot_dname_table_t *table,
knot_dname_t *dname)
{
if (dname == NULL || table == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Node for insertion has to be created */
@@ -199,7 +198,7 @@ int knot_dname_table_add_dname_check(knot_dname_table_t *table,
knot_dname_t *found_dname = NULL;
if (table == NULL || dname == NULL || *dname == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Fetch dname, need to release it later. */
diff --git a/src/libknot/zone/dname-table.h b/src/libknot/zone/dname-table.h
index 945b6de..945b6de 100755..100644
--- a/src/libknot/zone/dname-table.h
+++ b/src/libknot/zone/dname-table.h
diff --git a/src/libknot/zone/node.c b/src/libknot/zone/node.c
index c196f29..eca4abc 100755..100644
--- a/src/libknot/zone/node.c
+++ b/src/libknot/zone/node.c
@@ -24,7 +24,6 @@
#include "common.h"
#include "zone/node.h"
#include "rrset.h"
-#include "util/error.h"
#include "common/skip-list.h"
#include "common/tree.h"
#include "util/debug.h"
@@ -58,6 +57,17 @@ static inline void knot_node_flags_set_deleg(uint8_t *flags)
/*----------------------------------------------------------------------------*/
/*!
+ * \brief Clears the delegation point flag.
+ *
+ * \param flags Flags to clear the flag in.
+ */
+static inline void knot_node_flags_clear_deleg(uint8_t *flags)
+{
+ *flags &= ~KNOT_NODE_FLAGS_DELEG;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
* \brief Returns the non-authoritative node flag
*
* \param flags Flags to retrieve the flag from.
@@ -83,6 +93,17 @@ static inline void knot_node_flags_set_nonauth(uint8_t *flags)
/*----------------------------------------------------------------------------*/
/*!
+ * \brief Clears the non-authoritative node flag.
+ *
+ * \param flags Flags to clear the flag in.
+ */
+static inline void knot_node_flags_clear_nonauth(uint8_t *flags)
+{
+ *flags &= ~KNOT_NODE_FLAGS_NONAUTH;
+}
+
+/*----------------------------------------------------------------------------*/
+/*!
* \brief Sets the empty node flag.
*
* \param flags Flags to set the flag in.
@@ -161,7 +182,7 @@ int knot_node_add_rrset(knot_node_t *node, knot_rrset_t *rrset,
int merge)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret = 0;
@@ -264,7 +285,7 @@ void knot_node_remove_all_rrsets(knot_node_t *node)
short knot_node_rrset_count(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return node->rrset_count;
@@ -343,7 +364,7 @@ static void count_rrsets(void *node, void *data)
int knot_node_count_rrsets(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int count = 0;
@@ -400,7 +421,7 @@ void knot_node_set_parent(knot_node_t *node, knot_node_t *parent)
unsigned int knot_node_children(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return node->children;
@@ -637,7 +658,7 @@ void knot_node_set_deleg_point(knot_node_t *node)
int knot_node_is_deleg_point(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_node_flags_get_deleg(node->flags);
@@ -659,7 +680,7 @@ void knot_node_set_non_auth(knot_node_t *node)
int knot_node_is_non_auth(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_node_flags_get_nonauth(node->flags);
@@ -667,10 +688,22 @@ int knot_node_is_non_auth(const knot_node_t *node)
/*----------------------------------------------------------------------------*/
+void knot_node_set_auth(knot_node_t *node)
+{
+ if (node == NULL) {
+ return;
+ }
+
+ knot_node_flags_clear_nonauth(&node->flags);
+ knot_node_flags_clear_deleg(&node->flags);
+}
+
+/*----------------------------------------------------------------------------*/
+
int knot_node_is_auth(const knot_node_t *node)
{
if (node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return (node->flags == 0);
@@ -762,7 +795,7 @@ int knot_node_compare(knot_node_t *node1, knot_node_t *node2)
int knot_node_shallow_copy(const knot_node_t *from, knot_node_t **to)
{
if (from == NULL || to == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// create new node
diff --git a/src/libknot/zone/node.h b/src/libknot/zone/node.h
index 1ab814a..4e0b2c4 100755..100644
--- a/src/libknot/zone/node.h
+++ b/src/libknot/zone/node.h
@@ -383,6 +383,8 @@ void knot_node_set_non_auth(knot_node_t *node);
*/
int knot_node_is_non_auth(const knot_node_t *node);
+void knot_node_set_auth(knot_node_t *node);
+
int knot_node_is_auth(const knot_node_t *node);
int knot_node_is_new(const knot_node_t *node);
diff --git a/src/libknot/zone/zone-contents.c b/src/libknot/zone/zone-contents.c
index 7e453a5..61e9e51 100755..100644
--- a/src/libknot/zone/zone-contents.c
+++ b/src/libknot/zone/zone-contents.c
@@ -17,7 +17,6 @@
#include <assert.h>
#include "zone/zone-contents.h"
-#include "util/error.h"
#include "util/debug.h"
#include "common/base32hex.h"
/*! \todo XXX TODO FIXME remove once testing is done. */
@@ -74,14 +73,14 @@ static void knot_zone_tree_apply(knot_zone_tree_node_t *node,
*
* \retval KNOT_EOK if both arguments are non-NULL and the node belongs to the
* zone.
- * \retval KNOT_EBADARG if either of the arguments is NULL.
+ * \retval KNOT_EINVAL if either of the arguments is NULL.
* \retval KNOT_EBADZONE if the node does not belong to the zone.
*/
static int knot_zone_contents_check_node(
const knot_zone_contents_t *contents, const knot_node_t *node)
{
if (contents == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// assert or just check??
@@ -182,6 +181,15 @@ static int knot_zone_contents_dnames_from_rrset_to_table(
{
assert(table != NULL && rrset != NULL && owner != NULL);
+dbg_zone_exec_detail(
+ char *name = knot_dname_to_str(knot_rrset_owner(rrset));
+ dbg_zone_detail("Putting dnames from RRSet to table: owner: (%p) %s,"
+ " type: %s\n", knot_rrset_owner(rrset),
+ name, knot_rrtype_to_string(
+ knot_rrset_type(rrset)));
+ free(name);
+);
+
if (replace_owner) {
// discard the old owner and replace it with the new
knot_rrset_set_owner(rrset, owner);
@@ -248,6 +256,13 @@ dbg_zone_exec_detail(
dbg_zone_detail("Inserting RRSets from node to table.\n");
rc = knot_zone_contents_dnames_from_rrset_to_table(table,
rrsets[i], replace_owner, node->owner);
+
+ if (rc == KNOT_EOK && knot_rrset_rrsigs(rrsets[i]) != NULL) {
+ rc = knot_zone_contents_dnames_from_rrset_to_table(
+ table, knot_rrset_get_rrsigs(rrsets[i]),
+ replace_owner, node->owner);
+ }
+
if (rc != KNOT_EOK) {
return rc;
}
@@ -338,9 +353,9 @@ static void knot_zone_contents_adjust_rdata_item(knot_rdata_t *rdata,
knot_zone_contents_apex(zone)))) {
// The name's node is either already set
// or the name does not belong to the zone
- dbg_zone_detail("Name's node either set or the name "
+ dbg_zone_detail("Name's (%p) node either set or the name"
"does not belong to the zone (%p).\n",
- knot_dname_node(dname));
+ dname, knot_dname_node(dname));
return;
}
@@ -351,7 +366,7 @@ static void knot_zone_contents_adjust_rdata_item(knot_rdata_t *rdata,
int ret = knot_zone_contents_find_dname(zone, dname, &n,
&closest_encloser, &prev);
- if (ret == KNOT_EBADARG || ret == KNOT_EBADZONE) {
+ if (ret == KNOT_EINVAL || ret == KNOT_EBADZONE) {
// TODO: do some cleanup if needed
dbg_zone_detail("Failed to find the name in zone: %s\n",
knot_strerror(ret));
@@ -521,32 +536,6 @@ static void knot_zone_contents_adjust_node(knot_node_t *node,
/*! \note Enabled again after a LONG time. Should test thoroughly. */
knot_zone_contents_adjust_rrsets(node, zone);
-dbg_zone_exec_detail(
- if (knot_node_parent(node)) {
- char *name = knot_dname_to_str(knot_node_owner(
- knot_node_parent(node)));
- dbg_zone_detail("Parent: %s\n", name);
- dbg_zone_detail("Parent is delegation point: %s\n",
- knot_node_is_deleg_point(knot_node_parent(node))
- ? "yes" : "no");
- dbg_zone_detail("Parent is non-authoritative: %s\n",
- knot_node_is_non_auth(knot_node_parent(node))
- ? "yes" : "no");
- free(name);
- } else {
- dbg_zone_detail("No parent!\n");
- }
-);
- // delegation point / non-authoritative node
- if (knot_node_parent(node)
- && (knot_node_is_deleg_point(knot_node_parent(node))
- || knot_node_is_non_auth(knot_node_parent(node)))) {
- knot_node_set_non_auth(node);
- } else if (knot_node_rrset(node, KNOT_RRTYPE_NS) != NULL
- && node != zone->apex) {
- knot_node_set_deleg_point(node);
- }
-
// assure that owner has proper node
if (knot_dname_node(knot_node_owner(node)) == NULL) {
knot_dname_set_node(knot_node_get_owner(node), node);
@@ -647,8 +636,38 @@ static void knot_zone_contents_adjust_node_in_tree_ptr(
knot_zone_adjust_arg_t *args = (knot_zone_adjust_arg_t *)data;
knot_node_t *node = tnode->node;
+ dbg_zone_exec_detail(
+ if (knot_node_parent(node)) {
+ char *name = knot_dname_to_str(knot_node_owner(
+ knot_node_parent(node)));
+ dbg_zone_detail("Parent: %s\n", name);
+ dbg_zone_detail("Parent is delegation point: %s\n",
+ knot_node_is_deleg_point(knot_node_parent(node))
+ ? "yes" : "no");
+ dbg_zone_detail("Parent is non-authoritative: %s\n",
+ knot_node_is_non_auth(knot_node_parent(node))
+ ? "yes" : "no");
+ free(name);
+ } else {
+ dbg_zone_detail("No parent!\n");
+ }
+);
+ /*
+ * 1) delegation point / non-authoritative node
+ */
+ if (knot_node_parent(node)
+ && (knot_node_is_deleg_point(knot_node_parent(node))
+ || knot_node_is_non_auth(knot_node_parent(node)))) {
+ knot_node_set_non_auth(node);
+ } else if (knot_node_rrset(node, KNOT_RRTYPE_NS) != NULL
+ && node != args->zone->apex) {
+ knot_node_set_deleg_point(node);
+ } else {
+ knot_node_set_auth(node);
+ }
+
/*
- * 1) Set previous node pointer.
+ * 2) Set previous node pointer.
*/
knot_node_set_previous(node, args->previous_node);
@@ -657,7 +676,7 @@ static void knot_zone_contents_adjust_node_in_tree_ptr(
}
/*
- * 2) Store previous node depending on the type of this node.
+ * 3) Store previous node depending on the type of this node.
*/
if (!knot_node_is_non_auth(node)
&& knot_node_rrset_count(node) > 0) {
@@ -1268,7 +1287,7 @@ uint16_t knot_zone_contents_class(const knot_zone_contents_t *contents)
{
if (contents == NULL || contents->apex == NULL
|| knot_node_rrset(contents->apex, KNOT_RRTYPE_SOA) == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return knot_rrset_class(knot_node_rrset(contents->apex,
@@ -1282,7 +1301,7 @@ int knot_zone_contents_add_node(knot_zone_contents_t *zone,
uint8_t flags, int use_domain_table)
{
if (zone == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zone_exec_detail(
@@ -1477,7 +1496,7 @@ int knot_zone_contents_add_rrset(knot_zone_contents_t *zone,
{
if (zone == NULL || rrset == NULL || zone->apex == NULL
|| zone->apex->owner == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zone_exec_detail(
@@ -1570,7 +1589,7 @@ dbg_zone_exec(
}
}
);
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// check if the RRSet belongs to the zone
@@ -1587,7 +1606,7 @@ dbg_zone_exec(
&& (knot_dname_compare(knot_rrset_owner(rrsigs),
knot_rrset_owner(*rrset)) != 0)) {
dbg_zone("RRSIGs do not belong to the given RRSet.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// if no RRSet given, try to find the right RRSet
@@ -1676,7 +1695,7 @@ int knot_zone_contents_add_nsec3_node(knot_zone_contents_t *zone,
UNUSED(flags);
if (zone == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret = 0;
@@ -1727,7 +1746,7 @@ int knot_zone_contents_add_nsec3_rrset(knot_zone_contents_t *zone,
{
if (zone == NULL || rrset == NULL || zone->apex == NULL
|| zone->apex->owner == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// check if the RRSet belongs to the zone
@@ -1795,7 +1814,7 @@ int knot_zone_contents_remove_node(knot_zone_contents_t *contents,
ck_hash_table_item_t **removed_hash)
{
if (contents == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_dname_t *owner = knot_node_owner(node);
@@ -1831,7 +1850,7 @@ int knot_zone_contents_remove_nsec3_node(knot_zone_contents_t *contents,
const knot_node_t *node, knot_zone_tree_node_t **removed)
{
if (contents == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_dname_t *owner = knot_node_owner(node);
@@ -1852,7 +1871,7 @@ int knot_zone_contents_create_and_fill_hash_table(
knot_zone_contents_t *zone)
{
if (zone == NULL || zone->apex == NULL || zone->apex->owner == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
* 1) Create hash table.
@@ -1955,7 +1974,7 @@ int knot_zone_contents_find_dname(const knot_zone_contents_t *zone,
if (zone == NULL || name == NULL || node == NULL
|| closest_encloser == NULL || previous == NULL
|| zone->apex == NULL || zone->apex->owner == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zone_exec_verb(
@@ -2115,7 +2134,7 @@ int knot_zone_contents_find_dname_hash(const knot_zone_contents_t *zone,
{
if (zone == NULL || name == NULL || node == NULL
|| closest_encloser == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zone_exec_verb(
@@ -2206,7 +2225,7 @@ int knot_zone_contents_find_nsec3_for_name(const knot_zone_contents_t *zone,
{
if (zone == NULL || name == NULL
|| nsec3_node == NULL || nsec3_previous == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_dname_t *nsec3_name = NULL;
@@ -2359,7 +2378,7 @@ knot_node_t *knot_zone_contents_get_apex(const knot_zone_contents_t *zone)
int knot_zone_contents_adjust(knot_zone_contents_t *zone)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// load NSEC3PARAM (needed on adjusting function)
@@ -2374,6 +2393,9 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone)
/*
* First of all we must set node.prev pointers, as these are used in
* the search functions.
+ *
+ * We must also set flags, as these are required to set the prev
+ * pointers well.
*/
dbg_zone("Setting 'prev' pointers to NSEC3 nodes.\n");
int ret = knot_zone_tree_forward_apply_inorder(zone->nsec3_nodes,
@@ -2451,7 +2473,7 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone)
int knot_zone_contents_check_loops(knot_zone_contents_t *zone)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zone("Checking CNAME and wildcard loops.\n");
@@ -2480,7 +2502,7 @@ int knot_zone_contents_check_loops(knot_zone_contents_t *zone)
int knot_zone_contents_load_nsec3param(knot_zone_contents_t *zone)
{
if (zone == NULL || zone->apex == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_rrset_t *rrset = knot_node_rrset(zone->apex,
@@ -2501,7 +2523,7 @@ int knot_zone_contents_load_nsec3param(knot_zone_contents_t *zone)
int knot_zone_contents_nsec3_enabled(const knot_zone_contents_t *zone)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return (zone->nsec3_params.algorithm != 0
@@ -2531,7 +2553,7 @@ int knot_zone_contents_tree_apply_postorder(knot_zone_contents_t *zone,
void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2549,7 +2571,7 @@ int knot_zone_contents_tree_apply_inorder(knot_zone_contents_t *zone,
void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2567,7 +2589,7 @@ int knot_zone_contents_tree_apply_inorder_reverse(
void (*function)(knot_node_t *node, void *data), void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2585,7 +2607,7 @@ int knot_zone_contents_nsec3_apply_postorder(knot_zone_contents_t *zone,
void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2603,7 +2625,7 @@ int knot_zone_contents_nsec3_apply_inorder(knot_zone_contents_t *zone,
void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2621,7 +2643,7 @@ int knot_zone_contents_nsec3_apply_inorder_reverse(
void (*function)(knot_node_t *node, void *data), void *data)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_func_t f;
@@ -2664,7 +2686,7 @@ int knot_zone_contents_dname_table_apply(knot_zone_contents_t *contents,
void *data)
{
if (contents == NULL || function == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_dname_table_tree_inorder_apply(contents->dname_table,
@@ -2679,12 +2701,12 @@ int knot_zone_contents_shallow_copy(const knot_zone_contents_t *from,
knot_zone_contents_t **to)
{
if (from == NULL || to == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Copy to same destination as source. */
if (from == *to) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret = KNOT_EOK;
@@ -2775,12 +2797,12 @@ int knot_zone_contents_shallow_copy2(const knot_zone_contents_t *from,
knot_zone_contents_t **to)
{
if (from == NULL || to == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Copy to same destination as source. */
if (from == *to) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int ret = KNOT_EOK;
diff --git a/src/libknot/zone/zone-contents.h b/src/libknot/zone/zone-contents.h
index 2ca333e..52eaa40 100755..100644
--- a/src/libknot/zone/zone-contents.h
+++ b/src/libknot/zone/zone-contents.h
@@ -113,7 +113,7 @@ uint16_t knot_zone_contents_class(const knot_zone_contents_t *contents);
* \param node Node to add into the zone.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EBADZONE
* \retval KNOT_EHASH
*/
@@ -140,7 +140,7 @@ int knot_zone_contents_add_node(knot_zone_contents_t *contents,
* and set it to this parameter.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EBADZONE
*/
int knot_zone_contents_add_rrset(knot_zone_contents_t *contents,
@@ -167,7 +167,7 @@ int knot_zone_contents_add_rrsigs(knot_zone_contents_t *contents,
* \param node Node to add into the zone.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EBADZONE
*/
int knot_zone_contents_add_nsec3_node(knot_zone_contents_t *contents,
@@ -246,7 +246,7 @@ const knot_node_t *knot_zone_contents_find_node(
*
* \retval KNOT_ZONE_NAME_FOUND if node with owner \a name was found.
* \retval KNOT_ZONE_NAME_NOT_FOUND if it was not found.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EBADZONE
*/
int knot_zone_contents_find_dname(const knot_zone_contents_t *contents,
@@ -288,7 +288,7 @@ knot_node_t *knot_zone_contents_get_previous_nsec3(
*
* \retval KNOT_ZONE_NAME_FOUND if node with owner \a name was found.
* \retval KNOT_ZONE_NAME_NOT_FOUND if it was not found.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_EBADZONE
*/
int knot_zone_contents_find_dname_hash(const knot_zone_contents_t *contents,
@@ -328,7 +328,7 @@ const knot_node_t *knot_zone_contents_find_nsec3_node(
*
* \retval KNOT_ZONE_NAME_FOUND if the corresponding NSEC3 node was found.
* \retval KNOT_ZONE_NAME_NOT_FOUND if it was not found.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENSEC3PAR
* \retval KNOT_ECRYPTO
* \retval KNOT_ERROR
@@ -537,7 +537,7 @@ int knot_zone_contents_dname_table_apply(knot_zone_contents_t *contents,
* \param to Copy of the zone.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_contents_shallow_copy(const knot_zone_contents_t *from,
diff --git a/src/libknot/zone/zone-diff.c b/src/libknot/zone/zone-diff.c
index d3fd961..65f162f 100755..100644
--- a/src/libknot/zone/zone-diff.c
+++ b/src/libknot/zone/zone-diff.c
@@ -17,7 +17,6 @@
#include <assert.h>
#include <config.h>
-#include "libknot/util/error.h"
#include "libknot/util/debug.h"
#include "libknot/rdata.h"
#include "zone-diff.h"
@@ -40,7 +39,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
knot_changeset_t *changeset)
{
if (zone1 == NULL || zone2 == NULL || changeset == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
const knot_node_t *apex1 = knot_zone_contents_apex(zone1);
@@ -48,7 +47,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
if (apex1 == NULL || apex2 == NULL) {
dbg_zonediff("zone_diff: "
"both zones must have apex nodes.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_rrset_t *soa_rrset1 = knot_node_get_rrset(apex1, KNOT_RRTYPE_SOA);
@@ -56,7 +55,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
if (soa_rrset1 == NULL || soa_rrset2 == NULL) {
dbg_zonediff("zone_diff: "
"both zones must have apex nodes.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (knot_rrset_rdata(soa_rrset1) == NULL ||
@@ -64,7 +63,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
dbg_zonediff("zone_diff: "
"both zones must have apex nodes with SOA "
"RRs.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
int64_t soa_serial1 =
@@ -144,7 +143,7 @@ static int knot_zone_diff_changeset_add_rrset(knot_changeset_t *changeset,
/* Remove all RRs of the RRSet. */
if (changeset == NULL || rrset == NULL) {
dbg_zonediff("zone_diff: add_rrset: NULL parameters.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (knot_rrset_rdata_rr_count(rrset) == 0) {
@@ -186,7 +185,7 @@ static int knot_zone_diff_changeset_remove_rrset(knot_changeset_t *changeset,
/* Remove all RRs of the RRSet. */
if (changeset == NULL) {
dbg_zonediff("zone_diff: remove_rrset: NULL parameters.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
if (rrset == NULL) {
@@ -231,7 +230,7 @@ static int knot_zone_diff_add_node(const knot_node_t *node,
{
if (node == NULL || changeset == NULL) {
dbg_zonediff("zone_diff: add_node: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Add all rrsets from node. */
@@ -264,7 +263,7 @@ static int knot_zone_diff_remove_node(knot_changeset_t *changeset,
{
if (changeset == NULL || node == NULL) {
dbg_zonediff("zone_diff: remove_node: NULL parameters.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zonediff("zone_diff: remove_node: Removing node:\n");
@@ -307,7 +306,7 @@ static int knot_zone_diff_rdata_return_changes(const knot_rrset_t *rrset1,
if (rrset1 == NULL || rrset2 == NULL) {
dbg_zonediff("zone_diff: diff_rdata: NULL arguments. (%p) (%p).\n",
rrset1, rrset2);
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
@@ -390,7 +389,7 @@ static int knot_zone_diff_rdata(const knot_rrset_t *rrset1,
{
if ((changeset == NULL) || (rrset1 == NULL && rrset2 == NULL)) {
dbg_zonediff("zone_diff: diff_rdata: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
* The easiest solution is to remove all the RRs that had no match and
@@ -544,7 +543,7 @@ static void knot_zone_diff_node(knot_node_t *node, void *data)
struct zone_diff_param *param = (struct zone_diff_param *)data;
if (param->changeset == NULL || param->contents == NULL) {
dbg_zonediff("zone_diff: diff_node: NULL arguments.\n");
- param->ret = KNOT_EBADARG;
+ param->ret = KNOT_EINVAL;
return;
}
@@ -747,7 +746,7 @@ static void knot_zone_diff_add_new_nodes(knot_node_t *node, void *data)
struct zone_diff_param *param = (struct zone_diff_param *)data;
if (param->changeset == NULL || param->contents == NULL) {
dbg_zonediff("zone_diff: add_new_nodes: NULL arguments.\n");
- param->ret = KNOT_EBADARG;
+ param->ret = KNOT_EINVAL;
return;
}
@@ -801,7 +800,7 @@ int knot_zone_contents_diff(const knot_zone_contents_t *zone1,
{
if (zone1 == NULL || zone2 == NULL) {
dbg_zonediff("zone_diff: NULL argument(s).\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// /* Create changeset structure. */
@@ -920,7 +919,7 @@ int knot_zone_diff_create_changesets(const knot_zone_contents_t *z1,
{
if (z1 == NULL || z2 == NULL) {
dbg_zonediff("zone_diff: create_changesets: NULL arguments.\n");
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/* Create changesets. */
int ret = knot_changeset_allocate(changesets);
diff --git a/src/libknot/zone/zone-diff.h b/src/libknot/zone/zone-diff.h
index 6e0eb1d..6e0eb1d 100755..100644
--- a/src/libknot/zone/zone-diff.h
+++ b/src/libknot/zone/zone-diff.h
diff --git a/src/libknot/zone/zone-tree.c b/src/libknot/zone/zone-tree.c
index 7de460a..ceaa6a9 100755..100644
--- a/src/libknot/zone/zone-tree.c
+++ b/src/libknot/zone/zone-tree.c
@@ -20,7 +20,6 @@
#include "zone-tree.h"
#include "zone/node.h"
-#include "util/error.h"
#include "util/debug.h"
/*----------------------------------------------------------------------------*/
@@ -172,7 +171,7 @@ static int knot_zone_tree_deep_copy_node(knot_zone_tree_node_t *from,
int knot_zone_tree_init(knot_zone_tree_t *tree)
{
if (tree == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
TREE_INIT(tree, knot_zone_tree_node_compare);
@@ -184,7 +183,7 @@ int knot_zone_tree_init(knot_zone_tree_t *tree)
int knot_zone_tree_insert(knot_zone_tree_t *tree, knot_node_t *node)
{
if (tree == NULL || node == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_node_t *znode = (knot_zone_tree_node_t *)malloc(
@@ -210,7 +209,7 @@ int knot_zone_tree_find(knot_zone_tree_t *tree, const knot_dname_t *owner,
const knot_node_t **found)
{
if (tree == NULL || owner == NULL || found == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_node_t *f = NULL;
@@ -225,7 +224,7 @@ int knot_zone_tree_get(knot_zone_tree_t *tree, const knot_dname_t *owner,
knot_node_t **found)
{
if (tree == NULL || owner == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
*found = NULL;
@@ -267,7 +266,7 @@ int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
const knot_node_t **previous)
{
if (tree == NULL || owner == NULL || found == NULL || previous == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_node_t *f, *p;
@@ -288,7 +287,7 @@ int knot_zone_tree_get_less_or_equal(knot_zone_tree_t *tree,
{
if (tree == NULL || owner == NULL || found == NULL
|| previous == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
knot_zone_tree_node_t *f = NULL, *prev = NULL;
@@ -380,7 +379,7 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree,
knot_zone_tree_node_t **removed)
{
if (tree == NULL || owner == NULL || removed == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
// create dummy node to use for lookup
@@ -423,7 +422,7 @@ int knot_zone_tree_forward_apply_inorder(knot_zone_tree_t *tree,
void *data)
{
if (tree == NULL || function == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
TREE_FORWARD_APPLY(tree, knot_zone_tree_node, avl,
@@ -441,7 +440,7 @@ int knot_zone_tree_forward_apply_postorder(knot_zone_tree_t *tree,
void *data)
{
if (tree == NULL || function == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
TREE_POST_ORDER_APPLY(tree, knot_zone_tree_node, avl,
@@ -459,7 +458,7 @@ int knot_zone_tree_reverse_apply_inorder(knot_zone_tree_t *tree,
void *data)
{
if (tree == NULL || function == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
TREE_REVERSE_APPLY(tree, knot_zone_tree_node, avl,
@@ -477,7 +476,7 @@ int knot_zone_tree_reverse_apply_postorder(knot_zone_tree_t *tree,
void *data)
{
if (tree == NULL || function == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
TREE_REVERSE_APPLY_POST(tree, knot_zone_tree_node, avl,
@@ -492,7 +491,7 @@ int knot_zone_tree_shallow_copy(knot_zone_tree_t *from,
knot_zone_tree_t *to)
{
if (to == NULL || from == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
* This function will copy the tree by hand, so that the nodes
@@ -511,7 +510,7 @@ int knot_zone_tree_deep_copy(knot_zone_tree_t *from,
knot_zone_tree_t *to)
{
if (to == NULL || from == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
/*
* This function will copy the tree by hand, so that the nodes
diff --git a/src/libknot/zone/zone-tree.h b/src/libknot/zone/zone-tree.h
index 95b4e23..6c38310 100755..100644
--- a/src/libknot/zone/zone-tree.h
+++ b/src/libknot/zone/zone-tree.h
@@ -54,7 +54,7 @@ typedef TREE_HEAD(knot_zone_tree, knot_zone_tree_node) knot_zone_tree_t;
* \param tree Zone tree structure to initialize.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_zone_tree_init(knot_zone_tree_t *tree);
@@ -65,7 +65,7 @@ int knot_zone_tree_init(knot_zone_tree_t *tree);
* \param node Node to insert.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_tree_insert(knot_zone_tree_t *tree, knot_node_t *node);
@@ -77,7 +77,7 @@ int knot_zone_tree_insert(knot_zone_tree_t *tree, knot_node_t *node);
* \param owner Owner of the node to find.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_tree_find(knot_zone_tree_t *tree,
@@ -94,7 +94,7 @@ int knot_zone_tree_find(knot_zone_tree_t *tree,
* \param owner Owner of the node to find.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_tree_get(knot_zone_tree_t *tree,
@@ -117,7 +117,7 @@ int knot_zone_tree_get(knot_zone_tree_t *tree,
* \a previous is set properly.
* \retval 0 if the domain name was not found. \a found may hold any (or none)
* node. \a previous is set properly.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
@@ -144,7 +144,7 @@ int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
* \a previous is set properly.
* \retval 0 if the domain name was not found. \a found may hold any (or none)
* node. \a previous is set properly.
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
* \retval KNOT_ENOMEM
*/
int knot_zone_tree_get_less_or_equal(knot_zone_tree_t *tree,
@@ -180,7 +180,7 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree,
* \param data Arbitrary data to be passed to the function.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_zone_tree_forward_apply_inorder(knot_zone_tree_t *tree,
void (*function)(
@@ -202,7 +202,7 @@ int knot_zone_tree_forward_apply_inorder(knot_zone_tree_t *tree,
* \param data Arbitrary data to be passed to the function.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_zone_tree_forward_apply_postorder(knot_zone_tree_t *tree,
void (*function)(
@@ -225,7 +225,7 @@ int knot_zone_tree_forward_apply_postorder(knot_zone_tree_t *tree,
* \param data Arbitrary data to be passed to the function.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_zone_tree_reverse_apply_inorder(knot_zone_tree_t *tree,
void (*function)(
@@ -248,7 +248,7 @@ int knot_zone_tree_reverse_apply_inorder(knot_zone_tree_t *tree,
* \param data Arbitrary data to be passed to the function.
*
* \retval KNOT_EOK
- * \retval KNOT_EBADARG
+ * \retval KNOT_EINVAL
*/
int knot_zone_tree_reverse_apply_postorder(knot_zone_tree_t *tree,
void (*function)(
diff --git a/src/libknot/zone/zone.c b/src/libknot/zone/zone.c
index 65f810d..3ab508e 100755..100644
--- a/src/libknot/zone/zone.c
+++ b/src/libknot/zone/zone.c
@@ -27,7 +27,6 @@
#include "dname.h"
#include "util/descriptor.h"
#include "nsec3.h"
-#include "util/error.h"
#include "util/debug.h"
#include "util/utils.h"
#include "hash/cuckoo-hash-table.h"
@@ -125,7 +124,7 @@ const knot_zone_contents_t *knot_zone_contents(
time_t knot_zone_version(const knot_zone_t *zone)
{
if (zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
return zone->version;
diff --git a/src/libknot/zone/zone.h b/src/libknot/zone/zone.h
index 31ff2ac..31ff2ac 100755..100644
--- a/src/libknot/zone/zone.h
+++ b/src/libknot/zone/zone.h
diff --git a/src/libknot/zone/zonedb.c b/src/libknot/zone/zonedb.c
index 43b4489..5e5c516 100755..100644
--- a/src/libknot/zone/zonedb.c
+++ b/src/libknot/zone/zonedb.c
@@ -25,7 +25,6 @@
#include "zone/zonedb.h"
#include "dname.h"
#include "zone/node.h"
-#include "util/error.h"
#include "util/debug.h"
#include "common/general-tree.h"
@@ -89,7 +88,7 @@ knot_zonedb_t *knot_zonedb_new()
int knot_zonedb_add_zone(knot_zonedb_t *db, knot_zone_t *zone)
{
if (db == NULL || zone == NULL) {
- return KNOT_EBADARG;
+ return KNOT_EINVAL;
}
dbg_zonedb_exec(
char *name = knot_dname_to_str(zone->name);
@@ -112,7 +111,7 @@ dbg_zonedb_exec(
db->zone_count++;
}
- return (ret != 0) ? KNOT_EZONEIN : KNOT_EOK;
+ return (ret != 0) ? KNOT_ERROR : KNOT_EOK;
}
/*----------------------------------------------------------------------------*/
diff --git a/src/libknot/zone/zonedb.h b/src/libknot/zone/zonedb.h
index 81326bf..81326bf 100755..100644
--- a/src/libknot/zone/zonedb.h
+++ b/src/libknot/zone/zonedb.h
diff --git a/src/tests/README b/src/tests/README
index 2f299ad..2f299ad 100755..100644
--- a/src/tests/README
+++ b/src/tests/README
diff --git a/src/tests/common/acl_tests.c b/src/tests/common/acl_tests.c
index c1884cd..c1884cd 100755..100644
--- a/src/tests/common/acl_tests.c
+++ b/src/tests/common/acl_tests.c
diff --git a/src/tests/common/acl_tests.h b/src/tests/common/acl_tests.h
index a928e2d..a928e2d 100755..100644
--- a/src/tests/common/acl_tests.h
+++ b/src/tests/common/acl_tests.h
diff --git a/src/tests/common/events_tests.c b/src/tests/common/events_tests.c
index 0acd706..0acd706 100755..100644
--- a/src/tests/common/events_tests.c
+++ b/src/tests/common/events_tests.c
diff --git a/src/tests/common/events_tests.h b/src/tests/common/events_tests.h
index b54b6da..b54b6da 100755..100644
--- a/src/tests/common/events_tests.h
+++ b/src/tests/common/events_tests.h
diff --git a/src/tests/common/fdset_tests.c b/src/tests/common/fdset_tests.c
index 08e0577..08e0577 100755..100644
--- a/src/tests/common/fdset_tests.c
+++ b/src/tests/common/fdset_tests.c
diff --git a/src/tests/common/fdset_tests.h b/src/tests/common/fdset_tests.h
index d29e1a9..d29e1a9 100755..100644
--- a/src/tests/common/fdset_tests.h
+++ b/src/tests/common/fdset_tests.h
diff --git a/src/tests/common/skiplist_tests.c b/src/tests/common/skiplist_tests.c
index 4fe99ec..4fe99ec 100755..100644
--- a/src/tests/common/skiplist_tests.c
+++ b/src/tests/common/skiplist_tests.c
diff --git a/src/tests/common/skiplist_tests.h b/src/tests/common/skiplist_tests.h
index ff91706..ff91706 100755..100644
--- a/src/tests/common/skiplist_tests.h
+++ b/src/tests/common/skiplist_tests.h
diff --git a/src/tests/common/slab_tests.c b/src/tests/common/slab_tests.c
index 5724a23..5724a23 100755..100644
--- a/src/tests/common/slab_tests.c
+++ b/src/tests/common/slab_tests.c
diff --git a/src/tests/common/slab_tests.h b/src/tests/common/slab_tests.h
index 4d45fb8..4d45fb8 100755..100644
--- a/src/tests/common/slab_tests.h
+++ b/src/tests/common/slab_tests.h
diff --git a/src/tests/files/sample_conf b/src/tests/files/sample_conf
index b15fce5..b15fce5 100755..100644
--- a/src/tests/files/sample_conf
+++ b/src/tests/files/sample_conf
diff --git a/src/tests/knot/conf_tests.c b/src/tests/knot/conf_tests.c
index 61520ea..61520ea 100755..100644
--- a/src/tests/knot/conf_tests.c
+++ b/src/tests/knot/conf_tests.c
diff --git a/src/tests/knot/conf_tests.h b/src/tests/knot/conf_tests.h
index dfd2fd7..dfd2fd7 100755..100644
--- a/src/tests/knot/conf_tests.h
+++ b/src/tests/knot/conf_tests.h
diff --git a/src/tests/knot/dthreads_tests.c b/src/tests/knot/dthreads_tests.c
index 982329b..982329b 100755..100644
--- a/src/tests/knot/dthreads_tests.c
+++ b/src/tests/knot/dthreads_tests.c
diff --git a/src/tests/knot/dthreads_tests.h b/src/tests/knot/dthreads_tests.h
index e41bdc5..e41bdc5 100755..100644
--- a/src/tests/knot/dthreads_tests.h
+++ b/src/tests/knot/dthreads_tests.h
diff --git a/src/tests/knot/journal_tests.c b/src/tests/knot/journal_tests.c
index 5c89de9..89466ea 100755..100644
--- a/src/tests/knot/journal_tests.c
+++ b/src/tests/knot/journal_tests.c
@@ -17,7 +17,7 @@
#include "tests/knot/journal_tests.h"
#include "knot/server/journal.h"
-#include "knot/other/error.h"
+#include "knot/common.h"
static int journal_tests_count(int argc, char *argv[]);
static int journal_tests_run(int argc, char *argv[]);
@@ -81,7 +81,7 @@ static int journal_tests_run(int argc, char *argv[])
/* Test 2: Create journal. */
const char *jfilename = jfn_buf;
int ret = journal_create(jfilename, jsize);
- ok(ret == KNOTD_EOK, "journal: create journal '%s'", jfilename);
+ ok(ret == KNOT_EOK, "journal: create journal '%s'", jfilename);
/* Test 3: Open journal. */
journal_t *journal = journal_open(jfilename, fsize, JOURNAL_LAZY, 0);
@@ -93,12 +93,12 @@ static int journal_tests_run(int argc, char *argv[])
/* Test 4: Write entry to log. */
const char *sample = "deadbeef";
ret = journal_write(j, 0x0a, sample, strlen(sample));
- ok(ret == KNOTD_EOK, "journal: write");
+ ok(ret == KNOT_EOK, "journal: write");
/* Test 5: Read entry from log. */
char tmpbuf[64] = {'\0'};
ret = journal_read(j, 0x0a, 0, tmpbuf);
- ok(ret == KNOTD_EOK, "journal: read entry");
+ ok(ret == KNOT_EOK, "journal: read entry");
/* Test 6: Compare read data. */
ret = strncmp(sample, tmpbuf, strlen(sample));
@@ -156,7 +156,7 @@ static int journal_tests_run(int argc, char *argv[])
for (int i = 0; i < itcount; ++i) {
int key = rand() % 65535;
randstr(tmpbuf, sizeof(tmpbuf));
- if (journal_write(j, key, tmpbuf, sizeof(tmpbuf)) != KNOTD_EOK) {
+ if (journal_write(j, key, tmpbuf, sizeof(tmpbuf)) != KNOT_EOK) {
ret = -1;
break;
}
@@ -237,13 +237,13 @@ static int journal_tests_run(int argc, char *argv[])
int key = i;
randstr(tmpbuf, sizeof(tmpbuf));
ret = journal_map(j, key, &mptr, sizeof(tmpbuf));
- if (ret != KNOTD_EOK) {
- diag("journal_map failed: %s", knotd_strerror(ret));
+ if (ret != KNOT_EOK) {
+ diag("journal_map failed: %s", knot_strerror(ret));
break;
}
memcpy(mptr, tmpbuf, sizeof(tmpbuf));
- if ((ret = journal_unmap(j, key, mptr, 1)) != KNOTD_EOK) {
- diag("journal_unmap failed: %s", knotd_strerror(ret));
+ if ((ret = journal_unmap(j, key, mptr, 1)) != KNOT_EOK) {
+ diag("journal_unmap failed: %s", knot_strerror(ret));
break;
}
@@ -252,7 +252,7 @@ static int journal_tests_run(int argc, char *argv[])
ret = journal_read(j, key, 0, chk_buf);
if (ret != 0) {
diag("journal_map integrity check failed %s",
- knotd_strerror(ret));
+ knot_strerror(ret));
break;
}
ret = strncmp(chk_buf, tmpbuf, sizeof(chk_buf));
diff --git a/src/tests/knot/journal_tests.h b/src/tests/knot/journal_tests.h
index beec8ca..beec8ca 100755..100644
--- a/src/tests/knot/journal_tests.h
+++ b/src/tests/knot/journal_tests.h
diff --git a/src/tests/knot/server_tests.c b/src/tests/knot/server_tests.c
index 5ae04d8..5ae04d8 100755..100644
--- a/src/tests/knot/server_tests.c
+++ b/src/tests/knot/server_tests.c
diff --git a/src/tests/knot/server_tests.h b/src/tests/knot/server_tests.h
index 43ad0c1..43ad0c1 100755..100644
--- a/src/tests/knot/server_tests.h
+++ b/src/tests/knot/server_tests.h
diff --git a/src/tests/libknot/files/parsed_data b/src/tests/libknot/files/parsed_data
index 4027c92..4027c92 100755..100644
--- a/src/tests/libknot/files/parsed_data
+++ b/src/tests/libknot/files/parsed_data
Binary files differ
diff --git a/src/tests/libknot/files/parsed_data_queries b/src/tests/libknot/files/parsed_data_queries
index 5857c87..5857c87 100755..100644
--- a/src/tests/libknot/files/parsed_data_queries
+++ b/src/tests/libknot/files/parsed_data_queries
Binary files differ
diff --git a/src/tests/libknot/files/raw_data b/src/tests/libknot/files/raw_data
index f94236b..f94236b 100755..100644
--- a/src/tests/libknot/files/raw_data
+++ b/src/tests/libknot/files/raw_data
Binary files differ
diff --git a/src/tests/libknot/files/raw_data_queries b/src/tests/libknot/files/raw_data_queries
index 9062d5a..9062d5a 100755..100644
--- a/src/tests/libknot/files/raw_data_queries
+++ b/src/tests/libknot/files/raw_data_queries
Binary files differ
diff --git a/src/tests/libknot/libknot/cuckoo_tests.c b/src/tests/libknot/libknot/cuckoo_tests.c
index 8d22e36..8d22e36 100755..100644
--- a/src/tests/libknot/libknot/cuckoo_tests.c
+++ b/src/tests/libknot/libknot/cuckoo_tests.c
diff --git a/src/tests/libknot/libknot/cuckoo_tests.h b/src/tests/libknot/libknot/cuckoo_tests.h
index b6b0db8..b6b0db8 100755..100644
--- a/src/tests/libknot/libknot/cuckoo_tests.h
+++ b/src/tests/libknot/libknot/cuckoo_tests.h
diff --git a/src/tests/libknot/libknot/dname_table_tests.c b/src/tests/libknot/libknot/dname_table_tests.c
index 0d00a44..991f1c6 100755..100644
--- a/src/tests/libknot/libknot/dname_table_tests.c
+++ b/src/tests/libknot/libknot/dname_table_tests.c
@@ -18,7 +18,6 @@
#include <assert.h>
#include "dname_table_tests.h"
-#include "libknot/util/error.h"
#include "libknot/zone/dname-table.h"
/* *test_t structures */
#include "tests/libknot/realdata/libknot_tests_loader_realdata.h"
@@ -99,25 +98,25 @@ static int test_dname_table_adding()
CHECK_ALLOC(table, 0);
/* Add NULL */
- if (knot_dname_table_add_dname(table, NULL) != KNOT_EBADARG) {
+ if (knot_dname_table_add_dname(table, NULL) != KNOT_EINVAL) {
diag("Adding NULL dname did not result in an error!");
errors++;
}
/* Add to NULL table*/
- if (knot_dname_table_add_dname(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_dname_table_add_dname(NULL, NULL) != KNOT_EINVAL) {
diag("Adding to NULL table did not result in an error!");
errors++;
}
/* Add NULL */
- if (knot_dname_table_add_dname_check(table, NULL) != KNOT_EBADARG) {
+ if (knot_dname_table_add_dname_check(table, NULL) != KNOT_EINVAL) {
diag("Adding NULL dname did not result in an error!");
errors++;
}
/* Add to NULL table*/
- if (knot_dname_table_add_dname_check(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_dname_table_add_dname_check(NULL, NULL) != KNOT_EINVAL) {
diag("Adding to NULL table did not result in an error!");
errors++;
}
diff --git a/src/tests/libknot/libknot/dname_table_tests.h b/src/tests/libknot/libknot/dname_table_tests.h
index f3088e9..f3088e9 100755..100644
--- a/src/tests/libknot/libknot/dname_table_tests.h
+++ b/src/tests/libknot/libknot/dname_table_tests.h
diff --git a/src/tests/libknot/libknot/dname_tests.c b/src/tests/libknot/libknot/dname_tests.c
index 35ac230..35ac230 100755..100644
--- a/src/tests/libknot/libknot/dname_tests.c
+++ b/src/tests/libknot/libknot/dname_tests.c
diff --git a/src/tests/libknot/libknot/dname_tests.h b/src/tests/libknot/libknot/dname_tests.h
index a7d75aa..a7d75aa 100755..100644
--- a/src/tests/libknot/libknot/dname_tests.h
+++ b/src/tests/libknot/libknot/dname_tests.h
diff --git a/src/tests/libknot/libknot/edns_tests.c b/src/tests/libknot/libknot/edns_tests.c
index 4d1a37a..4d1a37a 100755..100644
--- a/src/tests/libknot/libknot/edns_tests.c
+++ b/src/tests/libknot/libknot/edns_tests.c
diff --git a/src/tests/libknot/libknot/edns_tests.h b/src/tests/libknot/libknot/edns_tests.h
index 4553234..4553234 100755..100644
--- a/src/tests/libknot/libknot/edns_tests.h
+++ b/src/tests/libknot/libknot/edns_tests.h
diff --git a/src/tests/libknot/libknot/node_tests.c b/src/tests/libknot/libknot/node_tests.c
index b252982..b252982 100755..100644
--- a/src/tests/libknot/libknot/node_tests.c
+++ b/src/tests/libknot/libknot/node_tests.c
diff --git a/src/tests/libknot/libknot/node_tests.h b/src/tests/libknot/libknot/node_tests.h
index a90179f..a90179f 100755..100644
--- a/src/tests/libknot/libknot/node_tests.h
+++ b/src/tests/libknot/libknot/node_tests.h
diff --git a/src/tests/libknot/libknot/nsec3_tests.c b/src/tests/libknot/libknot/nsec3_tests.c
index 7b95549..5864b05 100755..100644
--- a/src/tests/libknot/libknot/nsec3_tests.c
+++ b/src/tests/libknot/libknot/nsec3_tests.c
@@ -18,7 +18,6 @@
#include <assert.h>
#include "libknot/common.h"
-#include "libknot/util/error.h"
#include "libknot/nsec3.h"
#include "libknot/util/utils.h"
#include "common/base32hex.h"
@@ -71,21 +70,21 @@ static int test_nsec3_params_from_wire()
lives_ok({
/* Create special variable for this block. */
if (knot_nsec3_params_from_wire(NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_nsec3_params_from_wire(&nsec3_test_params, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_nsec3_params_from_wire(NULL, rrset) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
@@ -140,14 +139,14 @@ static int test_nsec3_sha1()
lives_ok({
if (knot_nsec3_sha1(NULL, NULL, 1, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_nsec3_sha1(&nsec3_test_params,
NULL, 1, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
uint8_t data[20];
@@ -155,7 +154,7 @@ static int test_nsec3_sha1()
lived = 0;
if (knot_nsec3_sha1(&nsec3_test_params,
data, 20, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
uint8_t *digest = NULL;
@@ -163,7 +162,7 @@ static int test_nsec3_sha1()
lived = 0;
if (knot_nsec3_sha1(&nsec3_test_params,
data, 20, &digest, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
// size_t size = 0;
@@ -171,13 +170,13 @@ static int test_nsec3_sha1()
// lived = 0;
// if (knot_nsec3_sha1(&nsec3_test_params,
// data, 20, &digest, &size) !=
-// KNOT_EBADARG) {
+// KNOT_EINVAL) {
// errors++;
// }
lived = 1;
}, "NSEC3: nsec3 sha1 NULL tests");
if (errors) {
- diag("Does not return KNOT_EBADARG after "
+ diag("Does not return KNOT_EINVAL after "
"execution with wrong arguments!");
}
diff --git a/src/tests/libknot/libknot/nsec3_tests.h b/src/tests/libknot/libknot/nsec3_tests.h
index 10e7ed9..10e7ed9 100755..100644
--- a/src/tests/libknot/libknot/nsec3_tests.h
+++ b/src/tests/libknot/libknot/nsec3_tests.h
diff --git a/src/tests/libknot/libknot/packet_tests.c b/src/tests/libknot/libknot/packet_tests.c
index 916328d..8e6597b 100755..100644
--- a/src/tests/libknot/libknot/packet_tests.c
+++ b/src/tests/libknot/libknot/packet_tests.c
@@ -19,7 +19,6 @@
#include <stdint.h>
#include "packet_tests.h"
-#include "libknot/util/error.h"
#include "libknot/packet/packet.h"
#include "libknot/util/wire.h"
/* *test_t structures */
@@ -75,17 +74,17 @@ static int test_packet_parse_from_wire()
int tmp = 0;
lives_ok({
if (knot_packet_parse_from_wire(NULL, NULL, 0, 0) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to parse NULL packet with NULL wire "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
tmp = 1;
tmp = 0;
if (knot_packet_parse_from_wire(packet, NULL, 0, 0) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to parse with NULL wire "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
tmp = 1;
@@ -117,19 +116,19 @@ static int test_packet_parse_next_rr_answer()
lives_ok({
int ret = 0;
if (knot_packet_parse_next_rr_answer(NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to parse next RR answer with "
"NULL packet with and NULL RRSet "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
tmp = 1;
tmp = 0;
if ((ret = knot_packet_parse_next_rr_answer(packet,
NULL)) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to parse next RR with NULL RRSet pointer "
- "did not return KNOT_EBADARG! Got %d.",
+ "did not return KNOT_EINVAL! Got %d.",
ret);
errors++;
}
@@ -138,10 +137,10 @@ static int test_packet_parse_next_rr_answer()
// tmp = 0;
// if (knot_packet_parse_next_rr_answer(packet,
// &rrset) !=
-// KNOT_EBADARG) {
+// KNOT_EINVAL) {
// diag("Trying to parse next RR answer with rrset pointer"
// " not pointing to NULL did not "
-// "return KNOT_EBADARG!");
+// "return KNOT_EINVAL!");
// errors++;
// }
// tmp = 1;
@@ -159,8 +158,8 @@ static int test_packet_parse_rest()
lives_ok({res = knot_packet_parse_rest(NULL);},
"packet: parse rest NULL test");
- if (res != KNOT_EBADARG) {
- diag("parse rest NULL did not return KNOT_EBADARG.\n");
+ if (res != KNOT_EINVAL) {
+ diag("parse rest NULL did not return KNOT_EINVAL.\n");
return 1;
}
@@ -188,9 +187,9 @@ static int test_packet_set_max_size()
lives_ok({
lived = 0;
- if (knot_packet_set_max_size(NULL, 1) != KNOT_EBADARG) {
+ if (knot_packet_set_max_size(NULL, 1) != KNOT_EINVAL) {
diag("Calling packet_set_max() with NULL packet "
- "did not return KNOT_EBADARG");
+ "did not return KNOT_EINVAL");
errors++;
}
lived = 1;
@@ -198,9 +197,9 @@ static int test_packet_set_max_size()
errors += lived != 1;
- if (knot_packet_set_max_size(packet, 0) != KNOT_EBADARG) {
+ if (knot_packet_set_max_size(packet, 0) != KNOT_EINVAL) {
diag("Calling packet_set_max() with size eqeal to 0 did not "
- "return KNOT_EBADARG");
+ "return KNOT_EINVAL");
errors++;
}
@@ -229,27 +228,27 @@ static int test_packet_add_tmp_rrset()
lives_ok({
if (knot_packet_add_tmp_rrset(NULL, rrset) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to add to NULL packet did not return "
- "KNOT_EBADARG!");
+ "KNOT_EINVAL!");
errors++;
}
lived = 1;
lived = 0;
if (knot_packet_add_tmp_rrset(packet, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to add NULL rrset did not return "
- "KNOT_EBADARG!");
+ "KNOT_EINVAL!");
errors++;
}
lived = 1;
lived = 0;
if (knot_packet_add_tmp_rrset(NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Trying to add NULL rrset to NULL packet "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -282,7 +281,7 @@ static int test_packet_add_tmp_rrset()
// lives_ok({
// if (knot_packet_contains(packet, NULL,
// KNOT_RRSET_COMPARE_PTR) !=
-// KNOT_EBADARG{
+// KNOT_EINVAL{
// diag();
// }
// }, "packet: contains NULL tests);
@@ -322,9 +321,9 @@ static int test_packet_question_to_wire()
assert(packet);
lives_ok({
- if (knot_packet_question_to_wire(NULL) != KNOT_EBADARG) {
+ if (knot_packet_question_to_wire(NULL) != KNOT_EINVAL) {
diag("Calling packet_question_to_wire with "
- "NULL pointer did not result to KNOT_EBADARG!");
+ "NULL pointer did not result to KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -369,28 +368,28 @@ static int test_packet_to_wire()
assert(packet);
lives_ok({
- if (knot_packet_to_wire(NULL, NULL, NULL) != KNOT_EBADARG) {
+ if (knot_packet_to_wire(NULL, NULL, NULL) != KNOT_EINVAL) {
diag("Calling packet_to_wire with "
- "NULL pointers did not return KNOT_EBADARG!");
+ "NULL pointers did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
size_t size;
lived = 0;
if (knot_packet_to_wire(packet, NULL, &size) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Calling packet_to_wire with "
- "NULL wire did not return KNOT_EBADARG!");
+ "NULL wire did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
uint8_t *wire = (uint8_t *)0xabcdef;
lived = 0;
if (knot_packet_to_wire(packet, &wire, &size) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Calling packet_to_wire with "
"wire not pointing to NULL did not return"
- " KNOT_EBADARG!");
+ " KNOT_EINVAL!");
errors++;
}
lived = 1;
diff --git a/src/tests/libknot/libknot/packet_tests.h b/src/tests/libknot/libknot/packet_tests.h
index 5a8ce03..5a8ce03 100755..100644
--- a/src/tests/libknot/libknot/packet_tests.h
+++ b/src/tests/libknot/libknot/packet_tests.h
diff --git a/src/tests/libknot/libknot/query_tests.c b/src/tests/libknot/libknot/query_tests.c
index 1e4e081..e056faa 100755..100644
--- a/src/tests/libknot/libknot/query_tests.c
+++ b/src/tests/libknot/libknot/query_tests.c
@@ -19,7 +19,6 @@
#include <stdint.h>
#include "packet_tests.h"
-#include "libknot/util/error.h"
#include "libknot/packet/packet.h"
#include "libknot/util/wire.h"
#include "libknot/packet/query.h"
@@ -52,9 +51,9 @@ static int test_query_init()
knot_packet_new(KNOT_PACKET_PREALLOC_QUERY);
assert(query);
lives_ok({
- if (knot_query_init(NULL) != KNOT_EBADARG) {
+ if (knot_query_init(NULL) != KNOT_EINVAL) {
diag("Calling query_init with NULL query did "
- "not return KNOT_EBADARG!");
+ "not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -101,19 +100,19 @@ static int test_query_set_question()
question->qclass = rrset->rclass;
lives_ok({
- if (knot_query_set_question(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_query_set_question(NULL, NULL) != KNOT_EINVAL) {
diag("Calling query_set_question with NULL");
errors++;
}
lived = 1;
lived = 0;
- if (knot_query_set_question(query, NULL) != KNOT_EBADARG) {
+ if (knot_query_set_question(query, NULL) != KNOT_EINVAL) {
diag("Calling query_set_question with NULL");
errors++;
}
lived = 1;
lived = 0;
- if (knot_query_set_question(NULL, question) != KNOT_EBADARG) {
+ if (knot_query_set_question(NULL, question) != KNOT_EINVAL) {
diag("Calling query_set_question with NULL");
errors++;
}
diff --git a/src/tests/libknot/libknot/query_tests.h b/src/tests/libknot/libknot/query_tests.h
index 037ecab..037ecab 100755..100644
--- a/src/tests/libknot/libknot/query_tests.h
+++ b/src/tests/libknot/libknot/query_tests.h
diff --git a/src/tests/libknot/libknot/rdata_tests.c b/src/tests/libknot/libknot/rdata_tests.c
index 0c53613..663124a 100755..100644
--- a/src/tests/libknot/libknot/rdata_tests.c
+++ b/src/tests/libknot/libknot/rdata_tests.c
@@ -23,7 +23,6 @@
#include "libknot/dname.h"
#include "libknot/util/descriptor.h"
#include "libknot/util/utils.h"
-#include "libknot/util/error.h"
enum { TEST_DOMAINS_OK = 8 };
@@ -556,7 +555,7 @@ static int test_rdata_set_items()
int errors = 0;
// check error return values
- if (knot_rdata_set_items(rdata, NULL, 0) != KNOT_EBADARG) {
+ if (knot_rdata_set_items(rdata, NULL, 0) != KNOT_EINVAL) {
diag("Return value of knot_rdata_set_items() "
"when rdata == NULL is wrong");
return 0;
@@ -564,13 +563,13 @@ static int test_rdata_set_items()
rdata = knot_rdata_new();
assert(rdata != NULL);
- if (knot_rdata_set_items(rdata, NULL, 0) != KNOT_EBADARG) {
+ if (knot_rdata_set_items(rdata, NULL, 0) != KNOT_EINVAL) {
diag("Return value of knot_rdata_set_items()"
" when items == NULL is wrong");
// knot_rdata_free(&rdata);
return 0;
} else if (knot_rdata_set_items(rdata, item, 0) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Return value of knot_rdata_set_items()"
" when count == 0"
"is wrong");
diff --git a/src/tests/libknot/libknot/rdata_tests.h b/src/tests/libknot/libknot/rdata_tests.h
index 1f43c91..1f43c91 100755..100644
--- a/src/tests/libknot/libknot/rdata_tests.h
+++ b/src/tests/libknot/libknot/rdata_tests.h
diff --git a/src/tests/libknot/libknot/response_tests.c b/src/tests/libknot/libknot/response_tests.c
index f40bb76..9c477c8 100755..100644
--- a/src/tests/libknot/libknot/response_tests.c
+++ b/src/tests/libknot/libknot/response_tests.c
@@ -22,7 +22,6 @@
#include "tests/libknot/libknot/response_tests.h"
#include "common/lists.h"
#include "libknot/common.h"
-#include "libknot/util/error.h"
#include "libknot/packet/response.h"
#include "libknot/rdata.h"
#include "libknot/rrset.h"
@@ -51,9 +50,9 @@ static int test_response_init()
int errors = 0;
int lived = 0;
lives_ok({
- if (knot_response_init(NULL) != KNOT_EBADARG) {
+ if (knot_response_init(NULL) != KNOT_EINVAL) {
diag("Calling response_init with NULL packet did "
- "not return KNOT_EBADARG!");
+ "not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -79,9 +78,9 @@ static int test_response_init_query()
int lived = 0;
lives_ok({
if (knot_response_init_from_query(NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Calling response_init_query with NULL packet and "
- "NULL query did not return KNOT_EBADARG!");
+ "NULL query did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -93,18 +92,18 @@ static int test_response_init_query()
knot_response_init(response);
lived = 0;
if (knot_response_init_from_query(response, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Calling response_init_query with NULL query "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
knot_packet_t *query =
knot_packet_new(KNOT_PACKET_PREALLOC_QUERY);
if (knot_response_init_from_query(NULL, query) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
diag("Calling response_init_query with NULL response "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
}, "response: init from query NULL tests");
@@ -234,9 +233,9 @@ static int test_response_add_opt()
opt.size = 25; // does it matter?
lives_ok({
- if (knot_response_add_opt(NULL, NULL, 0, 0) != KNOT_EBADARG) {
+ if (knot_response_add_opt(NULL, NULL, 0, 0) != KNOT_EINVAL) {
diag("Calling response add opt with NULL arguments "
- "did not result to KNOT_EBADARG");
+ "did not result to KNOT_EINVAL");
errors++;
}
lived = 1;
@@ -245,18 +244,18 @@ static int test_response_add_opt()
assert(response);
lived = 0;
if (knot_response_add_opt(response,
- NULL, 0, 0) != KNOT_EBADARG) {
+ NULL, 0, 0) != KNOT_EINVAL) {
diag("Calling response add opt with NULL OPT RR "
- "did not result to KNOT_EBADARG");
+ "did not result to KNOT_EINVAL");
errors++;
}
lived = 1;
lived = 0;
if (knot_response_add_opt(NULL,
- &opt, 0, 0) != KNOT_EBADARG) {
+ &opt, 0, 0) != KNOT_EINVAL) {
diag("Calling response add opt with NULL response "
- "did not result to KNOT_EBADARG");
+ "did not result to KNOT_EINVAL");
errors++;
}
lived = 1;
@@ -284,9 +283,9 @@ static int test_response_add_opt()
}
opt.payload = 0;
- if (knot_response_add_opt(response, &opt, 1, 0) != KNOT_EBADARG) {
+ if (knot_response_add_opt(response, &opt, 1, 0) != KNOT_EINVAL) {
diag("Calling response_add_opt with OPT RR payload set to 0 "
- "did not return KNOT_EBADARG");
+ "did not return KNOT_EINVAL");
}
knot_packet_free(&response);
@@ -301,9 +300,9 @@ static int test_response_add_generic(int (*func)(knot_packet_t *,
int lived = 0;
lives_ok({
- if (func(NULL, NULL, 0, 0, 0, 0) != KNOT_EBADARG) {
+ if (func(NULL, NULL, 0, 0, 0, 0) != KNOT_EINVAL) {
diag("Calling response add rrset with NULL "
- "arguments did not return KNOT_EBADARG!");
+ "arguments did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -311,9 +310,9 @@ static int test_response_add_generic(int (*func)(knot_packet_t *,
knot_packet_new(KNOT_PACKET_PREALLOC_RESPONSE);
assert(response);
lived = 0;
- if (func(response, NULL, 0, 0, 0, 0) != KNOT_EBADARG) {
+ if (func(response, NULL, 0, 0, 0, 0) != KNOT_EINVAL) {
diag("Calling response add rrset with NULL rrset "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -327,9 +326,9 @@ static int test_response_add_generic(int (*func)(knot_packet_t *,
KNOT_CLASS_IN, 3600);
assert(rrset);
lived = 0;
- if (func(NULL, rrset, 0, 0, 0, 0) != KNOT_EBADARG) {
+ if (func(NULL, rrset, 0, 0, 0, 0) != KNOT_EINVAL) {
diag("Calling response add rrset with NULL response "
- "did not return KNOT_EBADARG!");
+ "did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -389,26 +388,26 @@ static int test_response_add_nsid()
uint16_t nsid_size = strlen((char *)nsid);
lives_ok({
if (knot_response_add_nsid(NULL,
- NULL, 1) != KNOT_EBADARG) {
+ NULL, 1) != KNOT_EINVAL) {
diag("Calling response add nsid with NULL arguments "
- "did not return KNOT_EBADARG");
+ "did not return KNOT_EINVAL");
errors++;
}
lived = 1;
lived = 0;
if (knot_response_add_nsid(NULL, nsid,
- nsid_size) != KNOT_EBADARG) {
+ nsid_size) != KNOT_EINVAL) {
diag("Calling response add nsid with NULL response "
- "did not return KNOT_EBADARG");
+ "did not return KNOT_EINVAL");
errors++;
}
lived = 1;
// lived = 0;
// if (knot_response_add_nsid(response, nsid,
-// 0) != KNOT_EBADARG) {
+// 0) != KNOT_EINVAL) {
// diag("Calling response add nsid with zero size "
-// "did not return KNOT_EBADARG");
+// "did not return KNOT_EINVAL");
// errors++;
// }
// lived = 1;
diff --git a/src/tests/libknot/libknot/response_tests.h b/src/tests/libknot/libknot/response_tests.h
index c9a117b..c9a117b 100755..100644
--- a/src/tests/libknot/libknot/response_tests.h
+++ b/src/tests/libknot/libknot/response_tests.h
diff --git a/src/tests/libknot/libknot/rrset_tests.c b/src/tests/libknot/libknot/rrset_tests.c
index 41284df..41284df 100755..100644
--- a/src/tests/libknot/libknot/rrset_tests.c
+++ b/src/tests/libknot/libknot/rrset_tests.c
diff --git a/src/tests/libknot/libknot/rrset_tests.h b/src/tests/libknot/libknot/rrset_tests.h
index b0787d6..b0787d6 100755..100644
--- a/src/tests/libknot/libknot/rrset_tests.h
+++ b/src/tests/libknot/libknot/rrset_tests.h
diff --git a/src/tests/libknot/libknot/tsig_tests.c b/src/tests/libknot/libknot/tsig_tests.c
index e0a3d34..53c90aa 100755..100644
--- a/src/tests/libknot/libknot/tsig_tests.c
+++ b/src/tests/libknot/libknot/tsig_tests.c
@@ -20,9 +20,9 @@
#include "libknot/rrset.h"
#include "libknot/packet/response.h"
#include "libknot/dname.h"
-#include "libknot/util/error.h"
#include "libknot/util/wire.h"
#include "libknot/tsig-op.h"
+#include "libknot/common.h"
#include "common/print.h"
#include "tsig_tests.h"
@@ -89,8 +89,8 @@ static int test_knot_tsig_sign()
lives_ok({
int ret = knot_tsig_sign(NULL, NULL, 0, NULL, 0, NULL,
NULL, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -98,8 +98,8 @@ static int test_knot_tsig_sign()
lived = 0;
ret = knot_tsig_sign((uint8_t *)0x1, NULL, 0, NULL, 0, NULL,
NULL, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -108,8 +108,8 @@ static int test_knot_tsig_sign()
ret = knot_tsig_sign((uint8_t *)0x1, (size_t *)0x1, 0, NULL,
0, NULL,
NULL, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -118,8 +118,8 @@ static int test_knot_tsig_sign()
ret = knot_tsig_sign((uint8_t *)0x1, (size_t *)0x1, 0,
(uint8_t *)0x1, 0, NULL,
NULL, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -128,8 +128,8 @@ static int test_knot_tsig_sign()
ret = knot_tsig_sign((uint8_t *)0x12345678, (size_t *)0x1,
0,(uint8_t *)0x1, 0,(uint8_t *) 0x1,
NULL, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -138,8 +138,8 @@ static int test_knot_tsig_sign()
ret = knot_tsig_sign((uint8_t *)0x12345678, (size_t *)0x1, 0,
(uint8_t *)0x1, 0,(uint8_t *) 0x1,
(size_t *)0x1, NULL, 0, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -304,8 +304,8 @@ static int test_knot_tsig_sign_next()
lives_ok({
int ret = knot_tsig_sign_next(NULL, NULL, 0, NULL, 0, NULL,
NULL, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -314,8 +314,8 @@ static int test_knot_tsig_sign_next()
ret = knot_tsig_sign_next((uint8_t *)0x1, NULL, 0, NULL, 0,
NULL,
NULL, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -324,8 +324,8 @@ static int test_knot_tsig_sign_next()
ret = knot_tsig_sign_next((uint8_t *)0x1, (size_t *)0x1, 0,
NULL, 0, NULL,
NULL, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -334,8 +334,8 @@ static int test_knot_tsig_sign_next()
ret = knot_tsig_sign_next((uint8_t *)0x1, (size_t *)0x1, 0,
(uint8_t *)0x1, 0, NULL,
NULL, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -344,8 +344,8 @@ static int test_knot_tsig_sign_next()
ret = knot_tsig_sign_next((uint8_t *)0x12345678, (size_t *)0x1,
0,(uint8_t *)0x1, 0,(uint8_t *) 0x1,
NULL, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -354,8 +354,8 @@ static int test_knot_tsig_sign_next()
ret = knot_tsig_sign_next((uint8_t *)0x12345678, (size_t *)0x1,
0, (uint8_t *)0x1, 0,(uint8_t *) 0x1,
(size_t *)0x1, NULL, NULL, 0); /*! \todo FIX */
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -418,8 +418,8 @@ static int test_knot_tsig_server_check()
int lived = 0;
lives_ok({
int ret = knot_tsig_server_check(NULL, NULL, 0, NULL);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -428,8 +428,8 @@ static int test_knot_tsig_server_check()
ret = knot_tsig_server_check((knot_rrset_t *)0x1,
(uint8_t *)0x1, 0,
NULL);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -490,8 +490,8 @@ static int test_knot_tsig_client_check()
lives_ok({
int ret = knot_tsig_client_check(NULL, NULL, 0, NULL,
0, NULL, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -499,8 +499,8 @@ static int test_knot_tsig_client_check()
lived = 0;
ret = knot_tsig_client_check((knot_rrset_t *)0x1, NULL, 0, NULL,
0, NULL, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -509,8 +509,8 @@ static int test_knot_tsig_client_check()
ret = knot_tsig_client_check((knot_rrset_t *)0x1,
(uint8_t *)0x1, 0, NULL,
0, NULL, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -519,8 +519,8 @@ static int test_knot_tsig_client_check()
ret = knot_tsig_client_check((knot_rrset_t *)0x1,
(uint8_t *)0x1, 0, NULL,
0, NULL, 0);
- if (ret != KNOT_EBADARG) {
- diag("NULL argument did not return KNOT_EBADARG!");
+ if (ret != KNOT_EINVAL) {
+ diag("NULL argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -617,8 +617,8 @@ static int test_knot_tsig_test_tsig_add()
int lived = 0;
lives_ok({
int ret = knot_tsig_add(NULL, NULL, 0, 0, NULL);
- if (ret != KNOT_EBADARG) {
- diag("tsig_add did not return EBADARG "
+ if (ret != KNOT_EINVAL) {
+ diag("tsig_add did not return EINVAL "
"when given NULL parameters.");
errors++;
}
@@ -626,8 +626,8 @@ static int test_knot_tsig_test_tsig_add()
lived = 0;
ret = knot_tsig_add((uint8_t *)0x1, NULL, 0, 0, NULL);
- if (ret != KNOT_EBADARG) {
- diag("tsig_add did not return EBADARG when "
+ if (ret != KNOT_EINVAL) {
+ diag("tsig_add did not return EINVAL when "
"given NULL parameters.");
errors++;
}
diff --git a/src/tests/libknot/libknot/tsig_tests.h b/src/tests/libknot/libknot/tsig_tests.h
index 8ea15f6..8ea15f6 100755..100644
--- a/src/tests/libknot/libknot/tsig_tests.h
+++ b/src/tests/libknot/libknot/tsig_tests.h
diff --git a/src/tests/libknot/libknot/zone_tests.c b/src/tests/libknot/libknot/zone_tests.c
index 54cd38d..f348ebf 100755..100644
--- a/src/tests/libknot/libknot/zone_tests.c
+++ b/src/tests/libknot/libknot/zone_tests.c
@@ -20,7 +20,6 @@
#include "libknot/common.h"
#include "libknot/zone/dname-table.h"
#include "libknot/zone/zone.h"
-#include "libknot/util/error.h"
#include "libknot/zone/node.h"
static int knot_zone_tests_count(int argc, char *argv[]);
@@ -172,10 +171,10 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3)
}
if ((res = ((nsec3) ? knot_zone_contents_add_nsec3_node(NULL, node, 0, 0, 0)
- : knot_zone_contents_add_node(NULL, node, 0, 0, 0))) != KNOT_EBADARG) {
+ : knot_zone_contents_add_node(NULL, node, 0, 0, 0))) != KNOT_EINVAL) {
diag("zone: Inserting node to NULL zone did not result in"
"proper return value (%d instead of %d)", res,
- KNOT_EBADARG);
+ KNOT_EINVAL);
++errors;
}
@@ -185,10 +184,10 @@ static int test_zone_add_node(knot_zone_contents_t *zone, int nsec3)
note("Inserting NULL node...\n");
if ((res = ((nsec3) ? knot_zone_contents_add_nsec3_node(zone, NULL, 0, 0, 0)
- : knot_zone_contents_add_node(zone, NULL, 0, 0, 0))) != KNOT_EBADARG) {
+ : knot_zone_contents_add_node(zone, NULL, 0, 0, 0))) != KNOT_EINVAL) {
diag("zone: Inserting NULL node to zone did not result in"
"proper return value (%d instead of %d)", res,
- KNOT_EBADARG);
+ KNOT_EINVAL);
++errors;
}
@@ -522,32 +521,32 @@ static int test_zone_shallow_copy()
knot_node_new(apex_dname, NULL, 0);
assert(apex_node);
lives_ok({
- if (knot_zone_contents_shallow_copy(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_zone_contents_shallow_copy(NULL, NULL) != KNOT_EINVAL) {
diag("Calling zone_shallow_copy with NULL "
- "arguments did not return KNOT_EBADARG!");
+ "arguments did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
lived = 0;
knot_zone_contents_t *zone = knot_zone_contents_new(apex_node,
0, 1, 0);
- if (knot_zone_contents_shallow_copy(zone, NULL) != KNOT_EBADARG) {
+ if (knot_zone_contents_shallow_copy(zone, NULL) != KNOT_EINVAL) {
diag("Calling zone_shallow_copy with NULL destination "
- "zone argument did not return KNOT_EBADARG!");
+ "zone argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_contents_shallow_copy(NULL, &zone) != KNOT_EBADARG) {
+ if (knot_zone_contents_shallow_copy(NULL, &zone) != KNOT_EINVAL) {
diag("Calling zone_shallow_copy with NULL source "
- "zone argument did not return KNOT_EBADARG!");
+ "zone argument did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_contents_shallow_copy(zone, &zone) != KNOT_EBADARG) {
+ if (knot_zone_contents_shallow_copy(zone, &zone) != KNOT_EINVAL) {
diag("Calling zone_shallow_copy with identical source "
- "and destination zone did not return KNOT_EBADARG!");
+ "and destination zone did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
diff --git a/src/tests/libknot/libknot/zone_tests.h b/src/tests/libknot/libknot/zone_tests.h
index 5539709..5539709 100755..100644
--- a/src/tests/libknot/libknot/zone_tests.h
+++ b/src/tests/libknot/libknot/zone_tests.h
diff --git a/src/tests/libknot/libknot/zone_tree_tests.c b/src/tests/libknot/libknot/zone_tree_tests.c
index 207afea..80fa8f4 100755..100644
--- a/src/tests/libknot/libknot/zone_tree_tests.c
+++ b/src/tests/libknot/libknot/zone_tree_tests.c
@@ -19,7 +19,7 @@
#include "tests/libknot/libknot/zone_tree_tests.h"
#include "libknot/zone/zone-tree.h"
-#include "libknot/util/error.h"
+#include "libknot/common.h"
static int knot_zone_tree_tests_count(int argc, char *argv[]);
static int knot_zone_tree_tests_run(int argc, char *argv[]);
@@ -42,9 +42,9 @@ static int test_tree_init()
int lived = 0;
lives_ok({
- if (knot_zone_tree_init(NULL) != KNOT_EBADARG) {
+ if (knot_zone_tree_init(NULL) != KNOT_EINVAL) {
diag("Calling knot_zone_tree_init with NULL "
- "tree did not return KNOT_EBADARG!");
+ "tree did not return KNOT_EINVAL!");
errors++;
}
lived = 1;
@@ -70,23 +70,23 @@ static int test_tree_insert()
assert(node);
lives_ok({
- if (knot_zone_tree_insert(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_zone_tree_insert(NULL, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_tree_insert(tree, NULL) != KNOT_EBADARG) {
+ if (knot_zone_tree_insert(tree, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_tree_insert(NULL, node) != KNOT_EBADARG) {
+ if (knot_zone_tree_insert(NULL, node) != KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: insert NULL tests");
if (errors) {
- diag("Zone tree insert did not return KNOT_EBADARG "
+ diag("Zone tree insert did not return KNOT_EINVAL "
"when given wrong arguments");
}
errors += lived != 1;
@@ -118,38 +118,38 @@ static int test_tree_finding()
lives_ok({
if (knot_zone_tree_find(NULL, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_find(tree, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_find(tree, node->owner,
- NULL) != KNOT_EBADARG) {
+ NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
const knot_node_t *found_node = NULL;
lived = 0;
if (knot_zone_tree_find(NULL, node->owner,
- &found_node) != KNOT_EBADARG) {
+ &found_node) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_find(tree, NULL,
- &found_node) != KNOT_EBADARG) {
+ &found_node) != KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: find NULL tests");
if (errors) {
- diag("Zone tree find did not return KNOT_EBADARG "
+ diag("Zone tree find did not return KNOT_EINVAL "
"when given wrong arguments");
}
@@ -239,14 +239,14 @@ static int test_tree_finding_less_or_equal()
NULL,
NULL,
NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_find_less_or_equal(tree, NULL,
NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
@@ -255,7 +255,7 @@ static int test_tree_finding_less_or_equal()
node->owner,
NULL,
NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
@@ -263,7 +263,7 @@ static int test_tree_finding_less_or_equal()
lived = 0;
if (knot_zone_tree_find_less_or_equal(NULL, node->owner,
&found_node, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
@@ -272,13 +272,13 @@ static int test_tree_finding_less_or_equal()
if (knot_zone_tree_find_less_or_equal(tree, NULL,
&found_node,
&previous_node) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: tree find less or equal NULL tests");
if (errors) {
- diag("Zone tree find did not return KNOT_EBADARG "
+ diag("Zone tree find did not return KNOT_EINVAL "
"when given wrong arguments");
}
@@ -444,44 +444,44 @@ static int test_tree_remove()
lives_ok({
if (knot_zone_tree_remove(NULL, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_remove(tree, NULL, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_remove(tree, node->owner, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_remove(NULL, node->owner, NULL) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
knot_zone_tree_node_t *deleted_node = NULL;
lived = 0;
if (knot_zone_tree_remove(NULL, node->owner, &deleted_node) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
if (knot_zone_tree_remove(tree, NULL, &deleted_node) !=
- KNOT_EBADARG) {
+ KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: remove NULL tests");
if (errors) {
- diag("Zone tree remove did not return KNOT_EBADARG "
+ diag("Zone tree remove did not return KNOT_EINVAL "
"when given wrong arguments");
}
@@ -552,24 +552,24 @@ static int test_traversal(knot_node_t **nodes,
knot_zone_tree_init(tree);
lives_ok({
- if (trav_func(NULL, NULL, NULL) != KNOT_EBADARG) {
+ if (trav_func(NULL, NULL, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (trav_func(tree, NULL, NULL) != KNOT_EBADARG) {
+ if (trav_func(tree, NULL, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (trav_func(NULL, add_to_array, NULL) != KNOT_EBADARG) {
+ if (trav_func(NULL, add_to_array, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: traversal NULL tests");
if (errors) {
- diag("Traversal function did not return KNOT_EBADARG "
+ diag("Traversal function did not return KNOT_EINVAL "
"when given NULL parameters");
}
@@ -656,23 +656,23 @@ static int test_tree_shallow_copy()
knot_zone_tree_init(tree);
lives_ok({
- if (knot_zone_tree_shallow_copy(NULL, NULL) != KNOT_EBADARG) {
+ if (knot_zone_tree_shallow_copy(NULL, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_tree_shallow_copy(tree, NULL) != KNOT_EBADARG) {
+ if (knot_zone_tree_shallow_copy(tree, NULL) != KNOT_EINVAL) {
errors++;
}
lived = 1;
lived = 0;
- if (knot_zone_tree_shallow_copy(NULL, tree) != KNOT_EBADARG) {
+ if (knot_zone_tree_shallow_copy(NULL, tree) != KNOT_EINVAL) {
errors++;
}
lived = 1;
}, "zone tree: shallow copy NULL tests");
if (errors) {
- diag("Zone tree shallow copy did not return KNOT_EBADARG when "
+ diag("Zone tree shallow copy did not return KNOT_EINVAL when "
"given NULL arguments");
}
errors += lived != 1;
diff --git a/src/tests/libknot/libknot/zone_tree_tests.h b/src/tests/libknot/libknot/zone_tree_tests.h
index 4cea88c..4cea88c 100755..100644
--- a/src/tests/libknot/libknot/zone_tree_tests.h
+++ b/src/tests/libknot/libknot/zone_tree_tests.h
diff --git a/src/tests/libknot/libknot/zonedb_tests.c b/src/tests/libknot/libknot/zonedb_tests.c
index 7b45587..7b45587 100755..100644
--- a/src/tests/libknot/libknot/zonedb_tests.c
+++ b/src/tests/libknot/libknot/zonedb_tests.c
diff --git a/src/tests/libknot/libknot/zonedb_tests.h b/src/tests/libknot/libknot/zonedb_tests.h
index 0c4f8ef..0c4f8ef 100755..100644
--- a/src/tests/libknot/libknot/zonedb_tests.h
+++ b/src/tests/libknot/libknot/zonedb_tests.h
diff --git a/src/tests/libknot/realdata/files/parsed_data b/src/tests/libknot/realdata/files/parsed_data
index fe22b90..fe22b90 100755..100644
--- a/src/tests/libknot/realdata/files/parsed_data
+++ b/src/tests/libknot/realdata/files/parsed_data
Binary files differ
diff --git a/src/tests/libknot/realdata/files/parsed_data_queries b/src/tests/libknot/realdata/files/parsed_data_queries
index 5857c87..5857c87 100755..100644
--- a/src/tests/libknot/realdata/files/parsed_data_queries
+++ b/src/tests/libknot/realdata/files/parsed_data_queries
Binary files differ
diff --git a/src/tests/libknot/realdata/files/raw_data b/src/tests/libknot/realdata/files/raw_data
index 502005e..502005e 100755..100644
--- a/src/tests/libknot/realdata/files/raw_data
+++ b/src/tests/libknot/realdata/files/raw_data
Binary files differ
diff --git a/src/tests/libknot/realdata/files/raw_data_queries b/src/tests/libknot/realdata/files/raw_data_queries
index 9062d5a..9062d5a 100755..100644
--- a/src/tests/libknot/realdata/files/raw_data_queries
+++ b/src/tests/libknot/realdata/files/raw_data_queries
Binary files differ
diff --git a/src/tests/libknot/realdata/libknot/dname_tests_realdata.c b/src/tests/libknot/realdata/libknot/dname_tests_realdata.c
index d0216c7..d0216c7 100755..100644
--- a/src/tests/libknot/realdata/libknot/dname_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/dname_tests_realdata.c
diff --git a/src/tests/libknot/realdata/libknot/dname_tests_realdata.h b/src/tests/libknot/realdata/libknot/dname_tests_realdata.h
index a7d75aa..a7d75aa 100755..100644
--- a/src/tests/libknot/realdata/libknot/dname_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/dname_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/edns_tests_realdata.c b/src/tests/libknot/realdata/libknot/edns_tests_realdata.c
index 257d480..257d480 100755..100644
--- a/src/tests/libknot/realdata/libknot/edns_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/edns_tests_realdata.c
diff --git a/src/tests/libknot/realdata/libknot/edns_tests_realdata.h b/src/tests/libknot/realdata/libknot/edns_tests_realdata.h
index cfa64b0..cfa64b0 100755..100644
--- a/src/tests/libknot/realdata/libknot/edns_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/edns_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/node_tests_realdata.c b/src/tests/libknot/realdata/libknot/node_tests_realdata.c
index 91209c9..91209c9 100755..100644
--- a/src/tests/libknot/realdata/libknot/node_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/node_tests_realdata.c
diff --git a/src/tests/libknot/realdata/libknot/node_tests_realdata.h b/src/tests/libknot/realdata/libknot/node_tests_realdata.h
index a90179f..a90179f 100755..100644
--- a/src/tests/libknot/realdata/libknot/node_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/node_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/packet_tests_realdata.c b/src/tests/libknot/realdata/libknot/packet_tests_realdata.c
index 08c0882..94aac89 100755..100644
--- a/src/tests/libknot/realdata/libknot/packet_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/packet_tests_realdata.c
@@ -20,7 +20,6 @@
#include <config.h>
#include "knot/common.h"
#include "packet_tests_realdata.h"
-#include "libknot/util/error.h"
#include "libknot/packet/packet.h"
#include "libknot/packet/response.h"
/* *test_t structures */
diff --git a/src/tests/libknot/realdata/libknot/packet_tests_realdata.h b/src/tests/libknot/realdata/libknot/packet_tests_realdata.h
index c0e0479..c0e0479 100755..100644
--- a/src/tests/libknot/realdata/libknot/packet_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/packet_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/rdata_tests_realdata.c b/src/tests/libknot/realdata/libknot/rdata_tests_realdata.c
index f4ba64c..0d39bfb 100755..100644
--- a/src/tests/libknot/realdata/libknot/rdata_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/rdata_tests_realdata.c
@@ -23,7 +23,6 @@
#include "libknot/rdata.h"
#include "libknot/util/descriptor.h"
#include "libknot/util/utils.h"
-#include "libknot/util/error.h"
static int knot_rdata_tests_count(int argc, char *argv[]);
static int knot_rdata_tests_run(int argc, char *argv[]);
diff --git a/src/tests/libknot/realdata/libknot/rdata_tests_realdata.h b/src/tests/libknot/realdata/libknot/rdata_tests_realdata.h
index 570b2b1..570b2b1 100755..100644
--- a/src/tests/libknot/realdata/libknot/rdata_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/rdata_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/response_tests_realdata.c b/src/tests/libknot/realdata/libknot/response_tests_realdata.c
index 7dac341..0413238 100755..100644
--- a/src/tests/libknot/realdata/libknot/response_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/response_tests_realdata.c
@@ -19,7 +19,6 @@
#include "packet_tests_realdata.h"
#include "knot/common.h"
-#include "libknot/util/error.h"
#include "libknot/packet/packet.h"
#include "libknot/packet/response.h"
/* *test_t structures */
diff --git a/src/tests/libknot/realdata/libknot/response_tests_realdata.h b/src/tests/libknot/realdata/libknot/response_tests_realdata.h
index 731604b..731604b 100755..100644
--- a/src/tests/libknot/realdata/libknot/response_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/response_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/rrset_tests_realdata.c b/src/tests/libknot/realdata/libknot/rrset_tests_realdata.c
index cb59f4c..cb59f4c 100755..100644
--- a/src/tests/libknot/realdata/libknot/rrset_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/rrset_tests_realdata.c
diff --git a/src/tests/libknot/realdata/libknot/rrset_tests_realdata.h b/src/tests/libknot/realdata/libknot/rrset_tests_realdata.h
index cc3b705..cc3b705 100755..100644
--- a/src/tests/libknot/realdata/libknot/rrset_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/rrset_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/zone_tests_realdata.c b/src/tests/libknot/realdata/libknot/zone_tests_realdata.c
index 4687978..9c92b72 100755..100644
--- a/src/tests/libknot/realdata/libknot/zone_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/zone_tests_realdata.c
@@ -20,7 +20,6 @@
#include "tests/libknot/realdata/libknot_tests_loader_realdata.h"
#include "libknot/common.h"
#include "libknot/zone/zone.h"
-#include "libknot/util/error.h"
#include "libknot/zone/node.h"
static int knot_zone_tests_count(int argc, char *argv[]);
diff --git a/src/tests/libknot/realdata/libknot/zone_tests_realdata.h b/src/tests/libknot/realdata/libknot/zone_tests_realdata.h
index 5539709..5539709 100755..100644
--- a/src/tests/libknot/realdata/libknot/zone_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/zone_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.c b/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.c
index 96d1517..96d1517 100755..100644
--- a/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.c
+++ b/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.c
diff --git a/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.h b/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.h
index 0c4f8ef..0c4f8ef 100755..100644
--- a/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.h
+++ b/src/tests/libknot/realdata/libknot/zonedb_tests_realdata.h
diff --git a/src/tests/libknot/realdata/libknot_tests_loader_realdata.c b/src/tests/libknot/realdata/libknot_tests_loader_realdata.c
index e972855..e972855 100755..100644
--- a/src/tests/libknot/realdata/libknot_tests_loader_realdata.c
+++ b/src/tests/libknot/realdata/libknot_tests_loader_realdata.c
diff --git a/src/tests/libknot/realdata/libknot_tests_loader_realdata.h b/src/tests/libknot/realdata/libknot_tests_loader_realdata.h
index 8f57944..8f57944 100755..100644
--- a/src/tests/libknot/realdata/libknot_tests_loader_realdata.h
+++ b/src/tests/libknot/realdata/libknot_tests_loader_realdata.h
diff --git a/src/tests/libknot/realdata/unittests_libknot_realdata.c b/src/tests/libknot/realdata/unittests_libknot_realdata.c
index e557c43..e557c43 100755..100644
--- a/src/tests/libknot/realdata/unittests_libknot_realdata.c
+++ b/src/tests/libknot/realdata/unittests_libknot_realdata.c
diff --git a/src/tests/libknot/unittests_libknot.c b/src/tests/libknot/unittests_libknot.c
index d522e1d..d522e1d 100755..100644
--- a/src/tests/libknot/unittests_libknot.c
+++ b/src/tests/libknot/unittests_libknot.c
diff --git a/src/tests/unittests_main.c b/src/tests/unittests_main.c
index 21eae14..21eae14 100755..100644
--- a/src/tests/unittests_main.c
+++ b/src/tests/unittests_main.c
diff --git a/src/tests/xfr_tests.c b/src/tests/xfr_tests.c
index b78678b..db6c486 100755..100644
--- a/src/tests/xfr_tests.c
+++ b/src/tests/xfr_tests.c
@@ -29,7 +29,6 @@
#include <getopt.h>
#include "knot/common.h"
-#include "knot/other/error.h"
#include "knot/server/server.h"
#include "knot/ctl/process.h"
#include "knot/conf/conf.h"
@@ -210,8 +209,8 @@ int main(int argc, char **argv)
// Open configuration
log_server_info("Reading configuration '%s' ...\n", config_fn);
int conf_ret = conf_open(config_fn);
- if (conf_ret != KNOTD_EOK) {
- if (conf_ret == KNOTD_ENOENT) {
+ if (conf_ret != KNOT_EOK) {
+ if (conf_ret == KNOT_ENOENT) {
log_server_error("Couldn't open configuration file "
"'%s'.\n", config_fn);
} else {
@@ -233,7 +232,7 @@ int main(int argc, char **argv)
// Run server
int res = 0;
log_server_info("Starting server...\n");
- if ((res = server_start(server)) == KNOTD_EOK) {
+ if ((res = server_start(server)) == KNOT_EOK) {
// Save PID
int has_pid = 1;
@@ -296,11 +295,11 @@ int main(int argc, char **argv)
sig_req_reload = 0;
int cf_ret = conf_open(config_fn);
switch (cf_ret) {
- case KNOTD_EOK:
+ case KNOT_EOK:
log_server_info("Configuration "
"reloaded.\n");
break;
- case KNOTD_ENOENT:
+ case KNOT_ENOENT:
log_server_error("Configuration "
"file '%s' "
"not found.\n",
@@ -338,7 +337,7 @@ int main(int argc, char **argv)
}
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
- if ((res = server_wait(server)) != KNOTD_EOK) {
+ if ((res = server_wait(server)) != KNOT_EOK) {
log_server_error("An error occured while "
"waiting for server to finish.\n");
} else {
diff --git a/src/tests/xfr_tests.h b/src/tests/xfr_tests.h
index 29de11d..29de11d 100755..100644
--- a/src/tests/xfr_tests.h
+++ b/src/tests/xfr_tests.h
diff --git a/src/zcompile/LICENSE b/src/zcompile/LICENSE
index 55faacf..55faacf 100755..100644
--- a/src/zcompile/LICENSE
+++ b/src/zcompile/LICENSE
diff --git a/src/zcompile/parser-descriptor.c b/src/zcompile/parser-descriptor.c
index bc3ee16..bc3ee16 100755..100644
--- a/src/zcompile/parser-descriptor.c
+++ b/src/zcompile/parser-descriptor.c
diff --git a/src/zcompile/parser-descriptor.h b/src/zcompile/parser-descriptor.h
index 48c6f02..48c6f02 100755..100644
--- a/src/zcompile/parser-descriptor.h
+++ b/src/zcompile/parser-descriptor.h
diff --git a/src/zcompile/parser-util.c b/src/zcompile/parser-util.c
index 955a7b0..955a7b0 100755..100644
--- a/src/zcompile/parser-util.c
+++ b/src/zcompile/parser-util.c
diff --git a/src/zcompile/parser-util.h b/src/zcompile/parser-util.h
index 57258dc..57258dc 100755..100644
--- a/src/zcompile/parser-util.h
+++ b/src/zcompile/parser-util.h
diff --git a/src/zcompile/tests/unittests_zp_main.c b/src/zcompile/tests/unittests_zp_main.c
index 5d8c5e9..5d8c5e9 100755..100644
--- a/src/zcompile/tests/unittests_zp_main.c
+++ b/src/zcompile/tests/unittests_zp_main.c
diff --git a/src/zcompile/tests/zcompile_tests.c b/src/zcompile/tests/zcompile_tests.c
index 5d3dce6..5d3dce6 100755..100644
--- a/src/zcompile/tests/zcompile_tests.c
+++ b/src/zcompile/tests/zcompile_tests.c
diff --git a/src/zcompile/zcompile-error.c b/src/zcompile/zcompile-error.c
index 9357cde..9357cde 100755..100644
--- a/src/zcompile/zcompile-error.c
+++ b/src/zcompile/zcompile-error.c
diff --git a/src/zcompile/zcompile-error.h b/src/zcompile/zcompile-error.h
index c6d999c..c6d999c 100755..100644
--- a/src/zcompile/zcompile-error.h
+++ b/src/zcompile/zcompile-error.h
diff --git a/src/zcompile/zcompile.c b/src/zcompile/zcompile.c
index e2f05e3..e2f05e3 100755..100644
--- a/src/zcompile/zcompile.c
+++ b/src/zcompile/zcompile.c
diff --git a/src/zcompile/zcompile.h b/src/zcompile/zcompile.h
index d19ef4c..d19ef4c 100755..100644
--- a/src/zcompile/zcompile.h
+++ b/src/zcompile/zcompile.h
diff --git a/src/zcompile/zcompile_main.c b/src/zcompile/zcompile_main.c
index 983376a..983376a 100755..100644
--- a/src/zcompile/zcompile_main.c
+++ b/src/zcompile/zcompile_main.c
diff --git a/src/zcompile/zlexer.l b/src/zcompile/zlexer.l
index 58e6439..58e6439 100755..100644
--- a/src/zcompile/zlexer.l
+++ b/src/zcompile/zlexer.l
diff --git a/src/zcompile/zparser.y b/src/zcompile/zparser.y
index c35060e..c35060e 100755..100644
--- a/src/zcompile/zparser.y
+++ b/src/zcompile/zparser.y
diff --git a/tests/querytcp.c b/tests/querytcp.c
index 7e1418f..7e1418f 100755..100644
--- a/tests/querytcp.c
+++ b/tests/querytcp.c