xfrin: rename XFRST_INITIALSOA to XFRST_ZONEXFRREQUEST

The XFRST_INITIALSOA state in the xfrin module is named like that,
because the first RR in a zone transfer must be SOA. However, the
name of the state is a bit confusing (especially when exposed to
the users with statistics channel), because it can be mistaken with
the refresh SOA request step, which takes place before the zone
transfer starts.

Rename the state to XFRST_ZONEXFRREQUEST (i.e. Zone Transfer Request).
During that step the state machine performs several operations -
establishing a connection, sending a request, and receiving/parsing
the first RR in the answer.
This commit is contained in:
Aram Sargsyan
2023-09-19 09:35:20 +00:00
parent dee829d9dc
commit 621a1461d9
3 changed files with 16 additions and 17 deletions

View File

@@ -715,9 +715,9 @@ _wait_for_transfers() {
getxfrins xml x$n || return 1
getxfrins json j$n || return 1
# XML is encoded in one line, use sed to separate each transfer
count=$(sed 's/<xfrin /\n<xfrin /g' xfrins.xml.x$n | grep -c '<state>\(Initial SOA\|First Data\|Receiving AXFR Data\)</state>')
count=$(sed 's/<xfrin /\n<xfrin /g' xfrins.xml.x$n | grep -c '<state>\(Zone Transfer Request\|First Data\|Receiving AXFR Data\)</state>')
if [ $count != 3 ]; then return 1; fi
count=$(grep -c '"state":"\(Initial SOA\|First Data\|Receiving AXFR Data\)"' xfrins.json.j$n)
count=$(grep -c '"state":"\(Zone Transfer Request\|First Data\|Receiving AXFR Data\)"' xfrins.json.j$n)
if [ $count != 3 ]; then return 1; fi
}

View File

@@ -7609,9 +7609,8 @@ Incoming Zone Transfers
An answer for the SOA query from the previous step is
received, initiating a transfer.
``Initial SOA``
Waiting for the transfer to start, which is expected
to begin with an initial SOA record. The ``Duration`` timer
``Zone Transfer Request``
Waiting for the zone transfer to start. The ``Duration (s)`` timer
restarts before entering this state.
``First Data``

View File

@@ -80,7 +80,7 @@
typedef enum {
XFRST_SOAQUERY,
XFRST_GOTSOA,
XFRST_INITIALSOA,
XFRST_ZONEXFRREQUEST,
XFRST_FIRSTDATA,
XFRST_IXFR_DELSOA,
XFRST_IXFR_DEL,
@@ -553,7 +553,7 @@ redo:
*/
break;
case XFRST_INITIALSOA:
case XFRST_ZONEXFRREQUEST:
if (rdata->type != dns_rdatatype_soa) {
xfrin_log(xfr, ISC_LOG_NOTICE,
"first RR in zone transfer must be SOA");
@@ -799,8 +799,8 @@ dns_xfrin_getstate(const dns_xfrin_t *xfr, const char **statestr,
case XFRST_GOTSOA:
*statestr = "Got SOA";
break;
case XFRST_INITIALSOA:
*statestr = "Initial SOA";
case XFRST_ZONEXFRREQUEST:
*statestr = "Zone Transfer Request";
break;
case XFRST_FIRSTDATA:
*statestr = "First Data";
@@ -1017,7 +1017,7 @@ xfrin_create(isc_mem_t *mctx, dns_zone_t *zone, dns_db_t *db,
if (reqtype == dns_rdatatype_soa) {
atomic_init(&xfr->state, XFRST_SOAQUERY);
} else {
atomic_init(&xfr->state, XFRST_INITIALSOA);
atomic_init(&xfr->state, XFRST_ZONEXFRREQUEST);
}
xfr->start = isc_time_now();
@@ -1101,9 +1101,9 @@ xfrin_start(dns_xfrin_t *xfr) {
/*
* If the transfer is started when the 'state' is XFRST_SOAQUERY, it
* means the SOA query will be performed by xfrin. A transfer could also
* be initiated starting from the XFRST_INITIALSOA state, which means
* that the SOA query was already performed by other means (e.g. by
* zone.c:soa_query()), or that it's a transfer without a preceding
* be initiated starting from the XFRST_ZONEXFRREQUEST state, which
* means that the SOA query was already performed by other means (e.g.
* by zone.c:soa_query()), or that it's a transfer without a preceding
* SOA request, and 'soa_transport_type' is already correctly
* set by the creator of the xfrin.
*/
@@ -1572,7 +1572,7 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
if (result == ISC_R_SUCCESS &&
msg->rcode == dns_rcode_formerr && xfr->edns &&
(atomic_load(&xfr->state) == XFRST_SOAQUERY ||
atomic_load(&xfr->state) == XFRST_INITIALSOA))
atomic_load(&xfr->state) == XFRST_ZONEXFRREQUEST))
{
xfr->edns = false;
dns_message_detach(&msg);
@@ -1632,7 +1632,7 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
}
if ((atomic_load(&xfr->state) == XFRST_SOAQUERY ||
atomic_load(&xfr->state) == XFRST_INITIALSOA) &&
atomic_load(&xfr->state) == XFRST_ZONEXFRREQUEST) &&
msg->counts[DNS_SECTION_QUESTION] != 1)
{
xfrin_log(xfr, ISC_LOG_NOTICE, "missing question section");
@@ -1682,7 +1682,7 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
* if the first RR in the answer section is not a SOA record.
*/
if (xfr->reqtype == dns_rdatatype_ixfr &&
atomic_load(&xfr->state) == XFRST_INITIALSOA &&
atomic_load(&xfr->state) == XFRST_ZONEXFRREQUEST &&
msg->counts[DNS_SECTION_ANSWER] == 0)
{
xfrin_log(xfr, ISC_LOG_DEBUG(3),
@@ -1787,7 +1787,7 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
switch (atomic_load(&xfr->state)) {
case XFRST_GOTSOA:
xfr->reqtype = dns_rdatatype_axfr;
atomic_store(&xfr->state, XFRST_INITIALSOA);
atomic_store(&xfr->state, XFRST_ZONEXFRREQUEST);
CHECK(xfrin_send_request(xfr));
break;
case XFRST_AXFR_END: