35#include <dns/result.h>
160#if defined (NSUPDATE)
161#if defined (DNS_ZONE_LOOKUP)
247 foo = &((*foo)->next);
314#define TRACE_PTR_LEN 8
369 log_error(
"trace_ddns_input_read: data too short");
390 log_error(
"trace_dns_input_read: unable to map cb pointer");
402 log_error(
"trace_ddns_input_read: unable to allocate event");
456 log_error(
"trace_ddns_output_write: no input found");
460 log_error(
"trace_ddns_output_write: data too short");
486 "unable to allocate map entry");
517 iov[2].buf = (
char *)arg;
529 log_error(
"unaccounted for ddns output.");
549#define ddns_update trace_ddns_output_write
551#define ddns_update dns_client_startupdate
554#define zone_resolve dns_client_startresolve
567 if (ddns_cb !=
NULL) {
574#if defined (DEBUG_DNS_UPDATES)
584#if defined (DEBUG_DNS_UPDATES)
598 log_error(
"Impossible memory leak at %s:%d (attempt to free "
599 "DDNS Control Block before transaction).",
MDL);
604 log_error(
"Possible memory leak at %s:%d (attempt to free "
605 "DDNS Control Block before fxed6_ia).",
MDL);
668 char *
tname = (
char *)0;
675 if (
name [len - 1] !=
'.') {
686 else if ((*zone)->timeout && (*zone)->timeout <
cur_time) {
705 if ((ptr ==
NULL) || (*ptr ==
NULL)) {
707#if defined (POINTER_DEBUG)
723#if defined (DEBUG_RC_HISTORY)
726#if defined (POINTER_DEBUG)
749#if defined (NSUPDATE)
750#if defined (DNS_ZONE_LOOKUP)
766 switch (rdataset->type) {
783 if ((
ns_cb->ttl == 0) || (
ns_cb->ttl > rdataset->ttl))
784 ns_cb->ttl = rdataset->ttl;
860 if (
ns_cb->num_addrs +
878 rdataset =
ns_cb->rdataset;
891 if (rdataset ==
ns_cb->rdataset) {
915 ns_cb->rdataset = rdataset;
925 &
ns_cb->transaction);
937 log_error(
"find_zone_ns: unable to continue "
957 if ((
ns_cb->num_addrs != 0) ||
958 (
ns_cb->num_addrs6 != 0))
962 &
ns_cb->eventp->answerlist);
1008 (
ns_cb->zname[1] == 0)) {
1026 &
ns_cb->transaction))
1028 log_error(
"find_zone_ns: Unable to build "
1029 "name or start resolve: %s %s",
1070 ns_cb->rdataset = rdataset;
1080 &
ns_cb->transaction);
1092 log_error(
"find_zone_ns: unable to continue "
1145 log_error(
"find_zone_start: unable to allocate cb");
1180 &
ns_cb->transaction))
1182 log_error(
"find_zone_start: Unable to build "
1183 "name or start resolve: %s %s",
1218 if ((
np ==
NULL) || (*
np ==
'\0')) {
1258 if (zone->primary) {
1261 zone->primary,
MDL)) {
1280 if (zone->primary6) {
1283 zone->primary6,
MDL)) {
1302 if (zone->secondary) {
1305 zone->secondary,
MDL)) {
1324 if (zone->secondary6) {
1327 zone->secondary6,
MDL)) {
1359 if ((zone ==
NULL) || (*zone ==
NULL)) {
1360 log_info(
"Null argument to repudiate zone");
1368#if defined (DNS_ZONE_LOOKUP)
1406 if (zone->
name[len-1] !=
'.') {
1407 zone->
name[len] =
'.';
1408 zone->
name[len+1] = 0;
1414 if (
ns_cb->num_addrs != 0) {
1428 if (
ns_cb->num_addrs6 != 0) {
1502 id->
data =
id->buffer->data;
1565 id->
data =
id->buffer->data;
1575 id->buffer->data[1] =
"0123456789abcdef"[(type >> 4) & 0xf];
1580 id->buffer->data[2] =
"0123456789abcdef"[type % 15];
1589 id->buffer->data[
i * 2 + 3] =
1590 "0123456789abcdef"[(buf[
i] >> 4) & 0xf];
1591 id->buffer->data[
i * 2 + 4] =
1592 "0123456789abcdef"[buf[
i] & 0xf];
1596 id->buffer->data[
id->len] = 0;
1647 if (
leaseid->terminated == 1) {
1667 unsigned char *
data,
1709 rdatalist->ttl = ttl;
1719#if defined (DEBUG_DNS_UPDATES)
1769#if defined (DEBUG_DNS_UPDATES)
1778 dataspace,
NULL, 0, 0);
1783 dataspace,
NULL, 0, 0);
1862#if defined (DEBUG_DNS_UPDATES)
1901 dataspace,
NULL, 0, 0);
1924 dataspace,
NULL, 0, 0);
1979#if defined (DEBUG_DNS_UPDATES)
1986 dataspace,
NULL, 0, 0);
1996 dataspace,
NULL, 0, 0);
2006 dataspace,
NULL, 0, 0);
2073#if defined (DEBUG_DNS_UPDATES)
2087 dataspace,
NULL, 0, 0);
2099 dataspace,
NULL, 0, 0);
2110 dataspace,
NULL, 0, 0);
2166#if defined (DEBUG_DNS_UPDATES)
2236#if defined (DEBUG_DNS_UPDATES)
2243 dataspace,
NULL, 0, 0);
2252 dataspace,
NULL, 0, 0);
2308#if defined (DEBUG_DNS_UPDATES)
2316 dataspace,
NULL, 0, 0);
2368#if defined (DEBUG_DNS_UPDATES)
2375 dataspace,
NULL, 0, 0);
2385 dataspace,
NULL, 0, 0);
2423#if defined (TRACING)
2429#if defined (DEBUG_DNS_UPDATES)
2440#if defined (DEBUG_DNS_UPDATES)
2441 log_info(
"DDNS: completeing transaction cancellation cb=%p, "
2446 log_info(
"DDNS: cleaning up lease pointer for a cancel "
2472 log_error(
"DDNS: bad zone information, repudiating zone %s",
2491 log_info(
"DDNS: Failed to retry after zone failure");
2515#if defined (DEBUG_DNS_UPDATES)
2555#if defined (DNS_ZONE_LOOKUP)
2584 if (ddns_cb->
zone) {
2588 log_error(
"Unable to build name for zone for "
2589 "fwd update: %s %s",
2609 if (tsec_key ==
NULL) {
2610 log_error(
"No tsec for use with key %s",
2621 log_error(
"Unable to build name for fwd update: %s %s",
2628 if (dataspace ==
NULL) {
2629 log_error(
"Unable to allocate memory for fwd update");
2637 switch(ddns_cb->
state) {
2714 log_error(
"ddns_modify_fwd: Invalid state: %d", ddns_cb->state);
2735 &ddns_cb->transaction);
2737 log_info(
"Unable to perform DDNS update, "
2738 "address family not supported");
2741#if defined (DEBUG_DNS_UPDATES)
2746#if defined (DEBUG_DNS_UPDATES)
2748 log_info(
"DDNS: %s(%d): error in ddns_modify_fwd %s for %p",
2753 if (dataspace !=
NULL) {
2755 sizeof(*dataspace) * 4);
2772 unsigned char buf[256];
2775#if defined (DEBUG_DNS_UPDATES)
2794#if defined (DNS_ZONE_LOOKUP)
2822 log_error(
"Unable to build name for zone for "
2823 "fwd update: %s %s",
2841 if (tsec_key ==
NULL) {
2842 log_error(
"No tsec for use with key %s",
2854 log_error(
"Unable to build name for fwd update: %s %s",
2865 if (dataspace ==
NULL) {
2866 log_error(
"Unable to allocate memory for fwd update");
2879 &dataspace[0],
NULL, 0, 0);
2898 while (buf[buflen] != 0) {
2899 buflen += buf[buflen] + 1;
2906 buf, buflen, ddns_cb->
ttl);
2929 &ddns_cb->transaction);
2931 log_info(
"Unable to perform DDNS update, "
2932 "address family not supported");
2935#if defined (DEBUG_DNS_UPDATES)
2940#if defined (DEBUG_DNS_UPDATES)
2942 log_info(
"DDNS: %s(%d): error in ddns_modify_ptr %s for %p",
2947 if (dataspace !=
NULL) {
2949 sizeof(*dataspace) * 2);
2963#if defined (DEBUG_DNS_UPDATES)
2964 log_info(
"DDNS: %s(%d): cancelling transaction for %p",
2974#if defined (NSUPDATE)
2975#if defined (DEBUG_DNS_UPDATES)
2997 while (
li->val != -1 &&
li->val != state) {
3048 sizeof(
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
3051 log_info(
"DDNS reply: id ptr %p, result: %s",
3062 en =
"DDNS request: id ptr ";
3072 switch (ddns_cb->
state) {
#define rc_register(file, line, reference, addr, refcnt, d, f)
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
int dns_zone_reference(struct dns_zone **ptr, struct dns_zone *bp, const char *file, int line)
int dns_zone_allocate(struct dns_zone **ptr, const char *file, int line)
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
int option_cache_allocate(struct option_cache **cptr, const char *file, int line)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
char * buf_to_hex(const unsigned char *s, unsigned len, const char *file, int line)
void putUShort(unsigned char *, u_int32_t)
void putUChar(unsigned char *, u_int32_t)
void repudiate_zone(struct dns_zone **)
#define DDNS_GUARD_ID_MUST_MATCH
#define DDNS_INCLUDE_RRSET
#define DNS_ZONE_INACTIVE
isc_result_t find_cached_zone(dhcp_ddns_cb_t *, int)
struct dhcp_ddns_cb dhcp_ddns_cb_t
void dhcid_tolease(struct data_string *, struct data_string *)
void ddns_cancel(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
#define DDNS_STATE_REM_FW_NXRR
#define DDNS_STATE_ADD_FW_YXDHCID
isc_result_t ddns_modify_fwd(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
#define DDNS_STATE_REM_PTR
#define DDNS_STATE_ADD_FW_NXDOMAIN
#define DDNS_STATE_ADD_PTR
isc_result_t dhcid_fromlease(struct data_string *, struct data_string *)
char * ddns_state_name(int state)
void ddns_cb_forget_zone(dhcp_ddns_cb_t *ddns_cb)
#define DDNS_STATE_DSMM_FW_ADD3
void trace_ddns_init(void)
#define DDNS_STATE_REM_FW_YXDHCID
void forget_zone(struct dns_zone **)
#define DDNS_PRINT_OUTBOUND
isc_result_t ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
#define DDNS_STATE_CLEANUP
dhcp_ddns_cb_t * ddns_cb_alloc(const char *file, int line)
void print_dns_status(int, struct dhcp_ddns_cb *, isc_result_t)
#define DDNS_PRINT_INBOUND
#define DDNS_OTHER_GUARD_IS_DYNAMIC
int get_dhcid(dhcp_ddns_cb_t *, int, const u_int8_t *, unsigned)
#define DDNS_CONFLICT_DETECTION
#define DDNS_STATE_REM_FW_DSMM_OTHER
void ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
#define DDNS_DUAL_STACK_MIXED_MODE
struct server_list * servers
struct dhcp_ddns_rdata dhcp_ddns_data_t
isc_result_t(* builder_func_t)(dhcp_ddns_cb_t *ddns_cb, dhcp_ddns_data_t *dataspace, dns_name_t *pname, dns_name_t *uname)
isc_result_t dns_zone_lookup(struct dns_zone **zone, const char *name)
isc_result_t remove_dns_zone(struct dns_zone *zone)
isc_result_t enter_dns_zone(struct dns_zone *zone)
int dns_zone_dereference(struct dns_zone **ptr, const char *file, int line)
dns_zone_hash_t * dns_zone_hash
unsigned do_case_hash(const void *, unsigned, unsigned)
#define HASH_FUNCTIONS(name, bufarg, type, hashtype, ref, deref, hasher)
const char * piaddr(const struct iaddr addr)
isc_result_t dhcp_isc_name(unsigned char *namestr, dns_fixedname_t *namefix, dns_name_t **name)
dhcp_context_t dhcp_gbl_ctx
int MRns_name_pton(const char *src, u_char *dst, size_t dstsiz)
void * dmalloc(size_t, const char *, int)
void dfree(void *, const char *, int)
int log_error(const char *,...) __attribute__((__format__(__printf__
int int log_info(const char *,...) __attribute__((__format__(__printf__
#define DHCP_R_INVALIDARG
const unsigned char * data
dns_rdataclass_t other_dhcid_class
isc_sockaddr_t zone_addrs[DHCP_MAXNS]
struct data_string fwd_name
dns_rdataclass_t dhcid_class
struct data_string rev_name
unsigned char zone_name[DHCP_MAXDNS_WIRE]
struct dhcp_ddns_cb * next_op
isc_sockaddrlist_t zone_server_list
dns_rdatalist_t rdatalist
struct option_cache * secondary6
struct option_cache * secondary
struct option_cache * primary
struct option_cache * primary6
trace_type_t * trace_type_register(const char *, void *, void(*)(trace_type_t *, unsigned, char *), void(*)(trace_type_t *), const char *, int)
isc_result_t trace_get_packet(trace_type_t **, unsigned *, char **)
isc_result_t trace_write_packet_iov(trace_type_t *, int, trace_iov_t *, const char *, int)
int evaluate_option_cache(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
struct binding_scope * global_scope