36#include <dns/result.h>
43#if defined (DEBUG_DNS_UPDATES)
151 if (ddns_cb ==
NULL) {
176 if (
lease6->static_lease) {
205 options, scope,
oc,
MDL))
216 options, scope,
oc,
MDL))
230 options, scope,
oc,
MDL)) {
243 options, scope,
oc,
MDL))
254 options, scope,
oc,
MDL);
266 options, scope,
oc,
MDL)) {
278 options, scope,
oc,
MDL);
284 log_error (
"ddns_update: host.domain name too long");
317#if defined (DDNS_UPDATE_SLOW_TRANSITION)
341 options, scope,
oc,
MDL)) {
350 "ddns-client-fqdn")) {
360 options, scope,
oc,
MDL))) {
371 log_error (
"client provided fqdn: too long");
405#ifndef USE_OLD_DDNS_TTL
455 log_error(
"ddns_update: Calculated rev domain "
511 char *
p = (
char *)&
rname->buffer->data;
513 for (
i=0;
i<16;
i++) {
515 (*a & 0xF), ((*a >> 4) & 0xF));
523 rname->terminated = 1;
736 bp, &
bp->data [0], 1,
741 bp, &
bp->data [1], 1,
748 options, scope,
oc,
MDL))
753 bp, &
bp->data [2], 1,
758 bp, &
bp->data [3], 1,
763 bp, &
bp->data [4], 1,
782 if (ddns_cb !=
NULL) {
883 switch(ddns_cb->
state) {
885 unset(*scope,
"ddns-rev-name");
887 unset(*scope,
"ddns-client-fqdn");
920 unset(*scope,
"ddns-fwd-name");
972 if (ddns_cb !=
NULL) {
980 "or overlapping pools");
991 log_error(
"Failed to properly update internal lease structure with "
993 log_error(
"control block structures. Tried to update lease for"
997 log_error(
"This condition can occur, if DHCP server configuration is "
999 log_error(
"In particular, please do check that your configuration:");
1000 log_error(
"a) does not have overlapping pools (especially containing");
1002 log_error(
"b) there are no duplicate fixed-address or fixed-address6");
1007 log_fatal(
"%s(%d): Failed to update lease database with DDNS info for "
1008 "address %s. Lease database inconsistent. Unable to recover."
1027 log_fatal(
"Impossible condition at %s:%d (called from %s:%d).",
1043 log_error(
"%s(%d): Invalid lease update. Tried to "
1044 "clear already NULL DDNS control block "
1045 "pointer for lease %s.",
1048#if defined (DNS_UPDATES_MEMORY_CHECKS)
1064 log_error(
"%s(%d): Failed to update internal lease "
1065 "structure with DDNS control block. Existing"
1066 " ddns_cb structure does not match "
1067 "expectations.IPv4=%s, old ddns_cb=%p, tried"
1068 "to update to new ddns_cb=%p",
file,
line,
1071#if defined (DNS_UPDATES_MEMORY_CHECKS)
1097 log_fatal(
"Impossible condition at %s:%d (called from %s:%d).",
1108 log_error(
"%s(%d): Failed to update internal lease "
1109 "structure. Tried to clear already NULL "
1110 "DDNS control block pointer for lease %s.",
1113#if defined (DNS_UPDATES_MEMORY_CHECKS)
1133 log_error(
"%s(%d): Failed to update internal lease "
1134 "structure with DDNS control block. Existing"
1135 " ddns_cb structure does not match "
1136 "expectations.IPv6=%s, old ddns_cb=%p, tried"
1137 "to update to new ddns_cb=%p",
file,
line,
1140#if defined (DNS_UPDATES_MEMORY_CHECKS)
1179 if (ddns_cb ==
NULL) {
1180 log_info(
"%s(%d): No control block for lease update",
1187#if defined (DEBUG_DNS_UPDATES)
1188 log_info(
"%s(%d): Updating lease_ptr for ddns_cp=%p (addr=%s)",
1197#if defined (DEBUG_DNS_UPDATES)
1198 log_info(
"lease is static, returning");
1222#if defined (DEBUG_DNS_UPDATES)
1223 log_info(
"%s(%d): find_lease_by_ip_addr(%s) successful:"
1233 log_error(
"%s(%d): ddns_update_lease_ptr failed. "
1234 "Lease for %s not found.",
1237#if defined (DNS_UPDATES_MEMORY_CHECKS)
1261 log_error(
"%s(%d): Pool for lease %s not found.",
1263#if defined (DNS_UPDATES_MEMORY_CHECKS)
1281 log_error(
"%s(%d): Lease %s not found within pool.",
1283#if defined (DNS_UPDATES_MEMORY_CHECKS)
1297 log_fatal(
"Impossible condition at %s:%d, called from %s:%d.",
1309 log_info(
"Added reverse map from %.*s to %.*s",
1317 log_error(
"Unable to add reverse map from %.*s to %.*s: %s",
1356 log_info(
"Removed reverse map on %.*s",
1369#if defined (DEBUG_DNS_UPDATES)
1370 log_info(
"DDNS: removed map or no reverse map to remove %.*s",
1377 log_error(
"Can't remove reverse map on %.*s: %s",
1437#if defined (DEBUG_DNS_UPDATES)
1438 log_info (
"DDNS:ddns_fwd_srv_add2: %s eresult: %d",
1447 log_info(
"Added new forward map from %.*s to %s",
1472 logstr =
"DHCID mismatch, belongs to another client.";
1490 logstr =
"Has an address record but no DHCID, not mine.";
1499 log_error(
"Forward map from %.*s to %s FAILED: %s",
1528#if defined (DEBUG_DNS_UPDATES)
1529 log_info (
"DDNS: ddns_fwd_srv_add1: %s eresult: %d",
1538 log_info (
"Added new forward map from %.*s to %s",
1572 log_error (
"Unable to add forward map from %.*s to %s: %s",
1609#if defined (DEBUG_DNS_UPDATES)
1610 log_info (
"DDNS: ddns_fwd_srv_add3: %s eresult: %d",
1621 log_info(
"Added new forward map from %.*s to %s",
1645 logstr =
"an entry that is either static or "
1646 "owned by another client exists.";
1650 logstr =
"static entry of the other protocol type exists.";
1659 log_error(
"Forward map from %.*s to %s FAILED: %s",
1690#if defined (DEBUG_DNS_UPDATES)
1691 log_info (
"DDNS: ddns_fwd_srv_connector: %s eresult: %d",
1695 if (ddns_cb ==
NULL) {
1747#if defined (DEBUG_DNS_UPDATES)
1748 log_info (
"DDNS: ddns_fwd_srv_rem2: %s eresult: %d",
1811#if defined (DEBUG_DNS_UPDATES)
1812 log_info (
"DDNS: ddns_fwd_srv_rem1: %s eresult: %d",
1820 log_info(
"Removed forward map from %.*s to %s",
1844 #define DSMM_OGD (DDNS_DUAL_STACK_MIXED_MODE | \
1845 DDNS_OTHER_GUARD_IS_DYNAMIC)
1858#if defined (DEBUG_DNS_UPDATES)
1859 log_info(
"DDNS: no forward map to remove. %p", ddns_cb);
1935#if defined (DEBUG_DNS_UPDATES)
1936 log_info (
"DDNS: ddns_removals: %s",
1985#if defined (DEBUG_DNS_UPDATES)
1986 log_info(
"DDNS %s(%d): removal already in "
1987 "progress new ddns_cb=%p",
1993 ddns_cb =
lease6->ddns_cb;
2013#if defined (DEBUG_DNS_UPDATES)
2014 log_info(
"DDNS %s(%d): removal already in "
2015 "progress new ddns_cb=%p",
2026 if (ddns_cb ==
NULL) {
2044 scope = &(
lease6->scope);
2092 "ddns-client-fqdn")) {
2174 unset(*scope,
"ddns-fwd-name");
2220 if (ddns_cb !=
NULL)
2279#if defined (DEBUG_DNS_UPDATES)
2280 log_info (
"DDNS conflict detection: off");
2324#if defined (DEBUG_DNS_UPDATES)
2325 log_info (
"DDNS conflict behavior:\n"
2326 "\tddns-update-style: %s\n"
2327 "\tupdate-conflict-detection: %d\n"
2328 "\tddns-dual-stack-mixed-mode: %d\n"
2329 "\tddns-guard-id-must-match %d\n"
2330 "\tddns-other-guard-is-dynamic: %d\n",
2340#if defined (DEBUG_DNS_UPDATES)
2366 while ((
lp->ptr) && (
lp->ptr != func)) {
2378 return (
"<ddns_cb is null>");
2382 ddns_cb, ddns_cb->
flags,
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 data_string_new(struct data_string *new_string, const char *src, unsigned int len, const char *file, int line)
Constructs a null-terminated data_string from a char* and length.
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
int buffer_dereference(struct buffer **ptr, const char *file, int line)
int save_option_buffer(struct universe *universe, struct option_state *options, struct buffer *bp, unsigned char *buffer, unsigned length, unsigned code, int terminatep)
struct option_cache * lookup_option(struct universe *universe, struct option_state *options, unsigned code)
u_int32_t getULong(const unsigned char *)
int write_lease(struct lease *lease)
#define FQDN_SERVER_UPDATE
#define DHO_DHCP_CLIENT_IDENTIFIER
#define FQDN_NO_CLIENT_UPDATE
#define SV_DDNS_DOMAIN_NAME
#define SV_UPDATE_STATIC_LEASES
#define DDNS_STATIC_LEASE
#define SV_DO_FORWARD_UPDATES
#define SV_DDNS_CONFLICT_DETECT
#define SV_DDNS_REV_DOMAIN_NAME
#define DDNS_EXECUTE_NEXT
#define DDNS_GUARD_ID_MUST_MATCH
#define SV_CLIENT_UPDATES
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 MAX_DEFAULT_DDNS_TTL
u_int16_t get_conflict_mask(struct option_state *input_options)
#define DDNS_STATE_ADD_FW_NXDOMAIN
#define DDNS_STATE_ADD_PTR
int ddns_updates(struct packet *, struct lease *, struct lease *, struct iasubopt *, struct iasubopt *, struct option_state *)
isc_result_t dhcid_fromlease(struct data_string *, struct data_string *)
#define SV_DDNS_HOST_NAME
#define SV_DDNS_GUARD_ID_MUST_MATCH
#define MAX_ADDRESS_STRING_LEN
char * ddns_state_name(int state)
void ddns_cb_forget_zone(dhcp_ddns_cb_t *ddns_cb)
struct universe server_universe
isc_result_t ia_dereference(struct ia_xx **ia, const char *file, int line)
#define DDNS_STATE_DSMM_FW_ADD3
#define DDNS_ACTIVE_LEASE
#define DDNS_UPDATE_STYLE_INTERIM
#define SV_USE_HOST_DECL_NAMES
#define DDNS_STATE_REM_FW_YXDHCID
#define DDNS_UPDATE_STYLE_STANDARD
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *addr)
int find_lease_by_ip_addr(struct lease **, struct iaddr, const char *, int)
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool, const char *file, int line)
de-reference an IPv6 pool structure.
isc_result_t ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
int write_ia(const struct ia_xx *)
#define SV_DDNS_OTHER_GUARD_IS_DYNAMIC
#define DDNS_STATE_CLEANUP
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line)
dhcp_ddns_cb_t * ddns_cb_alloc(const char *file, int line)
isc_result_t ddns_removals(struct lease *, struct iasubopt *, struct dhcp_ddns_cb *, isc_boolean_t)
#define SV_DDNS_DUAL_STACK_MIXED_MODE
#define DDNS_OTHER_GUARD_IS_DYNAMIC
int get_dhcid(dhcp_ddns_cb_t *, int, const u_int8_t *, unsigned)
#define SV_UPDATE_OPTIMIZATION
#define DDNS_CLIENT_DID_UPDATE
#define DDNS_CONFLICT_DETECTION
#define DDNS_STATE_REM_FW_DSMM_OTHER
int find_lease(struct lease **, struct packet *, struct shared_network *, int *, int *, struct lease *, const char *, int)
void ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
#define DDNS_DUAL_STACK_MIXED_MODE
u_int16_t ddns_conflict_mask
#define SV_DO_REVERSE_UPDATES
const char * piaddr(const struct iaddr addr)
int log_error(const char *,...) __attribute__((__format__(__printf__
void log_fatal(const char *,...) __attribute__((__format__(__printf__
int int log_info(const char *,...) __attribute__((__format__(__printf__
struct enumeration_value ddns_styles_values[]
const unsigned char * data
dns_rdataclass_t other_dhcid_class
struct data_string fwd_name
dns_rdataclass_t dhcid_class
struct data_string rev_name
struct dhcp_ddns_cb * next_op
u_int8_t hbuf[HARDWARE_ADDR_LEN+1]
struct dhcp_ddns_cb * ddns_cb
struct binding_scope * scope
struct hardware hardware_addr
struct option_state * options
struct universe fqdn_universe
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)
int evaluate_boolean_option_cache(int *ignorep, 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)
int bind_ds_value(struct binding_scope **scope, const char *name, struct data_string *value)
int unset(struct binding_scope *scope, const char *name)
struct binding_scope * global_scope
int find_bound_string(struct data_string *value, struct binding_scope *scope, const char *name)