zone revision 40f53fa8d9c6a4fc38c0014495e7a42b08f52481
009efae64aabc651dfd00b4c0add09e07420aa53Razvan PascanuCopyright (C) 1999, 2000 Internet Software Consortium.
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan PascanuSee COPYRIGHT in the source root or http://www.isc.org/copyright for terms.
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu $Id: zone,v 1.7 2000/08/01 01:18:19 tale Exp $
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu Zones are the unit of delegation in the DNS and may go from holding
9a80079e082fdf4fe8e19f8fc61e6cd8799b47a7Christian Maeder RR's only at the zone top to holding the complete hierachy (private
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu roots zones). Zones have an associated database which is the
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu container for the RR sets that make up the zone.
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu Zone have certain properties associated with them.
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * master / slave / stub / hint / cache / forward
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * serial number
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer * signed / unsigned
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu * update periods (refresh / retry) (slave / stub)
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu * last update time (slave / stub)
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu * access restrictions
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross * transfer restrictions (master / slave)
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu * update restictions (master / slave)
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * expire period (slave / stub)
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * children => bottom
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * rrsets / data
f153609d4ff5616d7caa410df605afcdfb9956dfChristian Maeder * transfer "in" in progress
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross * transfers "out" in progress
28ca54b0d63d1d26a991711c8c7e85c474994715Christian Maeder * "current" check in progress
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * primary master name (required to auto generate our masters)
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer * master file name
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross * database name
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer * database type
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross * initially only master_file (BIND 4 & 8)
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer * expanded axfr + ixfr
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * transaction logs
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu * notification lists
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * static additional sites (stealth servers)
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu * dynamically learned sites (soa queries)
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer Zones have two types of versions associated with them.
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer The image of the "current" zone when a AXFR out is in progress.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu There may be several of these at once but they cease to need
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu to exist once the AXFR's on this version has completed. These
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer are maintained by the various database access methods.
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross These are virtual versions of the zone and are required to
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu support IXFR requests. While the entire contents of the old
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross version does not need to be kept, a change log needs to be
5c7c1141dc19f7b7d1e4c25fcde606b4b1a76752Christian Maeder kept. An index into this log would be useful in speeding
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu up replies. These versions have an explict expiry date.
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder "How long are we going to keep them operationally?"
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder While there are expriry dates based on last update /
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu change time + expire. In practice holding the deltas
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu for a few refresh periods should be enough. If the network
5b971df2318e549e9151fb5e145097fe05b11474Markus Gross and servers are up one is enough.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu "How are we going to generate them from a master file?"
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu UPDATE should not be the only answer to this question.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu We need a tool that takes the current zone & new zone.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu Verifies the new zone, generates a delta and feeds this
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu at named. It could well be part of ndc but does not have
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu Zones need to have certain operations performed on them. The need to
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * updated (UPDATE / IXFR)
9a80079e082fdf4fe8e19f8fc61e6cd8799b47a7Christian Maeder * copied out in full (AXFR) or as partial deltas (IXFR)
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * generate a delta between two given versions.
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * signed / resigned
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu * maintenance
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu validate current soa
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu remove old deltas / consolidation
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu purge stale rrsets (cache)
475f17c9988a758a35c35ff26f7beaaf5d4c8125Markus Gross * notification
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu responding to
9a80079e082fdf4fe8e19f8fc61e6cd8799b47a7Christian Maeder While not strictly a nameserver function, bad delegation and bad
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu slave setups are continual and ongoing sources of problems in the
9a80079e082fdf4fe8e19f8fc61e6cd8799b47a7Christian Maeder DNS. Periodic checks to ensure parent and child servers agree on
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu the list of nameservers and that slaves are tracking the changes
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu made in the master server's zone will allow problems in
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu configurations to be identified earlier providing for a more stable
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan PascanuCompatability:
3ee0a2095e7213b1b7889025658f784ef48426eaRazvan Pascanu Zones are required to be configuration file compatable with
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer typedef enum {
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_none = 0,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_master,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_slave,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_stub,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_hint,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_cache,
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer dns_zone_forward
44c1fff98bd6c54db237bef5030657d3f47058a5Thiemo Wiedemeyer } dns_zonetypes_t;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu typedef struct dns_ixfr dns_ixfr_t;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu struct dns_ixfr {
36286d0ec57c3b3a1f73960ec935c3b69bad96faMarkus Gross unsigned int magic; /* IXFR */
36286d0ec57c3b3a1f73960ec935c3b69bad96faMarkus Gross isc_uint32_t serial;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu time_t expire;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu unsigned int offset;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu ISC_LINK(dns_ixfr_t) link;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross struct dns_zone {
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross unsigned int magic; /* ZONE */
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_name_t name;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_rdataclass_t class;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zonetypes_t type;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_bt_t top;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross isc_uint32_t version;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross isc_uint32_t serial;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross isc_uint32_t refresh;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross isc_uint32_t retry;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross isc_uint32_t serial;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross char *masterfile;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_acl_t *access;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_acl_t *transfer;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_acl_t *acl;
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu dns_scl_t *scl; /* tsig based acl */
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross char *database;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross ISC_LIST(dns_ixfr_t) ixfr;
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_init(dns_zone_t *zone, dns_rdataclass_t class, isc_mem_t *mxtc);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_invalidate(dns_zone_t *zone);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_ixfr_init(dns_ixfr_t *ixfr, unsigned long serial, time_t expire);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_ixfr_invalidate(dns_ixfr_t *ixfr);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_axfrout(dns_zone_t *zone);
36286d0ec57c3b3a1f73960ec935c3b69bad96faMarkus Gross Initiate outgoing zone transfer.
36286d0ec57c3b3a1f73960ec935c3b69bad96faMarkus Gross dns_zone_axfrin(dns_zone_t *zone, isc_sockaddr_t *addr);
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu Initiate transfer of the zone from the given server or the
36286d0ec57c3b3a1f73960ec935c3b69bad96faMarkus Gross masters masters listed in the zone structure.
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu dns_zone_maintenance(dns_zone_t *zone);
8f5219469b89a15dc6d4c2c30463775975f5841cRazvan Pascanu Perform any maintenance operations required on the zone
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross * initiate up to date checks
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross * expire zones
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross * initiate ixfr version expire consolidation
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_locateprimary(dns_zone_t *zone);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Working from the root zone locate the primary master for the zone.
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Used if masters are not given in named.conf.
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_locateservers(dns_zone_t *zone);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Working from the root zone locate the servers for the zone.
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Primary master moved to first in list if in NS set. Remove self
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Used if masters are not given in named.conf.
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_notify(dns_zone_t *);
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross Queue notify messages.
ce1c76a52a42788c085b7794a1a5f9758799a0e2Markus Gross dns_zone_checkparents(dns_zone_t *);
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu check that the parent nameservers NS lists for this zone agree with
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu the NS list this zone, check glue A records. Warn if not identical.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu This operation is performed on master zones.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu dns_zone_checkchildren(dns_zone_t *);
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu check that the child zones NS lists agree with the NS lists in this
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu zone, check glue records. Warn if not identical.
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder dns_zone_checkservers(dns_zone_t *);
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder check that all the listed servers for the zone agree on NS list and
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu serial number. NOTE only errors which continue over several refresh
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder periods to be reported.
009efae64aabc651dfd00b4c0add09e07420aa53Razvan Pascanu dns_zone_dump(dns_zone_t *, FILE *fp);
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder Write the contents of the zone to the file associated with fp.
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder dns_zone_validate(dns_zone_t *);
83e814d7ac048930de2fe34b5b23d883654a1777Christian Maeder Validate the zone contents using DNSSEC.
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross dns_zone_tordatalist(dns_zone_t *zone, dns_rdatalist_t *list)
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross dns_zone_addmaster(dns_zone_t *zone, isc_sockaddr_t *addr);
a723f05d73fb1b577e7c4526e22e316394221c9aMarkus Gross Add addr to the set of masters for the zone.
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_clearmasters(dns_zone_t *zone);
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross Clear the master set.
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_setreadacl(dns_zone_t *, dns_acl_t *)
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_setxfracl(dns_zone_t *, dns_acl_t *)
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_addnotify(dns_zone_t *, isc_sockaddr_t *addr, isc_boolean_t perm);
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_clearnotify(dns_zone_t *)
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_load(dns_zone_t *);
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross dns_zone_consolidate(dns_zone_t *);
9a9860760c6f30558e5e60049692b6fc63904590Markus Gross Consolidate on disk copy of zone.