xref: /netbsd-src/external/bsd/unbound/include/config.h (revision d909946ca08dceb44d7d0f22ec9488679695d976)
1 /* config.h.  Generated from config.h.in by configure.  */
2 /* config.h.in.  Generated from configure.ac by autoheader.  */
3 
4 /* Directory to chroot to */
5 #define CHROOT_DIR "/var/chroot/unbound"
6 
7 /* Do sha512 definitions in config.h */
8 /* #undef COMPAT_SHA512 */
9 
10 /* Pathname to the Unbound configuration file */
11 #define CONFIGFILE "/etc/unbound/unbound.conf"
12 
13 /* Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work
14    */
15 /* #undef DARWIN_BROKEN_SETREUID */
16 
17 /* Whether daemon is deprecated */
18 /* #undef DEPRECATED_DAEMON */
19 
20 /* default dnstap socket path */
21 /* #undef DNSTAP_SOCKET_PATH */
22 
23 /* Define if you want to use debug lock checking (slow). */
24 /* #undef ENABLE_LOCK_CHECKS */
25 
26 /* Define this if you enabled-allsymbols from libunbound to link binaries to
27    it for smaller install size, but the libunbound export table is polluted by
28    internal symbols */
29 /* #undef EXPORT_ALL_SYMBOLS */
30 
31 /* Define to 1 if you have the `arc4random' function. */
32 #define HAVE_ARC4RANDOM 1
33 
34 /* Define to 1 if you have the `arc4random_uniform' function. */
35 #define HAVE_ARC4RANDOM_UNIFORM 1
36 
37 /* Define to 1 if you have the <arpa/inet.h> header file. */
38 #define HAVE_ARPA_INET_H 1
39 
40 /* Whether the C compiler accepts the "format" attribute */
41 #define HAVE_ATTR_FORMAT 1
42 
43 /* Whether the C compiler accepts the "unused" attribute */
44 #define HAVE_ATTR_UNUSED 1
45 
46 /* Whether the C compiler accepts the "weak" attribute */
47 #define HAVE_ATTR_WEAK 1
48 
49 /* Define to 1 if you have the `chown' function. */
50 #define HAVE_CHOWN 1
51 
52 /* Define to 1 if you have the `chroot' function. */
53 #define HAVE_CHROOT 1
54 
55 /* Define to 1 if you have the `ctime_r' function. */
56 #define HAVE_CTIME_R 1
57 
58 /* Define to 1 if you have the `daemon' function. */
59 #define HAVE_DAEMON 1
60 
61 /* Define to 1 if you have the declaration of `arc4random', and to 0 if you
62    don't. */
63 /* #undef HAVE_DECL_ARC4RANDOM */
64 
65 /* Define to 1 if you have the declaration of `arc4random_uniform', and to 0
66    if you don't. */
67 /* #undef HAVE_DECL_ARC4RANDOM_UNIFORM */
68 
69 /* Define to 1 if you have the declaration of `NID_secp384r1', and to 0 if you
70    don't. */
71 #define HAVE_DECL_NID_SECP384R1 1
72 
73 /* Define to 1 if you have the declaration of `NID_X9_62_prime256v1', and to 0
74    if you don't. */
75 #define HAVE_DECL_NID_X9_62_PRIME256V1 1
76 
77 /* Define to 1 if you have the declaration of `reallocarray', and to 0 if you
78    don't. */
79 /* #undef HAVE_DECL_REALLOCARRAY */
80 
81 /* Define to 1 if you have the declaration of `sk_SSL_COMP_pop_free', and to 0
82    if you don't. */
83 #define HAVE_DECL_SK_SSL_COMP_POP_FREE 1
84 
85 /* Define to 1 if you have the declaration of
86    `SSL_COMP_get_compression_methods', and to 0 if you don't. */
87 #define HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS 1
88 
89 /* Define to 1 if you have the declaration of `SSL_CTX_set_ecdh_auto', and to
90    0 if you don't. */
91 #define HAVE_DECL_SSL_CTX_SET_ECDH_AUTO 0
92 
93 /* Define to 1 if you have the declaration of `strlcat', and to 0 if you
94    don't. */
95 #define HAVE_DECL_STRLCAT 1
96 
97 /* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
98    don't. */
99 #define HAVE_DECL_STRLCPY 1
100 
101 /* Define to 1 if you have the declaration of `XML_StopParser', and to 0 if
102    you don't. */
103 #define HAVE_DECL_XML_STOPPARSER 1
104 
105 /* Define to 1 if you have the <dlfcn.h> header file. */
106 #define HAVE_DLFCN_H 1
107 
108 /* Define to 1 if you have the <endian.h> header file. */
109 /* #undef HAVE_ENDIAN_H */
110 
111 /* Define to 1 if you have the `endprotoent' function. */
112 #define HAVE_ENDPROTOENT 1
113 
114 /* Define to 1 if you have the `endservent' function. */
115 #define HAVE_ENDSERVENT 1
116 
117 /* Define to 1 if you have the `event_base_free' function. */
118 /* #undef HAVE_EVENT_BASE_FREE */
119 
120 /* Define to 1 if you have the `event_base_get_method' function. */
121 /* #undef HAVE_EVENT_BASE_GET_METHOD */
122 
123 /* Define to 1 if you have the `event_base_new' function. */
124 /* #undef HAVE_EVENT_BASE_NEW */
125 
126 /* Define to 1 if you have the `event_base_once' function. */
127 /* #undef HAVE_EVENT_BASE_ONCE */
128 
129 /* Define to 1 if you have the <event.h> header file. */
130 /* #undef HAVE_EVENT_H */
131 
132 /* Define to 1 if you have the `EVP_MD_CTX_new' function. */
133 /* #undef HAVE_EVP_MD_CTX_NEW */
134 
135 /* Define to 1 if you have the `EVP_sha1' function. */
136 #define HAVE_EVP_SHA1 1
137 
138 /* Define to 1 if you have the `EVP_sha256' function. */
139 #define HAVE_EVP_SHA256 1
140 
141 /* Define to 1 if you have the `EVP_sha512' function. */
142 #define HAVE_EVP_SHA512 1
143 
144 /* Define to 1 if you have the `ev_default_loop' function. */
145 /* #undef HAVE_EV_DEFAULT_LOOP */
146 
147 /* Define to 1 if you have the `ev_loop' function. */
148 /* #undef HAVE_EV_LOOP */
149 
150 /* Define to 1 if you have the <expat.h> header file. */
151 #define HAVE_EXPAT_H 1
152 
153 /* Define to 1 if you have the `fcntl' function. */
154 #define HAVE_FCNTL 1
155 
156 /* Define to 1 if you have the `FIPS_mode' function. */
157 #define HAVE_FIPS_MODE 1
158 
159 /* Define to 1 if you have the `fork' function. */
160 #define HAVE_FORK 1
161 
162 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
163 #define HAVE_FSEEKO 1
164 
165 /* Define to 1 if you have the `fsync' function. */
166 #define HAVE_FSYNC 1
167 
168 /* Whether getaddrinfo is available */
169 #define HAVE_GETADDRINFO 1
170 
171 /* Define to 1 if you have the `getauxval' function. */
172 /* #undef HAVE_GETAUXVAL */
173 
174 /* Define to 1 if you have the `getentropy' function. */
175 /* #undef HAVE_GETENTROPY */
176 
177 /* Define to 1 if you have the <getopt.h> header file. */
178 #define HAVE_GETOPT_H 1
179 
180 /* Define to 1 if you have the `getpwnam' function. */
181 #define HAVE_GETPWNAM 1
182 
183 /* Define to 1 if you have the `getrlimit' function. */
184 #define HAVE_GETRLIMIT 1
185 
186 /* Define to 1 if you have the `glob' function. */
187 #define HAVE_GLOB 1
188 
189 /* Define to 1 if you have the <glob.h> header file. */
190 #define HAVE_GLOB_H 1
191 
192 /* Define to 1 if you have the `gmtime_r' function. */
193 #define HAVE_GMTIME_R 1
194 
195 /* Define to 1 if you have the <grp.h> header file. */
196 #define HAVE_GRP_H 1
197 
198 /* If you have HMAC_Update */
199 #define HAVE_HMAC_UPDATE 1
200 
201 /* Define to 1 if you have the `inet_aton' function. */
202 #define HAVE_INET_ATON 1
203 
204 /* Define to 1 if you have the `inet_ntop' function. */
205 #define HAVE_INET_NTOP 1
206 
207 /* Define to 1 if you have the `inet_pton' function. */
208 #define HAVE_INET_PTON 1
209 
210 /* Define to 1 if you have the `initgroups' function. */
211 #define HAVE_INITGROUPS 1
212 
213 /* Define to 1 if you have the <inttypes.h> header file. */
214 #define HAVE_INTTYPES_H 1
215 
216 /* if the function 'ioctlsocket' is available */
217 /* #undef HAVE_IOCTLSOCKET */
218 
219 /* Define to 1 if you have the <iphlpapi.h> header file. */
220 /* #undef HAVE_IPHLPAPI_H */
221 
222 /* Define to 1 if you have the `isblank' function. */
223 #define HAVE_ISBLANK 1
224 
225 /* Define to 1 if you have the `kill' function. */
226 #define HAVE_KILL 1
227 
228 /* Define if we have LibreSSL */
229 /* #undef HAVE_LIBRESSL */
230 
231 /* Define to 1 if you have the `localtime_r' function. */
232 #define HAVE_LOCALTIME_R 1
233 
234 /* Define to 1 if you have the <login_cap.h> header file. */
235 #define HAVE_LOGIN_CAP_H 1
236 
237 /* If have GNU libc compatible malloc */
238 #define HAVE_MALLOC 1
239 
240 /* Define to 1 if you have the `memmove' function. */
241 #define HAVE_MEMMOVE 1
242 
243 /* Define to 1 if you have the <memory.h> header file. */
244 #define HAVE_MEMORY_H 1
245 
246 /* Define to 1 if you have the <netdb.h> header file. */
247 #define HAVE_NETDB_H 1
248 
249 /* Define to 1 if you have the <netinet/in.h> header file. */
250 #define HAVE_NETINET_IN_H 1
251 
252 /* Define to 1 if you have the <netinet/tcp.h> header file. */
253 #define HAVE_NETINET_TCP_H 1
254 
255 /* Use libnettle for crypto */
256 /* #undef HAVE_NETTLE */
257 
258 /* Use libnss for crypto */
259 /* #undef HAVE_NSS */
260 
261 /* Define to 1 if you have the `OPENSSL_config' function. */
262 #define HAVE_OPENSSL_CONFIG 1
263 
264 /* Define to 1 if you have the <openssl/conf.h> header file. */
265 #define HAVE_OPENSSL_CONF_H 1
266 
267 /* Define to 1 if you have the <openssl/engine.h> header file. */
268 #define HAVE_OPENSSL_ENGINE_H 1
269 
270 /* Define to 1 if you have the <openssl/err.h> header file. */
271 #define HAVE_OPENSSL_ERR_H 1
272 
273 /* Define to 1 if you have the <openssl/rand.h> header file. */
274 #define HAVE_OPENSSL_RAND_H 1
275 
276 /* Define to 1 if you have the <openssl/ssl.h> header file. */
277 #define HAVE_OPENSSL_SSL_H 1
278 
279 /* Define if you have POSIX threads libraries and header files. */
280 #define HAVE_PTHREAD 1
281 
282 /* Have PTHREAD_PRIO_INHERIT. */
283 #define HAVE_PTHREAD_PRIO_INHERIT 1
284 
285 /* Define to 1 if the system has the type `pthread_rwlock_t'. */
286 #define HAVE_PTHREAD_RWLOCK_T 1
287 
288 /* Define to 1 if the system has the type `pthread_spinlock_t'. */
289 #define HAVE_PTHREAD_SPINLOCK_T 1
290 
291 /* Define to 1 if you have the <pwd.h> header file. */
292 #define HAVE_PWD_H 1
293 
294 /* Define if you have Python libraries and header files. */
295 /* #undef HAVE_PYTHON */
296 
297 /* Define to 1 if you have the `random' function. */
298 #define HAVE_RANDOM 1
299 
300 /* Define to 1 if you have the `reallocarray' function. */
301 #define HAVE_REALLOCARRAY 1
302 
303 /* Define to 1 if you have the `recvmsg' function. */
304 #define HAVE_RECVMSG 1
305 
306 /* define if you have the sbrk() call */
307 #define HAVE_SBRK 1
308 
309 /* Define to 1 if you have the `sendmsg' function. */
310 #define HAVE_SENDMSG 1
311 
312 /* Define to 1 if you have the `setregid' function. */
313 #define HAVE_SETREGID 1
314 
315 /* Define to 1 if you have the `setresgid' function. */
316 /* #undef HAVE_SETRESGID */
317 
318 /* Define to 1 if you have the `setresuid' function. */
319 /* #undef HAVE_SETRESUID */
320 
321 /* Define to 1 if you have the `setreuid' function. */
322 #define HAVE_SETREUID 1
323 
324 /* Define to 1 if you have the `setrlimit' function. */
325 #define HAVE_SETRLIMIT 1
326 
327 /* Define to 1 if you have the `setsid' function. */
328 #define HAVE_SETSID 1
329 
330 /* Define to 1 if you have the `setusercontext' function. */
331 #define HAVE_SETUSERCONTEXT 1
332 
333 /* Define to 1 if you have the `SHA512_Update' function. */
334 /* #undef HAVE_SHA512_UPDATE */
335 
336 /* Define to 1 if you have the `sigprocmask' function. */
337 #define HAVE_SIGPROCMASK 1
338 
339 /* Define to 1 if you have the `sleep' function. */
340 #define HAVE_SLEEP 1
341 
342 /* Define to 1 if you have the `snprintf' function. */
343 #define HAVE_SNPRINTF 1
344 
345 /* Define to 1 if you have the `socketpair' function. */
346 #define HAVE_SOCKETPAIR 1
347 
348 /* Using Solaris threads */
349 /* #undef HAVE_SOLARIS_THREADS */
350 
351 /* Define to 1 if you have the `srandom' function. */
352 #define HAVE_SRANDOM 1
353 
354 /* Define if you have the SSL libraries installed. */
355 #define HAVE_SSL /**/
356 
357 /* Define to 1 if you have the <stdarg.h> header file. */
358 #define HAVE_STDARG_H 1
359 
360 /* Define to 1 if you have the <stdbool.h> header file. */
361 #define HAVE_STDBOOL_H 1
362 
363 /* Define to 1 if you have the <stdint.h> header file. */
364 #define HAVE_STDINT_H 1
365 
366 /* Define to 1 if you have the <stdlib.h> header file. */
367 #define HAVE_STDLIB_H 1
368 
369 /* Define to 1 if you have the `strftime' function. */
370 #define HAVE_STRFTIME 1
371 
372 /* Define to 1 if you have the <strings.h> header file. */
373 #define HAVE_STRINGS_H 1
374 
375 /* Define to 1 if you have the <string.h> header file. */
376 #define HAVE_STRING_H 1
377 
378 /* Define to 1 if you have the `strlcat' function. */
379 #define HAVE_STRLCAT 1
380 
381 /* Define to 1 if you have the `strlcpy' function. */
382 #define HAVE_STRLCPY 1
383 
384 /* Define to 1 if you have the `strptime' function. */
385 #define HAVE_STRPTIME 1
386 
387 /* Define to 1 if you have the `strsep' function. */
388 #define HAVE_STRSEP 1
389 
390 /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */
391 /* #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST */
392 
393 /* Define to 1 if `sun_len' is a member of `struct sockaddr_un'. */
394 #define HAVE_STRUCT_SOCKADDR_UN_SUN_LEN 1
395 
396 /* Define if you have Swig libraries and header files. */
397 /* #undef HAVE_SWIG */
398 
399 /* Define to 1 if you have the <syslog.h> header file. */
400 #define HAVE_SYSLOG_H 1
401 
402 /* Define to 1 if you have the <sys/param.h> header file. */
403 #define HAVE_SYS_PARAM_H 1
404 
405 /* Define to 1 if you have the <sys/resource.h> header file. */
406 #define HAVE_SYS_RESOURCE_H 1
407 
408 /* Define to 1 if you have the <sys/sha2.h> header file. */
409 /* #undef HAVE_SYS_SHA2_H */
410 
411 /* Define to 1 if you have the <sys/socket.h> header file. */
412 #define HAVE_SYS_SOCKET_H 1
413 
414 /* Define to 1 if you have the <sys/stat.h> header file. */
415 #define HAVE_SYS_STAT_H 1
416 
417 /* Define to 1 if you have the <sys/sysctl.h> header file. */
418 /* #undef HAVE_SYS_SYSCTL_H */
419 
420 /* Define to 1 if you have the <sys/types.h> header file. */
421 #define HAVE_SYS_TYPES_H 1
422 
423 /* Define to 1 if you have the <sys/uio.h> header file. */
424 #define HAVE_SYS_UIO_H 1
425 
426 /* Define to 1 if you have the <sys/un.h> header file. */
427 #define HAVE_SYS_UN_H 1
428 
429 /* Define to 1 if you have the <sys/wait.h> header file. */
430 #define HAVE_SYS_WAIT_H 1
431 
432 /* Define to 1 if you have the <time.h> header file. */
433 #define HAVE_TIME_H 1
434 
435 /* Define to 1 if you have the `tzset' function. */
436 #define HAVE_TZSET 1
437 
438 /* Define to 1 if you have the <unistd.h> header file. */
439 #define HAVE_UNISTD_H 1
440 
441 /* Define to 1 if you have the `usleep' function. */
442 #define HAVE_USLEEP 1
443 
444 /* Define to 1 if you have the `vfork' function. */
445 #define HAVE_VFORK 1
446 
447 /* Define to 1 if you have the <vfork.h> header file. */
448 /* #undef HAVE_VFORK_H */
449 
450 /* Define to 1 if you have the <windows.h> header file. */
451 /* #undef HAVE_WINDOWS_H */
452 
453 /* Using Windows threads */
454 /* #undef HAVE_WINDOWS_THREADS */
455 
456 /* Define to 1 if you have the <winsock2.h> header file. */
457 /* #undef HAVE_WINSOCK2_H */
458 
459 /* Define to 1 if `fork' works. */
460 #define HAVE_WORKING_FORK 1
461 
462 /* Define to 1 if `vfork' works. */
463 #define HAVE_WORKING_VFORK 1
464 
465 /* Define to 1 if you have the `writev' function. */
466 #define HAVE_WRITEV 1
467 
468 /* Define to 1 if you have the <ws2tcpip.h> header file. */
469 /* #undef HAVE_WS2TCPIP_H */
470 
471 /* Define to 1 if you have the `_beginthreadex' function. */
472 /* #undef HAVE__BEGINTHREADEX */
473 
474 /* if lex has yylex_destroy */
475 #define LEX_HAS_YYLEX_DESTROY 1
476 
477 /* Define to the sub-directory where libtool stores uninstalled libraries. */
478 #define LT_OBJDIR ".libs/"
479 
480 /* Define to the maximum message length to pass to syslog. */
481 #define MAXSYSLOGMSGLEN 10240
482 
483 /* Define if memcmp() does not compare unsigned bytes */
484 /* #undef MEMCMP_IS_BROKEN */
485 
486 /* Define if mkdir has one argument. */
487 /* #undef MKDIR_HAS_ONE_ARG */
488 
489 /* Define if the network stack does not fully support nonblocking io (causes
490    lower performance). */
491 /* #undef NONBLOCKING_IS_BROKEN */
492 
493 /* Put -D_ALL_SOURCE define in config.h */
494 /* #undef OMITTED__D_ALL_SOURCE */
495 
496 /* Put -D_BSD_SOURCE define in config.h */
497 /* #undef OMITTED__D_BSD_SOURCE */
498 
499 /* Put -D_DEFAULT_SOURCE define in config.h */
500 /* #undef OMITTED__D_DEFAULT_SOURCE */
501 
502 /* Put -D_GNU_SOURCE define in config.h */
503 /* #undef OMITTED__D_GNU_SOURCE */
504 
505 /* Put -D_LARGEFILE_SOURCE=1 define in config.h */
506 /* #undef OMITTED__D_LARGEFILE_SOURCE_1 */
507 
508 /* Put -D_POSIX_C_SOURCE=200112 define in config.h */
509 /* #undef OMITTED__D_POSIX_C_SOURCE_200112 */
510 
511 /* Put -D_XOPEN_SOURCE=600 define in config.h */
512 /* #undef OMITTED__D_XOPEN_SOURCE_600 */
513 
514 /* Put -D_XOPEN_SOURCE_EXTENDED=1 define in config.h */
515 /* #undef OMITTED__D_XOPEN_SOURCE_EXTENDED_1 */
516 
517 /* Put -D__EXTENSIONS__ define in config.h */
518 /* #undef OMITTED__D__EXTENSIONS__ */
519 
520 /* Define to the address where bug reports for this package should be sent. */
521 #define PACKAGE_BUGREPORT "unbound-bugs@nlnetlabs.nl"
522 
523 /* Define to the full name of this package. */
524 #define PACKAGE_NAME "unbound"
525 
526 /* Define to the full name and version of this package. */
527 #define PACKAGE_STRING "unbound 1.5.9"
528 
529 /* Define to the one symbol short name of this package. */
530 #define PACKAGE_TARNAME "unbound"
531 
532 /* Define to the home page for this package. */
533 #define PACKAGE_URL ""
534 
535 /* Define to the version of this package. */
536 #define PACKAGE_VERSION "1.5.9"
537 
538 /* default pidfile location */
539 #define PIDFILE "/var/run/unbound.pid"
540 
541 /* Define to necessary symbol if this constant uses a non-standard name on
542    your system. */
543 /* #undef PTHREAD_CREATE_JOINABLE */
544 
545 /* Define as the return type of signal handlers (`int' or `void'). */
546 #define RETSIGTYPE void
547 
548 /* default rootkey location */
549 #define ROOT_ANCHOR_FILE "/etc/unbound/root.key"
550 
551 /* default rootcert location */
552 #define ROOT_CERT_FILE "/etc/unbound/icannbundle.pem"
553 
554 /* version number for resource files */
555 #define RSRC_PACKAGE_VERSION 1,5,9,0
556 
557 /* Directory to chdir to */
558 #define RUN_DIR "/var/chroot/unbound"
559 
560 /* Shared data */
561 #define SHARE_DIR "/etc/unbound"
562 
563 /* The size of `time_t', as computed by sizeof. */
564 #define SIZEOF_TIME_T 8
565 
566 /* define if (v)snprintf does not return length needed, (but length used) */
567 /* #undef SNPRINTF_RET_BROKEN */
568 
569 /* Define to 1 if you have the ANSI C header files. */
570 #define STDC_HEADERS 1
571 
572 /* use default strptime. */
573 #define STRPTIME_WORKS 1
574 
575 /* Use win32 resources and API */
576 /* #undef UB_ON_WINDOWS */
577 
578 /* default username */
579 #define UB_USERNAME "_unbound"
580 
581 /* use to enable lightweight alloc assertions, for debug use */
582 /* #undef UNBOUND_ALLOC_LITE */
583 
584 /* use malloc not regions, for debug use */
585 /* #undef UNBOUND_ALLOC_NONREGIONAL */
586 
587 /* use statistics for allocs and frees, for debug use */
588 /* #undef UNBOUND_ALLOC_STATS */
589 
590 /* define this to enable debug checks. */
591 /* #undef UNBOUND_DEBUG */
592 
593 /* Define to 1 to use cachedb support */
594 /* #undef USE_CACHEDB */
595 
596 /* Define to 1 to enable dnstap support */
597 /* #undef USE_DNSTAP */
598 
599 /* Define this to enable DSA support. */
600 #define USE_DSA 1
601 
602 /* Define this to enable ECDSA support. */
603 #define USE_ECDSA 1
604 
605 /* Define this to enable an EVP workaround for older openssl */
606 /* #undef USE_ECDSA_EVP_WORKAROUND */
607 
608 /* Define this to enable GOST support. */
609 #define USE_GOST 1
610 
611 /* Define if you want to use internal select based events */
612 #define USE_MINI_EVENT 1
613 
614 /* Define this to enable SHA256 and SHA512 support. */
615 #define USE_SHA2 1
616 
617 /* Enable extensions on AIX 3, Interix.  */
618 #ifndef _ALL_SOURCE
619 # define _ALL_SOURCE 1
620 #endif
621 /* Enable GNU extensions on systems that have them.  */
622 #ifndef _GNU_SOURCE
623 # define _GNU_SOURCE 1
624 #endif
625 /* Enable threading extensions on Solaris.  */
626 #ifndef _POSIX_PTHREAD_SEMANTICS
627 # define _POSIX_PTHREAD_SEMANTICS 1
628 #endif
629 /* Enable extensions on HP NonStop.  */
630 #ifndef _TANDEM_SOURCE
631 # define _TANDEM_SOURCE 1
632 #endif
633 /* Enable general extensions on Solaris.  */
634 #ifndef __EXTENSIONS__
635 # define __EXTENSIONS__ 1
636 #endif
637 
638 
639 /* Whether the windows socket API is used */
640 /* #undef USE_WINSOCK */
641 
642 /* the version of the windows API enabled */
643 #define WINVER 0x0502
644 
645 /* Define if you want Python module. */
646 /* #undef WITH_PYTHONMODULE */
647 
648 /* Define if you want PyUnbound. */
649 /* #undef WITH_PYUNBOUND */
650 
651 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
652    `char[]'. */
653 #define YYTEXT_POINTER 1
654 
655 /* Enable large inode numbers on Mac OS X 10.5.  */
656 #ifndef _DARWIN_USE_64_BIT_INODE
657 # define _DARWIN_USE_64_BIT_INODE 1
658 #endif
659 
660 /* Number of bits in a file offset, on hosts where this is settable. */
661 /* #undef _FILE_OFFSET_BITS */
662 
663 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
664 /* #undef _LARGEFILE_SOURCE */
665 
666 /* Define for large files, on AIX-style hosts. */
667 /* #undef _LARGE_FILES */
668 
669 /* Define to 1 if on MINIX. */
670 /* #undef _MINIX */
671 
672 /* Enable for compile on Minix */
673 /* #undef _NETBSD_SOURCE */
674 
675 /* Define to 2 if the system does not provide POSIX.1 features except with
676    this defined. */
677 /* #undef _POSIX_1_SOURCE */
678 
679 /* Define to 1 if you need to in order for `stat' and other things to work. */
680 /* #undef _POSIX_SOURCE */
681 
682 /* Define to empty if `const' does not conform to ANSI C. */
683 /* #undef const */
684 
685 /* Define to `int' if <sys/types.h> doesn't define. */
686 /* #undef gid_t */
687 
688 /* in_addr_t */
689 /* #undef in_addr_t */
690 
691 /* in_port_t */
692 /* #undef in_port_t */
693 
694 /* Define to `__inline__' or `__inline' if that's what the C compiler
695    calls it, or to nothing if 'inline' is not supported under any name.  */
696 #ifndef __cplusplus
697 /* #undef inline */
698 #endif
699 
700 /* Define to `short' if <sys/types.h> does not define. */
701 /* #undef int16_t */
702 
703 /* Define to `int' if <sys/types.h> does not define. */
704 /* #undef int32_t */
705 
706 /* Define to `long long' if <sys/types.h> does not define. */
707 /* #undef int64_t */
708 
709 /* Define to `signed char' if <sys/types.h> does not define. */
710 /* #undef int8_t */
711 
712 /* Define if replacement function should be used. */
713 /* #undef malloc */
714 
715 /* Define to `long int' if <sys/types.h> does not define. */
716 /* #undef off_t */
717 
718 /* Define to `int' if <sys/types.h> does not define. */
719 /* #undef pid_t */
720 
721 /* Define to 'int' if not defined */
722 /* #undef rlim_t */
723 
724 /* Define to `unsigned int' if <sys/types.h> does not define. */
725 /* #undef size_t */
726 
727 /* Define to 'int' if not defined */
728 /* #undef socklen_t */
729 
730 /* Define to `int' if <sys/types.h> does not define. */
731 /* #undef ssize_t */
732 
733 /* Define to 'unsigned char if not defined */
734 /* #undef u_char */
735 
736 /* Define to `int' if <sys/types.h> doesn't define. */
737 /* #undef uid_t */
738 
739 /* Define to `unsigned short' if <sys/types.h> does not define. */
740 /* #undef uint16_t */
741 
742 /* Define to `unsigned int' if <sys/types.h> does not define. */
743 /* #undef uint32_t */
744 
745 /* Define to `unsigned long long' if <sys/types.h> does not define. */
746 /* #undef uint64_t */
747 
748 /* Define to `unsigned char' if <sys/types.h> does not define. */
749 /* #undef uint8_t */
750 
751 /* Define as `fork' if `vfork' does not work. */
752 /* #undef vfork */
753 
754 #if defined(OMITTED__D_GNU_SOURCE) && !defined(_GNU_SOURCE)
755 #define _GNU_SOURCE 1
756 #endif
757 
758 #if defined(OMITTED__D_BSD_SOURCE) && !defined(_BSD_SOURCE)
759 #define _BSD_SOURCE 1
760 #endif
761 
762 #if defined(OMITTED__D_DEFAULT_SOURCE) && !defined(_DEFAULT_SOURCE)
763 #define _DEFAULT_SOURCE 1
764 #endif
765 
766 #if defined(OMITTED__D__EXTENSIONS__) && !defined(__EXTENSIONS__)
767 #define __EXTENSIONS__ 1
768 #endif
769 
770 #if defined(OMITTED__D_POSIX_C_SOURCE_200112) && !defined(_POSIX_C_SOURCE)
771 #define _POSIX_C_SOURCE 200112
772 #endif
773 
774 #if defined(OMITTED__D_XOPEN_SOURCE_600) && !defined(_XOPEN_SOURCE)
775 #define _XOPEN_SOURCE 600
776 #endif
777 
778 #if defined(OMITTED__D_XOPEN_SOURCE_EXTENDED_1) && !defined(_XOPEN_SOURCE_EXTENDED)
779 #define _XOPEN_SOURCE_EXTENDED 1
780 #endif
781 
782 #if defined(OMITTED__D_ALL_SOURCE) && !defined(_ALL_SOURCE)
783 #define _ALL_SOURCE 1
784 #endif
785 
786 #if defined(OMITTED__D_LARGEFILE_SOURCE_1) && !defined(_LARGEFILE_SOURCE)
787 #define _LARGEFILE_SOURCE 1
788 #endif
789 
790 
791 
792 
793 #ifndef UNBOUND_DEBUG
794 #  define NDEBUG
795 #endif
796 
797 /** Use small-ldns codebase */
798 #define USE_SLDNS 1
799 #ifdef HAVE_SSL
800 #  define LDNS_BUILD_CONFIG_HAVE_SSL 1
801 #endif
802 
803 #include <stdio.h>
804 #include <string.h>
805 #include <unistd.h>
806 #include <assert.h>
807 
808 #if STDC_HEADERS
809 #include <stdlib.h>
810 #include <stddef.h>
811 #endif
812 
813 #ifdef HAVE_STDARG_H
814 #include <stdarg.h>
815 #endif
816 
817 #ifdef HAVE_STDINT_H
818 #include <stdint.h>
819 #endif
820 
821 #include <errno.h>
822 
823 #if HAVE_SYS_PARAM_H
824 #include <sys/param.h>
825 #endif
826 
827 #ifdef HAVE_SYS_SOCKET_H
828 #include <sys/socket.h>
829 #endif
830 
831 #ifdef HAVE_SYS_UIO_H
832 #include <sys/uio.h>
833 #endif
834 
835 #ifdef HAVE_NETINET_IN_H
836 #include <netinet/in.h>
837 #endif
838 
839 #ifdef HAVE_NETINET_TCP_H
840 #include <netinet/tcp.h>
841 #endif
842 
843 #ifdef HAVE_ARPA_INET_H
844 #include <arpa/inet.h>
845 #endif
846 
847 #ifdef HAVE_WINSOCK2_H
848 #include <winsock2.h>
849 #endif
850 
851 #ifdef HAVE_WS2TCPIP_H
852 #include <ws2tcpip.h>
853 #endif
854 
855 #ifndef USE_WINSOCK
856 #define ARG_LL "%ll"
857 #else
858 #define ARG_LL "%I64"
859 #endif
860 
861 #ifndef AF_LOCAL
862 #define AF_LOCAL AF_UNIX
863 #endif
864 
865 
866 
867 #ifdef HAVE_ATTR_FORMAT
868 #  define ATTR_FORMAT(archetype, string_index, first_to_check) \
869     __attribute__ ((format (archetype, string_index, first_to_check)))
870 #else /* !HAVE_ATTR_FORMAT */
871 #  define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
872 #endif /* !HAVE_ATTR_FORMAT */
873 
874 
875 #if defined(DOXYGEN)
876 #  define ATTR_UNUSED(x)  x
877 #elif defined(__cplusplus)
878 #  define ATTR_UNUSED(x)
879 #elif defined(HAVE_ATTR_UNUSED)
880 #  define ATTR_UNUSED(x)  x __attribute__((unused))
881 #else /* !HAVE_ATTR_UNUSED */
882 #  define ATTR_UNUSED(x)  x
883 #endif /* !HAVE_ATTR_UNUSED */
884 
885 
886 #ifndef HAVE_FSEEKO
887 #define fseeko fseek
888 #define ftello ftell
889 #endif /* HAVE_FSEEKO */
890 
891 
892 #ifndef MAXHOSTNAMELEN
893 #define MAXHOSTNAMELEN 256
894 #endif
895 
896 #if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN)
897 #define snprintf snprintf_unbound
898 #define vsnprintf vsnprintf_unbound
899 #include <stdarg.h>
900 int snprintf (char *str, size_t count, const char *fmt, ...);
901 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
902 #endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */
903 
904 #ifndef HAVE_INET_PTON
905 #define inet_pton inet_pton_unbound
906 int inet_pton(int af, const char* src, void* dst);
907 #endif /* HAVE_INET_PTON */
908 
909 
910 #ifndef HAVE_INET_NTOP
911 #define inet_ntop inet_ntop_unbound
912 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
913 #endif
914 
915 
916 #ifndef HAVE_INET_ATON
917 #define inet_aton inet_aton_unbound
918 int inet_aton(const char *cp, struct in_addr *addr);
919 #endif
920 
921 
922 #ifndef HAVE_MEMMOVE
923 #define memmove memmove_unbound
924 void *memmove(void *dest, const void *src, size_t n);
925 #endif
926 
927 
928 #ifndef HAVE_STRLCAT
929 #define strlcat strlcat_unbound
930 size_t strlcat(char *dst, const char *src, size_t siz);
931 #endif
932 
933 
934 #ifndef HAVE_STRLCPY
935 #define strlcpy strlcpy_unbound
936 size_t strlcpy(char *dst, const char *src, size_t siz);
937 #endif
938 
939 
940 #ifndef HAVE_GMTIME_R
941 #define gmtime_r gmtime_r_unbound
942 struct tm *gmtime_r(const time_t *timep, struct tm *result);
943 #endif
944 
945 
946 #ifndef HAVE_REALLOCARRAY
947 #define reallocarray reallocarrayunbound
948 void* reallocarray(void *ptr, size_t nmemb, size_t size);
949 #endif
950 
951 
952 #if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H)
953 #define sleep(x) Sleep((x)*1000) /* on win32 */
954 #endif /* HAVE_SLEEP */
955 
956 
957 #ifndef HAVE_USLEEP
958 #define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
959 #endif /* HAVE_USLEEP */
960 
961 
962 #ifndef HAVE_RANDOM
963 #define random rand /* on win32, for tests only (bad random) */
964 #endif /* HAVE_RANDOM */
965 
966 
967 #ifndef HAVE_SRANDOM
968 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
969 #endif /* HAVE_SRANDOM */
970 
971 
972 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
973 #ifdef HAVE_WINSOCK2_H
974 #define FD_SET_T (u_int)
975 #else
976 #define FD_SET_T
977 #endif
978 
979 
980 #ifndef IPV6_MIN_MTU
981 #define IPV6_MIN_MTU 1280
982 #endif /* IPV6_MIN_MTU */
983 
984 
985 #ifdef MEMCMP_IS_BROKEN
986 #include "compat/memcmp.h"
987 #define memcmp memcmp_unbound
988 int memcmp(const void *x, const void *y, size_t n);
989 #endif
990 
991 
992 
993 #ifndef HAVE_CTIME_R
994 #define ctime_r unbound_ctime_r
995 char *ctime_r(const time_t *timep, char *buf);
996 #endif
997 
998 #ifndef HAVE_STRSEP
999 #define strsep unbound_strsep
1000 char *strsep(char **stringp, const char *delim);
1001 #endif
1002 
1003 #ifndef HAVE_ISBLANK
1004 #define isblank unbound_isblank
1005 int isblank(int c);
1006 #endif
1007 
1008 #if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
1009 #define strptime unbound_strptime
1010 struct tm;
1011 char *strptime(const char *s, const char *format, struct tm *tm);
1012 #endif
1013 
1014 #ifdef HAVE_LIBRESSL
1015 #  if !HAVE_DECL_STRLCPY
1016 size_t strlcpy(char *dst, const char *src, size_t siz);
1017 #  endif
1018 #  if !HAVE_DECL_STRLCAT
1019 size_t strlcat(char *dst, const char *src, size_t siz);
1020 #  endif
1021 #  if !HAVE_DECL_ARC4RANDOM && defined(HAVE_ARC4RANDOM)
1022 uint32_t arc4random(void);
1023 #  endif
1024 #  if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
1025 uint32_t arc4random_uniform(uint32_t upper_bound);
1026 #  endif
1027 #  if !HAVE_DECL_REALLOCARRAY
1028 void *reallocarray(void *ptr, size_t nmemb, size_t size);
1029 #  endif
1030 #endif /* HAVE_LIBRESSL */
1031 #ifndef HAVE_ARC4RANDOM
1032 void explicit_bzero(void* buf, size_t len);
1033 int getentropy(void* buf, size_t len);
1034 uint32_t arc4random(void);
1035 void arc4random_buf(void* buf, size_t n);
1036 void _ARC4_LOCK(void);
1037 void _ARC4_UNLOCK(void);
1038 #endif
1039 #ifndef HAVE_ARC4RANDOM_UNIFORM
1040 uint32_t arc4random_uniform(uint32_t upper_bound);
1041 #endif
1042 #ifdef COMPAT_SHA512
1043 #ifndef SHA512_DIGEST_LENGTH
1044 #define SHA512_BLOCK_LENGTH		128
1045 #define SHA512_DIGEST_LENGTH		64
1046 #define SHA512_DIGEST_STRING_LENGTH	(SHA512_DIGEST_LENGTH * 2 + 1)
1047 typedef struct _SHA512_CTX {
1048 	uint64_t	state[8];
1049 	uint64_t	bitcount[2];
1050 	uint8_t	buffer[SHA512_BLOCK_LENGTH];
1051 } SHA512_CTX;
1052 #endif /* SHA512_DIGEST_LENGTH */
1053 void SHA512_Init(SHA512_CTX*);
1054 void SHA512_Update(SHA512_CTX*, void*, size_t);
1055 void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
1056 unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest);
1057 #endif /* COMPAT_SHA512 */
1058 
1059 
1060 
1061 #if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
1062    /* using version of libevent that is not threadsafe. */
1063 #  define LIBEVENT_SIGNAL_PROBLEM 1
1064 #endif
1065 
1066 #ifndef CHECKED_INET6
1067 #  define CHECKED_INET6
1068 #  ifdef AF_INET6
1069 #    define INET6
1070 #  else
1071 #    define AF_INET6        28
1072 #  endif
1073 #endif /* CHECKED_INET6 */
1074 
1075 #ifndef HAVE_GETADDRINFO
1076 struct sockaddr_storage;
1077 #include "compat/fake-rfc2553.h"
1078 #endif
1079 
1080 #ifdef UNBOUND_ALLOC_STATS
1081 #  define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
1082 #  define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
1083 #  define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
1084 #  define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
1085 void *unbound_stat_malloc(size_t size);
1086 void *unbound_stat_calloc(size_t nmemb, size_t size);
1087 void unbound_stat_free(void *ptr);
1088 void *unbound_stat_realloc(void *ptr, size_t size);
1089 void *unbound_stat_malloc_log(size_t size, const char* file, int line,
1090 	const char* func);
1091 void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file,
1092 	int line, const char* func);
1093 void unbound_stat_free_log(void *ptr, const char* file, int line,
1094 	const char* func);
1095 void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
1096 	int line, const char* func);
1097 #elif defined(UNBOUND_ALLOC_LITE)
1098 #  include "util/alloc.h"
1099 #endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
1100 
1101 /** default port for DNS traffic. */
1102 #define UNBOUND_DNS_PORT 53
1103 /** default port for unbound control traffic, registered port with IANA,
1104     ub-dns-control  8953/tcp    unbound dns nameserver control */
1105 #define UNBOUND_CONTROL_PORT 8953
1106 /** the version of unbound-control that this software implements */
1107 #define UNBOUND_CONTROL_VERSION 1
1108 
1109 
1110