44dhcp_dns_client_setservers(
void)
47 irs_resconf_t *resconf = NULL;
48 isc_sockaddrlist_t *nameservers;
53 if (result !=
ISC_R_SUCCESS && result != ISC_R_FILENOTFOUND) {
54 log_error(
"irs_resconf_load failed: %d.", result);
58 nameservers = irs_resconf_getnameservers(resconf);
61 for (sa = ISC_LIST_HEAD(*nameservers);
63 sa = ISC_LIST_NEXT(sa, link)) {
64 switch (sa->type.sa.sa_family) {
80 log_error(
"dns_client_setservers failed: %d.",
92 dns_client_destroy((dns_client_t **)&
dhcp_gbl_ctx.dnsclient);
125handle_signal(
int sig,
void (*handler)(
int)) {
128 memset(&sa, 0,
sizeof(sa));
129 sa.sa_handler = handler;
130 sigfillset(&sa.sa_mask);
131 if (sigaction(sig, &sa, NULL) != 0) {
132 log_debug(
"handle_signal() failed for signal %d error: %s",
133 sig, strerror(errno));
153set_ctx_running(isc_task_t *task, isc_event_t *event) {
163 isc_event_free(&event);
168 struct in_addr *local4,
169 struct in6_addr *local6) {
182 log_fatal(
"register_table() %s: %u",
"failed", result);
190 gettimeofday(&
cur_tv, (
struct timezone *)0);
191 isc_random_seed(
cur_tv.tv_sec);
202#if defined (NSUPDATE)
203 result = dns_lib_init();
260 handle_signal(SIGPIPE, SIG_IGN);
264 handle_signal(SIGINT, SIG_DFL);
265 handle_signal(SIGTERM, SIG_DFL);
268#if defined (NSUPDATE)
274 if (local4 != NULL) {
280 if (local6 != NULL) {
287 result = dns_client_init();
314 dns_fixedname_t *namefix,
321 namelen = strlen((
char *)namestr);
322 isc_buffer_init(&b, namestr, namelen);
323 isc_buffer_add(&b, namelen);
324 dns_fixedname_init(namefix);
325 *name = dns_fixedname_name(namefix);
326 result = dns_name_fromtext(*name, &b, dns_rootname, 0, NULL);
327 isc_buffer_invalidate(&b);
334 unsigned char *secret,
340 dns_fixedname_t name0;
342 unsigned int algorithm_code;
344 isc_buffer_init(&b, secret, length);
345 isc_buffer_add(&b, length);
348 algorithm_code = DST_ALG_HMACMD5;
350 algorithm_code = DST_ALG_HMACSHA1;
352 algorithm_code = DST_ALG_HMACSHA224;
354 algorithm_code = DST_ALG_HMACSHA256;
356 algorithm_code = DST_ALG_HMACSHA384;
358 algorithm_code = DST_ALG_HMACSHA512;
363 result =
dhcp_isc_name((
unsigned char *)inname, &name0, &name);
368 return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY,
369 DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
393#if defined (NSUPDATE)
394isc_result_t dns_client_init() {
412 log_error(
"Unable to create DNS client context:"
413 " result: %d", result);
420 result = dhcp_dns_client_setservers();
422 log_error(
"Unable to set resolver from resolv.conf; "
423 "startup continuing but DDNS support "
424 "may be affected: result %d", result);
#define _PATH_RESOLV_CONF
isc_result_t dhcp_context_create(int flags, struct in_addr *local4, struct in6_addr *local6)
isc_result_t dhcp_isc_name(unsigned char *namestr, dns_fixedname_t *namefix, dns_name_t **name)
void dhcp_signal_handler(int signal)
void isclib_cleanup(void)
isc_result_t isclib_make_dst_key(char *inname, char *algorithm, unsigned char *secret, int length, dst_key_t **dstkey)
#define DHCP_HMAC_SHA1_NAME
#define DHCP_HMAC_SHA384_NAME
struct dhcp_context dhcp_context_t
#define DHCP_HMAC_SHA256_NAME
#define DHCP_HMAC_SHA224_NAME
#define DHCP_HMAC_SHA512_NAME
#define DHCP_DNS_CLIENT_LAZY_INIT
dhcp_context_t dhcp_gbl_ctx
#define DHCP_CONTEXT_PRE_DB
#define DHCP_HMAC_MD5_NAME
#define DHCP_CONTEXT_POST_DB
int log_error(const char *,...) __attribute__((__format__(__printf__
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
void log_fatal(const char *,...) __attribute__((__format__(__printf__
#define DHCP_R_INVALIDARG
isc_result_t dhcp_result_register(void)