summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2024-07-25 20:43:49 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2024-08-11 21:14:12 +0200
commit50aa6f908bfe369b7d678ba9ce8139bfbf7c93a3 (patch)
tree407c07b7181814a4dfee6b1b0c2f2ded9b74f667 /src
parentCI: replace $CI_BUILD_TOKEN with $CI_JOB_TOKEN (diff)
downloadknot-50aa6f908bfe369b7d678ba9ce8139bfbf7c93a3.tar.xz
knot-50aa6f908bfe369b7d678ba9ce8139bfbf7c93a3.zip
nameserver: use state type knot_layer_state_t where appropriate
Diffstat (limited to 'src')
-rw-r--r--src/knot/nameserver/axfr.c4
-rw-r--r--src/knot/nameserver/axfr.h6
-rw-r--r--src/knot/nameserver/internet.c4
-rw-r--r--src/knot/nameserver/internet.h7
-rw-r--r--src/knot/nameserver/ixfr.c8
-rw-r--r--src/knot/nameserver/ixfr.h8
-rw-r--r--src/knot/nameserver/notify.c6
-rw-r--r--src/knot/nameserver/notify.h7
-rw-r--r--src/knot/nameserver/process_query.c6
-rw-r--r--src/knot/nameserver/update.c2
-rw-r--r--src/knot/nameserver/update.h6
11 files changed, 25 insertions, 39 deletions
diff --git a/src/knot/nameserver/axfr.c b/src/knot/nameserver/axfr.c
index a35a3ae89..cd9ee3262 100644
--- a/src/knot/nameserver/axfr.c
+++ b/src/knot/nameserver/axfr.c
@@ -128,7 +128,7 @@ static void axfr_answer_finished(knotd_qdata_t *qdata, knot_pkt_t *pkt, int stat
}
}
-static int axfr_query_check(knotd_qdata_t *qdata)
+static knot_layer_state_t axfr_query_check(knotd_qdata_t *qdata)
{
NS_NEED_ZONE(qdata, KNOT_RCODE_NOTAUTH);
NS_NEED_AUTH(qdata, ACL_ACTION_TRANSFER);
@@ -187,7 +187,7 @@ static int axfr_query_init(knotd_qdata_t *qdata)
return KNOT_EOK;
}
-int axfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+knot_layer_state_t axfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
if (pkt == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
diff --git a/src/knot/nameserver/axfr.h b/src/knot/nameserver/axfr.h
index 81fcad882..25c5f1c1e 100644
--- a/src/knot/nameserver/axfr.h
+++ b/src/knot/nameserver/axfr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -21,7 +21,5 @@
/*!
* \brief Process an AXFR query message.
- *
- * \return KNOT_STATE_* processing states
*/
-int axfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
+knot_layer_state_t axfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
diff --git a/src/knot/nameserver/internet.c b/src/knot/nameserver/internet.c
index 51bde9757..b84284000 100644
--- a/src/knot/nameserver/internet.c
+++ b/src/knot/nameserver/internet.c
@@ -641,7 +641,7 @@ static int solve_additional_dnssec(int state, knot_pkt_t *pkt, knotd_qdata_t *qd
return KNOT_STATE_FAIL; \
}
-static int answer_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+static knot_layer_state_t answer_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
int state = KNOTD_IN_STATE_BEGIN;
struct query_plan *plan = qdata->extra->zone->query_plan;
@@ -698,7 +698,7 @@ static int answer_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
return KNOT_STATE_DONE;
}
-int internet_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+knot_layer_state_t internet_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
if (pkt == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
diff --git a/src/knot/nameserver/internet.h b/src/knot/nameserver/internet.h
index 0a884d787..606c839d3 100644
--- a/src/knot/nameserver/internet.h
+++ b/src/knot/nameserver/internet.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -25,11 +25,8 @@
/*!
* \brief Answer query from an IN class zone.
- *
- * \retval KNOT_STATE_FAIL if it encountered an error.
- * \retval KNOT_STATE_DONE if finished.
*/
-int internet_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
+knot_layer_state_t internet_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
/*! \brief Require given QUERY TYPE or return error code. */
#define NS_NEED_QTYPE(qdata, qtype_want, error_rcode) \
diff --git a/src/knot/nameserver/ixfr.c b/src/knot/nameserver/ixfr.c
index 8a4dd37e8..c0e17ea6d 100644
--- a/src/knot/nameserver/ixfr.c
+++ b/src/knot/nameserver/ixfr.c
@@ -130,7 +130,7 @@ static int ixfr_load_chsets(journal_read_t **journal_read, zone_t *zone,
return journal_read_begin(zone_journal(zone), false, serial_from, journal_read);
}
-static int ixfr_query_check(knotd_qdata_t *qdata)
+static knot_layer_state_t ixfr_query_check(knotd_qdata_t *qdata)
{
NS_NEED_ZONE(qdata, KNOT_RCODE_NOTAUTH);
NS_NEED_AUTH(qdata, ACL_ACTION_TRANSFER);
@@ -245,13 +245,13 @@ static int ixfr_answer_init(knotd_qdata_t *qdata, uint32_t *serial_from)
return KNOT_EOK;
}
-static int ixfr_answer_soa(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+static knot_layer_state_t ixfr_answer_soa(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
assert(pkt);
assert(qdata);
/* Check query. */
- int state = ixfr_query_check(qdata);
+ knot_layer_state_t state = ixfr_query_check(qdata);
if (state == KNOT_STATE_FAIL) {
return state; /* Malformed query. */
}
@@ -277,7 +277,7 @@ static int ixfr_answer_soa(knot_pkt_t *pkt, knotd_qdata_t *qdata)
return KNOT_STATE_DONE;
}
-int ixfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+knot_layer_state_t ixfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
if (pkt == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
diff --git a/src/knot/nameserver/ixfr.h b/src/knot/nameserver/ixfr.h
index 3012be123..91ce7507b 100644
--- a/src/knot/nameserver/ixfr.h
+++ b/src/knot/nameserver/ixfr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -55,9 +55,5 @@ struct ixfr_proc {
/*!
* \brief IXFR query processing module.
- *
- * \retval PRODUCE if it has an answer, but not yet finished.
- * \retval FAIL if it encountered an error.
- * \retval DONE if finished.
*/
-int ixfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
+knot_layer_state_t ixfr_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
diff --git a/src/knot/nameserver/notify.c b/src/knot/nameserver/notify.c
index eaa305ab0..5b1593f13 100644
--- a/src/knot/nameserver/notify.c
+++ b/src/knot/nameserver/notify.c
@@ -29,7 +29,7 @@
LOG_DIRECTION_IN, (qdata)->params->remote, (qdata)->params->proto, \
false, (qdata)->sign.tsig_key.name, fmt)
-static int notify_check_query(knotd_qdata_t *qdata)
+static knot_layer_state_t notify_check_query(knotd_qdata_t *qdata)
{
NS_NEED_ZONE(qdata, KNOT_RCODE_NOTAUTH);
NS_NEED_AUTH(qdata, ACL_ACTION_NOTIFY);
@@ -39,14 +39,14 @@ static int notify_check_query(knotd_qdata_t *qdata)
return KNOT_STATE_DONE;
}
-int notify_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+knot_layer_state_t notify_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
if (pkt == NULL || qdata == NULL) {
return KNOT_STATE_FAIL;
}
/* Validate notification query. */
- int state = notify_check_query(qdata);
+ knot_layer_state_t state = notify_check_query(qdata);
if (state == KNOT_STATE_FAIL) {
switch (qdata->rcode) {
case KNOT_RCODE_NOTAUTH: /* Not authorized, already logged. */
diff --git a/src/knot/nameserver/notify.h b/src/knot/nameserver/notify.h
index d0bff144f..0e60b58c1 100644
--- a/src/knot/nameserver/notify.h
+++ b/src/knot/nameserver/notify.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -21,8 +21,5 @@
/*!
* \brief Answer IN class zone NOTIFY message (RFC1996).
- *
- * \retval FAIL if it encountered an error.
- * \retval DONE if finished.
*/
-int notify_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
+knot_layer_state_t notify_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
diff --git a/src/knot/nameserver/process_query.c b/src/knot/nameserver/process_query.c
index 4539d5b90..7cb89b7fe 100644
--- a/src/knot/nameserver/process_query.c
+++ b/src/knot/nameserver/process_query.c
@@ -147,7 +147,7 @@ static int process_query_in(knot_layer_t *ctx, knot_pkt_t *pkt)
/*!
* \brief Create a response for a given query in the INTERNET class.
*/
-static int query_internet(knot_pkt_t *pkt, knot_layer_t *ctx)
+static knot_layer_state_t query_internet(knot_pkt_t *pkt, knot_layer_t *ctx)
{
knotd_qdata_t *data = QUERY_DATA(ctx);
@@ -167,7 +167,7 @@ static int query_internet(knot_pkt_t *pkt, knot_layer_t *ctx)
/*!
* \brief Create a response for a given query in the CHAOS class.
*/
-static int query_chaos(knot_pkt_t *pkt, knot_layer_t *ctx)
+static knot_layer_state_t query_chaos(knot_pkt_t *pkt, knot_layer_t *ctx)
{
knotd_qdata_t *data = QUERY_DATA(ctx);
@@ -507,7 +507,7 @@ static void set_rcode_to_packet(knot_pkt_t *pkt, knotd_qdata_t *qdata)
knot_wire_set_rcode(pkt->wire, KNOT_EDNS_RCODE_LO(qdata->rcode));
}
-static int process_query_err(knot_layer_t *ctx, knot_pkt_t *pkt)
+static knot_layer_state_t process_query_err(knot_layer_t *ctx, knot_pkt_t *pkt)
{
assert(ctx && pkt);
diff --git a/src/knot/nameserver/update.c b/src/knot/nameserver/update.c
index 3f069c614..ee884fdf7 100644
--- a/src/knot/nameserver/update.c
+++ b/src/knot/nameserver/update.c
@@ -104,7 +104,7 @@ static int update_enqueue(zone_t *zone, knotd_qdata_t *qdata)
return KNOT_EOK;
}
-int update_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
+knot_layer_state_t update_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata)
{
/* DDNS over XDP not supported. */
if (qdata->params->xdp_msg != NULL) {
diff --git a/src/knot/nameserver/update.h b/src/knot/nameserver/update.h
index 609acd963..430b323c5 100644
--- a/src/knot/nameserver/update.h
+++ b/src/knot/nameserver/update.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -21,7 +21,5 @@
/*!
* \brief UPDATE query processing module.
- *
- * \return KNOT_STATE_* processing states
*/
-int update_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);
+knot_layer_state_t update_process_query(knot_pkt_t *pkt, knotd_qdata_t *qdata);