check-tool.c File Reference

#include <config.h>
#include <stdio.h>
#include "check-tool.h"
#include <isc/buffer.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/netdb.h>
#include <isc/net.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/symtab.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/zone.h>
#include <isccfg/log.h>

Go to the source code of this file.

Defines

#define CHECK_SIBLING   1
#define CHECK_LOCAL   1
#define CHECK(r)
#define ERR_IS_CNAME   1
#define ERR_NO_ADDRESSES   2
#define ERR_LOOKUP_FAILURE   3
#define ERR_EXTRA_A   4
#define ERR_EXTRA_AAAA   5
#define ERR_MISSING_GLUE   5
#define ERR_IS_MXCNAME   6
#define ERR_IS_SRVCNAME   7

Functions

static void freekey (char *key, unsigned int type, isc_symvalue_t value, void *userarg)
static void add (char *key, int value)
static isc_boolean_t logged (char *key, int value)
static isc_boolean_t checkns (dns_zone_t *zone, dns_name_t *name, dns_name_t *owner, dns_rdataset_t *a, dns_rdataset_t *aaaa)
static isc_boolean_t checkmx (dns_zone_t *zone, dns_name_t *name, dns_name_t *owner)
static isc_boolean_t checksrv (dns_zone_t *zone, dns_name_t *name, dns_name_t *owner)
isc_result_t setup_logging (isc_mem_t *mctx, FILE *errout, isc_log_t **logp)
static isc_result_t check_ttls (dns_zone_t *zone, dns_ttl_t maxttl)
 scan the zone for oversize TTLs
isc_result_t load_zone (isc_mem_t *mctx, const char *zonename, const char *filename, dns_masterformat_t fileformat, const char *classname, dns_ttl_t maxttl, dns_zone_t **zonep)
 load the zone
isc_result_t dump_zone (const char *zonename, dns_zone_t *zone, const char *filename, dns_masterformat_t fileformat, const dns_master_style_t *style, const isc_uint32_t rawversion)
 dump the zone

Variables

static const char * dbtype [] = { "rbt" }
int debug = 0
const char * journal = NULL
isc_boolean_t nomerge = ISC_TRUE
isc_boolean_t docheckmx = ISC_TRUE
isc_boolean_t dochecksrv = ISC_TRUE
isc_boolean_t docheckns = ISC_TRUE
unsigned int zone_options
unsigned int zone_options2 = 0
static isc_logcategory_t categories []
static isc_symtab_tsymtab = NULL
static isc_mem_tsym_mctx


Detailed Description

Definition in file check-tool.c.


Define Documentation

#define CHECK_SIBLING   1

Definition at line 60 of file check-tool.c.

#define CHECK_LOCAL   1

Definition at line 64 of file check-tool.c.

#define CHECK ( r   ) 

Value:

do { \
                result = (r); \
                if (result != ISC_R_SUCCESS) \
                        goto cleanup; \
        } while (0)

Definition at line 75 of file check-tool.c.

#define ERR_IS_CNAME   1

Definition at line 82 of file check-tool.c.

Referenced by checkns().

#define ERR_NO_ADDRESSES   2

Definition at line 83 of file check-tool.c.

Referenced by checkmx(), checkns(), and checksrv().

#define ERR_LOOKUP_FAILURE   3

Definition at line 84 of file check-tool.c.

Referenced by checkmx(), checkns(), and checksrv().

#define ERR_EXTRA_A   4

Definition at line 85 of file check-tool.c.

Referenced by checkns().

#define ERR_EXTRA_AAAA   5

Definition at line 86 of file check-tool.c.

Referenced by checkns().

#define ERR_MISSING_GLUE   5

Definition at line 87 of file check-tool.c.

Referenced by checkns().

#define ERR_IS_MXCNAME   6

Definition at line 88 of file check-tool.c.

Referenced by checkmx().

#define ERR_IS_SRVCNAME   7

Definition at line 89 of file check-tool.c.

Referenced by checksrv().


Function Documentation

static void freekey ( char *  key,
unsigned int  type,
isc_symvalue_t  value,
void *  userarg 
) [static]

Definition at line 136 of file check-tool.c.

References isc_mem_free, and UNUSED.

static void add ( char *  key,
int  value 
) [static]

Definition at line 143 of file check-tool.c.

References isc_symvalue::as_pointer, freekey(), ISC_FALSE, isc_mem_create(), isc_mem_free, isc_mem_strdup, ISC_R_SUCCESS, isc_symexists_reject, isc_symtab_create(), isc_symtab_define(), key, and symtab.

static isc_boolean_t logged ( char *  key,
int  value 
) [static]

Definition at line 172 of file check-tool.c.

References ISC_FALSE, ISC_R_SUCCESS, isc_symtab_lookup(), ISC_TRUE, and symtab.

Referenced by checkmx(), checkns(), and checksrv().

static isc_boolean_t checkns ( dns_zone_t zone,
dns_name_t name,
dns_name_t owner,
dns_rdataset_t a,
dns_rdataset_t aaaa 
) [static]

Definition at line 185 of file check-tool.c.

References AF_INET6, answer, dns_rdata::data, dns_name_countlabels(), dns_name_format(), DNS_NAME_FORMATSIZE, DNS_RDATA_INIT, dns_rdata_reset(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_zone_log(), ERR_EXTRA_A, ERR_EXTRA_AAAA, ERR_IS_CNAME, ERR_LOOKUP_FAILURE, ERR_MISSING_GLUE, ERR_NO_ADDRESSES, ISC_FALSE, ISC_LOG_ERROR, ISC_LOG_WARNING, ISC_R_FAILURE, ISC_R_SUCCESS, ISC_TRUE, dns_rdata::length, logged(), match(), namebuf, REQUIRE, sockaddr_in6::sin6_addr, and dns_rdataset::type.

Referenced by ISC_LIST(), and load_zone().

static isc_boolean_t checkmx ( dns_zone_t zone,
dns_name_t name,
dns_name_t owner 
) [static]

Definition at line 389 of file check-tool.c.

References answer, dns_name_countlabels(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_zone_log(), DNS_ZONEOPT_IGNOREMXCNAME, DNS_ZONEOPT_WARNMXCNAME, ERR_IS_MXCNAME, ERR_LOOKUP_FAILURE, ERR_NO_ADDRESSES, ISC_FALSE, ISC_LOG_ERROR, ISC_LOG_WARNING, ISC_TRUE, logged(), namebuf, and zone_options.

Referenced by integrity_checks(), ISC_LIST(), and load_zone().

static isc_boolean_t checksrv ( dns_zone_t zone,
dns_name_t name,
dns_name_t owner 
) [static]

Definition at line 474 of file check-tool.c.

References answer, dns_name_countlabels(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_zone_log(), DNS_ZONEOPT_IGNORESRVCNAME, DNS_ZONEOPT_WARNSRVCNAME, ERR_IS_SRVCNAME, ERR_LOOKUP_FAILURE, ERR_NO_ADDRESSES, ISC_FALSE, ISC_LOG_ERROR, ISC_LOG_WARNING, ISC_TRUE, logged(), namebuf, and zone_options.

Referenced by integrity_checks(), ISC_LIST(), and load_zone().

isc_result_t setup_logging ( isc_mem_t mctx,
FILE *  errout,
isc_log_t **  logp 
)

Definition at line 558 of file check-tool.c.

References cfg_log_init(), dns_log_init(), dns_log_setcontext(), isc_logdestination::file, isc_log_create(), isc_log_createchannel(), ISC_LOG_DYNAMIC, isc_log_registercategories(), ISC_LOG_ROLLNEVER, isc_log_setcontext(), ISC_LOG_TOFILEDESC, isc_log_usechannel(), ISC_R_SUCCESS, isc_logfile::maximum_size, isc_logfile::name, RUNTIME_CHECK, isc_logfile::stream, and isc_logfile::versions.

Referenced by main().

static isc_result_t check_ttls ( dns_zone_t zone,
dns_ttl_t  maxttl 
) [static]

scan the zone for oversize TTLs

Definition at line 587 of file check-tool.c.

References isc_region::base, CHECK, cleanup(), dns_db_allrdatasets(), dns_db_closeversion(), dns_db_createiterator(), dns_db_detach(), dns_db_detachnode(), dns_db_newversion(), dns_dbiterator_current(), dns_dbiterator_destroy(), dns_dbiterator_first(), dns_dbiterator_next(), dns_fixedname_init, dns_fixedname_name, dns_name_format(), DNS_NAME_FORMATSIZE, DNS_R_NEWORIGIN, dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdatasetiter_current(), dns_rdatasetiter_destroy(), dns_rdatasetiter_first(), dns_rdatasetiter_next(), dns_rdatatype_totext(), dns_zone_getdb(), dns_zone_log(), INSIST, isc_buffer_init, isc_buffer_usedregion, ISC_FALSE, ISC_LOG_ERROR, ISC_R_NOMORE, ISC_R_RANGE, ISC_R_SUCCESS, isc_region::length, name, r, dns_rdataset::ttl, dns_rdataset::type, and version.

Referenced by load_zone().

isc_result_t load_zone ( isc_mem_t mctx,
const char *  zonename,
const char *  filename,
dns_masterformat_t  fileformat,
const char *  classname,
dns_ttl_t  maxttl,
dns_zone_t **  zonep 
)

load the zone

Definition at line 669 of file check-tool.c.

References isc_textregion::base, buffer, CHECK, check_ttls(), checkmx(), checkns(), checksrv(), cleanup(), dbtype, DE_CONST, debug, dns_fixedname_init, dns_fixedname_name, dns_masterformat_map, dns_name_fromtext(), dns_rdataclass_fromtext(), dns_rootname, dns_zone_create(), dns_zone_detach(), dns_zone_load(), dns_zone_master, dns_zone_setcheckmx(), dns_zone_setcheckns(), dns_zone_setchecksrv(), dns_zone_setclass(), dns_zone_setdbtype(), dns_zone_setfile2(), dns_zone_setjournal(), dns_zone_setmaxttl(), dns_zone_setoption(), dns_zone_setoption2(), dns_zone_setorigin(), dns_zone_settype(), DNS_ZONEOPT_NOMERGE, docheckmx, docheckns, dochecksrv, isc_buffer_add, isc_buffer_constinit, ISC_TRUE, journal, isc_textregion::length, nomerge, origin, rdclass, REQUIRE, zone, zone_options, and zone_options2.

Referenced by configure_zone(), and main().

isc_result_t dump_zone ( const char *  zonename,
dns_zone_t zone,
const char *  filename,
dns_masterformat_t  fileformat,
const dns_master_style_t style,
const isc_uint32_t  rawversion 
)

dump the zone

Definition at line 743 of file check-tool.c.

References debug, dns_masterformat_text, dns_zone_dumptostream3(), ISC_R_FAILURE, ISC_R_SUCCESS, isc_stdio_close(), isc_stdio_open(), and output().

Referenced by main().


Variable Documentation

const char* dbtype[] = { "rbt" } [static]

Definition at line 91 of file check-tool.c.

Referenced by createview(), and load_zone().

static void debug = 0

Definition at line 93 of file check-tool.c.

Referenced by add_opt(), add_question(), addlookup(), bringup_timer(), cancel_all(), cancel_lookup(), check_for_more_data(), check_if_done(), check_next_lookup(), clear_query(), clone_lookup(), clone_server_list(), connect_done(), connect_timeout(), copy_server_list(), create_search_list(), dash_option(), destroy_libs(), destroy_lookup(), detailsection(), dighost_shutdown(), do_lookup(), dump_zone(), flush_server_list(), followup_lookup(), force_timeout(), insert_soa(), launch_next_query(), load_zone(), main(), make_empty_lookup(), make_server(), next_origin(), parse_args(), printmessage(), printsection(), recv_done(), requeue_lookup(), send_done(), send_tcp_connect(), send_udp(), setup_file_key(), setup_keyfile(), setup_keystr(), setup_libs(), setup_lookup(), setup_system(), setup_text_key(), start_lookup(), tcp_length_done(), and try_clear_lookup().

const char* journal = NULL

Definition at line 94 of file check-tool.c.

Referenced by default_journal(), dns_db_diffx(), ISC_LIST(), load_zone(), main(), synczone(), update_action(), zone_journal(), and zone_postload().

isc_boolean_t nomerge = ISC_TRUE

Definition at line 95 of file check-tool.c.

Referenced by load_zone(), and main().

isc_boolean_t docheckmx = ISC_TRUE

Definition at line 97 of file check-tool.c.

Referenced by load_zone(), and main().

isc_boolean_t dochecksrv = ISC_TRUE

Definition at line 98 of file check-tool.c.

Referenced by load_zone(), and main().

isc_boolean_t docheckns = ISC_TRUE

Definition at line 99 of file check-tool.c.

Referenced by load_zone(), and main().

unsigned int zone_options

Initial value:

Definition at line 104 of file check-tool.c.

Referenced by checkmx(), checksrv(), configure_zone(), load_zone(), and main().

unsigned int zone_options2 = 0

Definition at line 115 of file check-tool.c.

Referenced by configure_zone(), load_zone(), and main().

isc_logcategory_t categories[] [static]

Initial value:

 {
        { "",                0 },
        { "client",          0 },
        { "network",         0 },
        { "update",          0 },
        { "queries",         0 },
        { "unmatched",       0 },
        { "update-security", 0 },
        { "query-errors",    0 },
        { NULL,              0 }
}

Definition at line 120 of file check-tool.c.

isc_symtab_t* symtab = NULL [static]

Definition at line 132 of file check-tool.c.

Referenced by add(), bind9_check_logging(), bind9_check_namedconf(), check_options(), check_viewconf(), create_map(), isc_symtab_create(), isc_symtab_destroy(), isccc_symtab_create(), isccc_symtab_destroy(), logged(), and validate_masters().

isc_mem_t* sym_mctx [static]

Definition at line 133 of file check-tool.c.


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