xfrin.c File Reference

#include <config.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/diff.h>
#include <dns/events.h>
#include <dns/journal.h>
#include <dns/log.h>
#include <dns/message.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/soa.h>
#include <dns/tcpmsg.h>
#include <dns/timer.h>
#include <dns/tsig.h>
#include <dns/view.h>
#include <dns/xfrin.h>
#include <dns/zone.h>
#include <dst/dst.h>

Go to the source code of this file.

Data Structures

struct  dns_xfrin_ctx
 Incoming zone transfer context. More...

Defines

#define FAIL(code)
 It would be non-sensical (or at least obtuse) to use FAIL() with an ISC_R_SUCCESS code, but the test is there to keep the Solaris compiler from complaining about "end-of-loop code not reached".
#define CHECK(op)
#define XFRIN_MAGIC   ISC_MAGIC('X', 'f', 'r', 'I')
#define VALID_XFRIN(x)   ISC_MAGIC_VALID(x, XFRIN_MAGIC)

Enumerations

enum  xfrin_state_t {
  XFRST_SOAQUERY, XFRST_GOTSOA, XFRST_INITIALSOA, XFRST_FIRSTDATA,
  XFRST_IXFR_DELSOA, XFRST_IXFR_DEL, XFRST_IXFR_ADDSOA, XFRST_IXFR_ADD,
  XFRST_IXFR_END, XFRST_AXFR, XFRST_AXFR_END
}
 The states of the *XFR state machine. We handle both IXFR and AXFR with a single integrated state machine because they cannot be distinguished immediately - an AXFR response to an IXFR request can only be detected when the first two (2) response RRs have already been received. More...

Functions

static isc_result_t xfrin_create (isc_mem_t *mctx, dns_zone_t *zone, dns_db_t *db, isc_task_t *task, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, dns_name_t *zonename, dns_rdataclass_t rdclass, dns_rdatatype_t reqtype, isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, isc_dscp_t dscp, dns_tsigkey_t *tsigkey, dns_xfrin_ctx_t **xfrp)
static isc_result_t axfr_init (dns_xfrin_ctx_t *xfr)
static isc_result_t axfr_makedb (dns_xfrin_ctx_t *xfr, dns_db_t **dbp)
static isc_result_t axfr_putdata (dns_xfrin_ctx_t *xfr, dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
static isc_result_t axfr_apply (dns_xfrin_ctx_t *xfr)
static isc_result_t axfr_commit (dns_xfrin_ctx_t *xfr)
static isc_result_t axfr_finalize (dns_xfrin_ctx_t *xfr)
static isc_result_t ixfr_init (dns_xfrin_ctx_t *xfr)
static isc_result_t ixfr_apply (dns_xfrin_ctx_t *xfr)
static isc_result_t ixfr_putdata (dns_xfrin_ctx_t *xfr, dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
static isc_result_t ixfr_commit (dns_xfrin_ctx_t *xfr)
static isc_result_t xfr_rr (dns_xfrin_ctx_t *xfr, dns_name_t *name, isc_uint32_t ttl, dns_rdata_t *rdata)
static isc_result_t xfrin_start (dns_xfrin_ctx_t *xfr)
static void xfrin_connect_done (isc_task_t *task, isc_event_t *event)
static isc_result_t xfrin_send_request (dns_xfrin_ctx_t *xfr)
static void xfrin_send_done (isc_task_t *task, isc_event_t *event)
static void xfrin_recv_done (isc_task_t *task, isc_event_t *event)
static void xfrin_timeout (isc_task_t *task, isc_event_t *event)
static void maybe_free (dns_xfrin_ctx_t *xfr)
static void xfrin_fail (dns_xfrin_ctx_t *xfr, isc_result_t result, const char *msg)
static isc_result_t render (dns_message_t *msg, isc_mem_t *mctx, isc_buffer_t *buf)
static void xfrin_logv (int level, const char *zonetext, isc_sockaddr_t *masteraddr, const char *fmt, va_list ap) ISC_FORMAT_PRINTF(4
static void static void xfrin_log1 (int level, const char *zonetext, isc_sockaddr_t *masteraddr, const char *fmt,...) ISC_FORMAT_PRINTF(4
static void static void static void xfrin_log (dns_xfrin_ctx_t *xfr, int level, const char *fmt,...) ISC_FORMAT_PRINTF(3
isc_result_t dns_xfrin_create (dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp)
 see dns_xfrin_create2()
isc_result_t dns_xfrin_create2 (dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp)
isc_result_t dns_xfrin_create3 (dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, isc_dscp_t dscp, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp)
 Attempt to start an incoming zone transfer of 'zone' from 'masteraddr', creating a dns_xfrin_ctx_t object to manage it. Attach '*xfrp' to the newly created object.
void dns_xfrin_shutdown (dns_xfrin_ctx_t *xfr)
 If the zone transfer 'xfr' has already finished, do nothing. Otherwise, abort it and cause it to call its done callback with a status of ISC_R_CANCELED.
void dns_xfrin_attach (dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target)
 Caller to maintain external locking if required.
void dns_xfrin_detach (dns_xfrin_ctx_t **xfrp)
 Detach a reference to a zone transfer object. Caller to maintain external locking if required.
static void xfrin_cancelio (dns_xfrin_ctx_t *xfr)
static void xfrin_reset (dns_xfrin_ctx_t *xfr)
static isc_result_t tuple2msgname (dns_difftuple_t *tuple, dns_message_t *msg, dns_name_t **target)


Detailed Description

Definition in file xfrin.c.


Define Documentation

#define FAIL ( code   ) 

Value:

do { result = (code);                                   \
                if (result != ISC_R_SUCCESS) goto failure;      \
        } while (0)
It would be non-sensical (or at least obtuse) to use FAIL() with an ISC_R_SUCCESS code, but the test is there to keep the Solaris compiler from complaining about "end-of-loop code not reached".

Definition at line 62 of file xfrin.c.

#define CHECK ( op   ) 

Value:

do { result = (op);                                     \
                if (result != ISC_R_SUCCESS) goto failure;      \
        } while (0)

Definition at line 67 of file xfrin.c.

#define XFRIN_MAGIC   ISC_MAGIC('X', 'f', 'r', 'I')

Definition at line 177 of file xfrin.c.

Referenced by xfrin_create().

#define VALID_XFRIN (  )     ISC_MAGIC_VALID(x, XFRIN_MAGIC)

Definition at line 178 of file xfrin.c.

Referenced by maybe_free(), xfrin_connect_done(), xfrin_recv_done(), xfrin_reset(), xfrin_send_done(), and xfrin_timeout().


Enumeration Type Documentation

enum xfrin_state_t

The states of the *XFR state machine. We handle both IXFR and AXFR with a single integrated state machine because they cannot be distinguished immediately - an AXFR response to an IXFR request can only be detected when the first two (2) response RRs have already been received.

Enumerator:
XFRST_SOAQUERY 
XFRST_GOTSOA 
XFRST_INITIALSOA 
XFRST_FIRSTDATA 
XFRST_IXFR_DELSOA 
XFRST_IXFR_DEL 
XFRST_IXFR_ADDSOA 
XFRST_IXFR_ADD 
XFRST_IXFR_END 
XFRST_AXFR 
XFRST_AXFR_END 

Definition at line 78 of file xfrin.c.


Function Documentation

static isc_result_t xfrin_create ( isc_mem_t mctx,
dns_zone_t zone,
dns_db_t db,
isc_task_t task,
isc_timermgr_t timermgr,
isc_socketmgr_t socketmgr,
dns_name_t zonename,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  reqtype,
isc_sockaddr_t masteraddr,
isc_sockaddr_t sourceaddr,
isc_dscp_t  dscp,
dns_tsigkey_t tsigkey,
dns_xfrin_ctx_t **  xfrp 
) [static]

Definition at line 785 of file xfrin.c.

References dns_rdatacallbacks::add, dns_rdatacallbacks::add_private, dns_xfrin_ctx::axfr, CHECK, dns_xfrin_ctx::checkid, dns_xfrin_ctx::connects, dns_xfrin_ctx::db, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_db_attach(), dns_db_detach(), dns_diff_init(), dns_name_dup(), dns_name_dynamic(), dns_name_free(), dns_name_init(), dns_timer_setidle(), dns_tsigkey_attach(), dns_tsigkey_detach(), dns_zone_getidlein(), dns_zone_getmaxxfrin(), dns_zone_iattach(), dns_zone_idetach(), dns_xfrin_ctx::done, dns_xfrin_ctx::dscp, dns_xfrin_ctx::id, INSIST, dns_xfrin_ctx::is_ixfr, isc_buffer_init, ISC_FALSE, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNSET, isc_random_get(), isc_sockaddr_pf(), isc_sockaddr_setport(), isc_task_attach(), isc_task_detach(), isc_time_now(), isc_timer_create(), isc_timer_detach(), isc_timertype_inactive, ISC_TRUE, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, dns_xfrin_ctx::lasttsig, dns_xfrin_ctx::magic, dns_xfrin_ctx::masteraddr, dns_xfrin_ctx::mctx, dns_xfrin_ctx::name, dns_xfrin_ctx::nbytes, dns_xfrin_ctx::nmsg, dns_xfrin_ctx::nrecs, dns_xfrin_ctx::qbuffer, dns_xfrin_ctx::qbuffer_data, dns_xfrin_ctx::rdclass, dns_xfrin_ctx::recvs, dns_xfrin_ctx::refcount, dns_xfrin_ctx::reqtype, dns_xfrin_ctx::sends, dns_xfrin_ctx::shutdown_result, dns_xfrin_ctx::shuttingdown, dns_xfrin_ctx::sincetsig, dns_xfrin_ctx::socket, dns_xfrin_ctx::socketmgr, dns_xfrin_ctx::sourceaddr, dns_xfrin_ctx::start, dns_xfrin_ctx::state, dns_xfrin_ctx::task, dns_xfrin_ctx::tcpmsg_valid, dns_xfrin_ctx::timer, dns_xfrin_ctx::tsigctx, dns_xfrin_ctx::tsigkey, dns_xfrin_ctx::ver, XFRIN_MAGIC, xfrin_timeout(), XFRST_INITIALSOA, XFRST_SOAQUERY, and dns_xfrin_ctx::zone.

Referenced by dns_xfrin_create3().

static void static void static void static isc_result_t axfr_init ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 255 of file xfrin.c.

References axfr_makedb(), CHECK, dns_db_beginload(), dns_db_detach(), dns_rdatacallbacks_init(), ISC_FALSE, and ISC_R_SUCCESS.

Referenced by xfr_rr().

static isc_result_t axfr_makedb ( dns_xfrin_ctx_t xfr,
dns_db_t **  dbp 
) [static]

Definition at line 272 of file xfrin.c.

References dns_db_create(), dns_dbtype_zone, dns_zone_rpz_enable_db(), ISC_R_SUCCESS, dns_xfrin_ctx::mctx, dns_xfrin_ctx::name, dns_xfrin_ctx::rdclass, and dns_xfrin_ctx::zone.

Referenced by axfr_init().

static isc_result_t axfr_putdata ( dns_xfrin_ctx_t xfr,
dns_diffop_t  op,
dns_name_t name,
dns_ttl_t  ttl,
dns_rdata_t rdata 
) [static]

Definition at line 288 of file xfrin.c.

References axfr_apply(), CHECK, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_diff_append(), dns_difftuple_create(), dns_zone_checknames(), ISC_R_SUCCESS, dns_diff::mctx, and dns_xfrin_ctx::zone.

Referenced by xfr_rr().

static isc_result_t axfr_apply ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 310 of file xfrin.c.

References dns_rdatacallbacks::add, dns_rdatacallbacks::add_private, dns_xfrin_ctx::axfr, CHECK, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_diff_clear(), dns_diff_load(), and ISC_R_SUCCESS.

Referenced by axfr_commit(), and axfr_putdata().

static isc_result_t axfr_commit ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 322 of file xfrin.c.

References dns_xfrin_ctx::axfr, axfr_apply(), CHECK, dns_xfrin_ctx::db, dns_db_endload(), and ISC_R_SUCCESS.

Referenced by xfr_rr().

static isc_result_t axfr_finalize ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 334 of file xfrin.c.

References CHECK, dns_xfrin_ctx::db, dns_zone_replacedb(), ISC_R_SUCCESS, ISC_TRUE, and dns_xfrin_ctx::zone.

Referenced by xfrin_recv_done().

static isc_result_t ixfr_init ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 350 of file xfrin.c.

References CHECK, dns_xfrin_ctx::db, dns_xfrin_ctx::difflen, DNS_JOURNAL_CREATE, dns_journal_open(), DNS_R_FORMERR, dns_zone_getjournal(), INSIST, dns_xfrin_ctx::is_ixfr, ISC_LOG_ERROR, ISC_R_SUCCESS, ISC_TRUE, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, dns_xfrin_ctx::mctx, dns_xfrin_ctx::reqtype, xfrin_log(), and dns_xfrin_ctx::zone.

Referenced by xfr_rr().

static isc_result_t ixfr_apply ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 397 of file xfrin.c.

References CHECK, dns_xfrin_ctx::db, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_db_newversion(), dns_diff_apply(), dns_diff_clear(), dns_journal_begin_transaction(), dns_journal_writediff(), ISC_R_SUCCESS, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, and dns_xfrin_ctx::ver.

Referenced by ixfr_commit(), and ixfr_putdata().

static isc_result_t ixfr_putdata ( dns_xfrin_ctx_t xfr,
dns_diffop_t  op,
dns_name_t name,
dns_ttl_t  ttl,
dns_rdata_t rdata 
) [static]

Definition at line 375 of file xfrin.c.

References CHECK, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_diff_append(), DNS_DIFFOP_ADD, dns_difftuple_create(), dns_zone_checknames(), ISC_R_SUCCESS, ixfr_apply(), dns_diff::mctx, and dns_xfrin_ctx::zone.

Referenced by xfr_rr().

static isc_result_t ixfr_commit ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 419 of file xfrin.c.

References CHECK, dns_xfrin_ctx::db, dns_db_closeversion(), dns_journal_commit(), dns_zone_markdirty(), ISC_R_SUCCESS, ISC_TRUE, dns_xfrin_ctx::ixfr, ixfr_apply(), dns_xfrin_ctx::journal, dns_xfrin_ctx::ver, and dns_xfrin_ctx::zone.

Referenced by xfr_rr().

static isc_result_t xfr_rr ( dns_xfrin_ctx_t xfr,
dns_name_t name,
isc_uint32_t  ttl,
dns_rdata_t rdata 
) [static]

Definition at line 445 of file xfrin.c.

References axfr_commit(), axfr_init(), axfr_putdata(), CHECK, dns_xfrin_ctx::checkid, dns_xfrin_ctx::current_serial, DNS_DIFFOP_ADD, DNS_DIFFOP_DEL, dns_name_iswildcard(), DNS_R_EXTRADATA, DNS_R_FORMERR, DNS_R_INVALIDNS, DNS_R_UPTODATE, dns_rdatatype_ismeta(), DNS_SERIAL_GT, dns_soa_getserial(), dns_zone_isforced(), dns_xfrin_ctx::end_serial, FAIL, INSIST, ISC_FALSE, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_R_SUCCESS, dns_xfrin_ctx::ixfr, ixfr_commit(), ixfr_init(), ixfr_putdata(), dns_xfrin_ctx::nrecs, dns_xfrin_ctx::rdclass, dns_rdata::rdclass, dns_xfrin_ctx::reqtype, dns_xfrin_ctx::request_serial, dns_xfrin_ctx::state, dns_rdata::type, xfrin_log(), XFRST_AXFR, XFRST_AXFR_END, XFRST_FIRSTDATA, XFRST_GOTSOA, XFRST_INITIALSOA, XFRST_IXFR_ADD, XFRST_IXFR_ADDSOA, XFRST_IXFR_DEL, XFRST_IXFR_DELSOA, XFRST_IXFR_END, XFRST_SOAQUERY, and dns_xfrin_ctx::zone.

Referenced by xfrin_recv_done().

static isc_result_t xfrin_start ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 914 of file xfrin.c.

References CHECK, dns_xfrin_ctx::connects, dns_xfrin_ctx::dscp, ISC_R_SUCCESS, isc_sockaddr_pf(), isc_socket_bind(), isc_socket_connect(), isc_socket_create(), isc_socket_dscp(), ISC_SOCKET_REUSEADDRESS, isc_socket_setname(), isc_sockettype_tcp, dns_xfrin_ctx::masteraddr, dns_xfrin_ctx::socket, dns_xfrin_ctx::socketmgr, dns_xfrin_ctx::sourceaddr, dns_xfrin_ctx::task, xfrin_connect_done(), and xfrin_fail().

Referenced by dns_xfrin_create3(), and xfrin_recv_done().

static void xfrin_connect_done ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 962 of file xfrin.c.

References CHECK, dns_xfrin_ctx::connects, dns_tcpmsg_init(), dns_zone_getmgr(), dns_zonemgr_unreachableadd(), dns_zonemgr_unreachabledel(), INSIST, isc_event_free(), ISC_LOG_INFO, ISC_R_SUCCESS, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_socket_getsockname(), ISC_SOCKEVENT_CONNECT, ISC_TRUE, dns_xfrin_ctx::masteraddr, maybe_free(), dns_xfrin_ctx::mctx, now, REQUIRE, isc_socket_connev::result, dns_xfrin_ctx::shuttingdown, dns_xfrin_ctx::socket, dns_xfrin_ctx::sourceaddr, dns_xfrin_ctx::tcpmsg, dns_xfrin_ctx::tcpmsg_valid, TIME_NOW, UNUSED, VALID_XFRIN, xfrin_fail(), xfrin_log(), xfrin_send_request(), and dns_xfrin_ctx::zone.

Referenced by xfrin_start().

static isc_result_t xfrin_send_request ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 1071 of file xfrin.c.

References isc_region::base, CHECK, dns_xfrin_ctx::checkid, dns_xfrin_ctx::current_serial, dns_xfrin_ctx::db, dns_db_closeversion(), dns_db_createsoatuple(), dns_db_currentversion(), dns_db_getsoaserial(), DNS_DIFFOP_EXISTS, dns_difftuple_free(), dns_message_addname(), dns_message_create(), dns_message_destroy(), dns_message_getquerytsig(), dns_message_gettempname(), dns_message_gettemprdataset(), DNS_MESSAGE_INTENTRENDER, dns_message_puttempname(), dns_message_puttemprdataset(), dns_message_settsigkey(), dns_name_clone(), dns_name_init(), dns_rdataset_init(), dns_rdataset_makequestion(), DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, dns_soa_getserial(), dst_context_destroy(), dns_message::id, dns_xfrin_ctx::id, INSIST, isc_buffer_free(), isc_buffer_usedregion, ISC_FALSE, ISC_LIST_APPEND, ISC_LOG_DEBUG, isc_socket_send(), isc_time_now(), ISC_TRUE, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::lasttsig, isc_region::length, dns_xfrin_ctx::mctx, dns_xfrin_ctx::name, dns_xfrin_ctx::nbytes, dns_xfrin_ctx::nmsg, dns_xfrin_ctx::nrecs, dns_xfrin_ctx::qbuffer, dns_xfrin_ctx::qbuffer_data, dns_difftuple::rdata, dns_xfrin_ctx::rdclass, render(), dns_xfrin_ctx::reqtype, dns_xfrin_ctx::request_serial, dns_xfrin_ctx::sends, dns_xfrin_ctx::socket, dns_xfrin_ctx::start, dns_xfrin_ctx::task, dns_xfrin_ctx::tsigctx, dns_xfrin_ctx::tsigkey, tuple2msgname(), xfrin_log(), and xfrin_send_done().

Referenced by xfrin_connect_done(), and xfrin_recv_done().

static void xfrin_send_done ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 1171 of file xfrin.c.

References CHECK, dns_tcpmsg_readmessage(), INSIST, isc_event_free(), ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_SOCKEVENT_SENDDONE, dns_xfrin_ctx::recvs, REQUIRE, isc_socketevent::result, dns_xfrin_ctx::sends, dns_xfrin_ctx::task, dns_xfrin_ctx::tcpmsg, UNUSED, VALID_XFRIN, xfrin_fail(), xfrin_log(), and xfrin_recv_done().

Referenced by xfrin_send_request().

static void xfrin_recv_done ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 1197 of file xfrin.c.

References axfr_finalize(), CHECK, dns_xfrin_ctx::checkid, DNS_EVENT_TCPMSG, dns_journal_destroy(), DNS_LOGCATEGORY_XFER_IN, DNS_LOGMODULE_XFER_IN, dns_message_checksig(), dns_message_create(), dns_message_currentname(), dns_message_destroy(), dns_message_firstname(), dns_message_getquerytsig(), dns_message_gettsig(), dns_message_gettsigkey(), DNS_MESSAGE_INTENTPARSE, dns_message_logpacket2(), dns_message_nextname(), dns_message_parse(), dns_message_setquerytsig(), dns_message_settsigkey(), DNS_MESSAGEFLAG_AA, DNS_MESSAGEPARSE_PRESERVEORDER, DNS_R_EXPECTEDTSIG, DNS_R_NOERROR, DNS_R_NOTAUTHORITATIVE, DNS_R_UNEXPECTEDID, dns_rcode_noerror, DNS_RDATA_INIT, dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), dns_result_totext(), DNS_SECTION_ANSWER, dns_tcpmsg_readmessage(), dns_zone_getview(), dns_xfrin_ctx::done, FAIL, dns_xfrin_ctx::id, INSIST, isc_buffer_free(), isc_event_free(), ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LOG_DEBUG, ISC_R_NOMORE, ISC_R_SUCCESS, isc_result_totext(), ISC_RESULTCLASS_DNSRCODE, isc_timer_touch(), ISC_TRUE, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, dns_xfrin_ctx::lasttsig, maybe_free(), dns_xfrin_ctx::mctx, name, dns_xfrin_ctx::nbytes, dns_xfrin_ctx::nmsg, dns_xfrin_ctx::recvs, dns_xfrin_ctx::reqtype, REQUIRE, dns_xfrin_ctx::shutdown_result, dns_xfrin_ctx::shuttingdown, dns_xfrin_ctx::sincetsig, dns_xfrin_ctx::state, dns_xfrin_ctx::task, dns_xfrin_ctx::tcpmsg, dns_xfrin_ctx::timer, dns_xfrin_ctx::tsigctx, dns_xfrin_ctx::tsigkey, dns_rdataset::ttl, UNUSED, VALID_XFRIN, xfr_rr(), xfrin_fail(), xfrin_log(), xfrin_reset(), xfrin_send_request(), xfrin_start(), XFRST_AXFR_END, XFRST_GOTSOA, XFRST_INITIALSOA, XFRST_IXFR_END, XFRST_SOAQUERY, and dns_xfrin_ctx::zone.

Referenced by xfrin_send_done().

static void xfrin_timeout ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 1419 of file xfrin.c.

References isc_event_free(), ISC_R_TIMEDOUT, REQUIRE, UNUSED, VALID_XFRIN, and xfrin_fail().

Referenced by xfrin_create().

static void maybe_free ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 1434 of file xfrin.c.

References dns_rdatacallbacks::add_private, dns_name::attributes, dns_xfrin_ctx::axfr, dns_xfrin_ctx::connects, dns_xfrin_ctx::db, dns_xfrin_ctx::diff, dns_db_closeversion(), dns_db_detach(), dns_db_endload(), dns_diff_clear(), dns_journal_destroy(), dns_name_free(), DNS_NAMEATTR_DYNAMIC, dns_tcpmsg_invalidate(), dns_tsigkey_detach(), dns_zone_idetach(), dst_context_destroy(), dns_xfrin_ctx::end, INSIST, isc_buffer_free(), ISC_FALSE, ISC_LOG_INFO, isc_mem_putanddetach, ISC_PRINT_QUADFORMAT, ISC_R_UNSET, isc_result_totext(), isc_socket_detach(), isc_task_detach(), isc_time_microdiff(), isc_time_now(), isc_timer_detach(), dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, dns_xfrin_ctx::lasttsig, dns_xfrin_ctx::mctx, dns_xfrin_ctx::name, dns_xfrin_ctx::nbytes, dns_xfrin_ctx::nmsg, dns_xfrin_ctx::nrecs, dns_xfrin_ctx::recvs, dns_xfrin_ctx::refcount, REQUIRE, dns_xfrin_ctx::sends, dns_xfrin_ctx::shutdown_result, dns_xfrin_ctx::shuttingdown, dns_xfrin_ctx::socket, dns_xfrin_ctx::start, dns_xfrin_ctx::task, dns_xfrin_ctx::tcpmsg, dns_xfrin_ctx::tcpmsg_valid, dns_xfrin_ctx::timer, dns_xfrin_ctx::tsigctx, dns_xfrin_ctx::tsigkey, VALID_XFRIN, dns_xfrin_ctx::ver, xfrin_log(), and dns_xfrin_ctx::zone.

Referenced by dns_xfrin_detach(), xfrin_connect_done(), xfrin_fail(), and xfrin_recv_done().

static void xfrin_fail ( dns_xfrin_ctx_t xfr,
isc_result_t  result,
const char *  msg 
) [static]

Definition at line 761 of file xfrin.c.

References dns_journal_destroy(), DNS_R_BADIXFR, DNS_R_UPTODATE, dns_xfrin_ctx::done, dns_xfrin_ctx::is_ixfr, ISC_LOG_ERROR, isc_result_totext(), ISC_TRUE, dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, maybe_free(), dns_xfrin_ctx::shutdown_result, dns_xfrin_ctx::shuttingdown, xfrin_cancelio(), xfrin_log(), and dns_xfrin_ctx::zone.

Referenced by dns_xfrin_shutdown(), xfrin_connect_done(), xfrin_recv_done(), xfrin_send_done(), xfrin_start(), and xfrin_timeout().

static isc_result_t render ( dns_message_t msg,
isc_mem_t mctx,
isc_buffer_t buf 
) [static]

Definition at line 938 of file xfrin.c.

References CHECK, dns_compress_init(), dns_compress_invalidate(), dns_message_renderbegin(), dns_message_renderend(), dns_message_rendersection(), DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, ISC_FALSE, ISC_R_SUCCESS, and ISC_TRUE.

Referenced by xfrin_send_request().

static void xfrin_logv ( int  level,
const char *  zonetext,
isc_sockaddr_t masteraddr,
const char *  fmt,
va_list  ap 
) [static]

Definition at line 1522 of file xfrin.c.

References dns_lctx, DNS_LOGCATEGORY_XFER_IN, DNS_LOGMODULE_XFER_IN, isc_log_write(), isc_sockaddr_format(), and ISC_SOCKADDR_FORMATSIZE.

Referenced by xfrin_log(), and xfrin_log1().

static void xfrin_log1 ( int  level,
const char *  zonetext,
isc_sockaddr_t masteraddr,
const char *  fmt,
  ... 
) [static]

Definition at line 1542 of file xfrin.c.

References dns_lctx, ISC_FALSE, isc_log_wouldlog(), and xfrin_logv().

Referenced by dns_xfrin_create3().

static void xfrin_log ( dns_xfrin_ctx_t xfr,
int  level,
const char *  fmt,
  ... 
) [static]

Definition at line 1560 of file xfrin.c.

References dns_lctx, DNS_NAME_MAXTEXT, dns_zone_name(), ISC_FALSE, isc_log_wouldlog(), dns_xfrin_ctx::masteraddr, xfrin_logv(), and dns_xfrin_ctx::zone.

Referenced by ixfr_init(), maybe_free(), xfr_rr(), xfrin_connect_done(), xfrin_fail(), xfrin_recv_done(), xfrin_reset(), xfrin_send_done(), and xfrin_send_request().

isc_result_t dns_xfrin_create ( dns_zone_t zone,
dns_rdatatype_t  xfrtype,
isc_sockaddr_t masteraddr,
dns_tsigkey_t tsigkey,
isc_mem_t mctx,
isc_timermgr_t timermgr,
isc_socketmgr_t socketmgr,
isc_task_t task,
dns_xfrindone_t  done,
dns_xfrin_ctx_t **  xfrp 
)

see dns_xfrin_create2()

Definition at line 609 of file xfrin.c.

References dns_xfrin_create3(), dns_zone_getxfrsource4(), dns_zone_getxfrsource4dscp(), dns_zone_getxfrsource6(), dns_zone_getxfrsource6dscp(), INSIST, isc_sockaddr_pf(), and PF_INET6.

isc_result_t dns_xfrin_create2 ( dns_zone_t zone,
dns_rdatatype_t  xfrtype,
isc_sockaddr_t masteraddr,
isc_sockaddr_t sourceaddr,
dns_tsigkey_t tsigkey,
isc_mem_t mctx,
isc_timermgr_t timermgr,
isc_socketmgr_t socketmgr,
isc_task_t task,
dns_xfrindone_t  done,
dns_xfrin_ctx_t **  xfrp 
)

Definition at line 637 of file xfrin.c.

References dns_xfrin_create3().

isc_result_t dns_xfrin_create3 ( dns_zone_t zone,
dns_rdatatype_t  xfrtype,
isc_sockaddr_t masteraddr,
isc_sockaddr_t sourceaddr,
isc_dscp_t  dscp,
dns_tsigkey_t tsigkey,
isc_mem_t mctx,
isc_timermgr_t timermgr,
isc_socketmgr_t socketmgr,
isc_task_t task,
dns_xfrindone_t  done,
dns_xfrin_ctx_t **  xfrp 
)

Attempt to start an incoming zone transfer of 'zone' from 'masteraddr', creating a dns_xfrin_ctx_t object to manage it. Attach '*xfrp' to the newly created object.

Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be called in the context of 'task', with 'zone' and a result code as arguments when the transfer finishes.

Requires:

Definition at line 650 of file xfrin.c.

References CHECK, dns_db_detach(), DNS_NAME_MAXTEXT, dns_zone_getclass(), dns_zone_getdb(), dns_zone_getorigin(), dns_zone_name(), dns_xfrin_ctx::done, ISC_LOG_ERROR, ISC_R_SUCCESS, dns_xfrin_ctx::refcount, REQUIRE, xfrin_create(), xfrin_log1(), and xfrin_start().

Referenced by dns_xfrin_create(), dns_xfrin_create2(), and got_transfer_quota().

void dns_xfrin_shutdown ( dns_xfrin_ctx_t xfr  ) 

If the zone transfer 'xfr' has already finished, do nothing. Otherwise, abort it and cause it to call its done callback with a status of ISC_R_CANCELED.

Definition at line 693 of file xfrin.c.

References ISC_R_CANCELED, dns_xfrin_ctx::shuttingdown, and xfrin_fail().

Referenced by zone_shutdown().

void dns_xfrin_attach ( dns_xfrin_ctx_t source,
dns_xfrin_ctx_t **  target 
)

Caller to maintain external locking if required.

Definition at line 699 of file xfrin.c.

References dns_xfrin_ctx::refcount, and REQUIRE.

void dns_xfrin_detach ( dns_xfrin_ctx_t **  xfrp  ) 

Detach a reference to a zone transfer object. Caller to maintain external locking if required.

Definition at line 706 of file xfrin.c.

References INSIST, maybe_free(), and dns_xfrin_ctx::refcount.

Referenced by zone_xfrdone().

static void xfrin_cancelio ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 715 of file xfrin.c.

References dns_xfrin_ctx::connects, dns_tcpmsg_cancelread(), ISC_SOCKCANCEL_CONNECT, ISC_SOCKCANCEL_SEND, isc_socket_cancel(), dns_xfrin_ctx::recvs, dns_xfrin_ctx::sends, dns_xfrin_ctx::socket, dns_xfrin_ctx::task, and dns_xfrin_ctx::tcpmsg.

Referenced by xfrin_fail(), and xfrin_reset().

static void xfrin_reset ( dns_xfrin_ctx_t xfr  )  [static]

Definition at line 728 of file xfrin.c.

References dns_rdatacallbacks::add_private, dns_xfrin_ctx::axfr, dns_xfrin_ctx::db, dns_xfrin_ctx::diff, dns_xfrin_ctx::difflen, dns_db_closeversion(), dns_db_endload(), dns_diff_clear(), dns_journal_destroy(), dns_tcpmsg_invalidate(), isc_buffer_free(), ISC_FALSE, ISC_LOG_INFO, isc_socket_detach(), dns_xfrin_ctx::ixfr, dns_xfrin_ctx::journal, dns_xfrin_ctx::lasttsig, REQUIRE, dns_xfrin_ctx::socket, dns_xfrin_ctx::tcpmsg, dns_xfrin_ctx::tcpmsg_valid, VALID_XFRIN, dns_xfrin_ctx::ver, xfrin_cancelio(), and xfrin_log().

Referenced by xfrin_recv_done().

static isc_result_t tuple2msgname ( dns_difftuple_t tuple,
dns_message_t msg,
dns_name_t **  target 
) [static]

Definition at line 1017 of file xfrin.c.

References CHECK, dns_message_gettempname(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_name_clone(), dns_name_init(), dns_rdata_clone(), dns_rdata_init(), dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_disassociate(), dns_rdataset_init(), ISC_LIST_APPEND, ISC_LIST_UNLINK, ISC_R_SUCCESS, dns_difftuple::name, name, dns_difftuple::rdata, dns_rdata::rdclass, dns_rdatalist::rdclass, REQUIRE, dns_difftuple::ttl, dns_rdatalist::ttl, dns_rdata::type, and dns_rdatalist::type.

Referenced by xfrin_send_request().


Generated on Tue Apr 28 17:41:14 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha