OpenDNSSEC-signer  1.3.16
Data Structures | Typedefs | Functions
zonedata.h File Reference
#include "config.h"
#include "adapter/adapter.h"
#include "daemon/worker.h"
#include "scheduler/fifoq.h"
#include "shared/allocator.h"
#include "shared/status.h"
#include "signer/denial.h"
#include "signer/domain.h"
#include "signer/keys.h"
#include "signer/signconf.h"
#include "signer/stats.h"
#include "signer/nsec3params.h"
#include <ldns/ldns.h>
#include <stdio.h>
Include dependency graph for zonedata.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  zonedata_struct
 

Typedefs

typedef struct zonedata_struct zonedata_type
 

Functions

void zonedata_init_denial (zonedata_type *zd)
 
zonedata_typezonedata_create (allocator_type *allocator)
 
ods_status zonedata_recover (zonedata_type *zd, FILE *fd)
 
domain_typezonedata_lookup_domain (zonedata_type *zd, ldns_rdf *name)
 
domain_typezonedata_add_domain (zonedata_type *zd, domain_type *domain)
 
domain_typezonedata_del_domain (zonedata_type *zd, domain_type *domain)
 
denial_typezonedata_lookup_denial (zonedata_type *zd, ldns_rdf *name)
 
ods_status zonedata_add_denial (zonedata_type *zd, domain_type *domain, ldns_rdf *apex, nsec3params_type *nsec3params)
 
denial_typezonedata_del_denial (zonedata_type *zd, denial_type *denial)
 
ods_status zonedata_examine (zonedata_type *zd, ldns_rdf *apex, adapter_mode mode)
 
ods_status zonedata_diff (zonedata_type *zd, keylist_type *kl)
 
ods_status zonedata_commit (zonedata_type *zd)
 
void zonedata_rollback (zonedata_type *zd)
 
ods_status zonedata_entize (zonedata_type *zd, ldns_rdf *apex)
 
ods_status zonedata_nsecify (zonedata_type *zd, ldns_rr_class klass, uint32_t ttl, uint32_t *num_added)
 
ods_status zonedata_nsecify3 (zonedata_type *zd, ldns_rr_class klass, uint32_t ttl, nsec3params_type *nsec3params, uint32_t *num_added)
 
ods_status zonedata_update_serial (zonedata_type *zd, signconf_type *sc, const char *zone_name)
 
ods_status zonedata_queue (zonedata_type *zd, fifoq_type *q, worker_type *worker)
 
void zonedata_wipe_denial (zonedata_type *zd)
 
void zonedata_cleanup_chain (zonedata_type *zd)
 
void zonedata_cleanup (zonedata_type *zd)
 
void zonedata_backup (FILE *fd, zonedata_type *zd)
 
ods_status zonedata_print (FILE *fd, zonedata_type *zd)
 
void log_rdf (ldns_rdf *rdf, const char *pre, int level)
 

Typedef Documentation

Zone data. Zone data.

Definition at line 58 of file zonedata.h.

Function Documentation

void log_rdf ( ldns_rdf *  rdf,
const char *  pre,
int  level 
)

Log RDF.

Parameters
[in]rdfRDF
[in]prestring to log before RDF
[in]levellog level

Log RDF.

Definition at line 55 of file zonedata.c.

References ods_log_debug(), ods_log_deeebug(), ods_log_error(), ods_log_get_level(), ods_log_info(), ods_log_verbose(), and ods_log_warning().

Referenced by zonedata_add_denial(), zonedata_add_domain(), zonedata_del_denial(), zonedata_del_domain(), zonedata_nsecify(), and zonedata_nsecify3().

ods_status zonedata_add_denial ( zonedata_type zd,
domain_type domain,
ldns_rdf *  apex,
nsec3params_type nsec3params 
)

Add denial of existence data point to zone data.

Parameters
[in]zdzone data
[in]domaincorresponding domain
[in]apexapex
[in]nsec3paramsNSEC3 parameters
Returns
ods_status status

Add denial of existence data point to the zone data.

Definition at line 489 of file zonedata.c.

References denial_struct::bitmap_changed, domain_struct::denial, zonedata_struct::denial_chain, denial_cleanup(), denial_create(), domain_struct::dname, denial_struct::domain, log_rdf(), denial_struct::nxt_changed, ods_log_assert, ods_log_error(), ODS_STATUS_ASSERT_ERR, ODS_STATUS_CONFLICT_ERR, ODS_STATUS_ERR, ODS_STATUS_OK, and zonedata_lookup_denial().

Referenced by zonedata_nsecify(), and zonedata_nsecify3().

domain_type* zonedata_add_domain ( zonedata_type zd,
domain_type domain 
)

Add domain to zone data.

Parameters
[in]zdzone data
[in]domaindomain to add
Returns
domain_type* added domain

Add a domain to the zone data.

Definition at line 327 of file zonedata.c.

References domain_struct::dname, zonedata_struct::domains, log_rdf(), ods_log_assert, and ods_log_error().

Referenced by zone_add_rr().

void zonedata_backup ( FILE *  fd,
zonedata_type zd 
)

Backup zone data.

Parameters
[in]fdoutput file descriptor
[in]zdzone data

Backup zone data.

Definition at line 1584 of file zonedata.c.

References domain_backup(), and zonedata_struct::domains.

Referenced by zone_backup().

void zonedata_cleanup ( zonedata_type zd)

Clean up zone data.

Parameters
[in]zdzone data to cleanup

Clean up zone data.

Definition at line 1564 of file zonedata.c.

References zonedata_struct::allocator, allocator_deallocate(), and zonedata_cleanup_chain().

Referenced by zone_cleanup(), and zone_recover().

void zonedata_cleanup_chain ( zonedata_type zd)

Clean up denial of existence chain.

Parameters
[in]zdzone data

Clean up denial of existence chain.

Definition at line 1548 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zone_load_signconf(), and zonedata_cleanup().

ods_status zonedata_commit ( zonedata_type zd)

Commit updates to zone data.

Parameters
[in]zdzone data
Returns
ods_status status

Commit updates to zone data.

Definition at line 687 of file zonedata.c.

References domain_struct::dname, domain_commit(), domain_count_rrset(), zonedata_struct::domains, ods_log_warning(), ODS_STATUS_ERR, ODS_STATUS_OK, and zonedata_del_domain().

Referenced by tools_input(), and zone_recover().

zonedata_type* zonedata_create ( allocator_type allocator)
denial_type* zonedata_del_denial ( zonedata_type zd,
denial_type denial 
)

Delete denial of existence data point from zone data.

Parameters
[in]zdzone data
[in]denialdenial of existence data point
Returns
denial_type* denial of existence data point if failed

Delete denial of existence data point from the zone data.

Definition at line 632 of file zonedata.c.

References zonedata_struct::denial_chain, log_rdf(), ods_log_assert, ods_log_error(), and denial_struct::owner.

Referenced by zonedata_del_domain(), zonedata_nsecify(), and zonedata_nsecify3().

domain_type* zonedata_del_domain ( zonedata_type zd,
domain_type domain 
)

Delete domain from zone data.

Parameters
[in]zdzone data
[in]domaindomain to delete
Returns
domain_type* domain if failed

Delete domain from the zone data.

Definition at line 388 of file zonedata.c.

References domain_struct::denial, domain_struct::dname, zonedata_struct::domains, log_rdf(), ods_log_assert, ods_log_error(), and zonedata_del_denial().

Referenced by zonedata_commit().

ods_status zonedata_diff ( zonedata_type zd,
keylist_type kl 
)

Calculate differences at the zonedata between current and new RRsets.

Parameters
[in]zdzone data
[in]klcurrent key list
Returns
ods_status status

Calculate differences at the zonedata between current and new RRsets.

Definition at line 658 of file zonedata.c.

References domain_diff(), zonedata_struct::domains, and ODS_STATUS_OK.

Referenced by adapi_trans_full().

ods_status zonedata_entize ( zonedata_type zd,
ldns_rdf *  apex 
)

Add empty non-terminals to zone data.

Parameters
[in]zdzone data
[in]apexzone apex
Returns
ods_status status

Add empty non-terminals to zone data.

Definition at line 913 of file zonedata.c.

References domain_dstatus(), zonedata_struct::domains, ods_log_assert, ods_log_error(), ODS_STATUS_ASSERT_ERR, and ODS_STATUS_OK.

Referenced by tools_nsecify(), and zone_recover().

ods_status zonedata_examine ( zonedata_type zd,
ldns_rdf *  apex,
adapter_mode  mode 
)

Examine updates to zone data.

Parameters
[in]zdzone data
[in]apexapex domain name
[in]modeadapter mode
Returns
ods_status status

Examine updates to zone data.

Definition at line 1408 of file zonedata.c.

References ADAPTER_FILE, domain_examine_rrset_is_alone(), domain_examine_rrset_is_singleton(), zonedata_struct::domains, ods_log_assert, ODS_STATUS_ERR, and ODS_STATUS_OK.

Referenced by zone_examine().

void zonedata_init_denial ( zonedata_type zd)

Initialize denial of existence chain.

Parameters
[in]zdzone data

Initialize denial of existence chain.

Definition at line 137 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zone_load_signconf(), and zonedata_create().

denial_type* zonedata_lookup_denial ( zonedata_type zd,
ldns_rdf *  dname 
)

Look up denial of existence data point.

Parameters
[in]zdzone data
[in]namedomain name to look for
Returns
domain_type* domain, if found

Lookup denial of existence data point.

Definition at line 440 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zonedata_add_denial().

domain_type* zonedata_lookup_domain ( zonedata_type zd,
ldns_rdf *  dname 
)

Recover RR from backup.

Parameters
[in]zdzone data
[in]rrRR to add
Returns
int 0 on success, 1 on false Recover RRSIG from backup.
Parameters
[in]zdzone data
[in]rrsigRRSIG to add
[in]locatorkey locaotor
[in]flagskey flags
Returns
int 0 on success, 1 on false Look up domain.
Parameters
[in]zdzone data
[in]namedomain name to look for
Returns
domain_type* domain, if found

Lookup domain.

Definition at line 314 of file zonedata.c.

References zonedata_struct::domains.

Referenced by zone_add_rr(), zone_del_rr(), zone_update_serial(), and zonedata_recover().

ods_status zonedata_nsecify ( zonedata_type zd,
ldns_rr_class  klass,
uint32_t  ttl,
uint32_t *  num_added 
)

Add NSEC records to zone data.

Parameters
[in]zdzone data
[in]klasszone class
[in]ttlNSEC ttl
[out]num_addednumber of NSEC RRs added
Returns
ods_status status

Add NSEC records to zonedata.

Now we have the complete denial of existence chain

Definition at line 955 of file zonedata.c.

References domain_struct::denial, zonedata_struct::denial_chain, denial_nsecify(), domain_struct::dname, domain_count_rrset(), DOMAIN_STATUS_APEX, DOMAIN_STATUS_ENT, DOMAIN_STATUS_NONE, DOMAIN_STATUS_OCCLUDED, zonedata_struct::domains, domain_struct::dstatus, log_rdf(), ods_log_alert(), ods_log_assert, ods_log_error(), ods_log_warning(), ODS_STATUS_ASSERT_ERR, ODS_STATUS_ERR, ODS_STATUS_OK, zonedata_add_denial(), and zonedata_del_denial().

Referenced by tools_nsecify().

ods_status zonedata_nsecify3 ( zonedata_type zd,
ldns_rr_class  klass,
uint32_t  ttl,
nsec3params_type nsec3params,
uint32_t *  num_added 
)

Add NSEC3 records to zone data.

Parameters
[in]zdzone data
[in]klasszone class
[in]ttlNSEC3 ttl
[in]nsec3paramsNSEC3 parameters
[out]num_addednumber of NSEC3 RRs added
Returns
ods_status status

Add NSEC3 records to zonedata.

Additionally, for collision detection purposes, optionally create an additional NSEC3 RR corresponding to the original owner name with the asterisk label prepended (i.e., as if a wildcard existed as a child of this owner name) and keep track of this original owner name. Mark this NSEC3 RR as temporary.

pseudo: wildcard_name = *.domain->dname; hashed_ownername = ldns_nsec3_hash_name(domain->dname, nsec3params->algorithm, nsec3params->iterations, nsec3params->salt_len, nsec3params->salt); domain->nsec3_wildcard = denial_create(hashed_ownername);

Now we have the complete denial of existence chain

Definition at line 1048 of file zonedata.c.

References domain_struct::denial, zonedata_struct::denial_chain, denial_nsecify3(), domain_struct::dname, DOMAIN_STATUS_APEX, DOMAIN_STATUS_NONE, DOMAIN_STATUS_NS, DOMAIN_STATUS_OCCLUDED, zonedata_struct::domains, domain_struct::dstatus, nsec3params_struct::flags, log_rdf(), ods_log_alert(), ods_log_assert, ods_log_error(), ODS_STATUS_ASSERT_ERR, ODS_STATUS_ERR, ODS_STATUS_OK, zonedata_add_denial(), and zonedata_del_denial().

Referenced by tools_nsecify().

ods_status zonedata_print ( FILE *  fd,
zonedata_type zd 
)

Print zone data.

Parameters
[in]fdoutput file descriptor
[in]zdzone data
Returns
ods_status status

Print zone data.

Definition at line 1609 of file zonedata.c.

References domain_print(), zonedata_struct::domains, ods_log_assert, ods_log_error(), ODS_STATUS_ASSERT_ERR, and ODS_STATUS_OK.

Referenced by zone_print().

ods_status zonedata_queue ( zonedata_type zd,
fifoq_type q,
worker_type worker 
)

Queue all RRsets.

Parameters
[in]zdzone data
[in]qqueue
[in]workerowner of data
Returns
ods_status status

Queue all RRsets.

Definition at line 1295 of file zonedata.c.

References domain_queue(), zonedata_struct::domains, and ODS_STATUS_OK.

ods_status zonedata_recover ( zonedata_type zd,
FILE *  fd 
)

Recover zone data from backup.

Parameters
[in]zdzone data
[in]fdbackup file descriptor
Returns
ods_status status

Recover zone data from backup.

Definition at line 202 of file zonedata.c.

References backup_read_check_str(), backup_read_int(), backup_read_str(), domain_struct::denial, zonedata_struct::denial_chain, domain_recover(), ods_log_assert, ods_log_error(), ODS_STATUS_ERR, ODS_STATUS_OK, ods_strcmp(), and zonedata_lookup_domain().

Referenced by zone_recover().

void zonedata_rollback ( zonedata_type zd)

Rollback updates from zone data.

Parameters
[in]zdzone data

Rollback updates from zone data.

Definition at line 739 of file zonedata.c.

References domain_rollback(), and zonedata_struct::domains.

Referenced by tools_input(), zone_load_signconf(), and zone_publish_dnskeys().

ods_status zonedata_update_serial ( zonedata_type zd,
signconf_type sc,
const char *  zone_name 
)
void zonedata_wipe_denial ( zonedata_type zd)

Wipe out all NSEC(3) RRsets.

Parameters
[in]zdzone data

Wipe out all NSEC RRsets.

Definition at line 1457 of file zonedata.c.

References zonedata_struct::denial_chain, denial_struct::rrset, and rrset_cleanup().

Referenced by zone_load_signconf().