Commit 4756f93e authored by Lubos Slovak's avatar Lubos Slovak

Merge branch 'master' into libknot-cleanup

parents d7308b71 7d2f14fa
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -43,4 +43,4 @@ Supported operating system
Knot DNS itself is written in a portable way, but it depends on
several libraries. Namely userspace-rcu, which could be a constraint
when it comes to the operating system support. Knot DNS can be compiled
and run on most of UNIX-like systems, such as Linux, *BSD and Mac OS X.
and run on most of UNIX-like systems, such as Linux, \*BSD and Mac OS X.
......@@ -119,3 +119,5 @@ bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n);
*/
int knot_nsec_create_chain(const zone_contents_t *zone, uint32_t ttl,
changeset_t *changeset);
/*! @} */
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file nsec3-chain-fix.h
* \file nsec3-chain.h
*
* \author Jan Vcelak <jan.vcelak@nic.cz> (chain creation)
*
......@@ -40,3 +40,5 @@
*/
int knot_nsec3_create_chain(const zone_contents_t *zone, uint32_t ttl,
changeset_t *changeset);
/*! @} */
......@@ -46,7 +46,7 @@
#define NOTIFY_QLOG(severity, msg...) \
QUERY_LOG(severity, qdata, "NOTIFY", msg)
int notify_check_query(struct query_data *qdata)
static int notify_check_query(struct query_data *qdata)
{
/* RFC1996 requires SOA question. */
NS_NEED_QTYPE(qdata, KNOT_RRTYPE_SOA, KNOT_RCODE_FORMERR);
......
......@@ -112,7 +112,7 @@ static int process_answer(knot_pkt_t *pkt, knot_process_t *ctx)
/* Verify incoming packet. */
int ret = tsig_verify_packet(&data->param->tsig_ctx, pkt);
if (ret != KNOT_EOK) {
ANSWER_LOG(LOG_INFO, data, "Response", "%s", knot_strerror(ret));
ANSWER_LOG(LOG_WARNING, data, "Response", "%s", knot_strerror(ret));
return NS_PROC_FAIL;
}
......
......@@ -63,3 +63,4 @@ int rrset_serialize(const knot_rrset_t *rrset, uint8_t *stream, size_t *size);
int rrset_deserialize(const uint8_t *stream, size_t *stream_size,
knot_rrset_t **rrset);
/*! @} */
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file rrsig-sign.h
* \file rrset-sign.h
*
* \author Jan Vcelak <jan.vcelak@nic.cz>
*
......
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file dnssec.h
* \file sign.h
*
* \author Jan Vcelak <jan.vcelak@nic.cz>
*
......
......@@ -41,7 +41,7 @@ static bool compr_label_match(const uint8_t *n, const uint8_t *p)
return true;
}
/*! \brief Helper for \fn knot_pkt_put_dname, writes label(s) with size checks. */
/*! \brief Helper for \fn knot_compr_put_dname, writes label(s) with size checks. */
#define WRITE_LABEL(dst, written, label, max, len) \
if ((written) + (len) > (max)) { \
return KNOT_ESPACE; \
......
/*!
* \file process.h
*
* \author Marek Vavrusa <marek.vavrusa@nic.cz>
*
* \addtogroup query_processing
* @{
*/
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
......@@ -21,6 +13,14 @@
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 process.h
*
* \author Marek Vavrusa <marek.vavrusa@nic.cz>
*
* \addtogroup query_processing
* @{
*/
#pragma once
......
......@@ -104,3 +104,5 @@ size_t knot_rdata_array_size(uint16_t size);
* \retval > 0 if rr1 > rr2.
*/
int knot_rdata_cmp(const knot_rdata_t *rr1, const knot_rdata_t *rr2);
/*! @} */
......@@ -156,3 +156,5 @@ uint8_t *knot_rdata_offset(const knot_rdataset_t *rrs, size_t pos, size_t offset
knot_rdata_t *rr = knot_rdataset_at(rrs, pos);
return knot_rdata_data(rr) + offset;
}
/*! @} */
#!/usr/bin/env python3
'''Test for changeset application after restart. '''
from dnstest.test import Test
import dnstest.utils
def check_axfr(server, zone):
# Get AXFR
axfr_pre = server.dig(zone[0].name, "AXFR", log_no_sep=True)
# Restart
server.stop()
t.sleep(1)
server.start()
server.zone_wait(zone)
# Get AXFR after restart
axfr_post = server.dig(zone[0].name, "AXFR", log_no_sep=True)
# Compare AXFRs
t.axfr_diff_resp(axfr_pre, axfr_post, server, server, zone[0])
t = Test()
master = t.server("knot")
slave = t.server("knot")
# Zone setup
zone = t.zone_rnd(1)
t.link(zone, master, slave, ixfr = True, ddns=True)
# Turn automatic DNSSEC on
master.dnssec_enable = True
master.enable_nsec3(zone)
master.gen_key(zone, ksk=True, alg="RSASHA256")
master.gen_key(zone, alg="RSASHA256")
t.start()
# Load zones - master should sign
master.zone_wait(zone)
slave.zone_wait(zone)
# Check DNSSEC application
check_axfr(master, zone)
# Update zone using DDNS
up = master.update(zone)
up.add("test123."+zone[0].name, "3600", "TXT", "test")
up.send("NOERROR")
# Check DDNS application
check_axfr(master, zone)
serial = master.zone_wait(zone)
# Update zonefile on master
master.flush()
t.sleep(1)
master.update_zonefile(zone, random=True)
master.reload()
master.zone_wait(zone)
# Wait for all changes on slave
slave.zone_wait(zone, serial)
# Make sure slave applied everything
check_axfr(slave, zone)
t.end()
......@@ -253,12 +253,10 @@ class Test(object):
raise Exception("Server is out of testing scope")
slave.set_slave(zone, master, ddns, ixfr)
def _axfr_records(self, server, zone):
def _axfr_records(self, resp, zone):
unique = set()
records = list()
resp = server.dig(zone.name, "AXFR", log_no_sep=True)
for msg in resp.resp:
for rrset in msg.answer:
rrs = rrset.to_text(origin=dns.name.from_text(zone.name),
......@@ -278,10 +276,7 @@ class Test(object):
return unique, records
def _axfr_diff(self, server1, server2, zone):
unique1, rrsets1 = self._axfr_records(server1, zone)
unique2, rrsets2 = self._axfr_records(server2, zone)
def _axfr_diff_resp(self, unique1, rrset1s, unique2, rrsets2, server1, server2):
diff1 = sorted(list(unique1 - unique2))
if diff1:
set_err("AXFR DIFF")
......@@ -296,6 +291,13 @@ class Test(object):
for record in diff2:
detail_log(" %s" % record)
def _axfr_diff(self, server1, server2, zone):
unique1, rrsets1 = self._axfr_records(server1.dig(zone.name, "AXFR", log_no_sep=True), zone)
unique2, rrsets2 = self._axfr_records(server2.dig(zone.name, "AXFR", log_no_sep=True), zone)
self._axfr_diff_resp(unique1, rrsets1, unique2, rrsets2, server1, server2)
class IxfrChange():
def __init__(self):
self.soa_old = None
......@@ -452,3 +454,9 @@ class Test(object):
self._axfr_diff(server1, server2, zone)
detail_log(SEP)
def axfr_diff_resp(self, resp1, resp2, server1, server2, zone):
unique1, rrsets1 = self._axfr_records(resp1, zone)
unique2, rrsets2 = self._axfr_records(resp2, zone)
self._axfr_diff_resp(unique1, rrsets1, unique2, rrsets2, server1, server2)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment