zoneconf.c File Reference

#include <config.h>
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/stats.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/masterdump.h>
#include <dns/rdata.h>
#include <dns/rdatatype.h>
#include <dns/rdataset.h>
#include <dns/rdatalist.h>
#include <dns/result.h>
#include <dns/sdlz.h>
#include <dns/ssu.h>
#include <dns/stats.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
#include <named/zoneconf.h>

Go to the source code of this file.

Defines

#define RETERR(x)
#define CHECK(x)
#define STATICSTUB_SERVER_TTL   86400
#define SIGNED   ".signed"

Enumerations

enum  acl_type_t {
  allow_notify, allow_query, allow_query_on, allow_transfer,
  allow_update, allow_update_forwarding
}

Functions

static isc_result_t configure_zone_acl (const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, const cfg_obj_t *config, acl_type_t acltype, cfg_aclconfctx_t *actx, dns_zone_t *zone, void(*setzacl)(dns_zone_t *, dns_acl_t *), void(*clearzacl)(dns_zone_t *))
 Convenience function for configuring a single zone ACL.
static isc_result_t configure_zone_ssutable (const cfg_obj_t *zconfig, dns_zone_t *zone, const char *zname)
 Parse the zone update-policy statement.
static isc_result_t configure_staticstub_serveraddrs (const cfg_obj_t *zconfig, dns_zone_t *zone, dns_rdatalist_t *rdatalist_ns, dns_rdatalist_t *rdatalist_a, dns_rdatalist_t *rdatalist_aaaa)
 Configure an apex NS with glues for a static-stub zone. For example, for the zone named "example.com", the following RRs will be added to the zone DB: example.com. NS example.com. example.com. A 192.0.2.1 example.com. AAAA 2001:db8::1.
static isc_result_t configure_staticstub_servernames (const cfg_obj_t *zconfig, dns_zone_t *zone, dns_rdatalist_t *rdatalist, const char *zname)
 Configure an apex NS with an out-of-zone NS names for a static-stub zone. For example, for the zone named "example.com", something like the following RRs will be added to the zone DB: example.com. NS ns.example.net.
static isc_result_t configure_staticstub (const cfg_obj_t *zconfig, dns_zone_t *zone, const char *zname, const char *dbtype)
 Configure static-stub zone.
static dns_zonetype_t zonetype_fromconfig (const cfg_obj_t *map)
 Convert a config file zone type into a server zone type.
static isc_result_t strtoargvsub (isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp, unsigned int n)
 Helper function for strtoargv(). Pardon the gratuitous recursion.
static isc_result_t strtoargv (isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp)
 Tokenize the string "s" into whitespace-separated words, return the number of words in '*argcp' and an array of pointers to the words in '*argvp'. The caller must free the array using isc_mem_put(). The string is modified in-place.
static void checknames (dns_zonetype_t ztype, const cfg_obj_t **maps, const cfg_obj_t **objp)
isc_result_t ns_zone_configure (const cfg_obj_t *config, const cfg_obj_t *vconfig, const cfg_obj_t *zconfig, cfg_aclconfctx_t *ac, dns_zone_t *zone, dns_zone_t *raw)
 Configure or reconfigure a zone according to the named.conf data in 'cctx' and 'czone'.
isc_result_t ns_zone_configure_writeable_dlz (dns_dlzdb_t *dlzdatabase, dns_zone_t *zone, dns_rdataclass_t rdclass, dns_name_t *name)
isc_boolean_t ns_zone_reusable (dns_zone_t *zone, const cfg_obj_t *zconfig)
 If 'zone' can be safely reconfigured according to the configuration data in 'zconfig', return ISC_TRUE. If the configuration data is so different from the current zone state that the zone needs to be destroyed and recreated, return ISC_FALSE.


Define Documentation

#define RETERR (  ) 

Value:

do { \
        isc_result_t _r = (x); \
        if (_r != ISC_R_SUCCESS) \
                return (_r); \
        } while (0)

Definition at line 62 of file zoneconf.c.

#define CHECK (  ) 

Value:

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

Definition at line 68 of file zoneconf.c.

#define STATICSTUB_SERVER_TTL   86400

Definition at line 399 of file zoneconf.c.

Referenced by configure_staticstub().

#define SIGNED   ".signed"

Referenced by ns_zone_configure().


Enumeration Type Documentation

enum acl_type_t

Enumerator:
allow_notify 
allow_query 
allow_query_on 
allow_transfer 
allow_update 
allow_update_forwarding 

Definition at line 53 of file zoneconf.c.


Function Documentation

static isc_result_t configure_zone_acl ( const cfg_obj_t zconfig,
const cfg_obj_t vconfig,
const cfg_obj_t config,
acl_type_t  acltype,
cfg_aclconfctx_t actx,
dns_zone_t zone,
void(*)(dns_zone_t *, dns_acl_t *)  setzacl,
void(*)(dns_zone_t *)  clearzacl 
) [static]

Convenience function for configuring a single zone ACL.

Definition at line 78 of file zoneconf.c.

References allow_notify, allow_query, allow_query_on, allow_transfer, allow_update, allow_update_forwarding, cfg_acl_fromconfig(), cfg_map_get(), cfg_tuple_get(), dns_acl_attach(), dns_acl_detach(), dns_zone_getmctx(), dns_zone_getview(), INSIST, ISC_R_FAILURE, ISC_R_SUCCESS, dns_view::notifyacl, ns_config_get(), dns_view::queryacl, dns_view::queryonacl, dns_view::transferacl, dns_view::updateacl, and dns_view::upfwdacl.

Referenced by ns_zone_configure().

static isc_result_t configure_zone_ssutable ( const cfg_obj_t zconfig,
dns_zone_t zone,
const char *  zname 
) [static]

Parse the zone update-policy statement.

Definition at line 186 of file zoneconf.c.

References isc_textregion::base, cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_get(), cfg_obj_asstring(), cfg_obj_isstring(), cfg_obj_log(), cfg_tuple_get(), cleanup(), DE_CONST, dns_fixedname_init, dns_fixedname_name, dns_name_copy(), dns_name_fromtext(), dns_rdatatype_fromtext(), dns_rootname, DNS_SSUMATCHTYPE_6TO4SELF, DNS_SSUMATCHTYPE_EXTERNAL, DNS_SSUMATCHTYPE_NAME, DNS_SSUMATCHTYPE_SELF, DNS_SSUMATCHTYPE_SELFKRB5, DNS_SSUMATCHTYPE_SELFMS, DNS_SSUMATCHTYPE_SELFSUB, DNS_SSUMATCHTYPE_SELFWILD, DNS_SSUMATCHTYPE_SUBDOMAIN, DNS_SSUMATCHTYPE_SUBDOMAINKRB5, DNS_SSUMATCHTYPE_SUBDOMAINMS, DNS_SSUMATCHTYPE_TCPSELF, DNS_SSUMATCHTYPE_WILDCARD, dns_ssutable_addrule(), dns_ssutable_create(), dns_ssutable_detach(), dns_zone_getmctx(), dns_zone_getorigin(), dns_zone_setssutable(), INSIST, isc_buffer_add, isc_buffer_constinit, ISC_FALSE, ISC_LOG_ERROR, isc_log_write(), isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_result_totext(), ISC_TRUE, isc_textregion::length, mctx, ns_config_listcount(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, r, and str.

Referenced by ns_zone_configure().

static isc_result_t configure_staticstub_serveraddrs ( const cfg_obj_t zconfig,
dns_zone_t zone,
dns_rdatalist_t rdatalist_ns,
dns_rdatalist_t rdatalist_a,
dns_rdatalist_t rdatalist_aaaa 
) [static]

Configure an apex NS with glues for a static-stub zone. For example, for the zone named "example.com", the following RRs will be added to the zone DB: example.com. NS example.com. example.com. A 192.0.2.1 example.com. AAAA 2001:db8::1.

Definition at line 410 of file zoneconf.c.

References AF_INET6, isc_region::base, cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_obj_assockaddr(), cfg_obj_log(), dns_name_toregion(), dns_rdata_fromregion(), dns_rdata_init(), dns_zone_getclass(), dns_zone_getmctx(), dns_zone_getorigin(), isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, INSIST, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LOG_ERROR, isc_mem_get, isc_netaddr_fromsockaddr(), isc_netaddr_getzone(), ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_sockaddr_getport(), isc_region::length, mctx, dns_rdatalist::type, and isc_netaddr::type.

Referenced by configure_staticstub().

static isc_result_t configure_staticstub_servernames ( const cfg_obj_t zconfig,
dns_zone_t zone,
dns_rdatalist_t rdatalist,
const char *  zname 
) [static]

Configure an apex NS with an out-of-zone NS names for a static-stub zone. For example, for the zone named "example.com", something like the following RRs will be added to the zone DB: example.com. NS ns.example.net.

Definition at line 506 of file zoneconf.c.

References isc_region::base, cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_obj_asstring(), cfg_obj_log(), dns_fixedname_init, dns_fixedname_name, dns_name_fromtext(), dns_name_issubdomain(), dns_name_toregion(), dns_rdata_fromregion(), dns_rdata_init(), dns_rootname, dns_zone_getclass(), dns_zone_getmctx(), dns_zone_getorigin(), isc_buffer_add, isc_buffer_constinit, ISC_LIST_APPEND, ISC_LOG_ERROR, isc_mem_get, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_region::length, mctx, and str.

Referenced by configure_staticstub().

static isc_result_t configure_staticstub ( const cfg_obj_t zconfig,
dns_zone_t zone,
const char *  zname,
const char *  dbtype 
) [static]

Configure static-stub zone.

Definition at line 568 of file zoneconf.c.

References cfg_map_get(), cleanup(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), dns_db_addrdataset(), dns_db_closeversion(), dns_db_create(), dns_db_detach(), dns_db_detachnode(), dns_db_findnode(), dns_db_newversion(), dns_dbtype_stub, dns_name_clone(), dns_name_init(), dns_rdata_toregion(), dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_disassociate(), dns_rdataset_init(), dns_zone_getclass(), dns_zone_getmctx(), dns_zone_getorigin(), dns_zone_setdb(), INSIST, ISC_FALSE, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_LOG_ERROR, isc_log_write(), isc_mem_put, ISC_R_FAILURE, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, mctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, dns_rdatalist::rdclass, RETERR, RUNTIME_CHECK, STATICSTUB_SERVER_TTL, dns_rdatalist::ttl, and dns_rdatalist::type.

Referenced by ns_zone_configure().

static dns_zonetype_t zonetype_fromconfig ( const cfg_obj_t map  )  [inline, static]

Convert a config file zone type into a server zone type.

Definition at line 719 of file zoneconf.c.

References cfg_map_get(), INSIST, ISC_R_SUCCESS, and ns_config_getzonetype().

Referenced by ns_zone_configure(), and ns_zone_reusable().

static isc_result_t strtoargvsub ( isc_mem_t mctx,
char *  s,
unsigned int *  argcp,
char ***  argvp,
unsigned int  n 
) [static]

Helper function for strtoargv(). Pardon the gratuitous recursion.

Definition at line 732 of file zoneconf.c.

References isc_mem_get, ISC_R_NOMEMORY, and ISC_R_SUCCESS.

Referenced by strtoargv().

static isc_result_t strtoargv ( isc_mem_t mctx,
char *  s,
unsigned int *  argcp,
char ***  argvp 
) [static]

Tokenize the string "s" into whitespace-separated words, return the number of words in '*argcp' and an array of pointers to the words in '*argvp'. The caller must free the array using isc_mem_put(). The string is modified in-place.

Definition at line 770 of file zoneconf.c.

References strtoargvsub().

Referenced by ns_zone_configure().

static void checknames ( dns_zonetype_t  ztype,
const cfg_obj_t **  maps,
const cfg_obj_t **  objp 
) [static]

Definition at line 775 of file zoneconf.c.

References dns_zone_master, dns_zone_slave, INSIST, ISC_R_SUCCESS, and ns_checknames_get().

isc_result_t ns_zone_configure ( const cfg_obj_t config,
const cfg_obj_t vconfig,
const cfg_obj_t zconfig,
cfg_aclconfctx_t ac,
dns_zone_t zone,
dns_zone_t raw 
)

Configure or reconfigure a zone according to the named.conf data in 'cctx' and 'czone'.

The zone origin is not configured, it is assumed to have been set at zone creation time.

Require:

Primary master functionality.

Definition at line 792 of file zoneconf.c.

References allow_notify, allow_query, allow_query_on, allow_transfer, allow_update, allow_update_forwarding, arg, cfg_map_get(), cfg_obj_asboolean(), cfg_obj_assockaddr(), cfg_obj_asstring(), cfg_obj_asuint32(), cfg_obj_asuint64(), cfg_obj_getdscp(), cfg_obj_isboolean(), cfg_obj_isstring(), cfg_obj_isvoid(), cfg_obj_log(), cfg_tuple_get(), checknames, configure_staticstub(), configure_zone_acl(), configure_zone_ssutable(), dialup(), dns_acl_isinsecure(), dns_dialuptype_no, dns_dialuptype_notify, dns_dialuptype_notifypassive, dns_dialuptype_passive, dns_dialuptype_refresh, dns_dialuptype_yes, DNS_LOGCATEGORY_SECURITY, dns_master_style_default, dns_master_style_full, dns_masterformat_map, dns_masterformat_raw, dns_masterformat_text, dns_notifytype_explicit, dns_notifytype_masteronly, dns_notifytype_no, dns_notifytype_yes, dns_nsstatscounter_max, dns_rdatatypestats_create(), dns_stats_detach(), dns_updatemethod_date, dns_updatemethod_increment, dns_updatemethod_unixtime, dns_zone_clearforwardacl(), dns_zone_clearnotifyacl(), dns_zone_clearqueryacl(), dns_zone_clearqueryonacl(), dns_zone_clearupdateacl(), dns_zone_clearxfracl(), dns_zone_getmctx(), dns_zone_getupdateacl(), dns_zone_getview(), dns_zone_master, dns_zone_redirect, dns_zone_setalsonotify(), dns_zone_setalsonotifydscpkeys(), dns_zone_setaltxfrsource4(), dns_zone_setaltxfrsource4dscp(), dns_zone_setaltxfrsource6(), dns_zone_setaltxfrsource6dscp(), dns_zone_setclass(), dns_zone_setdbtype(), dns_zone_setdialup(), dns_zone_setfile3(), dns_zone_setforwardacl(), dns_zone_setidlein(), dns_zone_setidleout(), dns_zone_setisself(), dns_zone_setjournal(), dns_zone_setjournalsize(), dns_zone_setkeydirectory(), dns_zone_setkeyopt(), dns_zone_setmasters(), dns_zone_setmasterswithkeys(), dns_zone_setmaxrefreshtime(), dns_zone_setmaxretrytime(), dns_zone_setmaxttl(), dns_zone_setmaxxfrin(), dns_zone_setmaxxfrout(), dns_zone_setminrefreshtime(), dns_zone_setminretrytime(), dns_zone_setnodes(), dns_zone_setnotifyacl(), dns_zone_setnotifydelay(), dns_zone_setnotifysrc4(), dns_zone_setnotifysrc4dscp(), dns_zone_setnotifysrc6(), dns_zone_setnotifysrc6dscp(), dns_zone_setnotifytype(), dns_zone_setoption(), dns_zone_setprivatetype(), dns_zone_setqueryacl(), dns_zone_setqueryonacl(), dns_zone_setrcvquerystats(), dns_zone_setrefreshkeyinterval(), dns_zone_setrequestexpire(), dns_zone_setrequestixfr(), dns_zone_setrequeststats(), dns_zone_setserialupdatemethod(), dns_zone_setsignatures(), dns_zone_setsigresigninginterval(), dns_zone_setsigvalidityinterval(), dns_zone_setstatlevel(), dns_zone_settype(), dns_zone_setupdateacl(), dns_zone_setxfracl(), dns_zone_setxfrsource4(), dns_zone_setxfrsource4dscp(), dns_zone_setxfrsource6(), dns_zone_setxfrsource6dscp(), dns_zone_setzeronosoattl(), dns_zone_slave, dns_zone_staticstub, dns_zone_stub, DNS_ZONEKEY_ALLOW, DNS_ZONEKEY_MAINTAIN, DNS_ZONEKEY_NORESIGN, DNS_ZONEOPT_CHECKDUPRR, DNS_ZONEOPT_CHECKDUPRRFAIL, DNS_ZONEOPT_CHECKINTEGRITY, DNS_ZONEOPT_CHECKMX, DNS_ZONEOPT_CHECKMXFAIL, DNS_ZONEOPT_CHECKNAMES, DNS_ZONEOPT_CHECKNAMESFAIL, DNS_ZONEOPT_CHECKSIBLING, DNS_ZONEOPT_CHECKSPF, DNS_ZONEOPT_CHECKWILDCARD, DNS_ZONEOPT_DNSKEYKSKONLY, DNS_ZONEOPT_IGNOREMXCNAME, DNS_ZONEOPT_IGNORESRVCNAME, DNS_ZONEOPT_IXFRFROMDIFFS, DNS_ZONEOPT_MULTIMASTER, DNS_ZONEOPT_NOTIFYTOSOA, DNS_ZONEOPT_NSEC3TESTZONE, DNS_ZONEOPT_SECURETOINSECURE, DNS_ZONEOPT_TRYTCPREFRESH, DNS_ZONEOPT_UPDATECHECKKSK, DNS_ZONEOPT_USEALTXFRSRC, DNS_ZONEOPT_WARNMXCNAME, DNS_ZONEOPT_WARNSRVCNAME, dns_zonestat_full, dns_zonestat_none, dns_zonestat_terse, ignore(), INSIST, ISC_FALSE, ISC_LOG_ERROR, ISC_LOG_WARNING, isc_log_write(), isc_mem_allocate, isc_mem_free, isc_mem_get, isc_mem_put, isc_mem_strdup, ISC_PRINT_QUADFORMAT, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_RANGE, ISC_R_SUCCESS, isc_stats_create(), isc_stats_detach(), ISC_TRUE, ISC_UINT32_MAX, masterstyle, maxttl, mctx, dns_view::name, ns_add_reserved_dispatch(), ns_client_isself(), ns_config_get(), ns_config_getclass(), ns_config_getipandkeylist(), ns_config_putipandkeylist(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, RETERR, SIGNED, str, strtoargv(), zname, and zonetype_fromconfig().

Referenced by configure_zone().

isc_result_t ns_zone_configure_writeable_dlz ( dns_dlzdb_t dlzdatabase,
dns_zone_t zone,
dns_rdataclass_t  rdclass,
dns_name_t name 
)

Definition at line 1763 of file zoneconf.c.

References dns_db_detach(), dns_sdlz_setdb, dns_zone_dlz, dns_zone_dlzpostload(), dns_zone_settype(), ISC_R_SUCCESS, now, and TIME_NOW.

Referenced by dlzconfigure_callback().

isc_boolean_t ns_zone_reusable ( dns_zone_t zone,
const cfg_obj_t zconfig 
)

If 'zone' can be safely reconfigured according to the configuration data in 'zconfig', return ISC_TRUE. If the configuration data is so different from the current zone state that the zone needs to be destroyed and recreated, return ISC_FALSE.

Definition at line 1782 of file zoneconf.c.

References cfg_map_get(), cfg_obj_asboolean(), cfg_obj_asstring(), cfg_tuple_get(), dns_zone_detach(), dns_zone_getfile(), dns_zone_getraw(), dns_zone_gettype(), dns_zone_log(), dns_zone_staticstub, ISC_FALSE, ISC_LOG_DEBUG, ISC_TRUE, and zonetype_fromconfig().

Referenced by configure_zone().


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