36 #if defined (NSUPDATE) 44 dhcp_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) {
79 if (result != ISC_R_SUCCESS) {
80 log_error(
"dns_client_setservers failed: %d.",
90 #if defined (NSUPDATE) 92 dns_client_destroy((dns_client_t **)&
dhcp_gbl_ctx.dnsclient);
125 handle_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));
139 struct in_addr *local4,
140 struct in6_addr *local6) {
149 if (result != ISC_R_SUCCESS) {
150 log_fatal(
"register_table() %s: %u",
"failed", result);
158 gettimeofday(&
cur_tv, (
struct timezone *)0);
159 isc_random_seed(
cur_tv.tv_sec);
166 if (result != ISC_R_SUCCESS)
170 #if defined (NSUPDATE) 171 result = dns_lib_init();
172 if (result != ISC_R_SUCCESS)
178 if (result != ISC_R_SUCCESS)
185 if (result != ISC_R_SUCCESS)
192 if (result != ISC_R_SUCCESS)
198 if (result != ISC_R_SUCCESS)
204 if (result != ISC_R_SUCCESS)
208 if (result != ISC_R_SUCCESS)
212 if (result != ISC_R_SUCCESS)
219 handle_signal(SIGPIPE, SIG_IGN);
223 handle_signal(SIGINT, SIG_DFL);
224 handle_signal(SIGTERM, SIG_DFL);
227 #if defined (NSUPDATE) 233 if (local4 != NULL) {
239 if (local6 != NULL) {
251 return(ISC_R_SUCCESS);
273 dns_fixedname_t *namefix,
280 namelen = strlen((
char *)namestr);
281 isc_buffer_init(&b, namestr, namelen);
282 isc_buffer_add(&b, namelen);
283 dns_fixedname_init(namefix);
284 *name = dns_fixedname_name(namefix);
285 result = dns_name_fromtext(*name, &b, dns_rootname, 0, NULL);
286 isc_buffer_invalidate(&b);
293 unsigned char *secret,
299 dns_fixedname_t name0;
301 unsigned int algorithm_code;
303 isc_buffer_init(&b, secret, length);
304 isc_buffer_add(&b, length);
307 algorithm_code = DST_ALG_HMACMD5;
309 algorithm_code = DST_ALG_HMACSHA1;
311 algorithm_code = DST_ALG_HMACSHA224;
313 algorithm_code = DST_ALG_HMACSHA256;
315 algorithm_code = DST_ALG_HMACSHA384;
317 algorithm_code = DST_ALG_HMACSHA512;
322 result =
dhcp_isc_name((
unsigned char *)inname, &name0, &name);
323 if (result != ISC_R_SUCCESS) {
327 return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY,
328 DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
349 if (ctx && ctx->methods && ctx->methods->ctxsuspend) {
350 (void) isc_app_ctxsuspend(ctx);
371 if (result != ISC_R_SUCCESS) {
372 log_error(
"Unable to create DNS client context:" 373 " result: %d", result);
380 result = dhcp_dns_client_setservers();
381 if (result != ISC_R_SUCCESS) {
382 log_error(
"Unable to set resolver from resolv.conf; " 383 "startup continuing but DDNS support " 384 "may be affected: result %d", result);
388 return ISC_R_SUCCESS;
#define DHCP_HMAC_SHA512_NAME
isc_result_t dhcp_isc_name(unsigned char *namestr, dns_fixedname_t *namefix, dns_name_t **name)
isc_result_t dhcp_context_create(int flags, struct in_addr *local4, struct in6_addr *local6)
isc_result_t dhcp_result_register(void)
#define DHCP_R_INVALIDARG
isc_result_t isclib_make_dst_key(char *inname, char *algorithm, unsigned char *secret, int length, dst_key_t **dstkey)
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
#define DHCP_CONTEXT_PRE_DB
isc_timermgr_t * timermgr
int log_error(const char *,...) __attribute__((__format__(__printf__
void dhcp_signal_handler(int signal)
isc_socketmgr_t * socketmgr
void log_fatal(const char *,...) __attribute__((__format__(__printf__
#define DHCP_CONTEXT_POST_DB
#define DHCP_HMAC_SHA1_NAME
isc_result_t dns_client_init()
#define DHCP_DNS_CLIENT_LAZY_INIT
#define DHCP_HMAC_SHA256_NAME
void isclib_cleanup(void)
dhcp_context_t dhcp_gbl_ctx
#define DHCP_HMAC_MD5_NAME
#define DHCP_HMAC_SHA384_NAME
#define DHCP_HMAC_SHA224_NAME
#define _PATH_RESOLV_CONF