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)
189 if (result != ISC_R_SUCCESS)
196 handle_signal(SIGPIPE, SIG_IGN);
202 if (result != ISC_R_SUCCESS)
208 if (result != ISC_R_SUCCESS)
214 if (result != ISC_R_SUCCESS)
218 if (result != ISC_R_SUCCESS)
222 #if defined (NSUPDATE)
230 isc_sockaddr_t localaddr4;
231 isc_sockaddr_t localaddr6;
232 if (local4 != NULL) {
233 isc_sockaddr_fromin(&localaddr4, local4, 0);
236 if (local6 != NULL) {
237 isc_sockaddr_fromin6(&localaddr6, local6, 0);
243 return(ISC_R_SUCCESS);
265 dns_fixedname_t *namefix,
272 namelen = strlen((
char *)namestr);
273 isc_buffer_init(&b, namestr, namelen);
274 isc_buffer_add(&b, namelen);
275 dns_fixedname_init(namefix);
276 *name = dns_fixedname_name(namefix);
277 result = dns_name_fromtext(*name, &b, dns_rootname, 0, NULL);
278 isc_buffer_invalidate(&b);
285 unsigned char *secret,
291 dns_fixedname_t name0;
293 unsigned int algorithm_code;
295 isc_buffer_init(&b, secret, length);
296 isc_buffer_add(&b, length);
299 algorithm_code = DST_ALG_HMACMD5;
301 algorithm_code = DST_ALG_HMACSHA1;
303 algorithm_code = DST_ALG_HMACSHA224;
305 algorithm_code = DST_ALG_HMACSHA256;
307 algorithm_code = DST_ALG_HMACSHA384;
309 algorithm_code = DST_ALG_HMACSHA512;
314 result =
dhcp_isc_name((
unsigned char *)inname, &name0, &name);
315 if (result != ISC_R_SUCCESS) {
319 return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY,
320 DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
341 if (ctx && ctx->methods && ctx->methods->ctxsuspend) {
342 (void) isc_app_ctxsuspend(ctx);