Codebase list unbound / 11ba8de
Imported Upstream version 1.3.0 Robert S. Edmonds 12 years ago
232 changed file(s) with 22383 addition(s) and 5316 deletion(s). Raw diff Collapse all Expand all
3737 configfile=@ub_conf_file@
3838 UNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
3939 CHECKLOCK_SRC=@CHECKLOCK_SRC@
40
40 UB_ON_WINDOWS=@UB_ON_WINDOWS@
41 WITH_PYTHONMODULE=@WITH_PYTHONMODULE@
42 WITH_PYUNBOUND=@WITH_PYUNBOUND@
43 PYTHON_SITE_PKG=@PYTHON_SITE_PKG@
44
45 SWIG=@SWIG@
4146 YACC=@YACC@
4247 LEX=@LEX@
4348 CC=@CC@
44 CPPFLAGS=-I$(srcdir) -I. @CPPFLAGS@ @DEFS@
49 CPPFLAGS=-I. @CPPFLAGS@
50 ifneq "$(srcdir)" "."
51 CPPFLAGS:=-I$(srcdir) $(CPPFLAGS)
52 endif
53 CPPFLAGS:=$(strip $(CPPFLAGS))
4554 CFLAGS=@CFLAGS@
4655 LDFLAGS=@LDFLAGS@
47 LIBS=@LIBS@
56 LIBS=$(strip @LIBS@)
4857 LIBOBJS=@LIBOBJS@
4958 RUNTIME_PATH=@RUNTIME_PATH@
5059 DEPFLAG=@DEPFLAG@
5564 endif
5665 BUILD=build/
5766
67 WINDRES=windres
5868 LINT=splint
59 LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
69 LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -Dglob64=glob -Dglobfree64=globfree
6070 # compat with openssl linux edition.
6171 LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned
6272
6373 INSTALL=$(srcdir)/install-sh
74 ifeq "$(WITH_PYTHONMODULE)" "yes"
75 PYTHONMOD_SRC=$(srcdir)/pythonmod/*.c
76 endif
6477
6578 COMMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/services/*.c \
6679 $(srcdir)/services/cache/*.c $(srcdir)/util/*.c \
6780 $(srcdir)/util/data/*.c $(srcdir)/util/storage/*.c \
68 $(srcdir)/iterator/*.c $(srcdir)/validator/*.c)) \
81 $(srcdir)/iterator/*.c $(srcdir)/validator/*.c $(PYTHONMOD_SRC))) \
6982 util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
7083 COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
7184 COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
97110 SIGNIT_OBJ=$(addprefix $(BUILD),$(SIGNIT_SRC:.c=.lo)) $(COMPAT_OBJ)
98111 MEMSTATS_SRC=testcode/memstats.c smallapp/worker_cb.c $(COMMON_SRC)
99112 MEMSTATS_OBJ=$(addprefix $(BUILD),$(MEMSTATS_SRC:.c=.lo)) $(COMPAT_OBJ)
100 ASYNCLOOK_SRC=testcode/asynclook.c
113 ASYNCLOOK_SRC=testcode/asynclook.c util/log.c util/locks.c
101114 ASYNCLOOK_OBJ=$(addprefix $(BUILD),$(ASYNCLOOK_SRC:.c=.lo)) $(COMPAT_OBJ)
102115 STREAMTCP_SRC=testcode/streamtcp.c smallapp/worker_cb.c $(COMMON_SRC)
103116 STREAMTCP_OBJ=$(addprefix $(BUILD),$(STREAMTCP_SRC:.c=.lo)) $(COMPAT_OBJ)
118131 ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.lo) \
119132 $(addprefix compat/,$(LIBOBJS:.o=.lo))) $(COMPAT_OBJ)
120133
134 ifeq "$(UB_ON_WINDOWS)" "yes"
135 DAEMON_SRC+=winrc/win_svc.c winrc/w_inst.c
136 DAEMON_OBJ+=$(BUILD)winrc/rsrc_unbound.o $(BUILD)winrc/win_svc.lo
137 HOST_OBJ+=$(BUILD)winrc/rsrc_unbound_host.o
138 CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
139 CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o
140
141 WINAPPS=unbound-service-install unbound-service-remove anchor-update
142 SVCINST_SRC=winrc/unbound-service-install.c winrc/w_inst.c
143 SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
144 $(BUILD)winrc/rsrc_svcinst.o
145 SVCUNINST_SRC=winrc/unbound-service-remove.c winrc/w_inst.c
146 SVCUNINST_OBJ=$(addprefix $(BUILD),$(SVCUNINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
147 $(BUILD)winrc/rsrc_svcuninst.o
148 ANCHORUPD_SRC=winrc/anchor-update.c
149 ANCHORUPD_OBJ=$(addprefix $(BUILD),$(ANCHORUPD_SRC:.c=.lo)) $(COMPAT_OBJ) \
150 $(BUILD)winrc/rsrc_anchorupd.o
151 ALL_SRC:=$(sort $(ALL_SRC) $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC))
152 ALL_OBJ:=$(sort $(ALL_OBJ) $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ))
153
154 $(BUILD)%.o: $(srcdir)/%.rc $(srcdir)/config.h
155 $(INFO) Resource $<
156 @if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
157 then (cd $(ldnsdir); $(MAKE) copy-headers); fi
158 @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
159 $Q$(WINDRES) $(CPPFLAGS) $< $@
160 endif
161
121162 COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
122 LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS)
123 LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined
163 LINK=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS))
164 LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined)
124165
125166 .PHONY: clean realclean doc lint all install uninstall tests test download_ldns strip lib
126167
131172 @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
132173 $Q$(COMPILE) -c $< -o $@
133174
134 all: $(COMMON_OBJ) unbound unbound-checkconf lib unbound-host unbound-control unbound-control-setup
175 all: $(COMMON_OBJ) unbound unbound-checkconf lib unbound-host unbound-control unbound-control-setup $(WINAPPS)
135176
136177 TEST_BIN=asynclook delayer harvest lock-verify memstats perf pktview signit \
137178 streamtcp testbound unittest
144185
145186 libunbound.la: $(LIBUNBOUND_OBJ)
146187 $(INFO) Link $@
147 $Q$(LINK_LIB) --export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
188 $Q$(LINK_LIB) -export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
148189
149190 ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
150191 ldnslib=$(ldnsdir)/lib/libldns.a
171212 $(INFO) Link $@
172213 $Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)
173214
215 unbound-service-install: $(SVCINST_OBJ)
216 $(INFO) Link $@
217 $Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)
218
219 unbound-service-remove: $(SVCUNINST_OBJ)
220 $(INFO) Link $@
221 $Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)
222
223 anchor-update: $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
224 $(INFO) Link $@
225 $Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)
226
174227 unittest: $(UNITTEST_OBJ) $(ldnslib)
175228 $(INFO) Link $@
176229 $Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
224277 # $(ldnsdir)/examples/ldns-testpkts.h
225278 # cp $(ldnsdir)/examples/ldns-testpkts.c testcode/ldns-testpkts.c
226279 # cp $(ldnsdir)/examples/ldns-testpkts.h testcode/ldns-testpkts.h
280
281 ifeq "$(WITH_PYTHONMODULE)" "yes"
282 $(srcdir)/pythonmod/pythonmod.c: pythonmod/interface.h
283 %.h: $(srcdir)/%.i $(srcdir)/config.h
284 @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
285 $(INFO) Swig $<
286 $Q$(SWIG) $(CPPFLAGS) -o $@ -python $<
287 endif
288
289 ifeq "$(WITH_PYUNBOUND)" "yes"
290 libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i $(srcdir)/libunbound/unbound.h
291 @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
292 $(INFO) Swig $<
293 $Q$(SWIG) -python -o $@ $(CPPFLAGS) $<
294
295 all: _unbound.la
296 _unbound.la: $(BUILD)libunbound/python/libunbound_wrap.lo libunbound.la
297 $(INFO) Link $@
298 $Q$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) -module -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined) -o $@ $< -rpath $(PYTHON_SITE_PKG) L. -L.libs -lunbound $(LIBS)
299 endif
227300
228301 util/config_file.c: util/configparser.h
229302 util/configlexer.c: $(srcdir)/util/configlexer.lex util/configparser.h
232305 $Qecho "rebuild lexer, but no lex program, skipped"
233306 else
234307 @-if test ! -d util; then $(INSTALL) -d util; fi
235 $Qecho "#include \"util/configyyrename.h\"" > $@
308 $Qecho "#include \"config.h\"" > $@
309 $Qecho "#include \"util/configyyrename.h\"" >> $@
236310 $Q$(LEX) -t $< >> $@
237311 endif
238312
244318 clean:
245319 rm -f *.o *.d *.lo *~ tags
246320 rm -f unbound unbound-checkconf unbound-host unbound-control unbound-control-setup libunbound.la
247 rm -rf autom4te.cache .libs build doc/html
321 rm -rf autom4te.cache .libs build doc/html doc/xml
248322
249323 realclean: clean
250324 rm -f config.status config.log config.h.in config.h
268342 doc:
269343 if test -n "$(doxygen)"; then \
270344 $(doxygen) $(srcdir)/doc/unbound.doxygen; fi
345 if test -x "`which sphinx-build 2>&1`"; then \
346 sphinx-build -b html pythonmod/doc doc/html/pythonmod; \
347 sphinx-build -b html libunbound/python/doc doc/html/pyunbound;\
348 fi
271349
272350 strip:
273351 strip unbound
288366 $(LIBTOOL) --mode=install cp unbound-checkconf $(DESTDIR)$(sbindir)/unbound-checkconf
289367 $(LIBTOOL) --mode=install cp unbound-control $(DESTDIR)$(sbindir)/unbound-control
290368 $(LIBTOOL) --mode=install cp unbound-host $(DESTDIR)$(sbindir)/unbound-host
369 ifeq "$(WITH_PYTHONMODULE)" "yes"
370 $(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
371 $(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
372 endif
373 ifeq "$(WITH_PYUNBOUND)" "yes"
374 $(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
375 $(INSTALL) -c -m 644 libunbound/python/unbound.py $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
376 $(LIBTOOL) --mode=install cp _unbound.la $(DESTDIR)$(PYTHON_SITE_PKG)
377 endif
291378 $(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
292379 $(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
293380 $(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8
306393 rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
307394 rm -f -- $(DESTDIR)$(includedir)/unbound.h
308395 $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libunbound.la
396 ifeq "$(WITH_PYTHONMODULE)" "yes"
397 rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
398 endif
399 ifeq "$(WITH_PYUNBOUND)" "yes"
400 rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
401 $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(PYTHON_SITE_PKG)/_unbound.la
402 endif
309403 @echo
310404 @echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand"
311405
327421 @if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
328422 then (cd $(ldnsdir); $(MAKE) copy-headers); fi
329423 @-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
330 $Q$(SHELL) -ec '$(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $< \
331 | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.lo $@ : !g'\'' > $@; \
332 [ -s $@ ] || rm -f $@'
424 $Q$(SHELL) -ec '$(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $< | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.lo $@ : !g'\'' > $@; [ -s $@ ] || rm -f $@'
333425
334426 ifneq ($(MAKECMDGOALS),clean)
335427 ifneq ($(MAKECMDGOALS),realclean)
11 * ./configure && make && make install
22 * on BSDs and Solaris use gmake (GNU make).
33 * You can use libevent if you want. libevent is useful when using
4 many (10000) outgoing ports. By default 16 ports are used and the
5 builtin alternative is equally capable and a little faster.
4 many (10000) outgoing ports. By default max 256 ports are opened at
5 the same time and the builtin alternative is equally capable and a
6 little faster.
67 * More detailed README, README.svn, README.tests in doc directory
78 * manual pages can be found in doc directory, and are installed, unbound(8).
89 * example configuration file doc/example.conf
0 # ===========================================================================
1 # http://autoconf-archive.cryp.to/ac_pkg_swig.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AC_PROG_SWIG([major.minor.micro])
7 #
8 # DESCRIPTION
9 #
10 # This macro searches for a SWIG installation on your system. If found you
11 # should call SWIG via $(SWIG). You can use the optional first argument to
12 # check if the version of the available SWIG is greater than or equal to
13 # the value of the argument. It should have the format: N[.N[.N]] (N is a
14 # number between 0 and 999. Only the first N is mandatory.)
15 #
16 # If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that
17 # the swig package is this version number or higher.
18 #
19 # In configure.in, use as:
20 #
21 # AC_PROG_SWIG(1.3.17)
22 # SWIG_ENABLE_CXX
23 # SWIG_MULTI_MODULE_SUPPORT
24 # SWIG_PYTHON
25 #
26 # LAST MODIFICATION
27 #
28 # 2008-04-12
29 #
30 # COPYLEFT
31 #
32 # Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
33 # Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
34 # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
35 # Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
36 #
37 # This program is free software; you can redistribute it and/or modify it
38 # under the terms of the GNU General Public License as published by the
39 # Free Software Foundation; either version 2 of the License, or (at your
40 # option) any later version.
41 #
42 # This program is distributed in the hope that it will be useful, but
43 # WITHOUT ANY WARRANTY; without even the implied warranty of
44 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
45 # Public License for more details.
46 #
47 # You should have received a copy of the GNU General Public License along
48 # with this program. If not, see <http://www.gnu.org/licenses/>.
49 #
50 # As a special exception, the respective Autoconf Macro's copyright owner
51 # gives unlimited permission to copy, distribute and modify the configure
52 # scripts that are the output of Autoconf when processing the Macro. You
53 # need not follow the terms of the GNU General Public License when using
54 # or distributing such scripts, even though portions of the text of the
55 # Macro appear in them. The GNU General Public License (GPL) does govern
56 # all other use of the material that constitutes the Autoconf Macro.
57 #
58 # This special exception to the GPL applies to versions of the Autoconf
59 # Macro released by the Autoconf Macro Archive. When you make and
60 # distribute a modified version of the Autoconf Macro, you may extend this
61 # special exception to the GPL to apply to your modified version as well.
62
63 AC_DEFUN([AC_PROG_SWIG],[
64 AC_PATH_PROG([SWIG],[swig])
65 if test -z "$SWIG" ; then
66 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
67 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
68 elif test -n "$1" ; then
69 AC_MSG_CHECKING([for SWIG version])
70 [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
71 AC_MSG_RESULT([$swig_version])
72 if test -n "$swig_version" ; then
73 # Calculate the required version number components
74 [required=$1]
75 [required_major=`echo $required | sed 's/[^0-9].*//'`]
76 if test -z "$required_major" ; then
77 [required_major=0]
78 fi
79 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
80 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
81 if test -z "$required_minor" ; then
82 [required_minor=0]
83 fi
84 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
85 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
86 if test -z "$required_patch" ; then
87 [required_patch=0]
88 fi
89 # Calculate the available version number components
90 [available=$swig_version]
91 [available_major=`echo $available | sed 's/[^0-9].*//'`]
92 if test -z "$available_major" ; then
93 [available_major=0]
94 fi
95 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
96 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
97 if test -z "$available_minor" ; then
98 [available_minor=0]
99 fi
100 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
101 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
102 if test -z "$available_patch" ; then
103 [available_patch=0]
104 fi
105 if test $available_major -ne $required_major \
106 -o $available_minor -ne $required_minor \
107 -o $available_patch -lt $required_patch ; then
108 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
109 SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
110 else
111 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
112 SWIG_LIB=`$SWIG -swiglib`
113 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
114 fi
115 else
116 AC_MSG_WARN([cannot determine SWIG version])
117 SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
118 fi
119 fi
120 AC_SUBST([SWIG_LIB])
121 ])
0 # acx_nlnetlabs.m4 - common macros for configure checks
1 # Copyright 2009, Wouter Wijngaards, NLnet Labs.
2 # BSD licensed.
3 #
4 # Version 1
5 # 2009-04-23
6 #
7 # Automates some of the checking constructs. Aims at portability for POSIX.
8 # Documentation for functions is below.
9 #
10 # the following macro's are provided in this file:
11 # (see below for details on each macro).
12 #
13 # ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc.
14 # ACX_RSRC_VERSION - create windows resource version number.
15 # ACX_CHECK_COMPILER_FLAG - see if cc supports a flag.
16 # ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below).
17 # ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly.
18 # ACX_DEPFLAG - find cc dependency flags.
19 # ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX.
20 # ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax.
21 # ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax.
22 # ACX_LIBTOOL_C_ONLY - create libtool for C only, improved.
23 # ACX_TYPE_U_CHAR - u_char type.
24 # ACX_TYPE_RLIM_T - rlim_t type.
25 # ACX_TYPE_SOCKLEN_T - socklen_t type.
26 # ACX_TYPE_IN_ADDR_T - in_addr_t type.
27 # ACX_TYPE_IN_PORT_T - in_port_t type.
28 # ACX_ARG_RPATH - add --disable-rpath option.
29 # ACX_WITH_SSL - add --with-ssl option, link -lcrypto.
30 # ACX_LIB_SSL - setup to link -lssl.
31 # ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files.
32 # ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably.
33 # ACX_FUNC_DEPRECATED - see if func is deprecated.
34 # ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work.
35 # ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments.
36 # ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably.
37 # AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format.
38 # AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused.
39 # AHX_CONFIG_FSEEKO - define fseeko, ftello fallback.
40 # AHX_CONFIG_RAND_MAX - define RAND_MAX if needed.
41 # AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed.
42 # AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed.
43 # AHX_CONFIG_SNPRINTF - snprintf compat prototype
44 # AHX_CONFIG_INET_PTON - inet_pton compat prototype
45 # AHX_CONFIG_INET_NTOP - inet_ntop compat prototype
46 # AHX_CONFIG_INET_ATON - inet_aton compat prototype
47 # AHX_CONFIG_MEMMOVE - memmove compat prototype
48 # AHX_CONFIG_STRLCPY - strlcpy compat prototype
49 # AHX_CONFIG_GMTIME_R - gmtime_r compat prototype
50 # AHX_CONFIG_W32_SLEEP - w32 compat for sleep
51 # AHX_CONFIG_W32_USLEEP - w32 compat for usleep
52 # AHX_CONFIG_W32_RANDOM - w32 compat for random
53 # AHX_CONFIG_W32_SRANDOM - w32 compat for srandom
54 # AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T.
55 # ACX_CFLAGS_STRIP - strip one flag from CFLAGS
56 # ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS
57 # AHX_CONFIG_FLAG_OMITTED - define omitted flag
58 # AHX_CONFIG_FLAG_EXT - define omitted extension flag
59 # AHX_CONFIG_EXT_FLAGS - define the stripped extension flags
60 #
61
62 dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines.
63 dnl for example, ACX_ESCAPE_BACKSLASH($from_var, to_var)
64 dnl $1: the text to change.
65 dnl $2: the result.
66 AC_DEFUN([ACX_ESCAPE_BACKSLASH], [$2="`echo $1 | sed -e 's/\\\\/\\\\\\\\/g'`"
67 ])
68
69 dnl Calculate comma separated windows-resource numbers from package version.
70 dnl Picks the first three(,0) or four numbers out of the name.
71 dnl $1: variable for the result
72 AC_DEFUN([ACX_RSRC_VERSION],
73 [$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `]
74 ])
75
76 dnl Routine to help check for compiler flags.
77 dnl Checks if the compiler will accept the flag.
78 dnl $1: the flag without a - in front, so g to check -g.
79 dnl $2: executed if yes
80 dnl $3: executed if no
81 AC_DEFUN([ACX_CHECK_COMPILER_FLAG],
82 [
83 AC_REQUIRE([AC_PROG_CC])
84 AC_MSG_CHECKING(whether $CC supports -$1)
85 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
86 AC_CACHE_VAL(cv_prog_cc_flag_$cache,
87 [
88 echo 'void f(){}' >conftest.c
89 if test -z "`$CC -$1 -c conftest.c 2>&1`"; then
90 eval "cv_prog_cc_flag_$cache=yes"
91 else
92 eval "cv_prog_cc_flag_$cache=no"
93 fi
94 rm -f conftest conftest.o conftest.c
95 ])
96 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
97 AC_MSG_RESULT(yes)
98 :
99 $2
100 else
101 AC_MSG_RESULT(no)
102 :
103 $3
104 fi
105 ])
106
107 dnl setup flags for ACX_CHECK_COMPILER_FLAG_NEEDED
108 dnl ERRFLAG: result, compiler flag to turn warnings into errors
109 AC_DEFUN([ACX_CHECK_ERROR_FLAGS],
110 [
111 ACX_CHECK_COMPILER_FLAG(Werror, [ERRFLAG="-Werror"], [ERRFLAG="-errwarn"])
112 ACX_CHECK_COMPILER_FLAG(Wall, [ERRFLAG="$ERRFLAG -Wall"],
113 [ERRFLAG="$ERRFLAG -errfmt"])
114 ])
115
116 dnl Routine to help check for needed compiler flags.
117 dnl $1: flags for CC
118 dnl $2: the includes and code
119 dnl $3: if the given code only compiles with the flag, execute argument 3
120 dnl $4: if the given code compiles without the flag, execute argument 4
121 dnl $5: with and without flag the compile fails, execute argument 5.
122 AC_DEFUN([ACX_CHECK_COMPILER_FLAG_NEEDED],
123 [
124 AC_REQUIRE([AC_PROG_CC])
125 AC_REQUIRE([ACX_CHECK_ERROR_FLAGS])
126 AC_MSG_CHECKING(whether we need $1 as a flag for $CC)
127 cache=AS_TR_SH($1)
128 dnl cache=`echo $1 | sed 'y%.=/+- %___p__%'`
129 AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache,
130 [
131 echo '$2' > conftest.c
132 echo 'void f(){}' >>conftest.c
133 if test -z "`$CC $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
134 eval "cv_prog_cc_flag_needed_$cache=no"
135 else
136 [
137 if test -z "`$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then
138 eval "cv_prog_cc_flag_needed_$cache=yes"
139 else
140 eval "cv_prog_cc_flag_needed_$cache=fail"
141 #echo 'Test with flag fails too!'
142 #cat conftest.c
143 #echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
144 #echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
145 #exit 1
146 fi
147 ]
148 fi
149 rm -f conftest conftest.c conftest.o
150 ])
151 if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
152 AC_MSG_RESULT(yes)
153 :
154 $3
155 else
156 if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
157 AC_MSG_RESULT(no)
158 #echo 'Test with flag is no!'
159 #cat conftest.c
160 #echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
161 #echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
162 #exit 1
163 :
164 $4
165 else
166 AC_MSG_RESULT(failed)
167 :
168 $5
169 fi
170 fi
171 ])
172
173 dnl Check for CC dependency flag
174 dnl DEPFLAG: set to flag that generates dependencies.
175 AC_DEFUN([ACX_DEPFLAG],
176 [
177 AC_MSG_CHECKING([$CC dependency flag])
178 echo 'void f(){}' >conftest.c
179 if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then
180 DEPFLAG="-MM"
181 else
182 if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then
183 DEPFLAG="-xM1"
184 else
185 DEPFLAG="-MM" # dunno do something
186 fi
187 fi
188 AC_MSG_RESULT($DEPFLAG)
189 rm -f conftest.c
190 AC_SUBST(DEPFLAG)
191 ])
192
193 dnl Determine flags that gives POSIX and BSD functionality.
194 dnl CFLAGS is modified for the result.
195 AC_DEFUN([ACX_DETERMINE_EXT_FLAGS_UNBOUND],
196 [
197 ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
198 ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
199
200 AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])
201
202 ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE,
203 [
204 #include "confdefs.h"
205 #include <stdlib.h>
206 #include <ctype.h>
207 #include <sys/time.h>
208 #ifdef HAVE_TIME_H
209 #include <time.h>
210 #endif
211 #include <unistd.h>
212 #include <netdb.h>
213 #ifdef HAVE_GETOPT_H
214 #include <getopt.h>
215 #endif
216
217 int test() {
218 int a;
219 char **opts = NULL;
220 struct timeval tv;
221 char *t;
222 time_t time = 0;
223 char *buf = NULL;
224 const char* str = NULL;
225 struct msghdr msg;
226 msg.msg_control = 0;
227 t = ctime_r(&time, buf);
228 tv.tv_usec = 10;
229 srandom(32);
230 a = getopt(2, opts, "a");
231 a = isascii(32);
232 str = gai_strerror(0);
233 return a;
234 }
235 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"])
236
237 ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE,
238 [
239 #include "confdefs.h"
240 #include <stdlib.h>
241 #include <ctype.h>
242 #include <sys/time.h>
243 #ifdef HAVE_TIME_H
244 #include <time.h>
245 #endif
246 #include <unistd.h>
247 #include <netdb.h>
248 #ifdef HAVE_GETOPT_H
249 #include <getopt.h>
250 #endif
251
252 int test() {
253 int a;
254 char **opts = NULL;
255 struct timeval tv;
256 char *t;
257 time_t time = 0;
258 char *buf = NULL;
259 const char* str = NULL;
260 struct msghdr msg;
261 msg.msg_control = 0;
262 t = ctime_r(&time, buf);
263 tv.tv_usec = 10;
264 srandom(32);
265 a = getopt(2, opts, "a");
266 a = isascii(32);
267 str = gai_strerror(0);
268 return a;
269 }
270 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"])
271
272 ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG,
273 [
274 #include <stdbool.h>
275 #include <ctype.h>
276 int test() {
277 int a = 0;
278 return a;
279 }
280 ], [CFLAGS="$CFLAGS $C99FLAG"])
281
282 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_BSD_SOURCE,
283 [
284 #include <ctype.h>
285
286 int test() {
287 int a;
288 a = isascii(32);
289 return a;
290 }
291 ], [CFLAGS="$CFLAGS -D_BSD_SOURCE"])
292
293 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE,
294 [
295 #include <netinet/in.h>
296
297 int test() {
298 struct in6_pktinfo inf;
299 int a = (int)sizeof(inf);
300 return a;
301 }
302 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
303
304 # check again for GNU_SOURCE for setresgid. May fail if setresgid
305 # is not available at all. -D_FRSRESGID is to make this check unique.
306 # otherwise we would get the previous cached result.
307 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE -D_FRSRESGID,
308 [
309 #include <unistd.h>
310
311 int test() {
312 int a = setresgid(0,0,0);
313 a = setresuid(0,0,0);
314 return a;
315 }
316 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
317
318 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112,
319 [
320 #include "confdefs.h"
321 #ifdef HAVE_TIME_H
322 #include <time.h>
323 #endif
324 #include <netdb.h>
325
326 int test() {
327 int a = 0;
328 char *t;
329 time_t time = 0;
330 char *buf = NULL;
331 const char* str = NULL;
332 t = ctime_r(&time, buf);
333 str = gai_strerror(0);
334 return a;
335 }
336 ], [CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"])
337
338 ACX_CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__,
339 [
340 #include "confdefs.h"
341 #include <stdlib.h>
342 #include <ctype.h>
343 #include <sys/time.h>
344 #ifdef HAVE_TIME_H
345 #include <time.h>
346 #endif
347 #include <unistd.h>
348 #ifdef HAVE_GETOPT_H
349 #include <getopt.h>
350 #endif
351
352 int test() {
353 int a;
354 char **opts = NULL;
355 struct timeval tv;
356 tv.tv_usec = 10;
357 srandom(32);
358 a = getopt(2, opts, "a");
359 a = isascii(32);
360 return a;
361 }
362 ], [CFLAGS="$CFLAGS -D__EXTENSIONS__"])
363
364 ])dnl End of ACX_DETERMINE_EXT_FLAGS_UNBOUND
365
366 dnl Check the printf-format attribute (if any)
367 dnl result in HAVE_ATTR_FORMAT.
368 dnl Make sure you also include the AHX_CONFIG_FORMAT_ATTRIBUTE.
369 AC_DEFUN([ACX_CHECK_FORMAT_ATTRIBUTE],
370 [AC_REQUIRE([AC_PROG_CC])
371 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute)
372 AC_CACHE_VAL(ac_cv_c_format_attribute,
373 [ac_cv_c_format_attribute=no
374 AC_TRY_COMPILE(
375 [#include <stdio.h>
376 void f (char *format, ...) __attribute__ ((format (printf, 1, 2)));
377 void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2)));
378 ], [
379 f ("%s", "str");
380 ],
381 [ac_cv_c_format_attribute="yes"],
382 [ac_cv_c_format_attribute="no"])
383 ])
384
385 AC_MSG_RESULT($ac_cv_c_format_attribute)
386 if test $ac_cv_c_format_attribute = yes; then
387 AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute])
388 fi
389 ])dnl End of ACX_CHECK_FORMAT_ATTRIBUTE
390
391 dnl Setup ATTR_FORMAT config.h parts.
392 dnl make sure you call ACX_CHECK_FORMAT_ATTRIBUTE also.
393 AC_DEFUN([AHX_CONFIG_FORMAT_ATTRIBUTE],
394 [
395 #ifdef HAVE_ATTR_FORMAT
396 # define ATTR_FORMAT(archetype, string_index, first_to_check) \
397 __attribute__ ((format (archetype, string_index, first_to_check)))
398 #else /* !HAVE_ATTR_FORMAT */
399 # define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
400 #endif /* !HAVE_ATTR_FORMAT */
401 ])
402
403 dnl Check how to mark function arguments as unused.
404 dnl result in HAVE_ATTR_UNUSED.
405 dnl Make sure you include AHX_CONFIG_UNUSED_ATTRIBUTE also.
406 AC_DEFUN([ACX_CHECK_UNUSED_ATTRIBUTE],
407 [AC_REQUIRE([AC_PROG_CC])
408 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute)
409 AC_CACHE_VAL(ac_cv_c_unused_attribute,
410 [ac_cv_c_unused_attribute=no
411 AC_TRY_COMPILE(
412 [#include <stdio.h>
413 void f (char *u __attribute__((unused)));
414 ], [
415 f ("x");
416 ],
417 [ac_cv_c_unused_attribute="yes"],
418 [ac_cv_c_unused_attribute="no"])
419 ])
420
421 dnl Setup ATTR_UNUSED config.h parts.
422 dnl make sure you call ACX_CHECK_UNUSED_ATTRIBUTE also.
423 AC_DEFUN([AHX_CONFIG_UNUSED_ATTRIBUTE],
424 [
425 #if defined(DOXYGEN)
426 # define ATTR_UNUSED(x) x
427 #elif defined(__cplusplus)
428 # define ATTR_UNUSED(x)
429 #elif defined(HAVE_ATTR_UNUSED)
430 # define ATTR_UNUSED(x) x __attribute__((unused))
431 #else /* !HAVE_ATTR_UNUSED */
432 # define ATTR_UNUSED(x) x
433 #endif /* !HAVE_ATTR_UNUSED */
434 ])
435
436 AC_MSG_RESULT($ac_cv_c_unused_attribute)
437 if test $ac_cv_c_unused_attribute = yes; then
438 AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute])
439 fi
440 ])dnl
441
442 dnl Pre-fun for ACX_LIBTOOL_C_ONLY
443 AC_DEFUN([ACX_LIBTOOL_C_PRE], [
444 # skip these tests, we do not need them.
445 AC_DEFUN([AC_PROG_F77], [:])
446 AC_DEFUN([AC_PROG_FC], [:])
447 AC_DEFUN([AC_PROG_CXX], [:])
448 AC_DEFUN([AC_PROG_CXXCPP], [:])
449 AC_DEFUN([AC_PROG_OBJC], [:])
450 AC_DEFUN([AC_PROG_OBJCCPP], [:])
451 AC_DEFUN([AC_LIBTOOL_CXX], [:])
452 AC_DEFUN([AC_LIBTOOL_F77], [:])
453 # always use ./libtool unless override from commandline (libtool=mylibtool)
454 if test -z "$libtool"; then
455 libtool="./libtool"
456 fi
457 AC_SUBST(libtool)
458 # avoid libtool max commandline length test on systems that fork slowly.
459 AC_CANONICAL_HOST
460 if echo "$host_os" | grep "sunos4" >/dev/null; then
461 lt_cv_sys_max_cmd_len=32750;
462 fi
463 AC_PATH_TOOL(AR, ar, [false])
464 if test $AR = false; then
465 AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it])
466 fi
467 ])
468
469 dnl Perform libtool check, portably, only for C
470 AC_DEFUN([ACX_LIBTOOL_C_ONLY], [
471 dnl as a requirement so that is gets called before LIBTOOL
472 dnl because libtools 'AC_REQUIRE' names are right after this one, before
473 dnl this function contents.
474 AC_REQUIRE([ACX_LIBTOOL_C_PRE])
475 AC_PROG_LIBTOOL
476 ])
477
478 dnl Detect if u_char type is defined, otherwise define it.
479 AC_DEFUN([ACX_TYPE_U_CHAR],
480 [AC_CHECK_TYPE(u_char, unsigned char)])
481
482 dnl Detect if rlim_t type is defined, otherwise define it.
483 AC_DEFUN([ACX_TYPE_RLIM_T],
484 [AC_CHECK_TYPE(rlim_t, ,
485 [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [
486 AC_INCLUDES_DEFAULT
487 #if HAVE_SYS_RESOURCE_H
488 # include <sys/resource.h>
489 #endif
490 ]) ])
491
492 dnl Detect if socklen_t type is defined, otherwise define it.
493 AC_DEFUN([ACX_TYPE_SOCKLEN_T],
494 [
495 AC_CHECK_TYPE(socklen_t, ,
496 [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
497 AC_INCLUDES_DEFAULT
498 #if HAVE_SYS_SOCKET_H
499 # include <sys/socket.h>
500 #endif
501 ]) ])
502
503 dnl Detect if socklen_t type is defined, otherwise define it.
504 AC_DEFUN([ACX_TYPE_IN_ADDR_T],
505 [ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
506 AC_INCLUDES_DEFAULT
507 #if HAVE_SYS_TYPES_H
508 # include <sys/types.h>
509 #endif
510 #if HAVE_NETINET_IN_H
511 # include <netinet/in.h>
512 #endif
513 ]) ])
514
515 dnl Detect if socklen_t type is defined, otherwise define it.
516 AC_DEFUN([ACX_TYPE_IN_PORT_T],
517 [ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
518 AC_INCLUDES_DEFAULT
519 #if HAVE_SYS_TYPES_H
520 # include <sys/types.h>
521 #endif
522 #if HAVE_NETINET_IN_H
523 # include <netinet/in.h>
524 #endif
525 ]) ])
526
527 dnl Add option to disable the evil rpath. Check whether to use rpath or not.
528 dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool.
529 AC_DEFUN([ACX_ARG_RPATH],
530 [
531 AC_ARG_ENABLE(rpath,
532 [ --disable-rpath disable hardcoded rpath (default=enabled)],
533 enable_rpath=$enableval, enable_rpath=yes)
534 if test "x$enable_rpath" = xno; then
535 AC_MSG_RESULT([Fixing libtool for -rpath problems.])
536 sed < libtool > libtool-2 \
537 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
538 mv libtool-2 libtool
539 chmod 755 libtool
540 libtool="./libtool"
541 fi
542 ])
543
544 dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is
545 dnl an absolute path.
546 dnl $1: the pathname to add.
547 AC_DEFUN([ACX_RUNTIME_PATH_ADD], [
548 if test "x$enable_rpath" = xyes; then
549 if echo "$1" | grep "^/" >/dev/null; then
550 RUNTIME_PATH="$RUNTIME_PATH -R$1"
551 fi
552 fi
553 ])
554
555 dnl Check for SSL.
556 dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
557 dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
558 dnl Checks main header files of SSL.
559 dnl
560 AC_DEFUN([ACX_WITH_SSL],
561 [
562 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
563 [enable SSL (will check /usr/local/ssl
564 /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
565 ],[
566 withval="yes"
567 ])
568 if test x_$withval = x_no; then
569 AC_MSG_ERROR([Need SSL library to do digital signature cryptography])
570 fi
571 if test x_$withval != x_no; then
572 AC_MSG_CHECKING(for SSL)
573 if test x_$withval = x_ -o x_$withval = x_yes; then
574 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
575 fi
576 for dir in $withval; do
577 ssldir="$dir"
578 if test -f "$dir/include/openssl/ssl.h"; then
579 found_ssl="yes"
580 AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
581 dnl assume /usr/include is already in the include-path.
582 if test "$ssldir" != "/usr"; then
583 CPPFLAGS="$CPPFLAGS -I$ssldir/include"
584 fi
585 break;
586 fi
587 done
588 if test x_$found_ssl != x_yes; then
589 AC_MSG_ERROR(Cannot find the SSL libraries in $withval)
590 else
591 AC_MSG_RESULT(found in $ssldir)
592 HAVE_SSL=yes
593 dnl assume /usr is already in the lib and dynlib paths.
594 if test "$ssldir" != "/usr"; then
595 LDFLAGS="$LDFLAGS -L$ssldir/lib"
596 ACX_RUNTIME_PATH_ADD([$ssldir/lib])
597 fi
598
599 AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
600 LIBS="$LIBS -lcrypto"
601 AC_TRY_LINK(, [
602 int HMAC_CTX_init(void);
603 (void)HMAC_CTX_init();
604 ], [
605 AC_MSG_RESULT(yes)
606 AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
607 [If you have HMAC_CTX_init])
608 ], [
609 AC_MSG_RESULT(no)
610 # check if -lwsock32 or -lgdi32 are needed.
611 BAKLIBS="$LIBS"
612 LIBS="$LIBS -lgdi32"
613 AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
614 AC_TRY_LINK([], [
615 int HMAC_CTX_init(void);
616 (void)HMAC_CTX_init();
617 ],[
618 AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
619 [If you have HMAC_CTX_init])
620 AC_MSG_RESULT(yes)
621 ],[
622 AC_MSG_RESULT(no)
623 LIBS="$BAKLIBS"
624 LIBS="$LIBS -ldl"
625 AC_MSG_CHECKING([if -lcrypto needs -ldl])
626 AC_TRY_LINK([], [
627 int HMAC_CTX_init(void);
628 (void)HMAC_CTX_init();
629 ],[
630 AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
631 [If you have HMAC_CTX_init])
632 AC_MSG_RESULT(yes)
633 ],[
634 AC_MSG_RESULT(no)
635 AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
636 ])
637 ])
638 ])
639 fi
640 AC_SUBST(HAVE_SSL)
641 AC_SUBST(RUNTIME_PATH)
642 fi
643 AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
644 AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
645 AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
646 ])dnl End of ACX_WITH_SSL
647
648 dnl Setup to use -lssl
649 dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one).
650 AC_DEFUN([ACX_LIB_SSL],
651 [
652 # check if libssl needs libdl
653 BAKLIBS="$LIBS"
654 LIBS="-lssl $LIBS"
655 AC_MSG_CHECKING([if libssl needs libdl])
656 AC_TRY_LINK_FUNC([SSL_CTX_new], [
657 AC_MSG_RESULT([no])
658 LIBS="$BAKLIBS"
659 ] , [
660 AC_MSG_RESULT([yes])
661 LIBS="$BAKLIBS"
662 AC_SEARCH_LIBS([dlopen], [dl])
663 ]) ])dnl End of ACX_LIB_SSL
664
665 dnl Setup to use very large files (>2Gb).
666 dnl setups fseeko and its own
667 AC_DEFUN([ACX_SYS_LARGEFILE],
668 [
669 AC_SYS_LARGEFILE
670 dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko
671 ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1,
672 [
673 #include <stdio.h>
674 int test() {
675 int a = fseeko(stdin, 0, 0);
676 return a;
677 }
678 ], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"])
679 ])
680
681 dnl Check getaddrinfo.
682 dnl Works on linux, solaris, bsd and windows(links winsock).
683 dnl defines HAVE_GETADDRINFO, USE_WINSOCK.
684 AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES],
685 [AC_REQUIRE([AC_PROG_CC])
686 AC_MSG_CHECKING(for getaddrinfo)
687 ac_cv_func_getaddrinfo=no
688 AC_LINK_IFELSE(
689 [
690 #ifdef __cplusplus
691 extern "C"
692 {
693 #endif
694 char* getaddrinfo();
695 char* (*f) () = getaddrinfo;
696 #ifdef __cplusplus
697 }
698 #endif
699 int main() {
700 ;
701 return 0;
702 }
703 ],
704 dnl this case on linux, solaris, bsd
705 [ac_cv_func_getaddrinfo="yes"],
706 dnl no quick getaddrinfo, try mingw32 and winsock2 library.
707 ORIGLIBS="$LIBS"
708 LIBS="$LIBS -lws2_32"
709 AC_LINK_IFELSE(
710 AC_LANG_PROGRAM(
711 [
712 #ifdef HAVE_WS2TCPIP_H
713 #include <ws2tcpip.h>
714 #endif
715 ],
716 [
717 (void)getaddrinfo(NULL, NULL, NULL, NULL);
718 ]
719 ),
720 [
721 ac_cv_func_getaddrinfo="yes"
722 dnl already: LIBS="$LIBS -lws2_32"
723 AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used])
724 USE_WINSOCK="1"
725 ],
726 [
727 ac_cv_func_getaddrinfo="no"
728 LIBS="$ORIGLIBS"
729 ])
730 )
731
732 AC_MSG_RESULT($ac_cv_func_getaddrinfo)
733 if test $ac_cv_func_getaddrinfo = yes; then
734 AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available])
735 fi
736 ])dnl Endof AC_CHECK_GETADDRINFO_WITH_INCLUDES
737
738 dnl check if a function is deprecated. defines DEPRECATED_func in config.h.
739 dnl $1: function name
740 dnl $2: C-statement that calls the function.
741 dnl $3: includes for the program.
742 dnl $4: executes if yes
743 dnl $5: executes if no
744 AC_DEFUN([ACX_FUNC_DEPRECATED],
745 [
746 AC_REQUIRE([AC_PROG_CC])
747 AC_MSG_CHECKING(if $1 is deprecated)
748 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
749 AC_CACHE_VAL(cv_cc_deprecated_$cache,
750 [
751 echo '$3' >conftest.c
752 echo 'void f(){ $2 }' >>conftest.c
753 if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then
754 eval "cv_cc_deprecated_$cache=no"
755 else
756 eval "cv_cc_deprecated_$cache=yes"
757 fi
758 rm -f conftest conftest.o conftest.c
759 ])
760 if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then
761 AC_MSG_RESULT(yes)
762 AC_DEFINE_UNQUOTED(AS_TR_CPP([DEPRECATED_$1]), 1, [Whether $1 is deprecated])
763 :
764 $4
765 else
766 AC_MSG_RESULT(no)
767 :
768 $5
769 fi
770 ])dnl end of ACX_FUNC_DEPRECATED
771
772 dnl check if select and nonblocking sockets actually work.
773 dnl Needs fork(2) and select(2).
774 dnl defines NONBLOCKING_IS_BROKEN, and if that is true multiple reads from
775 dnl a nonblocking socket do not work, a new call to select is necessary.
776 AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN],
777 [
778 AC_MSG_CHECKING([if nonblocking sockets work])
779 AC_RUN_IFELSE(AC_LANG_PROGRAM([
780 #include <stdio.h>
781 #include <string.h>
782 #include <stdlib.h>
783 #include <fcntl.h>
784 #include <errno.h>
785 #ifdef HAVE_SYS_TYPES_H
786 #include <sys/types.h>
787 #endif
788 #ifdef HAVE_SYS_SOCKET_H
789 #include <sys/socket.h>
790 #endif
791 #ifdef HAVE_NETINET_IN_H
792 #include <netinet/in.h>
793 #endif
794 #ifdef HAVE_ARPA_INET_H
795 #include <arpa/inet.h>
796 #endif
797 #ifdef HAVE_UNISTD_H
798 #include <unistd.h>
799 #endif
800 #ifdef HAVE_TIME_H
801 #include <time.h>
802 #endif
803 ],[[
804 int port;
805 int sfd, cfd;
806 int num = 10;
807 int i, p;
808 struct sockaddr_in a;
809 /* test if select and nonblocking reads work well together */
810 /* open port.
811 fork child to send 10 messages.
812 select to read.
813 then try to nonblocking read the 10 messages
814 then, nonblocking read must give EAGAIN
815 */
816
817 port = 12345 + (time(0)%32);
818 sfd = socket(PF_INET, SOCK_DGRAM, 0);
819 if(sfd == -1) {
820 perror("socket");
821 return 1;
822 }
823 memset(&a, 0, sizeof(a));
824 a.sin_family = AF_INET;
825 a.sin_port = htons(port);
826 a.sin_addr.s_addr = inet_addr("127.0.0.1");
827 if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) {
828 perror("bind");
829 return 1;
830 }
831 if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) {
832 perror("fcntl");
833 return 1;
834 }
835
836 cfd = socket(PF_INET, SOCK_DGRAM, 0);
837 if(cfd == -1) {
838 perror("client socket");
839 return 1;
840 }
841 a.sin_port = 0;
842 if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) {
843 perror("client bind");
844 return 1;
845 }
846 a.sin_port = htons(port);
847
848 /* no handler, causes exit in 10 seconds */
849 alarm(10);
850
851 /* send and receive on the socket */
852 if((p=fork()) == 0) {
853 for(i=0; i<num; i++) {
854 if(sendto(cfd, &i, sizeof(i), 0,
855 (struct sockaddr*)&a, sizeof(a)) < 0) {
856 perror("sendto");
857 return 1;
858 }
859 }
860 } else {
861 /* parent */
862 fd_set rset;
863 int x;
864 if(p == -1) {
865 perror("fork");
866 return 1;
867 }
868 FD_ZERO(&rset);
869 FD_SET(sfd, &rset);
870 if(select(sfd+1, &rset, NULL, NULL, NULL) < 1) {
871 perror("select");
872 return 1;
873 }
874 i = 0;
875 while(i < num) {
876 if(recv(sfd, &x, sizeof(x), 0) != sizeof(x)) {
877 if(errno == EAGAIN)
878 continue;
879 perror("recv");
880 return 1;
881 }
882 i++;
883 }
884 /* now we want to get EAGAIN: nonblocking goodness */
885 errno = 0;
886 recv(sfd, &x, sizeof(x), 0);
887 if(errno != EAGAIN) {
888 perror("trying to recv again");
889 return 1;
890 }
891 /* EAGAIN encountered */
892 }
893
894 close(sfd);
895 close(cfd);
896 ]]), [
897 AC_MSG_RESULT([yes])
898 ], [
899 AC_MSG_RESULT([no])
900 AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).])
901 ], [
902 AC_MSG_RESULT([crosscompile(yes)])
903 ])
904 ])dnl End of ACX_CHECK_NONBLOCKING_BROKEN
905
906 dnl Check if mkdir has one or two arguments.
907 dnl defines MKDIR_HAS_ONE_ARG
908 AC_DEFUN([ACX_MKDIR_ONE_ARG],
909 [
910 AC_MSG_CHECKING([whether mkdir has one arg])
911 AC_TRY_COMPILE([
912 #include <stdio.h>
913 #include <unistd.h>
914 #ifdef HAVE_WINSOCK2_H
915 #include <winsock2.h>
916 #endif
917 #ifdef HAVE_SYS_STAT_H
918 #include <sys/stat.h>
919 #endif
920 ], [
921 (void)mkdir("directory");
922 ],
923 AC_MSG_RESULT(yes)
924 AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.])
925 ,
926 AC_MSG_RESULT(no)
927 )
928 ])dnl end of ACX_MKDIR_ONE_ARG
929
930 dnl Check for ioctlsocket function. works on mingw32 too.
931 AC_DEFUN([ACX_FUNC_IOCTLSOCKET],
932 [
933 # check ioctlsocket
934 AC_MSG_CHECKING(for ioctlsocket)
935 AC_LINK_IFELSE(AC_LANG_PROGRAM([
936 #ifdef HAVE_WINSOCK2_H
937 #include <winsock2.h>
938 #endif
939 ], [
940 (void)ioctlsocket(0, 0, NULL);
941 ]), [
942 AC_MSG_RESULT(yes)
943 AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
944 ],[AC_MSG_RESULT(no)])
945 ])dnl end of ACX_FUNC_IOCTLSOCKET
946
947 dnl Define fallback for fseeko and ftello if needed.
948 AC_DEFUN([AHX_CONFIG_FSEEKO],
949 [
950 #ifndef HAVE_FSEEKO
951 #define fseeko fseek
952 #define ftello ftell
953 #endif /* HAVE_FSEEKO */
954 ])
955
956 dnl Define RAND_MAX if not defined
957 AC_DEFUN([AHX_CONFIG_RAND_MAX],
958 [
959 #ifndef RAND_MAX
960 #define RAND_MAX 2147483647
961 #endif
962 ])
963
964 dnl Define MAXHOSTNAMELEN if not defined
965 AC_DEFUN([AHX_CONFIG_MAXHOSTNAMELEN],
966 [
967 #ifndef MAXHOSTNAMELEN
968 #define MAXHOSTNAMELEN 256
969 #endif
970 ])
971
972 dnl Define IPV6_MIN_MTU if not defined
973 AC_DEFUN([AHX_CONFIG_IPV6_MIN_MTU],
974 [
975 #ifndef IPV6_MIN_MTU
976 #define IPV6_MIN_MTU 1280
977 #endif /* IPV6_MIN_MTU */
978 ])
979
980 dnl provide snprintf, vsnprintf compat prototype
981 dnl $1: unique name for compat code
982 AC_DEFUN([AHX_CONFIG_SNPRINTF],
983 [
984 #ifndef HAVE_SNPRINTF
985 #define snprintf snprintf_$1
986 #define vsnprintf vsnprintf_$1
987 #include <stdarg.h>
988 int snprintf (char *str, size_t count, const char *fmt, ...);
989 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
990 #endif /* HAVE_SNPRINTF */
991 ])
992
993 dnl provide inet_pton compat prototype.
994 dnl $1: unique name for compat code
995 AC_DEFUN([AHX_CONFIG_INET_PTON],
996 [
997 #ifndef HAVE_INET_PTON
998 #define inet_pton inet_pton_$1
999 int inet_pton(int af, const char* src, void* dst);
1000 #endif /* HAVE_INET_PTON */
1001 ])
1002
1003 dnl provide inet_ntop compat prototype.
1004 dnl $1: unique name for compat code
1005 AC_DEFUN([AHX_CONFIG_INET_NTOP],
1006 [
1007 #ifndef HAVE_INET_NTOP
1008 #define inet_ntop inet_ntop_$1
1009 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
1010 #endif
1011 ])
1012
1013 dnl provide inet_aton compat prototype.
1014 dnl $1: unique name for compat code
1015 AC_DEFUN([AHX_CONFIG_INET_ATON],
1016 [
1017 #ifndef HAVE_INET_ATON
1018 #define inet_aton inet_aton_$1
1019 int inet_aton(const char *cp, struct in_addr *addr);
1020 #endif
1021 ])
1022
1023 dnl provide memmove compat prototype.
1024 dnl $1: unique name for compat code
1025 AC_DEFUN([AHX_CONFIG_MEMMOVE],
1026 [
1027 #ifndef HAVE_MEMMOVE
1028 #define memmove memmove_$1
1029 void *memmove(void *dest, const void *src, size_t n);
1030 #endif
1031 ])
1032
1033 dnl provide strlcpy compat prototype.
1034 dnl $1: unique name for compat code
1035 AC_DEFUN([AHX_CONFIG_STRLCPY],
1036 [
1037 #ifndef HAVE_STRLCPY
1038 #define strlcpy strlcpy_$1
1039 size_t strlcpy(char *dst, const char *src, size_t siz);
1040 #endif
1041 ])
1042
1043 dnl provide gmtime_r compat prototype.
1044 dnl $1: unique name for compat code
1045 AC_DEFUN([AHX_CONFIG_GMTIME_R],
1046 [
1047 #ifndef HAVE_GMTIME_R
1048 #define gmtime_r gmtime_r_$1
1049 struct tm *gmtime_r(const time_t *timep, struct tm *result);
1050 #endif
1051 ])
1052
1053 dnl provide w32 compat definition for sleep
1054 AC_DEFUN([AHX_CONFIG_W32_SLEEP],
1055 [
1056 #ifndef HAVE_SLEEP
1057 #define sleep(x) Sleep((x)*1000) /* on win32 */
1058 #endif /* HAVE_SLEEP */
1059 ])
1060
1061 dnl provide w32 compat definition for usleep
1062 AC_DEFUN([AHX_CONFIG_W32_USLEEP],
1063 [
1064 #ifndef HAVE_USLEEP
1065 #define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
1066 #endif /* HAVE_USLEEP */
1067 ])
1068
1069 dnl provide w32 compat definition for random
1070 AC_DEFUN([AHX_CONFIG_W32_RANDOM],
1071 [
1072 #ifndef HAVE_RANDOM
1073 #define random rand /* on win32, for tests only (bad random) */
1074 #endif /* HAVE_RANDOM */
1075 ])
1076
1077 dnl provide w32 compat definition for srandom
1078 AC_DEFUN([AHX_CONFIG_W32_SRANDOM],
1079 [
1080 #ifndef HAVE_SRANDOM
1081 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
1082 #endif /* HAVE_SRANDOM */
1083 ])
1084
1085 dnl provide w32 compat definition for FD_SET_T
1086 AC_DEFUN([AHX_CONFIG_W32_FD_SET_T],
1087 [
1088 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
1089 #ifdef HAVE_WINSOCK2_H
1090 #define FD_SET_T (u_int)
1091 #else
1092 #define FD_SET_T
1093 #endif
1094 ])
1095
1096 dnl Remove an extension flag from CFLAGS, define replacement to be made.
1097 dnl Used by ACX_STRIP_EXT_FLAGS.
1098 dnl $1: the name of the flag, for example -D_GNU_SOURCE.
1099 AC_DEFUN([ACX_CFLAGS_STRIP],
1100 [
1101 if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then
1102 CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`"
1103 AC_DEFINE(AS_TR_CPP(OMITTED_$1), 1, Put $1 define in config.h)
1104 fi
1105 ])
1106
1107 dnl Remove EXT flags from the CFLAGS and set them to be defined in config.h
1108 dnl use with ACX_DETERMINE_EXT_FLAGS.
1109 AC_DEFUN([ACX_STRIP_EXT_FLAGS],
1110 [
1111 AC_MSG_NOTICE([Stripping extension flags...])
1112 ACX_CFLAGS_STRIP(-D_GNU_SOURCE)
1113 ACX_CFLAGS_STRIP(-D_BSD_SOURCE)
1114 ACX_CFLAGS_STRIP(-D__EXTENSIONS__)
1115 ACX_CFLAGS_STRIP(-D_POSIX_C_SOURCE=200112)
1116 ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE=600)
1117 ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE_EXTENDED=1)
1118 ACX_CFLAGS_STRIP(-D_ALL_SOURCE)
1119 ACX_CFLAGS_STRIP(-D_LARGEFILE_SOURCE=1)
1120 ]) dnl End of ACX_STRIP_EXT_FLAGS
1121
1122 dnl define one omitted flag for config.h
1123 dnl $1: flag name. -D_GNU_SOURCE
1124 dnl $2: replacement define. _GNU_SOURCE
1125 dnl $3: define value, 1
1126 AC_DEFUN([AHX_CONFIG_FLAG_OMITTED],
1127 [#if defined($1) && !defined($2)
1128 #define $2 $3
1129 [#]endif ])
1130
1131 dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags
1132 dnl $1: the -DNAME or -DNAME=value string.
1133 AC_DEFUN([AHX_CONFIG_FLAG_EXT],
1134 [AHX_CONFIG_FLAG_OMITTED(AS_TR_CPP(OMITTED_$1),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,)))
1135 ])
1136
1137 dnl config.h part to define omitted cflags, use with ACX_STRIP_EXT_FLAGS.
1138 AC_DEFUN([AHX_CONFIG_EXT_FLAGS],
1139 [AHX_CONFIG_FLAG_EXT(-D_GNU_SOURCE)
1140 AHX_CONFIG_FLAG_EXT(-D_BSD_SOURCE)
1141 AHX_CONFIG_FLAG_EXT(-D__EXTENSIONS__)
1142 AHX_CONFIG_FLAG_EXT(-D_POSIX_C_SOURCE=200112)
1143 AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE=600)
1144 AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE_EXTENDED=1)
1145 AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE)
1146 AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1)
1147 ])
1148
1149 dnl End of file
0 AC_DEFUN([AC_PYTHON_DEVEL],[
1 #
2 # Allow the use of a (user set) custom python version
3 #
4 AC_ARG_VAR([PYTHON_VERSION],[The installed Python
5 version to use, for example '2.3'. This string
6 will be appended to the Python interpreter
7 canonical name.])
8
9 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
10 if test -z "$PYTHON"; then
11 AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
12 PYTHON_VERSION=""
13 fi
14
15 if test -z "$PYTHON_VERSION"; then
16 PYTHON_VERSION=`$PYTHON -c "import sys, string; \
17 print string.split(sys.version)[[0]]"`
18 fi
19
20 #
21 # Check for a version of Python >= 2.1.0
22 #
23 AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
24 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
25 ver = string.split(sys.version)[[0]]; \
26 print ver >= '2.1.0'"`
27 if test "$ac_supports_python_ver" != "True"; then
28 if test -z "$PYTHON_NOVERSIONCHECK"; then
29 AC_MSG_RESULT([no])
30 AC_MSG_FAILURE([
31 This version of the AC@&t@_PYTHON_DEVEL macro
32 doesn't work properly with versions of Python before
33 2.1.0. You may need to re-run configure, setting the
34 variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
35 PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
36 Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
37 to something else than an empty string.
38 ])
39 else
40 AC_MSG_RESULT([skip at user request])
41 fi
42 else
43 AC_MSG_RESULT([yes])
44 fi
45
46 #
47 # if the macro parameter ``version'' is set, honour it
48 #
49 if test -n "$1"; then
50 AC_MSG_CHECKING([for a version of Python $1])
51 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
52 ver = string.split(sys.version)[[0]]; \
53 print ver $1"`
54 if test "$ac_supports_python_ver" = "True"; then
55 AC_MSG_RESULT([yes])
56 else
57 AC_MSG_RESULT([no])
58 AC_MSG_ERROR([this package requires Python $1.
59 If you have it installed, but it isn't the default Python
60 interpreter in your system path, please pass the PYTHON_VERSION
61 variable to configure. See ``configure --help'' for reference.
62 ])
63 PYTHON_VERSION=""
64 fi
65 fi
66
67 #
68 # Check if you have distutils, else fail
69 #
70 AC_MSG_CHECKING([for the distutils Python package])
71 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
72 if test -z "$ac_distutils_result"; then
73 AC_MSG_RESULT([yes])
74 else
75 AC_MSG_RESULT([no])
76 AC_MSG_ERROR([cannot import Python module "distutils".
77 Please check your Python installation. The error was:
78 $ac_distutils_result])
79 PYTHON_VERSION=""
80 fi
81
82 #
83 # Check for Python include path
84 #
85 AC_MSG_CHECKING([for Python include path])
86 if test -z "$PYTHON_CPPFLAGS"; then
87 python_path=`$PYTHON -c "import distutils.sysconfig; \
88 print distutils.sysconfig.get_python_inc();"`
89 if test -n "${python_path}"; then
90 python_path="-I$python_path"
91 fi
92 PYTHON_CPPFLAGS=$python_path
93 fi
94 AC_MSG_RESULT([$PYTHON_CPPFLAGS])
95 AC_SUBST([PYTHON_CPPFLAGS])
96
97 #
98 # Check for Python library path
99 #
100 AC_MSG_CHECKING([for Python library path])
101 if test -z "$PYTHON_LDFLAGS"; then
102 # (makes two attempts to ensure we've got a version number
103 # from the interpreter)
104 py_version=`$PYTHON -c "from distutils.sysconfig import *; \
105 from string import join; \
106 print join(get_config_vars('VERSION'))"`
107 if test "$py_version" = "[None]"; then
108 if test -n "$PYTHON_VERSION"; then
109 py_version=$PYTHON_VERSION
110 else
111 py_version=`$PYTHON -c "import sys; \
112 print sys.version[[:3]]"`
113 fi
114 fi
115
116 PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
117 from string import join; \
118 print '-L' + get_python_lib(0,1), \
119 '-L' + os.path.dirname(get_python_lib(0,1)), \
120 '-lpython';"`$py_version
121 fi
122 AC_MSG_RESULT([$PYTHON_LDFLAGS])
123 AC_SUBST([PYTHON_LDFLAGS])
124
125 #
126 # Check for site packages
127 #
128 AC_MSG_CHECKING([for Python site-packages path])
129 if test -z "$PYTHON_SITE_PKG"; then
130 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
131 print distutils.sysconfig.get_python_lib(0,0);"`
132 fi
133 AC_MSG_RESULT([$PYTHON_SITE_PKG])
134 AC_SUBST([PYTHON_SITE_PKG])
135
136 #
137 # libraries which must be linked in when embedding
138 #
139 AC_MSG_CHECKING(python extra libraries)
140 if test -z "$PYTHON_EXTRA_LIBS"; then
141 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
142 conf = distutils.sysconfig.get_config_var; \
143 print conf('LOCALMODLIBS'), conf('LIBS')"`
144 fi
145 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
146 AC_SUBST(PYTHON_EXTRA_LIBS)
147
148 #
149 # linking flags needed when embedding
150 #
151 AC_MSG_CHECKING(python extra linking flags)
152 if test -z "$PYTHON_EXTRA_LDFLAGS"; then
153 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
154 conf = distutils.sysconfig.get_config_var; \
155 print conf('LINKFORSHARED')"`
156 fi
157 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
158 AC_SUBST(PYTHON_EXTRA_LDFLAGS)
159
160 #
161 # final check to see if everything compiles alright
162 #
163 AC_MSG_CHECKING([consistency of all components of python development environment])
164 AC_LANG_PUSH([C])
165 # save current global flags
166 LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
167 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
168 AC_TRY_LINK([
169 #include <Python.h>
170 ],[
171 Py_Initialize();
172 ],[pythonexists=yes],[pythonexists=no])
173
174 AC_MSG_RESULT([$pythonexists])
175
176 if test ! "$pythonexists" = "yes"; then
177 AC_MSG_ERROR([
178 Could not link test program to Python. Maybe the main Python library has been
179 installed in some non-standard library path. If so, pass it to configure,
180 via the LDFLAGS environment variable.
181 Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
182 ============================================================================
183 ERROR!
184 You probably have to install the development version of the Python package
185 for your distribution. The exact name of this package varies among them.
186 ============================================================================
187 ])
188 PYTHON_VERSION=""
189 fi
190 AC_LANG_POP
191 # turn back to default flags
192 CPPFLAGS="$ac_save_CPPFLAGS"
193 LIBS="$ac_save_LIBS"
194
195 #
196 # all done!
197 #
198 ])
199
00 /* Just a replacement, if the original malloc is not
11 GNU-compliant. See autoconf documentation. */
22
3 #if HAVE_CONFIG_H
4 #include <config.h>
5 #endif
3 #include "config.h"
64 #undef malloc
75
86 #include <sys/types.h>
99 */
1010 #undef DARWIN_BROKEN_SETREUID
1111
12 /* Whether daemon is deprecated */
13 #undef DEPRECATED_DAEMON
14
1215 /* Define if you want to use debug lock checking (slow). */
1316 #undef ENABLE_LOCK_CHECKS
1417
2730 /* Define to 1 if you have the `chroot' function. */
2831 #undef HAVE_CHROOT
2932
33 /* Define to 1 if you have the `daemon' function. */
34 #undef HAVE_DAEMON
35
3036 /* Define to 1 if you have the <dlfcn.h> header file. */
3137 #undef HAVE_DLFCN_H
3238
39 /* Define to 1 if you have the `ENGINE_load_gost' function. */
40 #undef HAVE_ENGINE_LOAD_GOST
41
3342 /* Define to 1 if you have the `event_base_free' function. */
3443 #undef HAVE_EVENT_BASE_FREE
3544
3645 /* Define to 1 if you have the `event_base_get_method' function. */
3746 #undef HAVE_EVENT_BASE_GET_METHOD
3847
48 /* Define to 1 if you have the `event_base_new' function. */
49 #undef HAVE_EVENT_BASE_NEW
50
3951 /* Define to 1 if you have the `event_base_once' function. */
4052 #undef HAVE_EVENT_BASE_ONCE
4153
8496 /* Define to 1 if you have the `gmtime_r' function. */
8597 #undef HAVE_GMTIME_R
8698
99 /* Define to 1 if you have the <grp.h> header file. */
100 #undef HAVE_GRP_H
101
87102 /* If you have HMAC_CTX_init */
88103 #undef HAVE_HMAC_CTX_INIT
89104
96111 /* Define to 1 if you have the `inet_pton' function. */
97112 #undef HAVE_INET_PTON
98113
114 /* Define to 1 if you have the `initgroups' function. */
115 #undef HAVE_INITGROUPS
116
99117 /* Define to 1 if you have the <inttypes.h> header file. */
100118 #undef HAVE_INTTYPES_H
101119
107125
108126 /* Define to 1 if you have the `ldns' library (-lldns). */
109127 #undef HAVE_LIBLDNS
128
129 /* Define to 1 if you have the `localtime_r' function. */
130 #undef HAVE_LOCALTIME_R
131
132 /* Define to 1 if you have the <login_cap.h> header file. */
133 #undef HAVE_LOGIN_CAP_H
110134
111135 /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
112136 to 0 otherwise. */
145169 /* Define to 1 if you have the <pwd.h> header file. */
146170 #undef HAVE_PWD_H
147171
172 /* Define if you have Python libraries and header files. */
173 #undef HAVE_PYTHON
174
148175 /* Define to 1 if you have the `random' function. */
149176 #undef HAVE_RANDOM
150177
172199 /* Define to 1 if you have the `setsid' function. */
173200 #undef HAVE_SETSID
174201
202 /* Define to 1 if you have the `setusercontext' function. */
203 #undef HAVE_SETUSERCONTEXT
204
175205 /* Define to 1 if you have the `sigprocmask' function. */
176206 #undef HAVE_SIGPROCMASK
177207
202232 /* Define to 1 if you have the <stdlib.h> header file. */
203233 #undef HAVE_STDLIB_H
204234
235 /* Define to 1 if you have the `strftime' function. */
236 #undef HAVE_STRFTIME
237
205238 /* Define to 1 if you have the <strings.h> header file. */
206239 #undef HAVE_STRINGS_H
207240
211244 /* Define to 1 if you have the `strlcpy' function. */
212245 #undef HAVE_STRLCPY
213246
247 /* Define if you have Swig libraries and header files. */
248 #undef HAVE_SWIG
249
214250 /* Define to 1 if you have the <syslog.h> header file. */
215251 #undef HAVE_SYSLOG_H
216252
273309
274310 /* Define to 1 if you have the <ws2tcpip.h> header file. */
275311 #undef HAVE_WS2TCPIP_H
312
313 /* Define to 1 if you have the `_beginthreadex' function. */
314 #undef HAVE__BEGINTHREADEX
276315
277316 /* Define to the maximum message length to pass to syslog. */
278317 #undef MAXSYSLOGMSGLEN
284323 lower performance). */
285324 #undef NONBLOCKING_IS_BROKEN
286325
326 /* Put -D_ALL_SOURCE define in config.h */
327 #undef OMITTED__D_ALL_SOURCE
328
329 /* Put -D_BSD_SOURCE define in config.h */
330 #undef OMITTED__D_BSD_SOURCE
331
332 /* Put -D_GNU_SOURCE define in config.h */
333 #undef OMITTED__D_GNU_SOURCE
334
335 /* Put -D_LARGEFILE_SOURCE=1 define in config.h */
336 #undef OMITTED__D_LARGEFILE_SOURCE_1
337
338 /* Put -D_POSIX_C_SOURCE=200112 define in config.h */
339 #undef OMITTED__D_POSIX_C_SOURCE_200112
340
341 /* Put -D_XOPEN_SOURCE=600 define in config.h */
342 #undef OMITTED__D_XOPEN_SOURCE_600
343
344 /* Put -D_XOPEN_SOURCE_EXTENDED=1 define in config.h */
345 #undef OMITTED__D_XOPEN_SOURCE_EXTENDED_1
346
347 /* Put -D__EXTENSIONS__ define in config.h */
348 #undef OMITTED__D__EXTENSIONS__
349
287350 /* Define to the address where bug reports for this package should be sent. */
288351 #undef PACKAGE_BUGREPORT
289352
309372 /* Define as the return type of signal handlers (`int' or `void'). */
310373 #undef RETSIGTYPE
311374
375 /* version number for resource files */
376 #undef RSRC_PACKAGE_VERSION
377
312378 /* Directory to chdir to */
313379 #undef RUN_DIR
314380
381 /* Shared data */
382 #undef SHARE_DIR
383
315384 /* Define to 1 if you have the ANSI C header files. */
316385 #undef STDC_HEADERS
317386
387 /* Use win32 resources and API */
388 #undef UB_ON_WINDOWS
389
318390 /* default username */
319391 #undef UB_USERNAME
320392
327399 /* Define if you want to use internal select based events */
328400 #undef USE_MINI_EVENT
329401
402 /* Define this to enable SHA256 and SHA512 support. */
403 #undef USE_SHA2
404
330405 /* Whether the windows socket API is used */
331406 #undef USE_WINSOCK
332407
333408 /* the version of the windows API enabled */
334409 #undef WINVER
410
411 /* Define if you want Python module. */
412 #undef WITH_PYTHONMODULE
413
414 /* Define if you want PyUnbound. */
415 #undef WITH_PYUNBOUND
335416
336417 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
337418 `char[]'. */
380461 /* Define to `long long' if <sys/types.h> does not define. */
381462 #undef int64_t
382463
383 /* Define to `char' if <sys/types.h> does not define. */
464 /* Define to `signed char' if <sys/types.h> does not define. */
384465 #undef int8_t
385466
386467 /* Define to rpl_malloc if the replacement function should be used. */
424505
425506 /* Define as `fork' if `vfork' does not work. */
426507 #undef vfork
508
509 #if defined(OMITTED__D_GNU_SOURCE) && !defined(_GNU_SOURCE)
510 #define _GNU_SOURCE 1
511 #endif
512
513 #if defined(OMITTED__D_BSD_SOURCE) && !defined(_BSD_SOURCE)
514 #define _BSD_SOURCE 1
515 #endif
516
517 #if defined(OMITTED__D__EXTENSIONS__) && !defined(__EXTENSIONS__)
518 #define __EXTENSIONS__ 1
519 #endif
520
521 #if defined(OMITTED__D_POSIX_C_SOURCE_200112) && !defined(_POSIX_C_SOURCE)
522 #define _POSIX_C_SOURCE 200112
523 #endif
524
525 #if defined(OMITTED__D_XOPEN_SOURCE_600) && !defined(_XOPEN_SOURCE)
526 #define _XOPEN_SOURCE 600
527 #endif
528
529 #if defined(OMITTED__D_XOPEN_SOURCE_EXTENDED_1) && !defined(_XOPEN_SOURCE_EXTENDED)
530 #define _XOPEN_SOURCE_EXTENDED 1
531 #endif
532
533 #if defined(OMITTED__D_ALL_SOURCE) && !defined(_ALL_SOURCE)
534 #define _ALL_SOURCE 1
535 #endif
536
537 #if defined(OMITTED__D_LARGEFILE_SOURCE_1) && !defined(_LARGEFILE_SOURCE)
538 #define _LARGEFILE_SOURCE 1
539 #endif
540
541
427542
428543
429544 #ifndef UNBOUND_DEBUG
486601 #include <openssl/rand.h>
487602 #endif
488603
604
605
489606 #ifdef HAVE_ATTR_FORMAT
490607 # define ATTR_FORMAT(archetype, string_index, first_to_check) \
491608 __attribute__ ((format (archetype, string_index, first_to_check)))
492609 #else /* !HAVE_ATTR_FORMAT */
493610 # define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
494611 #endif /* !HAVE_ATTR_FORMAT */
612
613
495614 #if defined(DOXYGEN)
496615 # define ATTR_UNUSED(x) x
497616 #elif defined(__cplusplus)
501620 #else /* !HAVE_ATTR_UNUSED */
502621 # define ATTR_UNUSED(x) x
503622 #endif /* !HAVE_ATTR_UNUSED */
623
624
504625 #ifndef HAVE_FSEEKO
505626 #define fseeko fseek
506627 #define ftello ftell
507628 #endif /* HAVE_FSEEKO */
629
630
631 #ifndef RAND_MAX
632 #define RAND_MAX 2147483647
633 #endif
634
635
636 #ifndef MAXHOSTNAMELEN
637 #define MAXHOSTNAMELEN 256
638 #endif
639
640
641 #ifndef HAVE_SNPRINTF
642 #define snprintf snprintf_unbound
643 #define vsnprintf vsnprintf_unbound
644 #include <stdarg.h>
645 int snprintf (char *str, size_t count, const char *fmt, ...);
646 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
647 #endif /* HAVE_SNPRINTF */
648
649
650 #ifndef HAVE_INET_PTON
651 #define inet_pton inet_pton_unbound
652 int inet_pton(int af, const char* src, void* dst);
653 #endif /* HAVE_INET_PTON */
654
655
656 #ifndef HAVE_INET_NTOP
657 #define inet_ntop inet_ntop_unbound
658 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
659 #endif
660
661
662 #ifndef HAVE_INET_ATON
663 #define inet_aton inet_aton_unbound
664 int inet_aton(const char *cp, struct in_addr *addr);
665 #endif
666
667
668 #ifndef HAVE_MEMMOVE
669 #define memmove memmove_unbound
670 void *memmove(void *dest, const void *src, size_t n);
671 #endif
672
673
674 #ifndef HAVE_STRLCPY
675 #define strlcpy strlcpy_unbound
676 size_t strlcpy(char *dst, const char *src, size_t siz);
677 #endif
678
679
680 #ifndef HAVE_GMTIME_R
681 #define gmtime_r gmtime_r_unbound
682 struct tm *gmtime_r(const time_t *timep, struct tm *result);
683 #endif
684
685
686 #ifndef HAVE_SLEEP
687 #define sleep(x) Sleep((x)*1000) /* on win32 */
688 #endif /* HAVE_SLEEP */
689
690
691 #ifndef HAVE_USLEEP
692 #define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
693 #endif /* HAVE_USLEEP */
694
695
696 #ifndef HAVE_RANDOM
697 #define random rand /* on win32, for tests only (bad random) */
698 #endif /* HAVE_RANDOM */
699
700
701 #ifndef HAVE_SRANDOM
702 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
703 #endif /* HAVE_SRANDOM */
704
705
706 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
707 #ifdef HAVE_WINSOCK2_H
708 #define FD_SET_T (u_int)
709 #else
710 #define FD_SET_T
711 #endif
712
713
714 #ifndef IPV6_MIN_MTU
715 #define IPV6_MIN_MTU 1280
716 #endif /* IPV6_MIN_MTU */
717
718
719
508720 #if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
509721 /* using version of libevent that is not threadsafe. */
510722 # define LIBEVENT_SIGNAL_PROBLEM 1
511723 #endif
512
513 #ifndef RAND_MAX
514 #define RAND_MAX 2147483647
515 #endif
516
517 #ifndef MAXHOSTNAMELEN
518 #define MAXHOSTNAMELEN 256
519 #endif
520
521 #ifndef IPV6_MIN_MTU
522 #define IPV6_MIN_MTU 1280
523 #endif /* IPV6_MIN_MTU */
524724
525725 #ifndef CHECKED_INET6
526726 # define CHECKED_INET6
533733
534734 /* maximum nesting of included files */
535735 #define MAXINCLUDES 10
536
537 #ifndef HAVE_SNPRINTF
538 #define snprintf snprintf_unbound
539 #define vsnprintf vsnprintf_unbound
540 #include <stdarg.h>
541 int snprintf (char *str, size_t count, const char *fmt, ...);
542 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
543 #endif /* HAVE_SNPRINTF */
544 #ifndef HAVE_INET_PTON
545 #define inet_pton inet_pton_unbound
546 int inet_pton(int af, const char* src, void* dst);
547 #endif /* HAVE_INET_PTON */
548 #ifndef HAVE_INET_NTOP
549 #define inet_ntop inet_ntop_unbound
550 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
551 #endif
552 #ifndef HAVE_INET_ATON
553 #define inet_aton inet_aton_unbound
554 int inet_aton(const char *cp, struct in_addr *addr);
555 #endif
556 #ifndef HAVE_MEMMOVE
557 #define memmove memmove_unbound
558 void *memmove(void *dest, const void *src, size_t n);
559 #endif
560 #ifndef HAVE_STRLCPY
561 #define strlcpy strlcpy_unbound
562 size_t strlcpy(char *dst, const char *src, size_t siz);
563 #endif
564 #ifndef HAVE_GMTIME_R
565 #define gmtime_r gmtime_r_unbound
566 struct tm *gmtime_r(const time_t *timep, struct tm *result);
567 #endif
568736 #ifndef HAVE_GETADDRINFO
569737 struct sockaddr_storage;
570738 #include "compat/fake-rfc2553.h"
571 #endif
572 #ifndef HAVE_SLEEP
573 #define sleep(x) Sleep((x)*1000) /* on win32 */
574 #endif /* HAVE_SLEEP */
575 #ifndef HAVE_USLEEP
576 #define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
577 #endif /* HAVE_USLEEP */
578 #ifndef HAVE_RANDOM
579 #define random rand /* on win32, for tests only (bad random) */
580 #endif /* HAVE_RANDOM */
581 #ifndef HAVE_SRANDOM
582 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
583 #endif /* HAVE_SRANDOM */
584
585 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
586 #ifdef HAVE_WINSOCK2_H
587 #define FD_SET_T (u_int)
588 #else
589 #define FD_SET_T
590739 #endif
591740
592741 #include "ldns/ldns.h"
+3457
-1929
configure less more
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.61 for unbound 1.2.1.
2 # Generated by GNU Autoconf 2.61 for unbound 1.3.0.
33 #
44 # Report bugs to <unbound-bugs@nlnetlabs.nl>.
55 #
723723 # Identity of this package.
724724 PACKAGE_NAME='unbound'
725725 PACKAGE_TARNAME='unbound'
726 PACKAGE_VERSION='1.2.1'
727 PACKAGE_STRING='unbound 1.2.1'
726 PACKAGE_VERSION='1.3.0'
727 PACKAGE_STRING='unbound 1.3.0'
728728 PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
729729
730730 # Factoring default headers for most tests.
816816 ub_conf_file
817817 UNBOUND_RUN_DIR
818818 UNBOUND_CHROOT_DIR
819 UNBOUND_SHARE_DIR
819820 UNBOUND_PIDFILE
820821 UNBOUND_USERNAME
821822 DEPFLAG
822823 debug_enabled
824 LEX
825 LEX_OUTPUT_ROOT
826 LEXLIB
827 YACC
828 YFLAGS
829 doxygen
823830 libtool
824 AR
825 doxygen
826831 build
827832 build_cpu
828833 build_vendor
831836 host_cpu
832837 host_vendor
833838 host_os
834 LEX
835 LEX_OUTPUT_ROOT
836 LEXLIB
837 YACC
838 YFLAGS
839 AR
839840 SED
840841 LN_S
841842 ECHO
842843 RANLIB
843844 STRIP
844845 LIBTOOL
845 HAVE_SSL
846 RUNTIME_PATH
847846 acx_pthread_config
848847 PTHREAD_CC
849848 PTHREAD_LIBS
850849 PTHREAD_CFLAGS
850 PYTHON_VERSION
851 PYTHON
852 PYTHON_CPPFLAGS
853 PYTHON_LDFLAGS
854 PYTHON_SITE_PKG
855 PYTHON_EXTRA_LIBS
856 PYTHON_EXTRA_LDFLAGS
857 SWIG
858 SWIG_LIB
859 swig
860 WITH_PYTHONMODULE
861 WITH_PYUNBOUND
862 HAVE_SSL
863 RUNTIME_PATH
851864 staticexe
852865 CHECKLOCK_SRC
853866 LIBOBJS
867 UB_ON_WINDOWS
854868 ldnsdir
855869 subdirs
856870 LTLIBOBJS'
865879 CPPFLAGS
866880 CPP
867881 YACC
868 YFLAGS'
882 YFLAGS
883 PYTHON_VERSION'
869884 ac_subdirs_all='ldns-src'
870885
871886 # Initialize some variables set by options.
13681383 # Omit some internal or obsolete options to make the list less imposing.
13691384 # This message is too long to be a string in the A/UX 3.1 sh.
13701385 cat <<_ACEOF
1371 \`configure' configures unbound 1.2.1 to adapt to many kinds of systems.
1386 \`configure' configures unbound 1.3.0 to adapt to many kinds of systems.
13721387
13731388 Usage: $0 [OPTION]... [VAR=VALUE]...
13741389
14331448
14341449 if test -n "$ac_init_help"; then
14351450 case $ac_init_help in
1436 short | recursive ) echo "Configuration of unbound 1.2.1:";;
1451 short | recursive ) echo "Configuration of unbound 1.3.0:";;
14371452 esac
14381453 cat <<\_ACEOF
14391454
14481463 optimize for fast installation [default=yes]
14491464 --disable-libtool-lock avoid locking (might break parallel builds)
14501465 --disable-rpath disable hardcoded rpath (default=enabled)
1466 --enable-sha2 Enable SHA256 and SHA512 RRSIG support
14511467 --enable-static-exe enable to compile executables statically against
14521468 event, ldns libs, for debug purposes
14531469 --enable-lock-checks enable to check lock and unlock calls, for debug
14641480 part of cfg file)
14651481 --with-chroot-dir=path set default directory to chroot to (by default same
14661482 as run-dir)
1483 --with-share-dir=path set default directory with shared data (by default
1484 same as share/unbound)
14671485 --with-pidfile=filename set default pathname to unbound pidfile (default
14681486 run-dir/unbound.pid)
14691487 --with-username=user set default user that unbound changes to (default
14721490 --with-pic try to use only PIC/non-PIC objects [default=use
14731491 both]
14741492 --with-tags[=TAGS] include additional configurations [automatic]
1493 --with-pthreads use pthreads library, or --without-pthreads to
1494 disable threading support.
1495 --with-solaris-threads use solaris native thread library.
1496 --with-pyunbound build PyUnbound, or --without-pyunbound to skip it.
1497 (default=no)
1498 --with-pythonmodule build Python module, or --without-pythonmodule to
1499 disable script engine. (default=no)
14751500 --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl
14761501 /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw
14771502 /usr)
1478 --with-pthreads use pthreads library, or --without-pthreads to
1479 disable threading support.
1480 --with-solaris-threads use solaris native thread library.
14811503 --with-libevent=pathname
14821504 use libevent (will check /usr/local /opt/local
14831505 /usr/lib /usr/pkg /usr/sfw /usr or you can specify
14841506 an explicit path). Slower, but allows use of large
14851507 outgoing port ranges.
14861508 --with-ldns=PATH specify prefix of path of ldns library to use
1487
1488
1509 --with-ldns-builtin forces use of package included with this one
14891510
14901511 Some influential environment variables:
14911512 CC C compiler command
15011522 YFLAGS The list of arguments that will be passed by default to $YACC.
15021523 This script will default YFLAGS to the empty string to avoid a
15031524 default value of `-d' given by some make applications.
1525 PYTHON_VERSION
1526 The installed Python version to use, for example '2.3'. This
1527 string will be appended to the Python interpreter canonical
1528 name.
15041529
15051530 Use these variables to override the choices made by `configure' or to help
15061531 it to find libraries and programs with nonstandard names/locations.
15661591 test -n "$ac_init_help" && exit $ac_status
15671592 if $ac_init_version; then
15681593 cat <<\_ACEOF
1569 unbound configure 1.2.1
1594 unbound configure 1.3.0
15701595 generated by GNU Autoconf 2.61
15711596
15721597 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
15801605 This file contains any messages produced by compilers while
15811606 running configure, to aid debugging if configure makes a mistake.
15821607
1583 It was created by unbound $as_me 1.2.1, which was
1608 It was created by unbound $as_me 1.3.0, which was
15841609 generated by GNU Autoconf 2.61. Invocation command line was
15851610
15861611 $ $0 $@
19341959
19351960
19361961
1937 LIBUNBOUND_CURRENT=0
1938 LIBUNBOUND_REVISION=18
1962 LIBUNBOUND_CURRENT=1
1963 LIBUNBOUND_REVISION=0
19391964 LIBUNBOUND_AGE=0
19401965 # 1.0.0 had 0:12:0
19411966 # 1.0.1 had 0:13:0
19441969 # 1.1.1 had 0:16:0
19451970 # 1.2.0 had 0:17:0
19461971 # 1.2.1 had 0:18:0
1972 # 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
19471973
19481974 # Current -- the number of the binary API that we're implementing
19491975 # Revision -- which iteration of the implementation of the binary
33173343 ;;
33183344 esac
33193345
3346 # are we on MinGW?
3347 if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
3348 else on_mingw="no"; fi
3349
33203350 #
33213351 # Determine configuration file
33223352 # the eval is to evaluate shell expansion twice
3323 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
3353 if test $on_mingw = "no"; then
3354 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
3355 else
3356 ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
3357 fi
33243358
33253359 # Check whether --with-conf_file was given.
33263360 if test "${with_conf_file+set}" = set; then
33283362 fi
33293363
33303364
3365 hdr_config="`echo $ub_conf_file | sed -e 's/\\\\/\\\\\\\\/g'`"
3366
33313367
33323368 cat >>confdefs.h <<_ACEOF
3333 #define CONFIGFILE "$ub_conf_file"
3369 #define CONFIGFILE "$hdr_config"
33343370 _ACEOF
33353371
33363372
33403376 if test "${with_run_dir+set}" = set; then
33413377 withval=$with_run_dir; UNBOUND_RUN_DIR="$withval"
33423378 else
3343 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
3344 fi
3345
3379 if test $on_mingw = no; then
3380 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
3381 else
3382 UNBOUND_RUN_DIR=""
3383 fi
3384
3385 fi
3386
3387
3388 hdr_run="`echo $UNBOUND_RUN_DIR | sed -e 's/\\\\/\\\\\\\\/g'`"
33463389
33473390
33483391 cat >>confdefs.h <<_ACEOF
3349 #define RUN_DIR "$UNBOUND_RUN_DIR"
3392 #define RUN_DIR "$hdr_run"
33503393 _ACEOF
33513394
33523395
33553398 if test "${with_chroot_dir+set}" = set; then
33563399 withval=$with_chroot_dir; UNBOUND_CHROOT_DIR="$withval"
33573400 else
3358 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
3359 fi
3360
3401 if test $on_mingw = no; then
3402 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
3403 else
3404 UNBOUND_CHROOT_DIR=""
3405 fi
3406
3407 fi
3408
3409
3410 hdr_chroot="`echo $UNBOUND_CHOOT_DIR | sed -e 's/\\\\/\\\\\\\\/g'`"
33613411
33623412
33633413 cat >>confdefs.h <<_ACEOF
3364 #define CHROOT_DIR "$UNBOUND_CHROOT_DIR"
3414 #define CHROOT_DIR "$hdr_chroot"
3415 _ACEOF
3416
3417
3418
3419 # Check whether --with-share-dir was given.
3420 if test "${with_share_dir+set}" = set; then
3421 withval=$with_share_dir; UNBOUND_SHARE_DIR="$withval"
3422 else
3423 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR"
3424 fi
3425
3426
3427
3428 cat >>confdefs.h <<_ACEOF
3429 #define SHARE_DIR "$UNBOUND_SHARE_DIR"
33653430 _ACEOF
33663431
33673432
33703435 if test "${with_pidfile+set}" = set; then
33713436 withval=$with_pidfile; UNBOUND_PIDFILE="$withval"
33723437 else
3373 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
3374 fi
3375
3438 if test $on_mingw = no; then
3439 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
3440 else
3441 UNBOUND_PIDFILE=""
3442 fi
3443
3444 fi
3445
3446
3447 hdr_pid="`echo $UNBOUND_PIDFILE | sed -e 's/\\\\/\\\\\\\\/g'`"
33763448
33773449
33783450 cat >>confdefs.h <<_ACEOF
3379 #define PIDFILE "$UNBOUND_PIDFILE"
3451 #define PIDFILE "$hdr_pid"
33803452 _ACEOF
33813453
33823454
34003472 #define WINVER 0x0502
34013473 _ACEOF
34023474
3403
3404
3405
3406
3407
3408 # if the given code compiles without the flag, execute argument 4
3409 # if the given code only compiles with the flag, execute argument 3
3410 # otherwise fail, execute argument 5.
3475 wnvs=`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `
3476
3477
3478 cat >>confdefs.h <<_ACEOF
3479 #define RSRC_PACKAGE_VERSION $wnvs
3480 _ACEOF
34113481
34123482
34133483 # Checks for typedefs, structures, and compiler characteristics.
35383608 else
35393609 eval "cv_prog_cc_flag_$cache=no"
35403610 fi
3541 rm -f conftest*
3611 rm -f conftest conftest.o conftest.c
35423612
35433613 fi
35443614
35693639 else
35703640 eval "cv_prog_cc_flag_$cache=no"
35713641 fi
3572 rm -f conftest*
3642 rm -f conftest conftest.o conftest.c
35733643
35743644 fi
35753645
35853655
35863656 fi
35873657
3588
3589 # test DEPFLAG
3658 ac_ext=c
3659 ac_cpp='$CPP $CPPFLAGS'
3660 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3661 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3662 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3663 if test -n "$ac_tool_prefix"; then
3664 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
3665 set dummy ${ac_tool_prefix}gcc; ac_word=$2
3666 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3667 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3668 if test "${ac_cv_prog_CC+set}" = set; then
3669 echo $ECHO_N "(cached) $ECHO_C" >&6
3670 else
3671 if test -n "$CC"; then
3672 ac_cv_prog_CC="$CC" # Let the user override the test.
3673 else
3674 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3675 for as_dir in $PATH
3676 do
3677 IFS=$as_save_IFS
3678 test -z "$as_dir" && as_dir=.
3679 for ac_exec_ext in '' $ac_executable_extensions; do
3680 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3681 ac_cv_prog_CC="${ac_tool_prefix}gcc"
3682 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3683 break 2
3684 fi
3685 done
3686 done
3687 IFS=$as_save_IFS
3688
3689 fi
3690 fi
3691 CC=$ac_cv_prog_CC
3692 if test -n "$CC"; then
3693 { echo "$as_me:$LINENO: result: $CC" >&5
3694 echo "${ECHO_T}$CC" >&6; }
3695 else
3696 { echo "$as_me:$LINENO: result: no" >&5
3697 echo "${ECHO_T}no" >&6; }
3698 fi
3699
3700
3701 fi
3702 if test -z "$ac_cv_prog_CC"; then
3703 ac_ct_CC=$CC
3704 # Extract the first word of "gcc", so it can be a program name with args.
3705 set dummy gcc; ac_word=$2
3706 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3707 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3708 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
3709 echo $ECHO_N "(cached) $ECHO_C" >&6
3710 else
3711 if test -n "$ac_ct_CC"; then
3712 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
3713 else
3714 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3715 for as_dir in $PATH
3716 do
3717 IFS=$as_save_IFS
3718 test -z "$as_dir" && as_dir=.
3719 for ac_exec_ext in '' $ac_executable_extensions; do
3720 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3721 ac_cv_prog_ac_ct_CC="gcc"
3722 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3723 break 2
3724 fi
3725 done
3726 done
3727 IFS=$as_save_IFS
3728
3729 fi
3730 fi
3731 ac_ct_CC=$ac_cv_prog_ac_ct_CC
3732 if test -n "$ac_ct_CC"; then
3733 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
3734 echo "${ECHO_T}$ac_ct_CC" >&6; }
3735 else
3736 { echo "$as_me:$LINENO: result: no" >&5
3737 echo "${ECHO_T}no" >&6; }
3738 fi
3739
3740 if test "x$ac_ct_CC" = x; then
3741 CC=""
3742 else
3743 case $cross_compiling:$ac_tool_warned in
3744 yes:)
3745 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
3746 whose name does not start with the host triplet. If you think this
3747 configuration is useful to you, please write to autoconf@gnu.org." >&5
3748 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
3749 whose name does not start with the host triplet. If you think this
3750 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
3751 ac_tool_warned=yes ;;
3752 esac
3753 CC=$ac_ct_CC
3754 fi
3755 else
3756 CC="$ac_cv_prog_CC"
3757 fi
3758
3759 if test -z "$CC"; then
3760 if test -n "$ac_tool_prefix"; then
3761 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
3762 set dummy ${ac_tool_prefix}cc; ac_word=$2
3763 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3764 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3765 if test "${ac_cv_prog_CC+set}" = set; then
3766 echo $ECHO_N "(cached) $ECHO_C" >&6
3767 else
3768 if test -n "$CC"; then
3769 ac_cv_prog_CC="$CC" # Let the user override the test.
3770 else
3771 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3772 for as_dir in $PATH
3773 do
3774 IFS=$as_save_IFS
3775 test -z "$as_dir" && as_dir=.
3776 for ac_exec_ext in '' $ac_executable_extensions; do
3777 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3778 ac_cv_prog_CC="${ac_tool_prefix}cc"
3779 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3780 break 2
3781 fi
3782 done
3783 done
3784 IFS=$as_save_IFS
3785
3786 fi
3787 fi
3788 CC=$ac_cv_prog_CC
3789 if test -n "$CC"; then
3790 { echo "$as_me:$LINENO: result: $CC" >&5
3791 echo "${ECHO_T}$CC" >&6; }
3792 else
3793 { echo "$as_me:$LINENO: result: no" >&5
3794 echo "${ECHO_T}no" >&6; }
3795 fi
3796
3797
3798 fi
3799 fi
3800 if test -z "$CC"; then
3801 # Extract the first word of "cc", so it can be a program name with args.
3802 set dummy cc; ac_word=$2
3803 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3804 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3805 if test "${ac_cv_prog_CC+set}" = set; then
3806 echo $ECHO_N "(cached) $ECHO_C" >&6
3807 else
3808 if test -n "$CC"; then
3809 ac_cv_prog_CC="$CC" # Let the user override the test.
3810 else
3811 ac_prog_rejected=no
3812 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3813 for as_dir in $PATH
3814 do
3815 IFS=$as_save_IFS
3816 test -z "$as_dir" && as_dir=.
3817 for ac_exec_ext in '' $ac_executable_extensions; do
3818 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3819 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
3820 ac_prog_rejected=yes
3821 continue
3822 fi
3823 ac_cv_prog_CC="cc"
3824 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3825 break 2
3826 fi
3827 done
3828 done
3829 IFS=$as_save_IFS
3830
3831 if test $ac_prog_rejected = yes; then
3832 # We found a bogon in the path, so make sure we never use it.
3833 set dummy $ac_cv_prog_CC
3834 shift
3835 if test $# != 0; then
3836 # We chose a different compiler from the bogus one.
3837 # However, it has the same basename, so the bogon will be chosen
3838 # first if we set CC to just the basename; use the full file name.
3839 shift
3840 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
3841 fi
3842 fi
3843 fi
3844 fi
3845 CC=$ac_cv_prog_CC
3846 if test -n "$CC"; then
3847 { echo "$as_me:$LINENO: result: $CC" >&5
3848 echo "${ECHO_T}$CC" >&6; }
3849 else
3850 { echo "$as_me:$LINENO: result: no" >&5
3851 echo "${ECHO_T}no" >&6; }
3852 fi
3853
3854
3855 fi
3856 if test -z "$CC"; then
3857 if test -n "$ac_tool_prefix"; then
3858 for ac_prog in cl.exe
3859 do
3860 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
3861 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
3862 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3863 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3864 if test "${ac_cv_prog_CC+set}" = set; then
3865 echo $ECHO_N "(cached) $ECHO_C" >&6
3866 else
3867 if test -n "$CC"; then
3868 ac_cv_prog_CC="$CC" # Let the user override the test.
3869 else
3870 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3871 for as_dir in $PATH
3872 do
3873 IFS=$as_save_IFS
3874 test -z "$as_dir" && as_dir=.
3875 for ac_exec_ext in '' $ac_executable_extensions; do
3876 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3877 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
3878 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3879 break 2
3880 fi
3881 done
3882 done
3883 IFS=$as_save_IFS
3884
3885 fi
3886 fi
3887 CC=$ac_cv_prog_CC
3888 if test -n "$CC"; then
3889 { echo "$as_me:$LINENO: result: $CC" >&5
3890 echo "${ECHO_T}$CC" >&6; }
3891 else
3892 { echo "$as_me:$LINENO: result: no" >&5
3893 echo "${ECHO_T}no" >&6; }
3894 fi
3895
3896
3897 test -n "$CC" && break
3898 done
3899 fi
3900 if test -z "$CC"; then
3901 ac_ct_CC=$CC
3902 for ac_prog in cl.exe
3903 do
3904 # Extract the first word of "$ac_prog", so it can be a program name with args.
3905 set dummy $ac_prog; ac_word=$2
3906 { echo "$as_me:$LINENO: checking for $ac_word" >&5
3907 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
3908 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
3909 echo $ECHO_N "(cached) $ECHO_C" >&6
3910 else
3911 if test -n "$ac_ct_CC"; then
3912 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
3913 else
3914 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3915 for as_dir in $PATH
3916 do
3917 IFS=$as_save_IFS
3918 test -z "$as_dir" && as_dir=.
3919 for ac_exec_ext in '' $ac_executable_extensions; do
3920 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3921 ac_cv_prog_ac_ct_CC="$ac_prog"
3922 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3923 break 2
3924 fi
3925 done
3926 done
3927 IFS=$as_save_IFS
3928
3929 fi
3930 fi
3931 ac_ct_CC=$ac_cv_prog_ac_ct_CC
3932 if test -n "$ac_ct_CC"; then
3933 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
3934 echo "${ECHO_T}$ac_ct_CC" >&6; }
3935 else
3936 { echo "$as_me:$LINENO: result: no" >&5
3937 echo "${ECHO_T}no" >&6; }
3938 fi
3939
3940
3941 test -n "$ac_ct_CC" && break
3942 done
3943
3944 if test "x$ac_ct_CC" = x; then
3945 CC=""
3946 else
3947 case $cross_compiling:$ac_tool_warned in
3948 yes:)
3949 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
3950 whose name does not start with the host triplet. If you think this
3951 configuration is useful to you, please write to autoconf@gnu.org." >&5
3952 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
3953 whose name does not start with the host triplet. If you think this
3954 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
3955 ac_tool_warned=yes ;;
3956 esac
3957 CC=$ac_ct_CC
3958 fi
3959 fi
3960
3961 fi
3962
3963
3964 test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
3965 See \`config.log' for more details." >&5
3966 echo "$as_me: error: no acceptable C compiler found in \$PATH
3967 See \`config.log' for more details." >&2;}
3968 { (exit 1); exit 1; }; }
3969
3970 # Provide some information about the compiler.
3971 echo "$as_me:$LINENO: checking for C compiler version" >&5
3972 ac_compiler=`set X $ac_compile; echo $2`
3973 { (ac_try="$ac_compiler --version >&5"
3974 case "(($ac_try" in
3975 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3976 *) ac_try_echo=$ac_try;;
3977 esac
3978 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3979 (eval "$ac_compiler --version >&5") 2>&5
3980 ac_status=$?
3981 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3982 (exit $ac_status); }
3983 { (ac_try="$ac_compiler -v >&5"
3984 case "(($ac_try" in
3985 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3986 *) ac_try_echo=$ac_try;;
3987 esac
3988 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3989 (eval "$ac_compiler -v >&5") 2>&5
3990 ac_status=$?
3991 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3992 (exit $ac_status); }
3993 { (ac_try="$ac_compiler -V >&5"
3994 case "(($ac_try" in
3995 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3996 *) ac_try_echo=$ac_try;;
3997 esac
3998 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3999 (eval "$ac_compiler -V >&5") 2>&5
4000 ac_status=$?
4001 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4002 (exit $ac_status); }
4003
4004 { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
4005 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
4006 if test "${ac_cv_c_compiler_gnu+set}" = set; then
4007 echo $ECHO_N "(cached) $ECHO_C" >&6
4008 else
4009 cat >conftest.$ac_ext <<_ACEOF
4010 /* confdefs.h. */
4011 _ACEOF
4012 cat confdefs.h >>conftest.$ac_ext
4013 cat >>conftest.$ac_ext <<_ACEOF
4014 /* end confdefs.h. */
4015
4016 int
4017 main ()
4018 {
4019 #ifndef __GNUC__
4020 choke me
4021 #endif
4022
4023 ;
4024 return 0;
4025 }
4026 _ACEOF
4027 rm -f conftest.$ac_objext
4028 if { (ac_try="$ac_compile"
4029 case "(($ac_try" in
4030 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4031 *) ac_try_echo=$ac_try;;
4032 esac
4033 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4034 (eval "$ac_compile") 2>conftest.er1
4035 ac_status=$?
4036 grep -v '^ *+' conftest.er1 >conftest.err
4037 rm -f conftest.er1
4038 cat conftest.err >&5
4039 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4040 (exit $ac_status); } && {
4041 test -z "$ac_c_werror_flag" ||
4042 test ! -s conftest.err
4043 } && test -s conftest.$ac_objext; then
4044 ac_compiler_gnu=yes
4045 else
4046 echo "$as_me: failed program was:" >&5
4047 sed 's/^/| /' conftest.$ac_ext >&5
4048
4049 ac_compiler_gnu=no
4050 fi
4051
4052 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4053 ac_cv_c_compiler_gnu=$ac_compiler_gnu
4054
4055 fi
4056 { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
4057 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
4058 GCC=`test $ac_compiler_gnu = yes && echo yes`
4059 ac_test_CFLAGS=${CFLAGS+set}
4060 ac_save_CFLAGS=$CFLAGS
4061 { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
4062 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
4063 if test "${ac_cv_prog_cc_g+set}" = set; then
4064 echo $ECHO_N "(cached) $ECHO_C" >&6
4065 else
4066 ac_save_c_werror_flag=$ac_c_werror_flag
4067 ac_c_werror_flag=yes
4068 ac_cv_prog_cc_g=no
4069 CFLAGS="-g"
4070 cat >conftest.$ac_ext <<_ACEOF
4071 /* confdefs.h. */
4072 _ACEOF
4073 cat confdefs.h >>conftest.$ac_ext
4074 cat >>conftest.$ac_ext <<_ACEOF
4075 /* end confdefs.h. */
4076
4077 int
4078 main ()
4079 {
4080
4081 ;
4082 return 0;
4083 }
4084 _ACEOF
4085 rm -f conftest.$ac_objext
4086 if { (ac_try="$ac_compile"
4087 case "(($ac_try" in
4088 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4089 *) ac_try_echo=$ac_try;;
4090 esac
4091 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4092 (eval "$ac_compile") 2>conftest.er1
4093 ac_status=$?
4094 grep -v '^ *+' conftest.er1 >conftest.err
4095 rm -f conftest.er1
4096 cat conftest.err >&5
4097 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4098 (exit $ac_status); } && {
4099 test -z "$ac_c_werror_flag" ||
4100 test ! -s conftest.err
4101 } && test -s conftest.$ac_objext; then
4102 ac_cv_prog_cc_g=yes
4103 else
4104 echo "$as_me: failed program was:" >&5
4105 sed 's/^/| /' conftest.$ac_ext >&5
4106
4107 CFLAGS=""
4108 cat >conftest.$ac_ext <<_ACEOF
4109 /* confdefs.h. */
4110 _ACEOF
4111 cat confdefs.h >>conftest.$ac_ext
4112 cat >>conftest.$ac_ext <<_ACEOF
4113 /* end confdefs.h. */
4114
4115 int
4116 main ()
4117 {
4118
4119 ;
4120 return 0;
4121 }
4122 _ACEOF
4123 rm -f conftest.$ac_objext
4124 if { (ac_try="$ac_compile"
4125 case "(($ac_try" in
4126 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4127 *) ac_try_echo=$ac_try;;
4128 esac
4129 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4130 (eval "$ac_compile") 2>conftest.er1
4131 ac_status=$?
4132 grep -v '^ *+' conftest.er1 >conftest.err
4133 rm -f conftest.er1
4134 cat conftest.err >&5
4135 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4136 (exit $ac_status); } && {
4137 test -z "$ac_c_werror_flag" ||
4138 test ! -s conftest.err
4139 } && test -s conftest.$ac_objext; then
4140 :
4141 else
4142 echo "$as_me: failed program was:" >&5
4143 sed 's/^/| /' conftest.$ac_ext >&5
4144
4145 ac_c_werror_flag=$ac_save_c_werror_flag
4146 CFLAGS="-g"
4147 cat >conftest.$ac_ext <<_ACEOF
4148 /* confdefs.h. */
4149 _ACEOF
4150 cat confdefs.h >>conftest.$ac_ext
4151 cat >>conftest.$ac_ext <<_ACEOF
4152 /* end confdefs.h. */
4153
4154 int
4155 main ()
4156 {
4157
4158 ;
4159 return 0;
4160 }
4161 _ACEOF
4162 rm -f conftest.$ac_objext
4163 if { (ac_try="$ac_compile"
4164 case "(($ac_try" in
4165 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4166 *) ac_try_echo=$ac_try;;
4167 esac
4168 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4169 (eval "$ac_compile") 2>conftest.er1
4170 ac_status=$?
4171 grep -v '^ *+' conftest.er1 >conftest.err
4172 rm -f conftest.er1
4173 cat conftest.err >&5
4174 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4175 (exit $ac_status); } && {
4176 test -z "$ac_c_werror_flag" ||
4177 test ! -s conftest.err
4178 } && test -s conftest.$ac_objext; then
4179 ac_cv_prog_cc_g=yes
4180 else
4181 echo "$as_me: failed program was:" >&5
4182 sed 's/^/| /' conftest.$ac_ext >&5
4183
4184
4185 fi
4186
4187 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4188 fi
4189
4190 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4191 fi
4192
4193 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4194 ac_c_werror_flag=$ac_save_c_werror_flag
4195 fi
4196 { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
4197 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
4198 if test "$ac_test_CFLAGS" = set; then
4199 CFLAGS=$ac_save_CFLAGS
4200 elif test $ac_cv_prog_cc_g = yes; then
4201 if test "$GCC" = yes; then
4202 CFLAGS="-g -O2"
4203 else
4204 CFLAGS="-g"
4205 fi
4206 else
4207 if test "$GCC" = yes; then
4208 CFLAGS="-O2"
4209 else
4210 CFLAGS=
4211 fi
4212 fi
4213 { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
4214 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
4215 if test "${ac_cv_prog_cc_c89+set}" = set; then
4216 echo $ECHO_N "(cached) $ECHO_C" >&6
4217 else
4218 ac_cv_prog_cc_c89=no
4219 ac_save_CC=$CC
4220 cat >conftest.$ac_ext <<_ACEOF
4221 /* confdefs.h. */
4222 _ACEOF
4223 cat confdefs.h >>conftest.$ac_ext
4224 cat >>conftest.$ac_ext <<_ACEOF
4225 /* end confdefs.h. */
4226 #include <stdarg.h>
4227 #include <stdio.h>
4228 #include <sys/types.h>
4229 #include <sys/stat.h>
4230 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
4231 struct buf { int x; };
4232 FILE * (*rcsopen) (struct buf *, struct stat *, int);
4233 static char *e (p, i)
4234 char **p;
4235 int i;
4236 {
4237 return p[i];
4238 }
4239 static char *f (char * (*g) (char **, int), char **p, ...)
4240 {
4241 char *s;
4242 va_list v;
4243 va_start (v,p);
4244 s = g (p, va_arg (v,int));
4245 va_end (v);
4246 return s;
4247 }
4248
4249 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
4250 function prototypes and stuff, but not '\xHH' hex character constants.
4251 These don't provoke an error unfortunately, instead are silently treated
4252 as 'x'. The following induces an error, until -std is added to get
4253 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
4254 array size at least. It's necessary to write '\x00'==0 to get something
4255 that's true only with -std. */
4256 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
4257
4258 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
4259 inside strings and character constants. */
4260 #define FOO(x) 'x'
4261 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
4262
4263 int test (int i, double x);
4264 struct s1 {int (*f) (int a);};
4265 struct s2 {int (*f) (double a);};
4266 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
4267 int argc;
4268 char **argv;
4269 int
4270 main ()
4271 {
4272 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
4273 ;
4274 return 0;
4275 }
4276 _ACEOF
4277 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
4278 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
4279 do
4280 CC="$ac_save_CC $ac_arg"
4281 rm -f conftest.$ac_objext
4282 if { (ac_try="$ac_compile"
4283 case "(($ac_try" in
4284 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4285 *) ac_try_echo=$ac_try;;
4286 esac
4287 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4288 (eval "$ac_compile") 2>conftest.er1
4289 ac_status=$?
4290 grep -v '^ *+' conftest.er1 >conftest.err
4291 rm -f conftest.er1
4292 cat conftest.err >&5
4293 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4294 (exit $ac_status); } && {
4295 test -z "$ac_c_werror_flag" ||
4296 test ! -s conftest.err
4297 } && test -s conftest.$ac_objext; then
4298 ac_cv_prog_cc_c89=$ac_arg
4299 else
4300 echo "$as_me: failed program was:" >&5
4301 sed 's/^/| /' conftest.$ac_ext >&5
4302
4303
4304 fi
4305
4306 rm -f core conftest.err conftest.$ac_objext
4307 test "x$ac_cv_prog_cc_c89" != "xno" && break
4308 done
4309 rm -f conftest.$ac_ext
4310 CC=$ac_save_CC
4311
4312 fi
4313 # AC_CACHE_VAL
4314 case "x$ac_cv_prog_cc_c89" in
4315 x)
4316 { echo "$as_me:$LINENO: result: none needed" >&5
4317 echo "${ECHO_T}none needed" >&6; } ;;
4318 xno)
4319 { echo "$as_me:$LINENO: result: unsupported" >&5
4320 echo "${ECHO_T}unsupported" >&6; } ;;
4321 *)
4322 CC="$CC $ac_cv_prog_cc_c89"
4323 { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
4324 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
4325 esac
4326
4327
4328 ac_ext=c
4329 ac_cpp='$CPP $CPPFLAGS'
4330 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4331 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4332 ac_compiler_gnu=$ac_cv_c_compiler_gnu
4333
4334
35904335 { echo "$as_me:$LINENO: checking $CC dependency flag" >&5
35914336 echo $ECHO_N "checking $CC dependency flag... $ECHO_C" >&6; }
35924337 echo 'void f(){}' >conftest.c
36024347 { echo "$as_me:$LINENO: result: $DEPFLAG" >&5
36034348 echo "${ECHO_T}$DEPFLAG" >&6; }
36044349 rm -f conftest.c
3605
3606
3607
3608
3609 { echo "$as_me:$LINENO: checking whether $CC supports -std=c99" >&5
3610 echo $ECHO_N "checking whether $CC supports -std=c99... $ECHO_C" >&6; }
3611 cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
3612 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
3613 echo $ECHO_N "(cached) $ECHO_C" >&6
3614 else
3615
3616 echo 'void f(){}' >conftest.c
3617 if test -z "`$CC -std=c99 -c conftest.c 2>&1`"; then
3618 eval "cv_prog_cc_flag_$cache=yes"
3619 else
3620 eval "cv_prog_cc_flag_$cache=no"
3621 fi
3622 rm -f conftest*
3623
3624 fi
3625
3626 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
3627 { echo "$as_me:$LINENO: result: yes" >&5
3628 echo "${ECHO_T}yes" >&6; }
3629 :
3630 C99FLAG="-std=c99"
3631 else
3632 { echo "$as_me:$LINENO: result: no" >&5
3633 echo "${ECHO_T}no" >&6; }
3634 :
3635
3636 fi
3637
3638
3639
3640 { echo "$as_me:$LINENO: checking whether $CC supports -xc99" >&5
3641 echo $ECHO_N "checking whether $CC supports -xc99... $ECHO_C" >&6; }
3642 cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
3643 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
3644 echo $ECHO_N "(cached) $ECHO_C" >&6
3645 else
3646
3647 echo 'void f(){}' >conftest.c
3648 if test -z "`$CC -xc99 -c conftest.c 2>&1`"; then
3649 eval "cv_prog_cc_flag_$cache=yes"
3650 else
3651 eval "cv_prog_cc_flag_$cache=no"
3652 fi
3653 rm -f conftest*
3654
3655 fi
3656
3657 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
3658 { echo "$as_me:$LINENO: result: yes" >&5
3659 echo "${ECHO_T}yes" >&6; }
3660 :
3661 C99FLAG="-xc99"
3662 else
3663 { echo "$as_me:$LINENO: result: no" >&5
3664 echo "${ECHO_T}no" >&6; }
3665 :
3666
3667 fi
36684350
36694351
36704352 { echo "$as_me:$LINENO: checking for ANSI C header files" >&5
39124594
39134595
39144596
4597
4598 { echo "$as_me:$LINENO: checking whether $CC supports -Werror" >&5
4599 echo $ECHO_N "checking whether $CC supports -Werror... $ECHO_C" >&6; }
4600 cache=`echo Werror | sed 'y%.=/+-%___p_%'`
4601 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4602 echo $ECHO_N "(cached) $ECHO_C" >&6
4603 else
4604
4605 echo 'void f(){}' >conftest.c
4606 if test -z "`$CC -Werror -c conftest.c 2>&1`"; then
4607 eval "cv_prog_cc_flag_$cache=yes"
4608 else
4609 eval "cv_prog_cc_flag_$cache=no"
4610 fi
4611 rm -f conftest conftest.o conftest.c
4612
4613 fi
4614
4615 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4616 { echo "$as_me:$LINENO: result: yes" >&5
4617 echo "${ECHO_T}yes" >&6; }
4618 :
4619 ERRFLAG="-Werror"
4620 else
4621 { echo "$as_me:$LINENO: result: no" >&5
4622 echo "${ECHO_T}no" >&6; }
4623 :
4624 ERRFLAG="-errwarn"
4625 fi
4626
4627
4628
4629 { echo "$as_me:$LINENO: checking whether $CC supports -Wall" >&5
4630 echo $ECHO_N "checking whether $CC supports -Wall... $ECHO_C" >&6; }
4631 cache=`echo Wall | sed 'y%.=/+-%___p_%'`
4632 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4633 echo $ECHO_N "(cached) $ECHO_C" >&6
4634 else
4635
4636 echo 'void f(){}' >conftest.c
4637 if test -z "`$CC -Wall -c conftest.c 2>&1`"; then
4638 eval "cv_prog_cc_flag_$cache=yes"
4639 else
4640 eval "cv_prog_cc_flag_$cache=no"
4641 fi
4642 rm -f conftest conftest.o conftest.c
4643
4644 fi
4645
4646 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4647 { echo "$as_me:$LINENO: result: yes" >&5
4648 echo "${ECHO_T}yes" >&6; }
4649 :
4650 ERRFLAG="$ERRFLAG -Wall"
4651 else
4652 { echo "$as_me:$LINENO: result: no" >&5
4653 echo "${ECHO_T}no" >&6; }
4654 :
4655 ERRFLAG="$ERRFLAG -errfmt"
4656 fi
4657
4658
4659
4660
4661
4662 { echo "$as_me:$LINENO: checking whether $CC supports -std=c99" >&5
4663 echo $ECHO_N "checking whether $CC supports -std=c99... $ECHO_C" >&6; }
4664 cache=`echo std=c99 | sed 'y%.=/+-%___p_%'`
4665 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4666 echo $ECHO_N "(cached) $ECHO_C" >&6
4667 else
4668
4669 echo 'void f(){}' >conftest.c
4670 if test -z "`$CC -std=c99 -c conftest.c 2>&1`"; then
4671 eval "cv_prog_cc_flag_$cache=yes"
4672 else
4673 eval "cv_prog_cc_flag_$cache=no"
4674 fi
4675 rm -f conftest conftest.o conftest.c
4676
4677 fi
4678
4679 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4680 { echo "$as_me:$LINENO: result: yes" >&5
4681 echo "${ECHO_T}yes" >&6; }
4682 :
4683 C99FLAG="-std=c99"
4684 else
4685 { echo "$as_me:$LINENO: result: no" >&5
4686 echo "${ECHO_T}no" >&6; }
4687 :
4688
4689 fi
4690
4691
4692
4693 { echo "$as_me:$LINENO: checking whether $CC supports -xc99" >&5
4694 echo $ECHO_N "checking whether $CC supports -xc99... $ECHO_C" >&6; }
4695 cache=`echo xc99 | sed 'y%.=/+-%___p_%'`
4696 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4697 echo $ECHO_N "(cached) $ECHO_C" >&6
4698 else
4699
4700 echo 'void f(){}' >conftest.c
4701 if test -z "`$CC -xc99 -c conftest.c 2>&1`"; then
4702 eval "cv_prog_cc_flag_$cache=yes"
4703 else
4704 eval "cv_prog_cc_flag_$cache=no"
4705 fi
4706 rm -f conftest conftest.o conftest.c
4707
4708 fi
4709
4710 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4711 { echo "$as_me:$LINENO: result: yes" >&5
4712 echo "${ECHO_T}yes" >&6; }
4713 :
4714 C99FLAG="-xc99"
4715 else
4716 { echo "$as_me:$LINENO: result: no" >&5
4717 echo "${ECHO_T}no" >&6; }
4718 :
4719
4720 fi
4721
4722
4723
4724
39154725 for ac_header in getopt.h time.h
39164726 do
39174727 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
39704780 done
39714781
39724782
3973 # MinGW32 tests
3974
3975
3976 for ac_header in winsock2.h ws2tcpip.h
3977 do
3978 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3979 { echo "$as_me:$LINENO: checking for $ac_header" >&5
3980 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
3981 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
3982 echo $ECHO_N "(cached) $ECHO_C" >&6
3983 else
3984 cat >conftest.$ac_ext <<_ACEOF
3985 /* confdefs.h. */
3986 _ACEOF
3987 cat confdefs.h >>conftest.$ac_ext
3988 cat >>conftest.$ac_ext <<_ACEOF
3989 /* end confdefs.h. */
3990 $ac_includes_default
3991
3992 #include <$ac_header>
3993 _ACEOF
3994 rm -f conftest.$ac_objext
3995 if { (ac_try="$ac_compile"
3996 case "(($ac_try" in
3997 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3998 *) ac_try_echo=$ac_try;;
3999 esac
4000 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4001 (eval "$ac_compile") 2>conftest.er1
4002 ac_status=$?
4003 grep -v '^ *+' conftest.er1 >conftest.err
4004 rm -f conftest.er1
4005 cat conftest.err >&5
4006 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4007 (exit $ac_status); } && {
4008 test -z "$ac_c_werror_flag" ||
4009 test ! -s conftest.err
4010 } && test -s conftest.$ac_objext; then
4011 eval "$as_ac_Header=yes"
4012 else
4013 echo "$as_me: failed program was:" >&5
4014 sed 's/^/| /' conftest.$ac_ext >&5
4015
4016 eval "$as_ac_Header=no"
4017 fi
4018
4019 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4020 fi
4021 ac_res=`eval echo '${'$as_ac_Header'}'`
4022 { echo "$as_me:$LINENO: result: $ac_res" >&5
4023 echo "${ECHO_T}$ac_res" >&6; }
4024 if test `eval echo '${'$as_ac_Header'}'` = yes; then
4025 cat >>confdefs.h <<_ACEOF
4026 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
4027 _ACEOF
4028
4029 fi
4030
4031 done
4032
4033 # end mingw32 tests
4034
4035
4036
4037
4038 { echo "$as_me:$LINENO: checking whether $CC supports -Werror" >&5
4039 echo $ECHO_N "checking whether $CC supports -Werror... $ECHO_C" >&6; }
4040 cache=`echo Werror | sed 'y%.=/+-%___p_%'`
4041 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4042 echo $ECHO_N "(cached) $ECHO_C" >&6
4043 else
4044
4045 echo 'void f(){}' >conftest.c
4046 if test -z "`$CC -Werror -c conftest.c 2>&1`"; then
4047 eval "cv_prog_cc_flag_$cache=yes"
4048 else
4049 eval "cv_prog_cc_flag_$cache=no"
4050 fi
4051 rm -f conftest*
4052
4053 fi
4054
4055 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4056 { echo "$as_me:$LINENO: result: yes" >&5
4057 echo "${ECHO_T}yes" >&6; }
4058 :
4059 ERRFLAG="-Werror"
4060 else
4061 { echo "$as_me:$LINENO: result: no" >&5
4062 echo "${ECHO_T}no" >&6; }
4063 :
4064 ERRFLAG="-errwarn"
4065 fi
4066
4067
4068
4069 { echo "$as_me:$LINENO: checking whether $CC supports -Wall" >&5
4070 echo $ECHO_N "checking whether $CC supports -Wall... $ECHO_C" >&6; }
4071 cache=`echo Wall | sed 'y%.=/+-%___p_%'`
4072 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
4073 echo $ECHO_N "(cached) $ECHO_C" >&6
4074 else
4075
4076 echo 'void f(){}' >conftest.c
4077 if test -z "`$CC -Wall -c conftest.c 2>&1`"; then
4078 eval "cv_prog_cc_flag_$cache=yes"
4079 else
4080 eval "cv_prog_cc_flag_$cache=no"
4081 fi
4082 rm -f conftest*
4083
4084 fi
4085
4086 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
4087 { echo "$as_me:$LINENO: result: yes" >&5
4088 echo "${ECHO_T}yes" >&6; }
4089 :
4090 ERRFLAG="$ERRFLAG -Wall"
4091 else
4092 { echo "$as_me:$LINENO: result: no" >&5
4093 echo "${ECHO_T}no" >&6; }
4094 :
4095 ERRFLAG="$ERRFLAG -errfmt"
4096 fi
4097
4098
40994783
41004784
41014785
41024786 { echo "$as_me:$LINENO: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC" >&5
41034787 echo $ECHO_N "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC... $ECHO_C" >&6; }
4104 cache=`echo $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE | sed 'y%.=/+- %___p__%'`
4788 cache=`echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" | $as_tr_sh`
41054789 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
41064790 echo $ECHO_N "(cached) $ECHO_C" >&6
41074791 else
41564840 fi
41574841
41584842 fi
4159 rm -f conftest
4843 rm -f conftest conftest.c conftest.o
41604844
41614845 fi
41624846
41904874
41914875 { echo "$as_me:$LINENO: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC" >&5
41924876 echo $ECHO_N "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC... $ECHO_C" >&6; }
4193 cache=`echo $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE | sed 'y%.=/+- %___p__%'`
4877 cache=`echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" | $as_tr_sh`
41944878 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
41954879 echo $ECHO_N "(cached) $ECHO_C" >&6
41964880 else
42454929 fi
42464930
42474931 fi
4248 rm -f conftest
4932 rm -f conftest conftest.c conftest.o
42494933
42504934 fi
42514935
42794963
42804964 { echo "$as_me:$LINENO: checking whether we need $C99FLAG as a flag for $CC" >&5
42814965 echo $ECHO_N "checking whether we need $C99FLAG as a flag for $CC... $ECHO_C" >&6; }
4282 cache=`echo $C99FLAG | sed 'y%.=/+- %___p__%'`
4966 cache=`echo "$C99FLAG" | $as_tr_sh`
42834967 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
42844968 echo $ECHO_N "(cached) $ECHO_C" >&6
42854969 else
43094993 fi
43104994
43114995 fi
4312 rm -f conftest
4996 rm -f conftest conftest.c conftest.o
43134997
43144998 fi
43154999
43435027
43445028 { echo "$as_me:$LINENO: checking whether we need -D_BSD_SOURCE as a flag for $CC" >&5
43455029 echo $ECHO_N "checking whether we need -D_BSD_SOURCE as a flag for $CC... $ECHO_C" >&6; }
4346 cache=`echo -D_BSD_SOURCE | sed 'y%.=/+- %___p__%'`
5030 cache=_D_BSD_SOURCE
43475031 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
43485032 echo $ECHO_N "(cached) $ECHO_C" >&6
43495033 else
43745058 fi
43755059
43765060 fi
4377 rm -f conftest
5061 rm -f conftest conftest.c conftest.o
43785062
43795063 fi
43805064
44085092
44095093 { echo "$as_me:$LINENO: checking whether we need -D_GNU_SOURCE as a flag for $CC" >&5
44105094 echo $ECHO_N "checking whether we need -D_GNU_SOURCE as a flag for $CC... $ECHO_C" >&6; }
4411 cache=`echo -D_GNU_SOURCE | sed 'y%.=/+- %___p__%'`
5095 cache=_D_GNU_SOURCE
44125096 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
44135097 echo $ECHO_N "(cached) $ECHO_C" >&6
44145098 else
44395123 fi
44405124
44415125 fi
4442 rm -f conftest
5126 rm -f conftest conftest.c conftest.o
44435127
44445128 fi
44455129
44765160
44775161 { echo "$as_me:$LINENO: checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC" >&5
44785162 echo $ECHO_N "checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC... $ECHO_C" >&6; }
4479 cache=`echo -D_GNU_SOURCE -D_FRSRESGID | sed 'y%.=/+- %___p__%'`
5163 cache=_D_GNU_SOURCE__D_FRSRESGID
44805164 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
44815165 echo $ECHO_N "(cached) $ECHO_C" >&6
44825166 else
45075191 fi
45085192
45095193 fi
4510 rm -f conftest
5194 rm -f conftest conftest.c conftest.o
45115195
45125196 fi
45135197
45415225
45425226 { echo "$as_me:$LINENO: checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC" >&5
45435227 echo $ECHO_N "checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC... $ECHO_C" >&6; }
4544 cache=`echo -D_POSIX_C_SOURCE=200112 | sed 'y%.=/+- %___p__%'`
5228 cache=_D_POSIX_C_SOURCE_200112
45455229 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
45465230 echo $ECHO_N "(cached) $ECHO_C" >&6
45475231 else
45815265 fi
45825266
45835267 fi
4584 rm -f conftest
5268 rm -f conftest conftest.c conftest.o
45855269
45865270 fi
45875271
46155299
46165300 { echo "$as_me:$LINENO: checking whether we need -D__EXTENSIONS__ as a flag for $CC" >&5
46175301 echo $ECHO_N "checking whether we need -D__EXTENSIONS__ as a flag for $CC... $ECHO_C" >&6; }
4618 cache=`echo -D__EXTENSIONS__ | sed 'y%.=/+- %___p__%'`
5302 cache=_D__EXTENSIONS__
46195303 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
46205304 echo $ECHO_N "(cached) $ECHO_C" >&6
46215305 else
46615345 fi
46625346
46635347 fi
4664 rm -f conftest
5348 rm -f conftest conftest.c conftest.o
46655349
46665350 fi
46675351
46905374 fi
46915375
46925376
5377
5378
46935379 # for Sun studio 11.
46945380
46955381
47065392 else
47075393 eval "cv_prog_cc_flag_$cache=no"
47085394 fi
4709 rm -f conftest*
5395 rm -f conftest conftest.o conftest.c
47105396
47115397 fi
47125398
47375423 else
47385424 eval "cv_prog_cc_flag_$cache=no"
47395425 fi
4740 rm -f conftest*
5426 rm -f conftest conftest.o conftest.c
47415427
47425428 fi
47435429
47535439
47545440 fi
47555441
4756 # flag warnings.
5442
5443 # debug mode flags warnings
47575444 # Check whether --enable-debug was given.
47585445 if test "${enable_debug+set}" = set; then
47595446 enableval=$enable_debug;
47785465 else
47795466 eval "cv_prog_cc_flag_$cache=no"
47805467 fi
4781 rm -f conftest*
5468 rm -f conftest conftest.o conftest.c
47825469
47835470 fi
47845471
48095496 else
48105497 eval "cv_prog_cc_flag_$cache=no"
48115498 fi
4812 rm -f conftest*
5499 rm -f conftest conftest.o conftest.c
48135500
48145501 fi
48155502
48405527 else
48415528 eval "cv_prog_cc_flag_$cache=no"
48425529 fi
4843 rm -f conftest*
5530 rm -f conftest conftest.o conftest.c
48445531
48455532 fi
48465533
48715558 else
48725559 eval "cv_prog_cc_flag_$cache=no"
48735560 fi
4874 rm -f conftest*
5561 rm -f conftest conftest.o conftest.c
48755562
48765563 fi
48775564
49685655 esac
49695656
49705657
4971
4972
4973
49745658 { echo "$as_me:$LINENO: checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute" >&5
49755659 echo $ECHO_N "checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute... $ECHO_C" >&6; }
49765660 if test "${ac_cv_c_format_attribute+set}" = set; then
50935777 fi
50945778
50955779
5780
5781
50965782 { echo "$as_me:$LINENO: result: $ac_cv_c_unused_attribute" >&5
50975783 echo "${ECHO_T}$ac_cv_c_unused_attribute" >&6; }
50985784 if test $ac_cv_c_unused_attribute = yes; then
51085794 CPPFLAGS="$CPPFLAGS -I$srcdir"
51095795 fi
51105796
5111 # skip these tests, we do not need them.
5112
5113
5114
5115
5116
5117
5118
5119
5120 # always use ./libtool unless override from commandline (libtool=mylibtool)
5121 if test -z "$libtool"; then
5122 libtool="./libtool"
5123 fi
5124
5125 if test -n "$ac_tool_prefix"; then
5126 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
5127 set dummy ${ac_tool_prefix}ar; ac_word=$2
5797 for ac_prog in flex lex
5798 do
5799 # Extract the first word of "$ac_prog", so it can be a program name with args.
5800 set dummy $ac_prog; ac_word=$2
51285801 { echo "$as_me:$LINENO: checking for $ac_word" >&5
51295802 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5130 if test "${ac_cv_path_AR+set}" = set; then
5803 if test "${ac_cv_prog_LEX+set}" = set; then
51315804 echo $ECHO_N "(cached) $ECHO_C" >&6
51325805 else
5133 case $AR in
5134 [\\/]* | ?:[\\/]*)
5135 ac_cv_path_AR="$AR" # Let the user override the test with a path.
5136 ;;
5137 *)
5138 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5806 if test -n "$LEX"; then
5807 ac_cv_prog_LEX="$LEX" # Let the user override the test.
5808 else
5809 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
51395810 for as_dir in $PATH
51405811 do
51415812 IFS=$as_save_IFS
51425813 test -z "$as_dir" && as_dir=.
51435814 for ac_exec_ext in '' $ac_executable_extensions; do
51445815 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5145 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
5816 ac_cv_prog_LEX="$ac_prog"
51465817 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
51475818 break 2
51485819 fi
51505821 done
51515822 IFS=$as_save_IFS
51525823
5153 ;;
5154 esac
5155 fi
5156 AR=$ac_cv_path_AR
5157 if test -n "$AR"; then
5158 { echo "$as_me:$LINENO: result: $AR" >&5
5159 echo "${ECHO_T}$AR" >&6; }
5824 fi
5825 fi
5826 LEX=$ac_cv_prog_LEX
5827 if test -n "$LEX"; then
5828 { echo "$as_me:$LINENO: result: $LEX" >&5
5829 echo "${ECHO_T}$LEX" >&6; }
51605830 else
51615831 { echo "$as_me:$LINENO: result: no" >&5
51625832 echo "${ECHO_T}no" >&6; }
51635833 fi
51645834
51655835
5166 fi
5167 if test -z "$ac_cv_path_AR"; then
5168 ac_pt_AR=$AR
5169 # Extract the first word of "ar", so it can be a program name with args.
5170 set dummy ar; ac_word=$2
5836 test -n "$LEX" && break
5837 done
5838 test -n "$LEX" || LEX=":"
5839
5840 if test "x$LEX" != "x:"; then
5841 cat >conftest.l <<_ACEOF
5842 %%
5843 a { ECHO; }
5844 b { REJECT; }
5845 c { yymore (); }
5846 d { yyless (1); }
5847 e { yyless (input () != 0); }
5848 f { unput (yytext[0]); }
5849 . { BEGIN INITIAL; }
5850 %%
5851 #ifdef YYTEXT_POINTER
5852 extern char *yytext;
5853 #endif
5854 int
5855 main (void)
5856 {
5857 return ! yylex () + ! yywrap ();
5858 }
5859 _ACEOF
5860 { (ac_try="$LEX conftest.l"
5861 case "(($ac_try" in
5862 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5863 *) ac_try_echo=$ac_try;;
5864 esac
5865 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5866 (eval "$LEX conftest.l") 2>&5
5867 ac_status=$?
5868 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5869 (exit $ac_status); }
5870 { echo "$as_me:$LINENO: checking lex output file root" >&5
5871 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
5872 if test "${ac_cv_prog_lex_root+set}" = set; then
5873 echo $ECHO_N "(cached) $ECHO_C" >&6
5874 else
5875
5876 if test -f lex.yy.c; then
5877 ac_cv_prog_lex_root=lex.yy
5878 elif test -f lexyy.c; then
5879 ac_cv_prog_lex_root=lexyy
5880 else
5881 { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
5882 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
5883 { (exit 1); exit 1; }; }
5884 fi
5885 fi
5886 { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
5887 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
5888 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
5889
5890 if test -z "${LEXLIB+set}"; then
5891 { echo "$as_me:$LINENO: checking lex library" >&5
5892 echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
5893 if test "${ac_cv_lib_lex+set}" = set; then
5894 echo $ECHO_N "(cached) $ECHO_C" >&6
5895 else
5896
5897 ac_save_LIBS=$LIBS
5898 ac_cv_lib_lex='none needed'
5899 for ac_lib in '' -lfl -ll; do
5900 LIBS="$ac_lib $ac_save_LIBS"
5901 cat >conftest.$ac_ext <<_ACEOF
5902 `cat $LEX_OUTPUT_ROOT.c`
5903 _ACEOF
5904 rm -f conftest.$ac_objext conftest$ac_exeext
5905 if { (ac_try="$ac_link"
5906 case "(($ac_try" in
5907 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5908 *) ac_try_echo=$ac_try;;
5909 esac
5910 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5911 (eval "$ac_link") 2>conftest.er1
5912 ac_status=$?
5913 grep -v '^ *+' conftest.er1 >conftest.err
5914 rm -f conftest.er1
5915 cat conftest.err >&5
5916 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5917 (exit $ac_status); } && {
5918 test -z "$ac_c_werror_flag" ||
5919 test ! -s conftest.err
5920 } && test -s conftest$ac_exeext &&
5921 $as_test_x conftest$ac_exeext; then
5922 ac_cv_lib_lex=$ac_lib
5923 else
5924 echo "$as_me: failed program was:" >&5
5925 sed 's/^/| /' conftest.$ac_ext >&5
5926
5927
5928 fi
5929
5930 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5931 conftest$ac_exeext conftest.$ac_ext
5932 test "$ac_cv_lib_lex" != 'none needed' && break
5933 done
5934 LIBS=$ac_save_LIBS
5935
5936 fi
5937 { echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
5938 echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
5939 test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
5940 fi
5941
5942
5943 { echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
5944 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
5945 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
5946 echo $ECHO_N "(cached) $ECHO_C" >&6
5947 else
5948 # POSIX says lex can declare yytext either as a pointer or an array; the
5949 # default is implementation-dependent. Figure out which it is, since
5950 # not all implementations provide the %pointer and %array declarations.
5951 ac_cv_prog_lex_yytext_pointer=no
5952 ac_save_LIBS=$LIBS
5953 LIBS="$LEXLIB $ac_save_LIBS"
5954 cat >conftest.$ac_ext <<_ACEOF
5955 #define YYTEXT_POINTER 1
5956 `cat $LEX_OUTPUT_ROOT.c`
5957 _ACEOF
5958 rm -f conftest.$ac_objext conftest$ac_exeext
5959 if { (ac_try="$ac_link"
5960 case "(($ac_try" in
5961 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5962 *) ac_try_echo=$ac_try;;
5963 esac
5964 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5965 (eval "$ac_link") 2>conftest.er1
5966 ac_status=$?
5967 grep -v '^ *+' conftest.er1 >conftest.err
5968 rm -f conftest.er1
5969 cat conftest.err >&5
5970 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5971 (exit $ac_status); } && {
5972 test -z "$ac_c_werror_flag" ||
5973 test ! -s conftest.err
5974 } && test -s conftest$ac_exeext &&
5975 $as_test_x conftest$ac_exeext; then
5976 ac_cv_prog_lex_yytext_pointer=yes
5977 else
5978 echo "$as_me: failed program was:" >&5
5979 sed 's/^/| /' conftest.$ac_ext >&5
5980
5981
5982 fi
5983
5984 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5985 conftest$ac_exeext conftest.$ac_ext
5986 LIBS=$ac_save_LIBS
5987
5988 fi
5989 { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
5990 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
5991 if test $ac_cv_prog_lex_yytext_pointer = yes; then
5992
5993 cat >>confdefs.h <<\_ACEOF
5994 #define YYTEXT_POINTER 1
5995 _ACEOF
5996
5997 fi
5998 rm -f conftest.l $LEX_OUTPUT_ROOT.c
5999
6000 fi
6001 for ac_prog in 'bison -y' byacc
6002 do
6003 # Extract the first word of "$ac_prog", so it can be a program name with args.
6004 set dummy $ac_prog; ac_word=$2
51716005 { echo "$as_me:$LINENO: checking for $ac_word" >&5
51726006 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5173 if test "${ac_cv_path_ac_pt_AR+set}" = set; then
6007 if test "${ac_cv_prog_YACC+set}" = set; then
51746008 echo $ECHO_N "(cached) $ECHO_C" >&6
51756009 else
5176 case $ac_pt_AR in
5177 [\\/]* | ?:[\\/]*)
5178 ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path.
5179 ;;
5180 *)
5181 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6010 if test -n "$YACC"; then
6011 ac_cv_prog_YACC="$YACC" # Let the user override the test.
6012 else
6013 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
51826014 for as_dir in $PATH
51836015 do
51846016 IFS=$as_save_IFS
51856017 test -z "$as_dir" && as_dir=.
51866018 for ac_exec_ext in '' $ac_executable_extensions; do
51876019 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5188 ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext"
6020 ac_cv_prog_YACC="$ac_prog"
51896021 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
51906022 break 2
51916023 fi
51936025 done
51946026 IFS=$as_save_IFS
51956027
5196 ;;
5197 esac
5198 fi
5199 ac_pt_AR=$ac_cv_path_ac_pt_AR
5200 if test -n "$ac_pt_AR"; then
5201 { echo "$as_me:$LINENO: result: $ac_pt_AR" >&5
5202 echo "${ECHO_T}$ac_pt_AR" >&6; }
6028 fi
6029 fi
6030 YACC=$ac_cv_prog_YACC
6031 if test -n "$YACC"; then
6032 { echo "$as_me:$LINENO: result: $YACC" >&5
6033 echo "${ECHO_T}$YACC" >&6; }
52036034 else
52046035 { echo "$as_me:$LINENO: result: no" >&5
52056036 echo "${ECHO_T}no" >&6; }
52066037 fi
52076038
5208 if test "x$ac_pt_AR" = x; then
5209 AR="false"
5210 else
5211 case $cross_compiling:$ac_tool_warned in
5212 yes:)
5213 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
5214 whose name does not start with the host triplet. If you think this
5215 configuration is useful to you, please write to autoconf@gnu.org." >&5
5216 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
5217 whose name does not start with the host triplet. If you think this
5218 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
5219 ac_tool_warned=yes ;;
5220 esac
5221 AR=$ac_pt_AR
5222 fi
5223 else
5224 AR="$ac_cv_path_AR"
5225 fi
5226
5227 if test $AR = false; then
5228 { { echo "$as_me:$LINENO: error: Cannot find 'ar', please extend PATH to include it" >&5
5229 echo "$as_me: error: Cannot find 'ar', please extend PATH to include it" >&2;}
5230 { (exit 1); exit 1; }; }
5231 fi
6039
6040 test -n "$YACC" && break
6041 done
6042 test -n "$YACC" || YACC="yacc"
6043
52326044 # Extract the first word of "doxygen", so it can be a program name with args.
52336045 set dummy doxygen; ac_word=$2
52346046 { echo "$as_me:$LINENO: checking for $ac_word" >&5
52666078 fi
52676079
52686080
5269 # avoid libtool max commandline length test on systems that fork slowly.
52706081 ac_aux_dir=
52716082 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
52726083 if test -f "$ac_dir/install-sh"; then
53446155 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
53456156
53466157
6158
6159 # skip these tests, we do not need them.
6160
6161
6162
6163
6164
6165
6166
6167
6168 # always use ./libtool unless override from commandline (libtool=mylibtool)
6169 if test -z "$libtool"; then
6170 libtool="./libtool"
6171 fi
6172
6173 # avoid libtool max commandline length test on systems that fork slowly.
53476174 { echo "$as_me:$LINENO: checking host system type" >&5
53486175 echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
53496176 if test "${ac_cv_host+set}" = set; then
53846211 if echo "$host_os" | grep "sunos4" >/dev/null; then
53856212 lt_cv_sys_max_cmd_len=32750;
53866213 fi
5387 for ac_prog in flex lex
5388 do
5389 # Extract the first word of "$ac_prog", so it can be a program name with args.
5390 set dummy $ac_prog; ac_word=$2
6214 if test -n "$ac_tool_prefix"; then
6215 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
6216 set dummy ${ac_tool_prefix}ar; ac_word=$2
53916217 { echo "$as_me:$LINENO: checking for $ac_word" >&5
53926218 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5393 if test "${ac_cv_prog_LEX+set}" = set; then
6219 if test "${ac_cv_path_AR+set}" = set; then
53946220 echo $ECHO_N "(cached) $ECHO_C" >&6
53956221 else
5396 if test -n "$LEX"; then
5397 ac_cv_prog_LEX="$LEX" # Let the user override the test.
5398 else
5399 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6222 case $AR in
6223 [\\/]* | ?:[\\/]*)
6224 ac_cv_path_AR="$AR" # Let the user override the test with a path.
6225 ;;
6226 *)
6227 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
54006228 for as_dir in $PATH
54016229 do
54026230 IFS=$as_save_IFS
54036231 test -z "$as_dir" && as_dir=.
54046232 for ac_exec_ext in '' $ac_executable_extensions; do
54056233 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5406 ac_cv_prog_LEX="$ac_prog"
6234 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
54076235 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
54086236 break 2
54096237 fi
54116239 done
54126240 IFS=$as_save_IFS
54136241
5414 fi
5415 fi
5416 LEX=$ac_cv_prog_LEX
5417 if test -n "$LEX"; then
5418 { echo "$as_me:$LINENO: result: $LEX" >&5
5419 echo "${ECHO_T}$LEX" >&6; }
6242 ;;
6243 esac
6244 fi
6245 AR=$ac_cv_path_AR
6246 if test -n "$AR"; then
6247 { echo "$as_me:$LINENO: result: $AR" >&5
6248 echo "${ECHO_T}$AR" >&6; }
54206249 else
54216250 { echo "$as_me:$LINENO: result: no" >&5
54226251 echo "${ECHO_T}no" >&6; }
54236252 fi
54246253
54256254
5426 test -n "$LEX" && break
5427 done
5428 test -n "$LEX" || LEX=":"
5429
5430 if test "x$LEX" != "x:"; then
5431 cat >conftest.l <<_ACEOF
5432 %%
5433 a { ECHO; }
5434 b { REJECT; }
5435 c { yymore (); }
5436 d { yyless (1); }
5437 e { yyless (input () != 0); }
5438 f { unput (yytext[0]); }
5439 . { BEGIN INITIAL; }
5440 %%
5441 #ifdef YYTEXT_POINTER
5442 extern char *yytext;
5443 #endif
5444 int
5445 main (void)
5446 {
5447 return ! yylex () + ! yywrap ();
5448 }
5449 _ACEOF
5450 { (ac_try="$LEX conftest.l"
5451 case "(($ac_try" in
5452 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5453 *) ac_try_echo=$ac_try;;
5454 esac
5455 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5456 (eval "$LEX conftest.l") 2>&5
5457 ac_status=$?
5458 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5459 (exit $ac_status); }
5460 { echo "$as_me:$LINENO: checking lex output file root" >&5
5461 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
5462 if test "${ac_cv_prog_lex_root+set}" = set; then
5463 echo $ECHO_N "(cached) $ECHO_C" >&6
5464 else
5465
5466 if test -f lex.yy.c; then
5467 ac_cv_prog_lex_root=lex.yy
5468 elif test -f lexyy.c; then
5469 ac_cv_prog_lex_root=lexyy
5470 else
5471 { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
5472 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
5473 { (exit 1); exit 1; }; }
5474 fi
5475 fi
5476 { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
5477 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
5478 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
5479
5480 if test -z "${LEXLIB+set}"; then
5481 { echo "$as_me:$LINENO: checking lex library" >&5
5482 echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
5483 if test "${ac_cv_lib_lex+set}" = set; then
5484 echo $ECHO_N "(cached) $ECHO_C" >&6
5485 else
5486
5487 ac_save_LIBS=$LIBS
5488 ac_cv_lib_lex='none needed'
5489 for ac_lib in '' -lfl -ll; do
5490 LIBS="$ac_lib $ac_save_LIBS"
5491 cat >conftest.$ac_ext <<_ACEOF
5492 `cat $LEX_OUTPUT_ROOT.c`
5493 _ACEOF
5494 rm -f conftest.$ac_objext conftest$ac_exeext
5495 if { (ac_try="$ac_link"
5496 case "(($ac_try" in
5497 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5498 *) ac_try_echo=$ac_try;;
5499 esac
5500 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5501 (eval "$ac_link") 2>conftest.er1
5502 ac_status=$?
5503 grep -v '^ *+' conftest.er1 >conftest.err
5504 rm -f conftest.er1
5505 cat conftest.err >&5
5506 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5507 (exit $ac_status); } && {
5508 test -z "$ac_c_werror_flag" ||
5509 test ! -s conftest.err
5510 } && test -s conftest$ac_exeext &&
5511 $as_test_x conftest$ac_exeext; then
5512 ac_cv_lib_lex=$ac_lib
5513 else
5514 echo "$as_me: failed program was:" >&5
5515 sed 's/^/| /' conftest.$ac_ext >&5
5516
5517
5518 fi
5519
5520 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5521 conftest$ac_exeext conftest.$ac_ext
5522 test "$ac_cv_lib_lex" != 'none needed' && break
5523 done
5524 LIBS=$ac_save_LIBS
5525
5526 fi
5527 { echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
5528 echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
5529 test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
5530 fi
5531
5532
5533 { echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
5534 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
5535 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
5536 echo $ECHO_N "(cached) $ECHO_C" >&6
5537 else
5538 # POSIX says lex can declare yytext either as a pointer or an array; the
5539 # default is implementation-dependent. Figure out which it is, since
5540 # not all implementations provide the %pointer and %array declarations.
5541 ac_cv_prog_lex_yytext_pointer=no
5542 ac_save_LIBS=$LIBS
5543 LIBS="$LEXLIB $ac_save_LIBS"
5544 cat >conftest.$ac_ext <<_ACEOF
5545 #define YYTEXT_POINTER 1
5546 `cat $LEX_OUTPUT_ROOT.c`
5547 _ACEOF
5548 rm -f conftest.$ac_objext conftest$ac_exeext
5549 if { (ac_try="$ac_link"
5550 case "(($ac_try" in
5551 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5552 *) ac_try_echo=$ac_try;;
5553 esac
5554 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5555 (eval "$ac_link") 2>conftest.er1
5556 ac_status=$?
5557 grep -v '^ *+' conftest.er1 >conftest.err
5558 rm -f conftest.er1
5559 cat conftest.err >&5
5560 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5561 (exit $ac_status); } && {
5562 test -z "$ac_c_werror_flag" ||
5563 test ! -s conftest.err
5564 } && test -s conftest$ac_exeext &&
5565 $as_test_x conftest$ac_exeext; then
5566 ac_cv_prog_lex_yytext_pointer=yes
5567 else
5568 echo "$as_me: failed program was:" >&5
5569 sed 's/^/| /' conftest.$ac_ext >&5
5570
5571
5572 fi
5573
5574 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5575 conftest$ac_exeext conftest.$ac_ext
5576 LIBS=$ac_save_LIBS
5577
5578 fi
5579 { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
5580 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
5581 if test $ac_cv_prog_lex_yytext_pointer = yes; then
5582
5583 cat >>confdefs.h <<\_ACEOF
5584 #define YYTEXT_POINTER 1
5585 _ACEOF
5586
5587 fi
5588 rm -f conftest.l $LEX_OUTPUT_ROOT.c
5589
5590 fi
5591 for ac_prog in 'bison -y' byacc
5592 do
5593 # Extract the first word of "$ac_prog", so it can be a program name with args.
5594 set dummy $ac_prog; ac_word=$2
6255 fi
6256 if test -z "$ac_cv_path_AR"; then
6257 ac_pt_AR=$AR
6258 # Extract the first word of "ar", so it can be a program name with args.
6259 set dummy ar; ac_word=$2
55956260 { echo "$as_me:$LINENO: checking for $ac_word" >&5
55966261 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5597 if test "${ac_cv_prog_YACC+set}" = set; then
6262 if test "${ac_cv_path_ac_pt_AR+set}" = set; then
55986263 echo $ECHO_N "(cached) $ECHO_C" >&6
55996264 else
5600 if test -n "$YACC"; then
5601 ac_cv_prog_YACC="$YACC" # Let the user override the test.
5602 else
5603 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6265 case $ac_pt_AR in
6266 [\\/]* | ?:[\\/]*)
6267 ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path.
6268 ;;
6269 *)
6270 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
56046271 for as_dir in $PATH
56056272 do
56066273 IFS=$as_save_IFS
56076274 test -z "$as_dir" && as_dir=.
56086275 for ac_exec_ext in '' $ac_executable_extensions; do
56096276 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5610 ac_cv_prog_YACC="$ac_prog"
6277 ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext"
56116278 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
56126279 break 2
56136280 fi
56156282 done
56166283 IFS=$as_save_IFS
56176284
5618 fi
5619 fi
5620 YACC=$ac_cv_prog_YACC
5621 if test -n "$YACC"; then
5622 { echo "$as_me:$LINENO: result: $YACC" >&5
5623 echo "${ECHO_T}$YACC" >&6; }
6285 ;;
6286 esac
6287 fi
6288 ac_pt_AR=$ac_cv_path_ac_pt_AR
6289 if test -n "$ac_pt_AR"; then
6290 { echo "$as_me:$LINENO: result: $ac_pt_AR" >&5
6291 echo "${ECHO_T}$ac_pt_AR" >&6; }
56246292 else
56256293 { echo "$as_me:$LINENO: result: no" >&5
56266294 echo "${ECHO_T}no" >&6; }
56276295 fi
56286296
5629
5630 test -n "$YACC" && break
5631 done
5632 test -n "$YACC" || YACC="yacc"
6297 if test "x$ac_pt_AR" = x; then
6298 AR="false"
6299 else
6300 case $cross_compiling:$ac_tool_warned in
6301 yes:)
6302 { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
6303 whose name does not start with the host triplet. If you think this
6304 configuration is useful to you, please write to autoconf@gnu.org." >&5
6305 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
6306 whose name does not start with the host triplet. If you think this
6307 configuration is useful to you, please write to autoconf@gnu.org." >&2;}
6308 ac_tool_warned=yes ;;
6309 esac
6310 AR=$ac_pt_AR
6311 fi
6312 else
6313 AR="$ac_cv_path_AR"
6314 fi
6315
6316 if test $AR = false; then
6317 { { echo "$as_me:$LINENO: error: Cannot find 'ar', please extend PATH to include it" >&5
6318 echo "$as_me: error: Cannot find 'ar', please extend PATH to include it" >&2;}
6319 { (exit 1); exit 1; }; }
6320 fi
56336321
56346322 # Check whether --enable-shared was given.
56356323 if test "${enable_shared+set}" = set; then
61936881 ;;
61946882 *-*-irix6*)
61956883 # Find out which ABI we are using.
6196 echo '#line 6197 "configure"' > conftest.$ac_ext
6884 echo '#line 6885 "configure"' > conftest.$ac_ext
61976885 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
61986886 (eval $ac_compile) 2>&5
61996887 ac_status=$?
75078195 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
75088196 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
75098197 -e 's:$: $lt_compiler_flag:'`
7510 (eval echo "\"\$as_me:7511: $lt_compile\"" >&5)
8198 (eval echo "\"\$as_me:8199: $lt_compile\"" >&5)
75118199 (eval "$lt_compile" 2>conftest.err)
75128200 ac_status=$?
75138201 cat conftest.err >&5
7514 echo "$as_me:7515: \$? = $ac_status" >&5
8202 echo "$as_me:8203: \$? = $ac_status" >&5
75158203 if (exit $ac_status) && test -s "$ac_outfile"; then
75168204 # The compiler can only warn and ignore the option if not recognized
75178205 # So say no if there are warnings other than the usual output.
77978485 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
77988486 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
77998487 -e 's:$: $lt_compiler_flag:'`
7800 (eval echo "\"\$as_me:7801: $lt_compile\"" >&5)
8488 (eval echo "\"\$as_me:8489: $lt_compile\"" >&5)
78018489 (eval "$lt_compile" 2>conftest.err)
78028490 ac_status=$?
78038491 cat conftest.err >&5
7804 echo "$as_me:7805: \$? = $ac_status" >&5
8492 echo "$as_me:8493: \$? = $ac_status" >&5
78058493 if (exit $ac_status) && test -s "$ac_outfile"; then
78068494 # The compiler can only warn and ignore the option if not recognized
78078495 # So say no if there are warnings other than the usual output.
79018589 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
79028590 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
79038591 -e 's:$: $lt_compiler_flag:'`
7904 (eval echo "\"\$as_me:7905: $lt_compile\"" >&5)
8592 (eval echo "\"\$as_me:8593: $lt_compile\"" >&5)
79058593 (eval "$lt_compile" 2>out/conftest.err)
79068594 ac_status=$?
79078595 cat out/conftest.err >&5
7908 echo "$as_me:7909: \$? = $ac_status" >&5
8596 echo "$as_me:8597: \$? = $ac_status" >&5
79098597 if (exit $ac_status) && test -s out/conftest2.$ac_objext
79108598 then
79118599 # The compiler can only warn and ignore the option if not recognized
1025210940 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1025310941 lt_status=$lt_dlunknown
1025410942 cat > conftest.$ac_ext <<EOF
10255 #line 10256 "configure"
10943 #line 10944 "configure"
1025610944 #include "confdefs.h"
1025710945
1025810946 #if HAVE_DLFCN_H
1035211040 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1035311041 lt_status=$lt_dlunknown
1035411042 cat > conftest.$ac_ext <<EOF
10355 #line 10356 "configure"
11043 #line 11044 "configure"
1035611044 #include "confdefs.h"
1035711045
1035811046 #if HAVE_DLFCN_H
1277213460 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1277313461 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1277413462 -e 's:$: $lt_compiler_flag:'`
12775 (eval echo "\"\$as_me:12776: $lt_compile\"" >&5)
13463 (eval echo "\"\$as_me:13464: $lt_compile\"" >&5)
1277613464 (eval "$lt_compile" 2>conftest.err)
1277713465 ac_status=$?
1277813466 cat conftest.err >&5
12779 echo "$as_me:12780: \$? = $ac_status" >&5
13467 echo "$as_me:13468: \$? = $ac_status" >&5
1278013468 if (exit $ac_status) && test -s "$ac_outfile"; then
1278113469 # The compiler can only warn and ignore the option if not recognized
1278213470 # So say no if there are warnings other than the usual output.
1287613564 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1287713565 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1287813566 -e 's:$: $lt_compiler_flag:'`
12879 (eval echo "\"\$as_me:12880: $lt_compile\"" >&5)
13567 (eval echo "\"\$as_me:13568: $lt_compile\"" >&5)
1288013568 (eval "$lt_compile" 2>out/conftest.err)
1288113569 ac_status=$?
1288213570 cat out/conftest.err >&5
12883 echo "$as_me:12884: \$? = $ac_status" >&5
13571 echo "$as_me:13572: \$? = $ac_status" >&5
1288413572 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1288513573 then
1288613574 # The compiler can only warn and ignore the option if not recognized
1444015128 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1444115129 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1444215130 -e 's:$: $lt_compiler_flag:'`
14443 (eval echo "\"\$as_me:14444: $lt_compile\"" >&5)
15131 (eval echo "\"\$as_me:15132: $lt_compile\"" >&5)
1444415132 (eval "$lt_compile" 2>conftest.err)
1444515133 ac_status=$?
1444615134 cat conftest.err >&5
14447 echo "$as_me:14448: \$? = $ac_status" >&5
15135 echo "$as_me:15136: \$? = $ac_status" >&5
1444815136 if (exit $ac_status) && test -s "$ac_outfile"; then
1444915137 # The compiler can only warn and ignore the option if not recognized
1445015138 # So say no if there are warnings other than the usual output.
1454415232 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1454515233 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1454615234 -e 's:$: $lt_compiler_flag:'`
14547 (eval echo "\"\$as_me:14548: $lt_compile\"" >&5)
15235 (eval echo "\"\$as_me:15236: $lt_compile\"" >&5)
1454815236 (eval "$lt_compile" 2>out/conftest.err)
1454915237 ac_status=$?
1455015238 cat out/conftest.err >&5
14551 echo "$as_me:14552: \$? = $ac_status" >&5
15239 echo "$as_me:15240: \$? = $ac_status" >&5
1455215240 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1455315241 then
1455415242 # The compiler can only warn and ignore the option if not recognized
1673317421 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1673417422 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1673517423 -e 's:$: $lt_compiler_flag:'`
16736 (eval echo "\"\$as_me:16737: $lt_compile\"" >&5)
17424 (eval echo "\"\$as_me:17425: $lt_compile\"" >&5)
1673717425 (eval "$lt_compile" 2>conftest.err)
1673817426 ac_status=$?
1673917427 cat conftest.err >&5
16740 echo "$as_me:16741: \$? = $ac_status" >&5
17428 echo "$as_me:17429: \$? = $ac_status" >&5
1674117429 if (exit $ac_status) && test -s "$ac_outfile"; then
1674217430 # The compiler can only warn and ignore the option if not recognized
1674317431 # So say no if there are warnings other than the usual output.
1702317711 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1702417712 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1702517713 -e 's:$: $lt_compiler_flag:'`
17026 (eval echo "\"\$as_me:17027: $lt_compile\"" >&5)
17714 (eval echo "\"\$as_me:17715: $lt_compile\"" >&5)
1702717715 (eval "$lt_compile" 2>conftest.err)
1702817716 ac_status=$?
1702917717 cat conftest.err >&5
17030 echo "$as_me:17031: \$? = $ac_status" >&5
17718 echo "$as_me:17719: \$? = $ac_status" >&5
1703117719 if (exit $ac_status) && test -s "$ac_outfile"; then
1703217720 # The compiler can only warn and ignore the option if not recognized
1703317721 # So say no if there are warnings other than the usual output.
1712717815 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1712817816 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1712917817 -e 's:$: $lt_compiler_flag:'`
17130 (eval echo "\"\$as_me:17131: $lt_compile\"" >&5)
17818 (eval echo "\"\$as_me:17819: $lt_compile\"" >&5)
1713117819 (eval "$lt_compile" 2>out/conftest.err)
1713217820 ac_status=$?
1713317821 cat out/conftest.err >&5
17134 echo "$as_me:17135: \$? = $ac_status" >&5
17822 echo "$as_me:17823: \$? = $ac_status" >&5
1713517823 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1713617824 then
1713717825 # The compiler can only warn and ignore the option if not recognized
1976320451 # Prevent multiple expansion
1976420452
1976520453
20454
20455
1976620456 :
1976720457 :
1976820458
1977120461
1977220462
1977320463
20464
1977420465 # Checks for header files.
19775 { echo "$as_me:$LINENO: checking for ANSI C header files" >&5
19776 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
19777 if test "${ac_cv_header_stdc+set}" = set; then
19778 echo $ECHO_N "(cached) $ECHO_C" >&6
19779 else
19780 cat >conftest.$ac_ext <<_ACEOF
19781 /* confdefs.h. */
19782 _ACEOF
19783 cat confdefs.h >>conftest.$ac_ext
19784 cat >>conftest.$ac_ext <<_ACEOF
19785 /* end confdefs.h. */
19786 #include <stdlib.h>
19787 #include <stdarg.h>
19788 #include <string.h>
19789 #include <float.h>
19790
19791 int
19792 main ()
19793 {
19794
19795 ;
19796 return 0;
19797 }
19798 _ACEOF
19799 rm -f conftest.$ac_objext
19800 if { (ac_try="$ac_compile"
19801 case "(($ac_try" in
19802 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19803 *) ac_try_echo=$ac_try;;
19804 esac
19805 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19806 (eval "$ac_compile") 2>conftest.er1
19807 ac_status=$?
19808 grep -v '^ *+' conftest.er1 >conftest.err
19809 rm -f conftest.er1
19810 cat conftest.err >&5
19811 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19812 (exit $ac_status); } && {
19813 test -z "$ac_c_werror_flag" ||
19814 test ! -s conftest.err
19815 } && test -s conftest.$ac_objext; then
19816 ac_cv_header_stdc=yes
19817 else
19818 echo "$as_me: failed program was:" >&5
19819 sed 's/^/| /' conftest.$ac_ext >&5
19820
19821 ac_cv_header_stdc=no
19822 fi
19823
19824 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
19825
19826 if test $ac_cv_header_stdc = yes; then
19827 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
19828 cat >conftest.$ac_ext <<_ACEOF
19829 /* confdefs.h. */
19830 _ACEOF
19831 cat confdefs.h >>conftest.$ac_ext
19832 cat >>conftest.$ac_ext <<_ACEOF
19833 /* end confdefs.h. */
19834 #include <string.h>
19835
19836 _ACEOF
19837 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
19838 $EGREP "memchr" >/dev/null 2>&1; then
19839 :
19840 else
19841 ac_cv_header_stdc=no
19842 fi
19843 rm -f conftest*
19844
19845 fi
19846
19847 if test $ac_cv_header_stdc = yes; then
19848 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
19849 cat >conftest.$ac_ext <<_ACEOF
19850 /* confdefs.h. */
19851 _ACEOF
19852 cat confdefs.h >>conftest.$ac_ext
19853 cat >>conftest.$ac_ext <<_ACEOF
19854 /* end confdefs.h. */
19855 #include <stdlib.h>
19856
19857 _ACEOF
19858 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
19859 $EGREP "free" >/dev/null 2>&1; then
19860 :
19861 else
19862 ac_cv_header_stdc=no
19863 fi
19864 rm -f conftest*
19865
19866 fi
19867
19868 if test $ac_cv_header_stdc = yes; then
19869 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
19870 if test "$cross_compiling" = yes; then
19871 :
19872 else
19873 cat >conftest.$ac_ext <<_ACEOF
19874 /* confdefs.h. */
19875 _ACEOF
19876 cat confdefs.h >>conftest.$ac_ext
19877 cat >>conftest.$ac_ext <<_ACEOF
19878 /* end confdefs.h. */
19879 #include <ctype.h>
19880 #include <stdlib.h>
19881 #if ((' ' & 0x0FF) == 0x020)
19882 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
19883 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
19884 #else
19885 # define ISLOWER(c) \
19886 (('a' <= (c) && (c) <= 'i') \
19887 || ('j' <= (c) && (c) <= 'r') \
19888 || ('s' <= (c) && (c) <= 'z'))
19889 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
19890 #endif
19891
19892 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
19893 int
19894 main ()
19895 {
19896 int i;
19897 for (i = 0; i < 256; i++)
19898 if (XOR (islower (i), ISLOWER (i))
19899 || toupper (i) != TOUPPER (i))
19900 return 2;
19901 return 0;
19902 }
19903 _ACEOF
19904 rm -f conftest$ac_exeext
19905 if { (ac_try="$ac_link"
19906 case "(($ac_try" in
19907 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19908 *) ac_try_echo=$ac_try;;
19909 esac
19910 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19911 (eval "$ac_link") 2>&5
19912 ac_status=$?
19913 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19914 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
19915 { (case "(($ac_try" in
19916 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19917 *) ac_try_echo=$ac_try;;
19918 esac
19919 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19920 (eval "$ac_try") 2>&5
19921 ac_status=$?
19922 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19923 (exit $ac_status); }; }; then
19924 :
19925 else
19926 echo "$as_me: program exited with status $ac_status" >&5
19927 echo "$as_me: failed program was:" >&5
19928 sed 's/^/| /' conftest.$ac_ext >&5
19929
19930 ( exit $ac_status )
19931 ac_cv_header_stdc=no
19932 fi
19933 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
19934 fi
19935
19936
19937 fi
19938 fi
19939 { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
19940 echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
19941 if test $ac_cv_header_stdc = yes; then
19942
19943 cat >>confdefs.h <<\_ACEOF
19944 #define STDC_HEADERS 1
19945 _ACEOF
19946
19947 fi
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962 for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483 for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h
1996320484 do
1996420485 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
1996520486 { echo "$as_me:$LINENO: checking for $ac_header" >&5
2001720538 done
2001820539
2001920540
20020 # check for types
20541 # check for types.
20542 # Using own tests for int64* because autoconf builtin only give 32bit.
2002120543 { echo "$as_me:$LINENO: checking for int8_t" >&5
2002220544 echo $ECHO_N "checking for int8_t... $ECHO_C" >&6; }
2002320545 if test "${ac_cv_type_int8_t+set}" = set; then
2007620598 else
2007720599
2007820600 cat >>confdefs.h <<_ACEOF
20079 #define int8_t char
20601 #define int8_t signed char
2008020602 _ACEOF
2008120603
2008220604 fi
2087521397
2087621398 fi
2087721399
20878
2087921400 { echo "$as_me:$LINENO: checking for rlim_t" >&5
2088021401 echo $ECHO_N "checking for rlim_t... $ECHO_C" >&6; }
2088121402 if test "${ac_cv_type_rlim_t+set}" = set; then
2094521466
2094621467 fi
2094721468
21469
2094821470 { echo "$as_me:$LINENO: checking for socklen_t" >&5
2094921471 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
2095021472 if test "${ac_cv_type_socklen_t+set}" = set; then
2101421536
2101521537 fi
2101621538
21017 { echo "$as_me:$LINENO: checking for in_addr_t" >&5
21539 { echo "$as_me:$LINENO: checking for in_addr_t" >&5
2101821540 echo $ECHO_N "checking for in_addr_t... $ECHO_C" >&6; }
2101921541 if test "${ac_cv_type_in_addr_t+set}" = set; then
2102021542 echo $ECHO_N "(cached) $ECHO_C" >&6
2108621608
2108721609 fi
2108821610
21089 { echo "$as_me:$LINENO: checking for in_port_t" >&5
21611 { echo "$as_me:$LINENO: checking for in_port_t" >&5
2109021612 echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6; }
2109121613 if test "${ac_cv_type_in_port_t+set}" = set; then
2109221614 echo $ECHO_N "(cached) $ECHO_C" >&6
2116021682
2116121683
2116221684 # add option to disable the evil rpath
21685
2116321686 # Check whether --enable-rpath was given.
2116421687 if test "${enable_rpath+set}" = set; then
2116521688 enableval=$enable_rpath; enable_rpath=$enableval
2117721700 libtool="./libtool"
2117821701 fi
2117921702
21180 # Checks for libraries.
21181
21182 # Check whether --with-ssl was given.
21183 if test "${with_ssl+set}" = set; then
21184 withval=$with_ssl;
21185
21186 else
21187
21188 withval="yes"
21189
21190 fi
21191
21192 if test x_$withval = x_no; then
21193 { { echo "$as_me:$LINENO: error: Need SSL library to do digital signature cryptography" >&5
21194 echo "$as_me: error: Need SSL library to do digital signature cryptography" >&2;}
21195 { (exit 1); exit 1; }; }
21196 fi
21197 if test x_$withval != x_no; then
21198 { echo "$as_me:$LINENO: checking for SSL" >&5
21199 echo $ECHO_N "checking for SSL... $ECHO_C" >&6; }
21200 if test x_$withval = x_ -o x_$withval = x_yes; then
21201 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
21202 fi
21203 for dir in $withval; do
21204 ssldir="$dir"
21205 if test -f "$dir/include/openssl/ssl.h"; then
21206 found_ssl="yes"
21207
21208 cat >>confdefs.h <<_ACEOF
21209 #define HAVE_SSL
21210 _ACEOF
21211
21212 CPPFLAGS="$CPPFLAGS -I$ssldir/include"
21213 break;
21214 fi
21215 done
21216 if test x_$found_ssl != x_yes; then
21217 { { echo "$as_me:$LINENO: error: Cannot find the SSL libraries in $withval" >&5
21218 echo "$as_me: error: Cannot find the SSL libraries in $withval" >&2;}
21219 { (exit 1); exit 1; }; }
21220 else
21221 { echo "$as_me:$LINENO: result: found in $ssldir" >&5
21222 echo "${ECHO_T}found in $ssldir" >&6; }
21223 HAVE_SSL=yes
21224 LDFLAGS="$LDFLAGS -L$ssldir/lib"
21225 if test "x$enable_rpath" = xyes; then
21226 RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib"
21227 fi
21228
21229 { echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
21230 echo $ECHO_N "checking for HMAC_CTX_init in -lcrypto... $ECHO_C" >&6; }
21231 LIBS="$LIBS -lcrypto"
21232 cat >conftest.$ac_ext <<_ACEOF
21703
21704 # check for thread library.
21705 # check this first, so that the pthread lib does not get linked in via
21706 # libssl or libpython, and thus distorts the tests, and we end up using
21707 # the non-threadsafe C libraries.
21708
21709 # Check whether --with-pthreads was given.
21710 if test "${with_pthreads+set}" = set; then
21711 withval=$with_pthreads;
21712 else
21713 withval="yes"
21714 fi
21715
21716 ub_have_pthreads=no
21717 if test x_$withval != x_no; then
21718
21719
21720
21721 ac_ext=c
21722 ac_cpp='$CPP $CPPFLAGS'
21723 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
21724 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
21725 ac_compiler_gnu=$ac_cv_c_compiler_gnu
21726
21727 acx_pthread_ok=no
21728
21729 # We used to check for pthread.h first, but this fails if pthread.h
21730 # requires special compiler flags (e.g. on True64 or Sequent).
21731 # It gets checked for in the link test anyway.
21732
21733 # First of all, check if the user has set any of the PTHREAD_LIBS,
21734 # etcetera environment variables, and if threads linking works using
21735 # them:
21736 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
21737 save_CFLAGS="$CFLAGS"
21738 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
21739 save_LIBS="$LIBS"
21740 LIBS="$PTHREAD_LIBS $LIBS"
21741 { echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
21742 echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6; }
21743 cat >conftest.$ac_ext <<_ACEOF
2123321744 /* confdefs.h. */
2123421745 _ACEOF
2123521746 cat confdefs.h >>conftest.$ac_ext
2123621747 cat >>conftest.$ac_ext <<_ACEOF
2123721748 /* end confdefs.h. */
2123821749
21750 /* Override any GCC internal prototype to avoid an error.
21751 Use char because int might match the return type of a GCC
21752 builtin and then its argument prototype would still apply. */
21753 #ifdef __cplusplus
21754 extern "C"
21755 #endif
21756 char pthread_join ();
2123921757 int
2124021758 main ()
2124121759 {
21242
21243 int HMAC_CTX_init(void);
21244 (void)HMAC_CTX_init();
21245
21760 return pthread_join ();
2124621761 ;
2124721762 return 0;
2124821763 }
2126521780 test ! -s conftest.err
2126621781 } && test -s conftest$ac_exeext &&
2126721782 $as_test_x conftest$ac_exeext; then
21268
21269 { echo "$as_me:$LINENO: result: yes" >&5
21270 echo "${ECHO_T}yes" >&6; }
21271
21272 cat >>confdefs.h <<\_ACEOF
21273 #define HAVE_HMAC_CTX_INIT 1
21274 _ACEOF
21275
21276
21783 acx_pthread_ok=yes
2127721784 else
2127821785 echo "$as_me: failed program was:" >&5
2127921786 sed 's/^/| /' conftest.$ac_ext >&5
2128021787
2128121788
21282 { echo "$as_me:$LINENO: result: no" >&5
21789 fi
21790
21791 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21792 conftest$ac_exeext conftest.$ac_ext
21793 { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
21794 echo "${ECHO_T}$acx_pthread_ok" >&6; }
21795 if test x"$acx_pthread_ok" = xno; then
21796 PTHREAD_LIBS=""
21797 PTHREAD_CFLAGS=""
21798 fi
21799 LIBS="$save_LIBS"
21800 CFLAGS="$save_CFLAGS"
21801 fi
21802
21803 # We must check for the threads library under a number of different
21804 # names; the ordering is very important because some systems
21805 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
21806 # libraries is broken (non-POSIX).
21807
21808 # Create a list of thread flags to try. Items starting with a "-" are
21809 # C compiler flags, and other items are library names, except for "none"
21810 # which indicates that we try without any flags at all, and "pthread-config"
21811 # which is a program returning the flags for the Pth emulation library.
21812
21813 acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
21814
21815 # The ordering *is* (sometimes) important. Some notes on the
21816 # individual items follow:
21817
21818 # pthreads: AIX (must check this before -lpthread)
21819 # none: in case threads are in libc; should be tried before -Kthread and
21820 # other compiler flags to prevent continual compiler warnings
21821 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
21822 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
21823 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
21824 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
21825 # -pthreads: Solaris/gcc
21826 # -mthreads: Mingw32/gcc, Lynx/gcc
21827 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
21828 # doesn't hurt to check since this sometimes defines pthreads too;
21829 # also defines -D_REENTRANT)
21830 # ... -mt is also the pthreads flag for HP/aCC
21831 # pthread: Linux, etcetera
21832 # --thread-safe: KAI C++
21833 # pthread-config: use pthread-config program (for GNU Pth library)
21834
21835 case "${host_cpu}-${host_os}" in
21836 *solaris*)
21837
21838 # On Solaris (at least, for some versions), libc contains stubbed
21839 # (non-functional) versions of the pthreads routines, so link-based
21840 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
21841 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
21842 # a function called by this macro, so we could check for that, but
21843 # who knows whether they'll stub that too in a future libc.) So,
21844 # we'll just look for -pthreads and -lpthread first:
21845
21846 acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
21847 ;;
21848 esac
21849
21850 if test x"$acx_pthread_ok" = xno; then
21851 for flag in $acx_pthread_flags; do
21852
21853 case $flag in
21854 none)
21855 { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
21856 echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; }
21857 ;;
21858
21859 -*)
21860 { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
21861 echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; }
21862 PTHREAD_CFLAGS="$flag"
21863 ;;
21864
21865 pthread-config)
21866 # Extract the first word of "pthread-config", so it can be a program name with args.
21867 set dummy pthread-config; ac_word=$2
21868 { echo "$as_me:$LINENO: checking for $ac_word" >&5
21869 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
21870 if test "${ac_cv_prog_acx_pthread_config+set}" = set; then
21871 echo $ECHO_N "(cached) $ECHO_C" >&6
21872 else
21873 if test -n "$acx_pthread_config"; then
21874 ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
21875 else
21876 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
21877 for as_dir in $PATH
21878 do
21879 IFS=$as_save_IFS
21880 test -z "$as_dir" && as_dir=.
21881 for ac_exec_ext in '' $ac_executable_extensions; do
21882 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
21883 ac_cv_prog_acx_pthread_config="yes"
21884 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
21885 break 2
21886 fi
21887 done
21888 done
21889 IFS=$as_save_IFS
21890
21891 test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
21892 fi
21893 fi
21894 acx_pthread_config=$ac_cv_prog_acx_pthread_config
21895 if test -n "$acx_pthread_config"; then
21896 { echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
21897 echo "${ECHO_T}$acx_pthread_config" >&6; }
21898 else
21899 { echo "$as_me:$LINENO: result: no" >&5
2128321900 echo "${ECHO_T}no" >&6; }
21284 # check if -lwsock32 or -lgdi32 are needed.
21285 LIBS="$LIBS -lgdi32"
21286 { echo "$as_me:$LINENO: checking if -lcrypto needs -lgdi32" >&5
21287 echo $ECHO_N "checking if -lcrypto needs -lgdi32... $ECHO_C" >&6; }
21288 cat >conftest.$ac_ext <<_ACEOF
21901 fi
21902
21903
21904 if test x"$acx_pthread_config" = xno; then continue; fi
21905 PTHREAD_CFLAGS="`pthread-config --cflags`"
21906 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
21907 ;;
21908
21909 *)
21910 { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
21911 echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; }
21912 PTHREAD_LIBS="-l$flag"
21913 ;;
21914 esac
21915
21916 save_LIBS="$LIBS"
21917 save_CFLAGS="$CFLAGS"
21918 LIBS="$PTHREAD_LIBS $LIBS"
21919 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
21920
21921 # Check for various functions. We must include pthread.h,
21922 # since some functions may be macros. (On the Sequent, we
21923 # need a special flag -Kthread to make this header compile.)
21924 # We check for pthread_join because it is in -lpthread on IRIX
21925 # while pthread_create is in libc. We check for pthread_attr_init
21926 # due to DEC craziness with -lpthreads. We check for
21927 # pthread_cleanup_push because it is one of the few pthread
21928 # functions on Solaris that doesn't have a non-functional libc stub.
21929 # We try pthread_create on general principles.
21930 cat >conftest.$ac_ext <<_ACEOF
2128921931 /* confdefs.h. */
2129021932 _ACEOF
2129121933 cat confdefs.h >>conftest.$ac_ext
2129221934 cat >>conftest.$ac_ext <<_ACEOF
2129321935 /* end confdefs.h. */
21294
21936 #include <pthread.h>
2129521937 int
2129621938 main ()
2129721939 {
21298
21299 int HMAC_CTX_init(void);
21300 (void)HMAC_CTX_init();
21301
21940 pthread_t th; pthread_join(th, 0);
21941 pthread_attr_init(0); pthread_cleanup_push(0, 0);
21942 pthread_create(0,0,0,0); pthread_cleanup_pop(0);
2130221943 ;
2130321944 return 0;
2130421945 }
2132121962 test ! -s conftest.err
2132221963 } && test -s conftest$ac_exeext &&
2132321964 $as_test_x conftest$ac_exeext; then
21324
21325
21326 cat >>confdefs.h <<\_ACEOF
21327 #define HAVE_HMAC_CTX_INIT 1
21328 _ACEOF
21329
21330 { echo "$as_me:$LINENO: result: yes" >&5
21331 echo "${ECHO_T}yes" >&6; }
21332
21965 acx_pthread_ok=yes
2133321966 else
2133421967 echo "$as_me: failed program was:" >&5
2133521968 sed 's/^/| /' conftest.$ac_ext >&5
2133621969
2133721970
21338 { echo "$as_me:$LINENO: result: no" >&5
21339 echo "${ECHO_T}no" >&6; }
21340 { { echo "$as_me:$LINENO: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&5
21341 echo "$as_me: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&2;}
21342 { (exit 1); exit 1; }; }
21343
2134421971 fi
2134521972
2134621973 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2134721974 conftest$ac_exeext conftest.$ac_ext
2134821975
21976 LIBS="$save_LIBS"
21977 CFLAGS="$save_CFLAGS"
21978
21979 { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
21980 echo "${ECHO_T}$acx_pthread_ok" >&6; }
21981 if test "x$acx_pthread_ok" = xyes; then
21982 break;
21983 fi
21984
21985 PTHREAD_LIBS=""
21986 PTHREAD_CFLAGS=""
21987 done
21988 fi
21989
21990 # Various other checks:
21991 if test "x$acx_pthread_ok" = xyes; then
21992 save_LIBS="$LIBS"
21993 LIBS="$PTHREAD_LIBS $LIBS"
21994 save_CFLAGS="$CFLAGS"
21995 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
21996
21997 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
21998 { echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
21999 echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6; }
22000 attr_name=unknown
22001 for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
22002 cat >conftest.$ac_ext <<_ACEOF
22003 /* confdefs.h. */
22004 _ACEOF
22005 cat confdefs.h >>conftest.$ac_ext
22006 cat >>conftest.$ac_ext <<_ACEOF
22007 /* end confdefs.h. */
22008 #include <pthread.h>
22009 int
22010 main ()
22011 {
22012 int attr=$attr; return attr;
22013 ;
22014 return 0;
22015 }
22016 _ACEOF
22017 rm -f conftest.$ac_objext conftest$ac_exeext
22018 if { (ac_try="$ac_link"
22019 case "(($ac_try" in
22020 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22021 *) ac_try_echo=$ac_try;;
22022 esac
22023 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22024 (eval "$ac_link") 2>conftest.er1
22025 ac_status=$?
22026 grep -v '^ *+' conftest.er1 >conftest.err
22027 rm -f conftest.er1
22028 cat conftest.err >&5
22029 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22030 (exit $ac_status); } && {
22031 test -z "$ac_c_werror_flag" ||
22032 test ! -s conftest.err
22033 } && test -s conftest$ac_exeext &&
22034 $as_test_x conftest$ac_exeext; then
22035 attr_name=$attr; break
22036 else
22037 echo "$as_me: failed program was:" >&5
22038 sed 's/^/| /' conftest.$ac_ext >&5
22039
22040
2134922041 fi
2135022042
2135122043 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2135222044 conftest$ac_exeext conftest.$ac_ext
22045 done
22046 { echo "$as_me:$LINENO: result: $attr_name" >&5
22047 echo "${ECHO_T}$attr_name" >&6; }
22048 if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
22049
22050 cat >>confdefs.h <<_ACEOF
22051 #define PTHREAD_CREATE_JOINABLE $attr_name
22052 _ACEOF
22053
2135322054 fi
2135422055
21355
21356 fi
21357
21358 for ac_header in openssl/ssl.h
22056 { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
22057 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; }
22058 flag=no
22059 case "${host_cpu}-${host_os}" in
22060 *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
22061 *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
22062 esac
22063 { echo "$as_me:$LINENO: result: ${flag}" >&5
22064 echo "${ECHO_T}${flag}" >&6; }
22065 if test "x$flag" != xno; then
22066 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
22067 fi
22068
22069 LIBS="$save_LIBS"
22070 CFLAGS="$save_CFLAGS"
22071
22072 # More AIX lossage: must compile with xlc_r or cc_r
22073 if test x"$GCC" != xyes; then
22074 for ac_prog in xlc_r cc_r
22075 do
22076 # Extract the first word of "$ac_prog", so it can be a program name with args.
22077 set dummy $ac_prog; ac_word=$2
22078 { echo "$as_me:$LINENO: checking for $ac_word" >&5
22079 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
22080 if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
22081 echo $ECHO_N "(cached) $ECHO_C" >&6
22082 else
22083 if test -n "$PTHREAD_CC"; then
22084 ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
22085 else
22086 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
22087 for as_dir in $PATH
22088 do
22089 IFS=$as_save_IFS
22090 test -z "$as_dir" && as_dir=.
22091 for ac_exec_ext in '' $ac_executable_extensions; do
22092 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
22093 ac_cv_prog_PTHREAD_CC="$ac_prog"
22094 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
22095 break 2
22096 fi
22097 done
22098 done
22099 IFS=$as_save_IFS
22100
22101 fi
22102 fi
22103 PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
22104 if test -n "$PTHREAD_CC"; then
22105 { echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
22106 echo "${ECHO_T}$PTHREAD_CC" >&6; }
22107 else
22108 { echo "$as_me:$LINENO: result: no" >&5
22109 echo "${ECHO_T}no" >&6; }
22110 fi
22111
22112
22113 test -n "$PTHREAD_CC" && break
22114 done
22115 test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
22116
22117 else
22118 PTHREAD_CC=$CC
22119 fi
22120 else
22121 PTHREAD_CC="$CC"
22122 fi
22123
22124
22125
22126
22127
22128 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
22129 if test x"$acx_pthread_ok" = xyes; then
22130
22131
22132 cat >>confdefs.h <<\_ACEOF
22133 #define HAVE_PTHREAD 1
22134 _ACEOF
22135
22136 LIBS="$PTHREAD_LIBS $LIBS"
22137 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
22138 CC="$PTHREAD_CC"
22139 ub_have_pthreads=yes
22140 { echo "$as_me:$LINENO: checking for pthread_spinlock_t" >&5
22141 echo $ECHO_N "checking for pthread_spinlock_t... $ECHO_C" >&6; }
22142 if test "${ac_cv_type_pthread_spinlock_t+set}" = set; then
22143 echo $ECHO_N "(cached) $ECHO_C" >&6
22144 else
22145 cat >conftest.$ac_ext <<_ACEOF
22146 /* confdefs.h. */
22147 _ACEOF
22148 cat confdefs.h >>conftest.$ac_ext
22149 cat >>conftest.$ac_ext <<_ACEOF
22150 /* end confdefs.h. */
22151 #include <pthread.h>
22152
22153 typedef pthread_spinlock_t ac__type_new_;
22154 int
22155 main ()
22156 {
22157 if ((ac__type_new_ *) 0)
22158 return 0;
22159 if (sizeof (ac__type_new_))
22160 return 0;
22161 ;
22162 return 0;
22163 }
22164 _ACEOF
22165 rm -f conftest.$ac_objext
22166 if { (ac_try="$ac_compile"
22167 case "(($ac_try" in
22168 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22169 *) ac_try_echo=$ac_try;;
22170 esac
22171 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22172 (eval "$ac_compile") 2>conftest.er1
22173 ac_status=$?
22174 grep -v '^ *+' conftest.er1 >conftest.err
22175 rm -f conftest.er1
22176 cat conftest.err >&5
22177 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22178 (exit $ac_status); } && {
22179 test -z "$ac_c_werror_flag" ||
22180 test ! -s conftest.err
22181 } && test -s conftest.$ac_objext; then
22182 ac_cv_type_pthread_spinlock_t=yes
22183 else
22184 echo "$as_me: failed program was:" >&5
22185 sed 's/^/| /' conftest.$ac_ext >&5
22186
22187 ac_cv_type_pthread_spinlock_t=no
22188 fi
22189
22190 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22191 fi
22192 { echo "$as_me:$LINENO: result: $ac_cv_type_pthread_spinlock_t" >&5
22193 echo "${ECHO_T}$ac_cv_type_pthread_spinlock_t" >&6; }
22194 if test $ac_cv_type_pthread_spinlock_t = yes; then
22195
22196 cat >>confdefs.h <<_ACEOF
22197 #define HAVE_PTHREAD_SPINLOCK_T 1
22198 _ACEOF
22199
22200
22201 fi
22202 { echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
22203 echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6; }
22204 if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then
22205 echo $ECHO_N "(cached) $ECHO_C" >&6
22206 else
22207 cat >conftest.$ac_ext <<_ACEOF
22208 /* confdefs.h. */
22209 _ACEOF
22210 cat confdefs.h >>conftest.$ac_ext
22211 cat >>conftest.$ac_ext <<_ACEOF
22212 /* end confdefs.h. */
22213 #include <pthread.h>
22214
22215 typedef pthread_rwlock_t ac__type_new_;
22216 int
22217 main ()
22218 {
22219 if ((ac__type_new_ *) 0)
22220 return 0;
22221 if (sizeof (ac__type_new_))
22222 return 0;
22223 ;
22224 return 0;
22225 }
22226 _ACEOF
22227 rm -f conftest.$ac_objext
22228 if { (ac_try="$ac_compile"
22229 case "(($ac_try" in
22230 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22231 *) ac_try_echo=$ac_try;;
22232 esac
22233 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22234 (eval "$ac_compile") 2>conftest.er1
22235 ac_status=$?
22236 grep -v '^ *+' conftest.er1 >conftest.err
22237 rm -f conftest.er1
22238 cat conftest.err >&5
22239 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22240 (exit $ac_status); } && {
22241 test -z "$ac_c_werror_flag" ||
22242 test ! -s conftest.err
22243 } && test -s conftest.$ac_objext; then
22244 ac_cv_type_pthread_rwlock_t=yes
22245 else
22246 echo "$as_me: failed program was:" >&5
22247 sed 's/^/| /' conftest.$ac_ext >&5
22248
22249 ac_cv_type_pthread_rwlock_t=no
22250 fi
22251
22252 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22253 fi
22254 { echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5
22255 echo "${ECHO_T}$ac_cv_type_pthread_rwlock_t" >&6; }
22256 if test $ac_cv_type_pthread_rwlock_t = yes; then
22257
22258 cat >>confdefs.h <<_ACEOF
22259 #define HAVE_PTHREAD_RWLOCK_T 1
22260 _ACEOF
22261
22262
22263 fi
22264
22265
22266 :
22267 else
22268 acx_pthread_ok=no
22269
22270 fi
22271 ac_ext=c
22272 ac_cpp='$CPP $CPPFLAGS'
22273 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
22274 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
22275 ac_compiler_gnu=$ac_cv_c_compiler_gnu
22276
22277
22278 fi
22279
22280 # check solaris thread library
22281
22282 # Check whether --with-solaris-threads was given.
22283 if test "${with_solaris_threads+set}" = set; then
22284 withval=$with_solaris_threads;
22285 else
22286 withval="no"
22287 fi
22288
22289 ub_have_sol_threads=no
22290 if test x_$withval != x_no; then
22291 if test x_$ub_have_pthreads != x_no; then
22292 { echo "$as_me:$LINENO: WARNING: Have pthreads already, ignoring --with-solaris-threads" >&5
22293 echo "$as_me: WARNING: Have pthreads already, ignoring --with-solaris-threads" >&2;}
22294 else
22295 { echo "$as_me:$LINENO: checking for library containing thr_create" >&5
22296 echo $ECHO_N "checking for library containing thr_create... $ECHO_C" >&6; }
22297 if test "${ac_cv_search_thr_create+set}" = set; then
22298 echo $ECHO_N "(cached) $ECHO_C" >&6
22299 else
22300 ac_func_search_save_LIBS=$LIBS
22301 cat >conftest.$ac_ext <<_ACEOF
22302 /* confdefs.h. */
22303 _ACEOF
22304 cat confdefs.h >>conftest.$ac_ext
22305 cat >>conftest.$ac_ext <<_ACEOF
22306 /* end confdefs.h. */
22307
22308 /* Override any GCC internal prototype to avoid an error.
22309 Use char because int might match the return type of a GCC
22310 builtin and then its argument prototype would still apply. */
22311 #ifdef __cplusplus
22312 extern "C"
22313 #endif
22314 char thr_create ();
22315 int
22316 main ()
22317 {
22318 return thr_create ();
22319 ;
22320 return 0;
22321 }
22322 _ACEOF
22323 for ac_lib in '' thread; do
22324 if test -z "$ac_lib"; then
22325 ac_res="none required"
22326 else
22327 ac_res=-l$ac_lib
22328 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
22329 fi
22330 rm -f conftest.$ac_objext conftest$ac_exeext
22331 if { (ac_try="$ac_link"
22332 case "(($ac_try" in
22333 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22334 *) ac_try_echo=$ac_try;;
22335 esac
22336 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22337 (eval "$ac_link") 2>conftest.er1
22338 ac_status=$?
22339 grep -v '^ *+' conftest.er1 >conftest.err
22340 rm -f conftest.er1
22341 cat conftest.err >&5
22342 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22343 (exit $ac_status); } && {
22344 test -z "$ac_c_werror_flag" ||
22345 test ! -s conftest.err
22346 } && test -s conftest$ac_exeext &&
22347 $as_test_x conftest$ac_exeext; then
22348 ac_cv_search_thr_create=$ac_res
22349 else
22350 echo "$as_me: failed program was:" >&5
22351 sed 's/^/| /' conftest.$ac_ext >&5
22352
22353
22354 fi
22355
22356 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22357 conftest$ac_exeext
22358 if test "${ac_cv_search_thr_create+set}" = set; then
22359 break
22360 fi
22361 done
22362 if test "${ac_cv_search_thr_create+set}" = set; then
22363 :
22364 else
22365 ac_cv_search_thr_create=no
22366 fi
22367 rm conftest.$ac_ext
22368 LIBS=$ac_func_search_save_LIBS
22369 fi
22370 { echo "$as_me:$LINENO: result: $ac_cv_search_thr_create" >&5
22371 echo "${ECHO_T}$ac_cv_search_thr_create" >&6; }
22372 ac_res=$ac_cv_search_thr_create
22373 if test "$ac_res" != no; then
22374 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
22375
22376
22377 cat >>confdefs.h <<\_ACEOF
22378 #define HAVE_SOLARIS_THREADS 1
22379 _ACEOF
22380
22381
22382
22383
22384 { echo "$as_me:$LINENO: checking whether $CC supports -mt" >&5
22385 echo $ECHO_N "checking whether $CC supports -mt... $ECHO_C" >&6; }
22386 cache=`echo mt | sed 'y%.=/+-%___p_%'`
22387 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
22388 echo $ECHO_N "(cached) $ECHO_C" >&6
22389 else
22390
22391 echo 'void f(){}' >conftest.c
22392 if test -z "`$CC -mt -c conftest.c 2>&1`"; then
22393 eval "cv_prog_cc_flag_$cache=yes"
22394 else
22395 eval "cv_prog_cc_flag_$cache=no"
22396 fi
22397 rm -f conftest conftest.o conftest.c
22398
22399 fi
22400
22401 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
22402 { echo "$as_me:$LINENO: result: yes" >&5
22403 echo "${ECHO_T}yes" >&6; }
22404 :
22405 CFLAGS="$CFLAGS -mt"
22406 else
22407 { echo "$as_me:$LINENO: result: no" >&5
22408 echo "${ECHO_T}no" >&6; }
22409 :
22410 CFLAGS="$CFLAGS -D_REENTRANT"
22411 fi
22412
22413 ub_have_sol_threads=yes
22414
22415 else
22416
22417 { { echo "$as_me:$LINENO: error: no solaris threads found." >&5
22418 echo "$as_me: error: no solaris threads found." >&2;}
22419 { (exit 1); exit 1; }; }
22420
22421 fi
22422
22423 fi
22424 fi
22425
22426 # check windows threads
22427 if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then
22428
22429 for ac_header in windows.h
2135922430 do
2136022431 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
2136122432 { echo "$as_me:$LINENO: checking for $ac_header" >&5
2141222483
2141322484 done
2141422485
21415
21416 for ac_header in openssl/err.h
22486 { echo "$as_me:$LINENO: checking for CreateThread" >&5
22487 echo $ECHO_N "checking for CreateThread... $ECHO_C" >&6; }
22488 cat >conftest.$ac_ext <<_ACEOF
22489 /* confdefs.h. */
22490 _ACEOF
22491 cat confdefs.h >>conftest.$ac_ext
22492 cat >>conftest.$ac_ext <<_ACEOF
22493 /* end confdefs.h. */
22494
22495 #ifdef HAVE_WINDOWS_H
22496 #include <windows.h>
22497 #endif
22498
22499 int
22500 main ()
22501 {
22502
22503 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
22504
22505 ;
22506 return 0;
22507 }
22508 _ACEOF
22509 rm -f conftest.$ac_objext
22510 if { (ac_try="$ac_compile"
22511 case "(($ac_try" in
22512 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22513 *) ac_try_echo=$ac_try;;
22514 esac
22515 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22516 (eval "$ac_compile") 2>conftest.er1
22517 ac_status=$?
22518 grep -v '^ *+' conftest.er1 >conftest.err
22519 rm -f conftest.er1
22520 cat conftest.err >&5
22521 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22522 (exit $ac_status); } && {
22523 test -z "$ac_c_werror_flag" ||
22524 test ! -s conftest.err
22525 } && test -s conftest.$ac_objext; then
22526 { echo "$as_me:$LINENO: result: yes" >&5
22527 echo "${ECHO_T}yes" >&6; }
22528
22529 cat >>confdefs.h <<\_ACEOF
22530 #define HAVE_WINDOWS_THREADS 1
22531 _ACEOF
22532
22533
22534 else
22535 echo "$as_me: failed program was:" >&5
22536 sed 's/^/| /' conftest.$ac_ext >&5
22537
22538 { echo "$as_me:$LINENO: result: no" >&5
22539 echo "${ECHO_T}no" >&6; }
22540
22541 fi
22542
22543 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22544 fi
22545
22546 # Check for PyUnbound
22547
22548 # Check whether --with-pyunbound was given.
22549 if test "${with_pyunbound+set}" = set; then
22550 withval=$with_pyunbound;
22551 else
22552 withval="no"
22553 fi
22554
22555
22556 ub_test_python=no
22557 ub_with_pyunbound=no
22558 if test x_$withval != x_no; then
22559 ub_with_pyunbound=yes
22560 ub_test_python=yes
22561 fi
22562
22563 # Check for Python module
22564
22565 # Check whether --with-pythonmodule was given.
22566 if test "${with_pythonmodule+set}" = set; then
22567 withval=$with_pythonmodule;
22568 else
22569 withval="no"
22570 fi
22571
22572
22573 ub_with_pythonmod=no
22574 if test x_$withval != x_no; then
22575 ub_with_pythonmod=yes
22576 ub_test_python=yes
22577 fi
22578
22579 # Check for Python & SWIG only on PyUnbound or PyModule
22580 if test x_$ub_test_python != x_no; then
22581
22582 # Check for Python
22583 ub_have_python=no
22584
22585 #
22586 # Allow the use of a (user set) custom python version
22587 #
22588
22589
22590 # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args.
22591 set dummy python$PYTHON_VERSION; ac_word=$2
22592 { echo "$as_me:$LINENO: checking for $ac_word" >&5
22593 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
22594 if test "${ac_cv_path_PYTHON+set}" = set; then
22595 echo $ECHO_N "(cached) $ECHO_C" >&6
22596 else
22597 case $PYTHON in
22598 [\\/]* | ?:[\\/]*)
22599 ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
22600 ;;
22601 *)
22602 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
22603 for as_dir in $PATH
22604 do
22605 IFS=$as_save_IFS
22606 test -z "$as_dir" && as_dir=.
22607 for ac_exec_ext in '' $ac_executable_extensions; do
22608 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
22609 ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
22610 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
22611 break 2
22612 fi
22613 done
22614 done
22615 IFS=$as_save_IFS
22616
22617 ;;
22618 esac
22619 fi
22620 PYTHON=$ac_cv_path_PYTHON
22621 if test -n "$PYTHON"; then
22622 { echo "$as_me:$LINENO: result: $PYTHON" >&5
22623 echo "${ECHO_T}$PYTHON" >&6; }
22624 else
22625 { echo "$as_me:$LINENO: result: no" >&5
22626 echo "${ECHO_T}no" >&6; }
22627 fi
22628
22629
22630 if test -z "$PYTHON"; then
22631 { { echo "$as_me:$LINENO: error: Cannot find python$PYTHON_VERSION in your system path" >&5
22632 echo "$as_me: error: Cannot find python$PYTHON_VERSION in your system path" >&2;}
22633 { (exit 1); exit 1; }; }
22634 PYTHON_VERSION=""
22635 fi
22636
22637 if test -z "$PYTHON_VERSION"; then
22638 PYTHON_VERSION=`$PYTHON -c "import sys, string; \
22639 print string.split(sys.version)[0]"`
22640 fi
22641
22642 #
22643 # Check for a version of Python >= 2.1.0
22644 #
22645 { echo "$as_me:$LINENO: checking for a version of Python >= '2.1.0'" >&5
22646 echo $ECHO_N "checking for a version of Python >= '2.1.0'... $ECHO_C" >&6; }
22647 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
22648 ver = string.split(sys.version)[0]; \
22649 print ver >= '2.1.0'"`
22650 if test "$ac_supports_python_ver" != "True"; then
22651 if test -z "$PYTHON_NOVERSIONCHECK"; then
22652 { echo "$as_me:$LINENO: result: no" >&5
22653 echo "${ECHO_T}no" >&6; }
22654 { { echo "$as_me:$LINENO: error:
22655 This version of the AC_PYTHON_DEVEL macro
22656 doesn't work properly with versions of Python before
22657 2.1.0. You may need to re-run configure, setting the
22658 variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
22659 PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
22660 Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
22661 to something else than an empty string.
22662
22663 See \`config.log' for more details." >&5
22664 echo "$as_me: error:
22665 This version of the AC_PYTHON_DEVEL macro
22666 doesn't work properly with versions of Python before
22667 2.1.0. You may need to re-run configure, setting the
22668 variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
22669 PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
22670 Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
22671 to something else than an empty string.
22672
22673 See \`config.log' for more details." >&2;}
22674 { (exit 1); exit 1; }; }
22675 else
22676 { echo "$as_me:$LINENO: result: skip at user request" >&5
22677 echo "${ECHO_T}skip at user request" >&6; }
22678 fi
22679 else
22680 { echo "$as_me:$LINENO: result: yes" >&5
22681 echo "${ECHO_T}yes" >&6; }
22682 fi
22683
22684 #
22685 # if the macro parameter ``version'' is set, honour it
22686 #
22687 if test -n ""; then
22688 { echo "$as_me:$LINENO: checking for a version of Python " >&5
22689 echo $ECHO_N "checking for a version of Python ... $ECHO_C" >&6; }
22690 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
22691 ver = string.split(sys.version)[0]; \
22692 print ver "`
22693 if test "$ac_supports_python_ver" = "True"; then
22694 { echo "$as_me:$LINENO: result: yes" >&5
22695 echo "${ECHO_T}yes" >&6; }
22696 else
22697 { echo "$as_me:$LINENO: result: no" >&5
22698 echo "${ECHO_T}no" >&6; }
22699 { { echo "$as_me:$LINENO: error: this package requires Python .
22700 If you have it installed, but it isn't the default Python
22701 interpreter in your system path, please pass the PYTHON_VERSION
22702 variable to configure. See \`\`configure --help'' for reference.
22703 " >&5
22704 echo "$as_me: error: this package requires Python .
22705 If you have it installed, but it isn't the default Python
22706 interpreter in your system path, please pass the PYTHON_VERSION
22707 variable to configure. See \`\`configure --help'' for reference.
22708 " >&2;}
22709 { (exit 1); exit 1; }; }
22710 PYTHON_VERSION=""
22711 fi
22712 fi
22713
22714 #
22715 # Check if you have distutils, else fail
22716 #
22717 { echo "$as_me:$LINENO: checking for the distutils Python package" >&5
22718 echo $ECHO_N "checking for the distutils Python package... $ECHO_C" >&6; }
22719 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
22720 if test -z "$ac_distutils_result"; then
22721 { echo "$as_me:$LINENO: result: yes" >&5
22722 echo "${ECHO_T}yes" >&6; }
22723 else
22724 { echo "$as_me:$LINENO: result: no" >&5
22725 echo "${ECHO_T}no" >&6; }
22726 { { echo "$as_me:$LINENO: error: cannot import Python module \"distutils\".
22727 Please check your Python installation. The error was:
22728 $ac_distutils_result" >&5
22729 echo "$as_me: error: cannot import Python module \"distutils\".
22730 Please check your Python installation. The error was:
22731 $ac_distutils_result" >&2;}
22732 { (exit 1); exit 1; }; }
22733 PYTHON_VERSION=""
22734 fi
22735
22736 #
22737 # Check for Python include path
22738 #
22739 { echo "$as_me:$LINENO: checking for Python include path" >&5
22740 echo $ECHO_N "checking for Python include path... $ECHO_C" >&6; }
22741 if test -z "$PYTHON_CPPFLAGS"; then
22742 python_path=`$PYTHON -c "import distutils.sysconfig; \
22743 print distutils.sysconfig.get_python_inc();"`
22744 if test -n "${python_path}"; then
22745 python_path="-I$python_path"
22746 fi
22747 PYTHON_CPPFLAGS=$python_path
22748 fi
22749 { echo "$as_me:$LINENO: result: $PYTHON_CPPFLAGS" >&5
22750 echo "${ECHO_T}$PYTHON_CPPFLAGS" >&6; }
22751
22752
22753 #
22754 # Check for Python library path
22755 #
22756 { echo "$as_me:$LINENO: checking for Python library path" >&5
22757 echo $ECHO_N "checking for Python library path... $ECHO_C" >&6; }
22758 if test -z "$PYTHON_LDFLAGS"; then
22759 # (makes two attempts to ensure we've got a version number
22760 # from the interpreter)
22761 py_version=`$PYTHON -c "from distutils.sysconfig import *; \
22762 from string import join; \
22763 print join(get_config_vars('VERSION'))"`
22764 if test "$py_version" = "None"; then
22765 if test -n "$PYTHON_VERSION"; then
22766 py_version=$PYTHON_VERSION
22767 else
22768 py_version=`$PYTHON -c "import sys; \
22769 print sys.version[:3]"`
22770 fi
22771 fi
22772
22773 PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
22774 from string import join; \
22775 print '-L' + get_python_lib(0,1), \
22776 '-L' + os.path.dirname(get_python_lib(0,1)), \
22777 '-lpython';"`$py_version
22778 fi
22779 { echo "$as_me:$LINENO: result: $PYTHON_LDFLAGS" >&5
22780 echo "${ECHO_T}$PYTHON_LDFLAGS" >&6; }
22781
22782
22783 #
22784 # Check for site packages
22785 #
22786 { echo "$as_me:$LINENO: checking for Python site-packages path" >&5
22787 echo $ECHO_N "checking for Python site-packages path... $ECHO_C" >&6; }
22788 if test -z "$PYTHON_SITE_PKG"; then
22789 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
22790 print distutils.sysconfig.get_python_lib(0,0);"`
22791 fi
22792 { echo "$as_me:$LINENO: result: $PYTHON_SITE_PKG" >&5
22793 echo "${ECHO_T}$PYTHON_SITE_PKG" >&6; }
22794
22795
22796 #
22797 # libraries which must be linked in when embedding
22798 #
22799 { echo "$as_me:$LINENO: checking python extra libraries" >&5
22800 echo $ECHO_N "checking python extra libraries... $ECHO_C" >&6; }
22801 if test -z "$PYTHON_EXTRA_LIBS"; then
22802 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
22803 conf = distutils.sysconfig.get_config_var; \
22804 print conf('LOCALMODLIBS'), conf('LIBS')"`
22805 fi
22806 { echo "$as_me:$LINENO: result: $PYTHON_EXTRA_LIBS" >&5
22807 echo "${ECHO_T}$PYTHON_EXTRA_LIBS" >&6; }
22808
22809
22810 #
22811 # linking flags needed when embedding
22812 #
22813 { echo "$as_me:$LINENO: checking python extra linking flags" >&5
22814 echo $ECHO_N "checking python extra linking flags... $ECHO_C" >&6; }
22815 if test -z "$PYTHON_EXTRA_LDFLAGS"; then
22816 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
22817 conf = distutils.sysconfig.get_config_var; \
22818 print conf('LINKFORSHARED')"`
22819 fi
22820 { echo "$as_me:$LINENO: result: $PYTHON_EXTRA_LDFLAGS" >&5
22821 echo "${ECHO_T}$PYTHON_EXTRA_LDFLAGS" >&6; }
22822
22823
22824 #
22825 # final check to see if everything compiles alright
22826 #
22827 { echo "$as_me:$LINENO: checking consistency of all components of python development environment" >&5
22828 echo $ECHO_N "checking consistency of all components of python development environment... $ECHO_C" >&6; }
22829 ac_ext=c
22830 ac_cpp='$CPP $CPPFLAGS'
22831 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
22832 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
22833 ac_compiler_gnu=$ac_cv_c_compiler_gnu
22834
22835 # save current global flags
22836 LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
22837 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
22838 cat >conftest.$ac_ext <<_ACEOF
22839 /* confdefs.h. */
22840 _ACEOF
22841 cat confdefs.h >>conftest.$ac_ext
22842 cat >>conftest.$ac_ext <<_ACEOF
22843 /* end confdefs.h. */
22844
22845 #include <Python.h>
22846
22847 int
22848 main ()
22849 {
22850
22851 Py_Initialize();
22852
22853 ;
22854 return 0;
22855 }
22856 _ACEOF
22857 rm -f conftest.$ac_objext conftest$ac_exeext
22858 if { (ac_try="$ac_link"
22859 case "(($ac_try" in
22860 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22861 *) ac_try_echo=$ac_try;;
22862 esac
22863 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22864 (eval "$ac_link") 2>conftest.er1
22865 ac_status=$?
22866 grep -v '^ *+' conftest.er1 >conftest.err
22867 rm -f conftest.er1
22868 cat conftest.err >&5
22869 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22870 (exit $ac_status); } && {
22871 test -z "$ac_c_werror_flag" ||
22872 test ! -s conftest.err
22873 } && test -s conftest$ac_exeext &&
22874 $as_test_x conftest$ac_exeext; then
22875 pythonexists=yes
22876 else
22877 echo "$as_me: failed program was:" >&5
22878 sed 's/^/| /' conftest.$ac_ext >&5
22879
22880 pythonexists=no
22881 fi
22882
22883 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22884 conftest$ac_exeext conftest.$ac_ext
22885
22886 { echo "$as_me:$LINENO: result: $pythonexists" >&5
22887 echo "${ECHO_T}$pythonexists" >&6; }
22888
22889 if test ! "$pythonexists" = "yes"; then
22890 { { echo "$as_me:$LINENO: error:
22891 Could not link test program to Python. Maybe the main Python library has been
22892 installed in some non-standard library path. If so, pass it to configure,
22893 via the LDFLAGS environment variable.
22894 Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\"
22895 ============================================================================
22896 ERROR!
22897 You probably have to install the development version of the Python package
22898 for your distribution. The exact name of this package varies among them.
22899 ============================================================================
22900 " >&5
22901 echo "$as_me: error:
22902 Could not link test program to Python. Maybe the main Python library has been
22903 installed in some non-standard library path. If so, pass it to configure,
22904 via the LDFLAGS environment variable.
22905 Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\"
22906 ============================================================================
22907 ERROR!
22908 You probably have to install the development version of the Python package
22909 for your distribution. The exact name of this package varies among them.
22910 ============================================================================
22911 " >&2;}
22912 { (exit 1); exit 1; }; }
22913 PYTHON_VERSION=""
22914 fi
22915 ac_ext=c
22916 ac_cpp='$CPP $CPPFLAGS'
22917 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
22918 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
22919 ac_compiler_gnu=$ac_cv_c_compiler_gnu
22920
22921 # turn back to default flags
22922 CPPFLAGS="$ac_save_CPPFLAGS"
22923 LIBS="$ac_save_LIBS"
22924
22925 #
22926 # all done!
22927 #
22928
22929 if test ! -z "$PYTHON_VERSION"; then
22930 if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
22931 { { echo "$as_me:$LINENO: error: Python version >= 2.4.0 is required" >&5
22932 echo "$as_me: error: Python version >= 2.4.0 is required" >&2;}
22933 { (exit 1); exit 1; }; }
22934 fi
22935
22936 # Have Python
22937
22938 cat >>confdefs.h <<\_ACEOF
22939 #define HAVE_PYTHON 1
22940 _ACEOF
22941
22942 LIBS="$PYTHON_LDFLAGS $LIBS"
22943 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
22944 ub_have_python=yes
22945
22946 # Check for SWIG
22947 ub_have_swig=no
22948
22949 # Extract the first word of "swig", so it can be a program name with args.
22950 set dummy swig; ac_word=$2
22951 { echo "$as_me:$LINENO: checking for $ac_word" >&5
22952 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
22953 if test "${ac_cv_path_SWIG+set}" = set; then
22954 echo $ECHO_N "(cached) $ECHO_C" >&6
22955 else
22956 case $SWIG in
22957 [\\/]* | ?:[\\/]*)
22958 ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
22959 ;;
22960 *)
22961 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
22962 for as_dir in $PATH
22963 do
22964 IFS=$as_save_IFS
22965 test -z "$as_dir" && as_dir=.
22966 for ac_exec_ext in '' $ac_executable_extensions; do
22967 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
22968 ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
22969 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
22970 break 2
22971 fi
22972 done
22973 done
22974 IFS=$as_save_IFS
22975
22976 ;;
22977 esac
22978 fi
22979 SWIG=$ac_cv_path_SWIG
22980 if test -n "$SWIG"; then
22981 { echo "$as_me:$LINENO: result: $SWIG" >&5
22982 echo "${ECHO_T}$SWIG" >&6; }
22983 else
22984 { echo "$as_me:$LINENO: result: no" >&5
22985 echo "${ECHO_T}no" >&6; }
22986 fi
22987
22988
22989 if test -z "$SWIG" ; then
22990 { echo "$as_me:$LINENO: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&5
22991 echo "$as_me: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&2;}
22992 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
22993 elif test -n "" ; then
22994 { echo "$as_me:$LINENO: checking for SWIG version" >&5
22995 echo $ECHO_N "checking for SWIG version... $ECHO_C" >&6; }
22996 swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
22997 { echo "$as_me:$LINENO: result: $swig_version" >&5
22998 echo "${ECHO_T}$swig_version" >&6; }
22999 if test -n "$swig_version" ; then
23000 # Calculate the required version number components
23001 required=
23002 required_major=`echo $required | sed 's/[^0-9].*//'`
23003 if test -z "$required_major" ; then
23004 required_major=0
23005 fi
23006 required=`echo $required | sed 's/[0-9]*[^0-9]//'`
23007 required_minor=`echo $required | sed 's/[^0-9].*//'`
23008 if test -z "$required_minor" ; then
23009 required_minor=0
23010 fi
23011 required=`echo $required | sed 's/[0-9]*[^0-9]//'`
23012 required_patch=`echo $required | sed 's/[^0-9].*//'`
23013 if test -z "$required_patch" ; then
23014 required_patch=0
23015 fi
23016 # Calculate the available version number components
23017 available=$swig_version
23018 available_major=`echo $available | sed 's/[^0-9].*//'`
23019 if test -z "$available_major" ; then
23020 available_major=0
23021 fi
23022 available=`echo $available | sed 's/[0-9]*[^0-9]//'`
23023 available_minor=`echo $available | sed 's/[^0-9].*//'`
23024 if test -z "$available_minor" ; then
23025 available_minor=0
23026 fi
23027 available=`echo $available | sed 's/[0-9]*[^0-9]//'`
23028 available_patch=`echo $available | sed 's/[^0-9].*//'`
23029 if test -z "$available_patch" ; then
23030 available_patch=0
23031 fi
23032 if test $available_major -ne $required_major \
23033 -o $available_minor -ne $required_minor \
23034 -o $available_patch -lt $required_patch ; then
23035 { echo "$as_me:$LINENO: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&5
23036 echo "$as_me: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&2;}
23037 SWIG='echo "Error: SWIG version >= is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
23038 else
23039 { echo "$as_me:$LINENO: SWIG executable is '$SWIG'" >&5
23040 echo "$as_me: SWIG executable is '$SWIG'" >&6;}
23041 SWIG_LIB=`$SWIG -swiglib`
23042 { echo "$as_me:$LINENO: SWIG library directory is '$SWIG_LIB'" >&5
23043 echo "$as_me: SWIG library directory is '$SWIG_LIB'" >&6;}
23044 fi
23045 else
23046 { echo "$as_me:$LINENO: WARNING: cannot determine SWIG version" >&5
23047 echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
23048 SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
23049 fi
23050 fi
23051
23052
23053 { echo "$as_me:$LINENO: checking SWIG" >&5
23054 echo $ECHO_N "checking SWIG... $ECHO_C" >&6; }
23055 if test ! -x "$SWIG"; then
23056 { echo "$as_me:$LINENO: result: failed" >&5
23057 echo "${ECHO_T}failed" >&6; }
23058 swig=""
23059
23060 ub_with_pyunbound=no
23061 ub_with_pythonmod=no
23062 else
23063
23064 cat >>confdefs.h <<\_ACEOF
23065 #define HAVE_SWIG 1
23066 _ACEOF
23067
23068 swig="$SWIG"
23069
23070 { echo "$as_me:$LINENO: result: present" >&5
23071 echo "${ECHO_T}present" >&6; }
23072
23073 # If have Python & SWIG
23074 # Declare PythonMod
23075 if test x_$ub_with_pythonmod != x_no; then
23076
23077 cat >>confdefs.h <<\_ACEOF
23078 #define WITH_PYTHONMODULE 1
23079 _ACEOF
23080
23081 WITH_PYTHONMODULE=yes
23082
23083 fi
23084
23085 # Declare PyUnbound
23086 if test x_$ub_with_pyunbound != x_no; then
23087
23088 cat >>confdefs.h <<\_ACEOF
23089 #define WITH_PYUNBOUND 1
23090 _ACEOF
23091
23092 WITH_PYUNBOUND=yes
23093
23094 fi
23095 fi
23096 else
23097 { echo "$as_me:$LINENO: result: *** Python libraries not found, won't build PythonMod or PyUnbound ***" >&5
23098 echo "${ECHO_T}*** Python libraries not found, won't build PythonMod or PyUnbound ***" >&6; }
23099 ub_with_pyunbound=no
23100 ub_with_pythonmod=no
23101 fi
23102 fi
23103
23104 # Checks for libraries.
23105
23106
23107 # Check whether --with-ssl was given.
23108 if test "${with_ssl+set}" = set; then
23109 withval=$with_ssl;
23110
23111 else
23112
23113 withval="yes"
23114
23115 fi
23116
23117 if test x_$withval = x_no; then
23118 { { echo "$as_me:$LINENO: error: Need SSL library to do digital signature cryptography" >&5
23119 echo "$as_me: error: Need SSL library to do digital signature cryptography" >&2;}
23120 { (exit 1); exit 1; }; }
23121 fi
23122 if test x_$withval != x_no; then
23123 { echo "$as_me:$LINENO: checking for SSL" >&5
23124 echo $ECHO_N "checking for SSL... $ECHO_C" >&6; }
23125 if test x_$withval = x_ -o x_$withval = x_yes; then
23126 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
23127 fi
23128 for dir in $withval; do
23129 ssldir="$dir"
23130 if test -f "$dir/include/openssl/ssl.h"; then
23131 found_ssl="yes"
23132
23133 cat >>confdefs.h <<_ACEOF
23134 #define HAVE_SSL
23135 _ACEOF
23136
23137 if test "$ssldir" != "/usr"; then
23138 CPPFLAGS="$CPPFLAGS -I$ssldir/include"
23139 fi
23140 break;
23141 fi
23142 done
23143 if test x_$found_ssl != x_yes; then
23144 { { echo "$as_me:$LINENO: error: Cannot find the SSL libraries in $withval" >&5
23145 echo "$as_me: error: Cannot find the SSL libraries in $withval" >&2;}
23146 { (exit 1); exit 1; }; }
23147 else
23148 { echo "$as_me:$LINENO: result: found in $ssldir" >&5
23149 echo "${ECHO_T}found in $ssldir" >&6; }
23150 HAVE_SSL=yes
23151 if test "$ssldir" != "/usr"; then
23152 LDFLAGS="$LDFLAGS -L$ssldir/lib"
23153
23154 if test "x$enable_rpath" = xyes; then
23155 if echo "$ssldir/lib" | grep "^/" >/dev/null; then
23156 RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib"
23157 fi
23158 fi
23159
23160 fi
23161
23162 { echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
23163 echo $ECHO_N "checking for HMAC_CTX_init in -lcrypto... $ECHO_C" >&6; }
23164 LIBS="$LIBS -lcrypto"
23165 cat >conftest.$ac_ext <<_ACEOF
23166 /* confdefs.h. */
23167 _ACEOF
23168 cat confdefs.h >>conftest.$ac_ext
23169 cat >>conftest.$ac_ext <<_ACEOF
23170 /* end confdefs.h. */
23171
23172 int
23173 main ()
23174 {
23175
23176 int HMAC_CTX_init(void);
23177 (void)HMAC_CTX_init();
23178
23179 ;
23180 return 0;
23181 }
23182 _ACEOF
23183 rm -f conftest.$ac_objext conftest$ac_exeext
23184 if { (ac_try="$ac_link"
23185 case "(($ac_try" in
23186 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23187 *) ac_try_echo=$ac_try;;
23188 esac
23189 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23190 (eval "$ac_link") 2>conftest.er1
23191 ac_status=$?
23192 grep -v '^ *+' conftest.er1 >conftest.err
23193 rm -f conftest.er1
23194 cat conftest.err >&5
23195 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23196 (exit $ac_status); } && {
23197 test -z "$ac_c_werror_flag" ||
23198 test ! -s conftest.err
23199 } && test -s conftest$ac_exeext &&
23200 $as_test_x conftest$ac_exeext; then
23201
23202 { echo "$as_me:$LINENO: result: yes" >&5
23203 echo "${ECHO_T}yes" >&6; }
23204
23205 cat >>confdefs.h <<\_ACEOF
23206 #define HAVE_HMAC_CTX_INIT 1
23207 _ACEOF
23208
23209
23210 else
23211 echo "$as_me: failed program was:" >&5
23212 sed 's/^/| /' conftest.$ac_ext >&5
23213
23214
23215 { echo "$as_me:$LINENO: result: no" >&5
23216 echo "${ECHO_T}no" >&6; }
23217 # check if -lwsock32 or -lgdi32 are needed.
23218 BAKLIBS="$LIBS"
23219 LIBS="$LIBS -lgdi32"
23220 { echo "$as_me:$LINENO: checking if -lcrypto needs -lgdi32" >&5
23221 echo $ECHO_N "checking if -lcrypto needs -lgdi32... $ECHO_C" >&6; }
23222 cat >conftest.$ac_ext <<_ACEOF
23223 /* confdefs.h. */
23224 _ACEOF
23225 cat confdefs.h >>conftest.$ac_ext
23226 cat >>conftest.$ac_ext <<_ACEOF
23227 /* end confdefs.h. */
23228
23229 int
23230 main ()
23231 {
23232
23233 int HMAC_CTX_init(void);
23234 (void)HMAC_CTX_init();
23235
23236 ;
23237 return 0;
23238 }
23239 _ACEOF
23240 rm -f conftest.$ac_objext conftest$ac_exeext
23241 if { (ac_try="$ac_link"
23242 case "(($ac_try" in
23243 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23244 *) ac_try_echo=$ac_try;;
23245 esac
23246 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23247 (eval "$ac_link") 2>conftest.er1
23248 ac_status=$?
23249 grep -v '^ *+' conftest.er1 >conftest.err
23250 rm -f conftest.er1
23251 cat conftest.err >&5
23252 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23253 (exit $ac_status); } && {
23254 test -z "$ac_c_werror_flag" ||
23255 test ! -s conftest.err
23256 } && test -s conftest$ac_exeext &&
23257 $as_test_x conftest$ac_exeext; then
23258
23259
23260 cat >>confdefs.h <<\_ACEOF
23261 #define HAVE_HMAC_CTX_INIT 1
23262 _ACEOF
23263
23264 { echo "$as_me:$LINENO: result: yes" >&5
23265 echo "${ECHO_T}yes" >&6; }
23266
23267 else
23268 echo "$as_me: failed program was:" >&5
23269 sed 's/^/| /' conftest.$ac_ext >&5
23270
23271
23272 { echo "$as_me:$LINENO: result: no" >&5
23273 echo "${ECHO_T}no" >&6; }
23274 LIBS="$BAKLIBS"
23275 LIBS="$LIBS -ldl"
23276 { echo "$as_me:$LINENO: checking if -lcrypto needs -ldl" >&5
23277 echo $ECHO_N "checking if -lcrypto needs -ldl... $ECHO_C" >&6; }
23278 cat >conftest.$ac_ext <<_ACEOF
23279 /* confdefs.h. */
23280 _ACEOF
23281 cat confdefs.h >>conftest.$ac_ext
23282 cat >>conftest.$ac_ext <<_ACEOF
23283 /* end confdefs.h. */
23284
23285 int
23286 main ()
23287 {
23288
23289 int HMAC_CTX_init(void);
23290 (void)HMAC_CTX_init();
23291
23292 ;
23293 return 0;
23294 }
23295 _ACEOF
23296 rm -f conftest.$ac_objext conftest$ac_exeext
23297 if { (ac_try="$ac_link"
23298 case "(($ac_try" in
23299 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23300 *) ac_try_echo=$ac_try;;
23301 esac
23302 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23303 (eval "$ac_link") 2>conftest.er1
23304 ac_status=$?
23305 grep -v '^ *+' conftest.er1 >conftest.err
23306 rm -f conftest.er1
23307 cat conftest.err >&5
23308 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23309 (exit $ac_status); } && {
23310 test -z "$ac_c_werror_flag" ||
23311 test ! -s conftest.err
23312 } && test -s conftest$ac_exeext &&
23313 $as_test_x conftest$ac_exeext; then
23314
23315
23316 cat >>confdefs.h <<\_ACEOF
23317 #define HAVE_HMAC_CTX_INIT 1
23318 _ACEOF
23319
23320 { echo "$as_me:$LINENO: result: yes" >&5
23321 echo "${ECHO_T}yes" >&6; }
23322
23323 else
23324 echo "$as_me: failed program was:" >&5
23325 sed 's/^/| /' conftest.$ac_ext >&5
23326
23327
23328 { echo "$as_me:$LINENO: result: no" >&5
23329 echo "${ECHO_T}no" >&6; }
23330 { { echo "$as_me:$LINENO: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&5
23331 echo "$as_me: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&2;}
23332 { (exit 1); exit 1; }; }
23333
23334 fi
23335
23336 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23337 conftest$ac_exeext conftest.$ac_ext
23338
23339 fi
23340
23341 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23342 conftest$ac_exeext conftest.$ac_ext
23343
23344 fi
23345
23346 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23347 conftest$ac_exeext conftest.$ac_ext
23348 fi
23349
23350
23351 fi
23352
23353 for ac_header in openssl/ssl.h
2141723354 do
2141823355 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
2141923356 { echo "$as_me:$LINENO: checking for $ac_header" >&5
2147123408 done
2147223409
2147323410
21474 for ac_header in openssl/rand.h
23411 for ac_header in openssl/err.h
2147523412 do
2147623413 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
2147723414 { echo "$as_me:$LINENO: checking for $ac_header" >&5
2152923466 done
2153023467
2153123468
21532
21533
21534 for ac_func in EVP_sha1 EVP_sha256 EVP_sha512
23469 for ac_header in openssl/rand.h
2153523470 do
21536 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
21537 { echo "$as_me:$LINENO: checking for $ac_func" >&5
21538 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
21539 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
23471 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
23472 { echo "$as_me:$LINENO: checking for $ac_header" >&5
23473 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
23474 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
2154023475 echo $ECHO_N "(cached) $ECHO_C" >&6
2154123476 else
2154223477 cat >conftest.$ac_ext <<_ACEOF
2154523480 cat confdefs.h >>conftest.$ac_ext
2154623481 cat >>conftest.$ac_ext <<_ACEOF
2154723482 /* end confdefs.h. */
21548 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
21549 For example, HP-UX 11i <limits.h> declares gettimeofday. */
21550 #define $ac_func innocuous_$ac_func
21551
21552 /* System header to define __stub macros and hopefully few prototypes,
21553 which can conflict with char $ac_func (); below.
21554 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
21555 <limits.h> exists even on freestanding compilers. */
21556
21557 #ifdef __STDC__
21558 # include <limits.h>
21559 #else
21560 # include <assert.h>
21561 #endif
21562
21563 #undef $ac_func
21564
21565 /* Override any GCC internal prototype to avoid an error.
21566 Use char because int might match the return type of a GCC
21567 builtin and then its argument prototype would still apply. */
21568 #ifdef __cplusplus
21569 extern "C"
21570 #endif
21571 char $ac_func ();
21572 /* The GNU C library defines this for functions which it implements
21573 to always fail with ENOSYS. Some functions are actually named
21574 something starting with __ and the normal name is an alias. */
21575 #if defined __stub_$ac_func || defined __stub___$ac_func
21576 choke me
21577 #endif
21578
21579 int
21580 main ()
21581 {
21582 return $ac_func ();
21583 ;
21584 return 0;
21585 }
21586 _ACEOF
21587 rm -f conftest.$ac_objext conftest$ac_exeext
21588 if { (ac_try="$ac_link"
23483 $ac_includes_default
23484
23485 #include <$ac_header>
23486 _ACEOF
23487 rm -f conftest.$ac_objext
23488 if { (ac_try="$ac_compile"
2158923489 case "(($ac_try" in
2159023490 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2159123491 *) ac_try_echo=$ac_try;;
2159223492 esac
2159323493 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21594 (eval "$ac_link") 2>conftest.er1
23494 (eval "$ac_compile") 2>conftest.er1
2159523495 ac_status=$?
2159623496 grep -v '^ *+' conftest.er1 >conftest.err
2159723497 rm -f conftest.er1
2160023500 (exit $ac_status); } && {
2160123501 test -z "$ac_c_werror_flag" ||
2160223502 test ! -s conftest.err
21603 } && test -s conftest$ac_exeext &&
21604 $as_test_x conftest$ac_exeext; then
21605 eval "$as_ac_var=yes"
23503 } && test -s conftest.$ac_objext; then
23504 eval "$as_ac_Header=yes"
2160623505 else
2160723506 echo "$as_me: failed program was:" >&5
2160823507 sed 's/^/| /' conftest.$ac_ext >&5
2160923508
21610 eval "$as_ac_var=no"
21611 fi
21612
21613 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21614 conftest$ac_exeext conftest.$ac_ext
21615 fi
21616 ac_res=`eval echo '${'$as_ac_var'}'`
23509 eval "$as_ac_Header=no"
23510 fi
23511
23512 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
23513 fi
23514 ac_res=`eval echo '${'$as_ac_Header'}'`
2161723515 { echo "$as_me:$LINENO: result: $ac_res" >&5
2161823516 echo "${ECHO_T}$ac_res" >&6; }
21619 if test `eval echo '${'$as_ac_var'}'` = yes; then
23517 if test `eval echo '${'$as_ac_Header'}'` = yes; then
2162023518 cat >>confdefs.h <<_ACEOF
21621 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
21622 _ACEOF
21623
21624 fi
23519 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
23520 _ACEOF
23521
23522 fi
23523
2162523524 done
23525
2162623526
2162723527
2162823528 # check if libssl needs libdl
2177223672 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2177323673 conftest$ac_exeext conftest.$ac_ext
2177423674
21775 # check for thread library.
21776
21777 # Check whether --with-pthreads was given.
21778 if test "${with_pthreads+set}" = set; then
21779 withval=$with_pthreads;
21780 else
21781 withval="yes"
21782 fi
21783
21784 ub_have_pthreads=no
21785 if test x_$withval != x_no; then
21786 ##### http://autoconf-archive.cryp.to/acx_pthread.html
21787 #
21788 # SYNOPSIS
21789 #
21790 # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
21791 #
21792 # DESCRIPTION
21793 #
21794 # This macro figures out how to build C programs using POSIX threads.
21795 # It sets the PTHREAD_LIBS output variable to the threads library and
21796 # linker flags, and the PTHREAD_CFLAGS output variable to any special
21797 # C compiler flags that are needed. (The user can also force certain
21798 # compiler flags/libs to be tested by setting these environment
21799 # variables.)
21800 #
21801 # Also sets PTHREAD_CC to any special C compiler that is needed for
21802 # multi-threaded programs (defaults to the value of CC otherwise).
21803 # (This is necessary on AIX to use the special cc_r compiler alias.)
21804 #
21805 # NOTE: You are assumed to not only compile your program with these
21806 # flags, but also link it with them as well. e.g. you should link
21807 # with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
21808 # $LIBS
21809 #
21810 # If you are only building threads programs, you may wish to use
21811 # these variables in your default LIBS, CFLAGS, and CC:
21812 #
21813 # LIBS="$PTHREAD_LIBS $LIBS"
21814 # CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
21815 # CC="$PTHREAD_CC"
21816 #
21817 # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
21818 # constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
21819 # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
21820 #
21821 # ACTION-IF-FOUND is a list of shell commands to run if a threads
21822 # library is found, and ACTION-IF-NOT-FOUND is a list of commands to
21823 # run it if it is not found. If ACTION-IF-FOUND is not specified, the
21824 # default action will define HAVE_PTHREAD.
21825 #
21826 # Please let the authors know if this macro fails on any platform, or
21827 # if you have any other suggestions or comments. This macro was based
21828 # on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
21829 # (with help from M. Frigo), as well as ac_pthread and hb_pthread
21830 # macros posted by Alejandro Forero Cuervo to the autoconf macro
21831 # repository. We are also grateful for the helpful feedback of
21832 # numerous users.
21833 #
21834 # LAST MODIFICATION
21835 #
21836 # 2006-05-29
21837 #
21838 # COPYLEFT
21839 #
21840 # Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
21841 #
21842 # This program is free software; you can redistribute it and/or
21843 # modify it under the terms of the GNU General Public License as
21844 # published by the Free Software Foundation; either version 2 of the
21845 # License, or (at your option) any later version.
21846 #
21847 # This program is distributed in the hope that it will be useful, but
21848 # WITHOUT ANY WARRANTY; without even the implied warranty of
21849 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21850 # General Public License for more details.
21851 #
21852 # You should have received a copy of the GNU General Public License
21853 # along with this program; if not, write to the Free Software
21854 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21855 # 02111-1307, USA.
21856 #
21857 # As a special exception, the respective Autoconf Macro's copyright
21858 # owner gives unlimited permission to copy, distribute and modify the
21859 # configure scripts that are the output of Autoconf when processing
21860 # the Macro. You need not follow the terms of the GNU General Public
21861 # License when using or distributing such scripts, even though
21862 # portions of the text of the Macro appear in them. The GNU General
21863 # Public License (GPL) does govern all other use of the material that
21864 # constitutes the Autoconf Macro.
21865 #
21866 # This special exception to the GPL applies to versions of the
21867 # Autoconf Macro released by the Autoconf Macro Archive. When you
21868 # make and distribute a modified version of the Autoconf Macro, you
21869 # may extend this special exception to the GPL to apply to your
21870 # modified version as well.
21871
21872
21873
21874
21875
21876 ac_ext=c
21877 ac_cpp='$CPP $CPPFLAGS'
21878 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
21879 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
21880 ac_compiler_gnu=$ac_cv_c_compiler_gnu
21881
21882 acx_pthread_ok=no
21883
21884 # We used to check for pthread.h first, but this fails if pthread.h
21885 # requires special compiler flags (e.g. on True64 or Sequent).
21886 # It gets checked for in the link test anyway.
21887
21888 # First of all, check if the user has set any of the PTHREAD_LIBS,
21889 # etcetera environment variables, and if threads linking works using
21890 # them:
21891 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
21892 save_CFLAGS="$CFLAGS"
21893 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
21894 save_LIBS="$LIBS"
21895 LIBS="$PTHREAD_LIBS $LIBS"
21896 { echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
21897 echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6; }
21898 cat >conftest.$ac_ext <<_ACEOF
23675
23676
23677
23678 for ac_func in EVP_sha1 EVP_sha256 EVP_sha512 ENGINE_load_gost
23679 do
23680 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
23681 { echo "$as_me:$LINENO: checking for $ac_func" >&5
23682 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
23683 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
23684 echo $ECHO_N "(cached) $ECHO_C" >&6
23685 else
23686 cat >conftest.$ac_ext <<_ACEOF
2189923687 /* confdefs.h. */
2190023688 _ACEOF
2190123689 cat confdefs.h >>conftest.$ac_ext
2190223690 cat >>conftest.$ac_ext <<_ACEOF
2190323691 /* end confdefs.h. */
23692 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
23693 For example, HP-UX 11i <limits.h> declares gettimeofday. */
23694 #define $ac_func innocuous_$ac_func
23695
23696 /* System header to define __stub macros and hopefully few prototypes,
23697 which can conflict with char $ac_func (); below.
23698 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
23699 <limits.h> exists even on freestanding compilers. */
23700
23701 #ifdef __STDC__
23702 # include <limits.h>
23703 #else
23704 # include <assert.h>
23705 #endif
23706
23707 #undef $ac_func
2190423708
2190523709 /* Override any GCC internal prototype to avoid an error.
2190623710 Use char because int might match the return type of a GCC
2190823712 #ifdef __cplusplus
2190923713 extern "C"
2191023714 #endif
21911 char pthread_join ();
23715 char $ac_func ();
23716 /* The GNU C library defines this for functions which it implements
23717 to always fail with ENOSYS. Some functions are actually named
23718 something starting with __ and the normal name is an alias. */
23719 #if defined __stub_$ac_func || defined __stub___$ac_func
23720 choke me
23721 #endif
23722
2191223723 int
2191323724 main ()
2191423725 {
21915 return pthread_join ();
23726 return $ac_func ();
2191623727 ;
2191723728 return 0;
2191823729 }
2193523746 test ! -s conftest.err
2193623747 } && test -s conftest$ac_exeext &&
2193723748 $as_test_x conftest$ac_exeext; then
21938 acx_pthread_ok=yes
23749 eval "$as_ac_var=yes"
2193923750 else
2194023751 echo "$as_me: failed program was:" >&5
2194123752 sed 's/^/| /' conftest.$ac_ext >&5
2194223753
21943
23754 eval "$as_ac_var=no"
2194423755 fi
2194523756
2194623757 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2194723758 conftest$ac_exeext conftest.$ac_ext
21948 { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
21949 echo "${ECHO_T}$acx_pthread_ok" >&6; }
21950 if test x"$acx_pthread_ok" = xno; then
21951 PTHREAD_LIBS=""
21952 PTHREAD_CFLAGS=""
21953 fi
21954 LIBS="$save_LIBS"
21955 CFLAGS="$save_CFLAGS"
21956 fi
21957
21958 # We must check for the threads library under a number of different
21959 # names; the ordering is very important because some systems
21960 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
21961 # libraries is broken (non-POSIX).
21962
21963 # Create a list of thread flags to try. Items starting with a "-" are
21964 # C compiler flags, and other items are library names, except for "none"
21965 # which indicates that we try without any flags at all, and "pthread-config"
21966 # which is a program returning the flags for the Pth emulation library.
21967
21968 acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
21969
21970 # The ordering *is* (sometimes) important. Some notes on the
21971 # individual items follow:
21972
21973 # pthreads: AIX (must check this before -lpthread)
21974 # none: in case threads are in libc; should be tried before -Kthread and
21975 # other compiler flags to prevent continual compiler warnings
21976 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
21977 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
21978 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
21979 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
21980 # -pthreads: Solaris/gcc
21981 # -mthreads: Mingw32/gcc, Lynx/gcc
21982 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
21983 # doesn't hurt to check since this sometimes defines pthreads too;
21984 # also defines -D_REENTRANT)
21985 # ... -mt is also the pthreads flag for HP/aCC
21986 # pthread: Linux, etcetera
21987 # --thread-safe: KAI C++
21988 # pthread-config: use pthread-config program (for GNU Pth library)
21989
21990 case "${host_cpu}-${host_os}" in
21991 *solaris*)
21992
21993 # On Solaris (at least, for some versions), libc contains stubbed
21994 # (non-functional) versions of the pthreads routines, so link-based
21995 # tests will erroneously succeed. (We need to link with -pthreads/-mt/
21996 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
21997 # a function called by this macro, so we could check for that, but
21998 # who knows whether they'll stub that too in a future libc.) So,
21999 # we'll just look for -pthreads and -lpthread first:
22000
22001 acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
22002 ;;
22003 esac
22004
22005 if test x"$acx_pthread_ok" = xno; then
22006 for flag in $acx_pthread_flags; do
22007
22008 case $flag in
22009 none)
22010 { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
22011 echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; }
22012 ;;
22013
22014 -*)
22015 { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
22016 echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; }
22017 PTHREAD_CFLAGS="$flag"
22018 ;;
22019
22020 pthread-config)
22021 # Extract the first word of "pthread-config", so it can be a program name with args.
22022 set dummy pthread-config; ac_word=$2
22023 { echo "$as_me:$LINENO: checking for $ac_word" >&5
22024 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
22025 if test "${ac_cv_prog_acx_pthread_config+set}" = set; then
22026 echo $ECHO_N "(cached) $ECHO_C" >&6
22027 else
22028 if test -n "$acx_pthread_config"; then
22029 ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
22030 else
22031 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
22032 for as_dir in $PATH
22033 do
22034 IFS=$as_save_IFS
22035 test -z "$as_dir" && as_dir=.
22036 for ac_exec_ext in '' $ac_executable_extensions; do
22037 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
22038 ac_cv_prog_acx_pthread_config="yes"
22039 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
22040 break 2
22041 fi
22042 done
22043 done
22044 IFS=$as_save_IFS
22045
22046 test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
22047 fi
22048 fi
22049 acx_pthread_config=$ac_cv_prog_acx_pthread_config
22050 if test -n "$acx_pthread_config"; then
22051 { echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
22052 echo "${ECHO_T}$acx_pthread_config" >&6; }
22053 else
22054 { echo "$as_me:$LINENO: result: no" >&5
22055 echo "${ECHO_T}no" >&6; }
22056 fi
22057
22058
22059 if test x"$acx_pthread_config" = xno; then continue; fi
22060 PTHREAD_CFLAGS="`pthread-config --cflags`"
22061 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
22062 ;;
22063
22064 *)
22065 { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
22066 echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; }
22067 PTHREAD_LIBS="-l$flag"
22068 ;;
22069 esac
22070
22071 save_LIBS="$LIBS"
22072 save_CFLAGS="$CFLAGS"
22073 LIBS="$PTHREAD_LIBS $LIBS"
22074 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
22075
22076 # Check for various functions. We must include pthread.h,
22077 # since some functions may be macros. (On the Sequent, we
22078 # need a special flag -Kthread to make this header compile.)
22079 # We check for pthread_join because it is in -lpthread on IRIX
22080 # while pthread_create is in libc. We check for pthread_attr_init
22081 # due to DEC craziness with -lpthreads. We check for
22082 # pthread_cleanup_push because it is one of the few pthread
22083 # functions on Solaris that doesn't have a non-functional libc stub.
22084 # We try pthread_create on general principles.
22085 cat >conftest.$ac_ext <<_ACEOF
22086 /* confdefs.h. */
22087 _ACEOF
22088 cat confdefs.h >>conftest.$ac_ext
22089 cat >>conftest.$ac_ext <<_ACEOF
22090 /* end confdefs.h. */
22091 #include <pthread.h>
22092 int
22093 main ()
22094 {
22095 pthread_t th; pthread_join(th, 0);
22096 pthread_attr_init(0); pthread_cleanup_push(0, 0);
22097 pthread_create(0,0,0,0); pthread_cleanup_pop(0);
22098 ;
22099 return 0;
22100 }
22101 _ACEOF
22102 rm -f conftest.$ac_objext conftest$ac_exeext
22103 if { (ac_try="$ac_link"
22104 case "(($ac_try" in
22105 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22106 *) ac_try_echo=$ac_try;;
22107 esac
22108 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22109 (eval "$ac_link") 2>conftest.er1
22110 ac_status=$?
22111 grep -v '^ *+' conftest.er1 >conftest.err
22112 rm -f conftest.er1
22113 cat conftest.err >&5
22114 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22115 (exit $ac_status); } && {
22116 test -z "$ac_c_werror_flag" ||
22117 test ! -s conftest.err
22118 } && test -s conftest$ac_exeext &&
22119 $as_test_x conftest$ac_exeext; then
22120 acx_pthread_ok=yes
22121 else
22122 echo "$as_me: failed program was:" >&5
22123 sed 's/^/| /' conftest.$ac_ext >&5
22124
22125
22126 fi
22127
22128 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22129 conftest$ac_exeext conftest.$ac_ext
22130
22131 LIBS="$save_LIBS"
22132 CFLAGS="$save_CFLAGS"
22133
22134 { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
22135 echo "${ECHO_T}$acx_pthread_ok" >&6; }
22136 if test "x$acx_pthread_ok" = xyes; then
22137 break;
22138 fi
22139
22140 PTHREAD_LIBS=""
22141 PTHREAD_CFLAGS=""
22142 done
22143 fi
22144
22145 # Various other checks:
22146 if test "x$acx_pthread_ok" = xyes; then
22147 save_LIBS="$LIBS"
22148 LIBS="$PTHREAD_LIBS $LIBS"
22149 save_CFLAGS="$CFLAGS"
22150 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
22151
22152 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
22153 { echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
22154 echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6; }
22155 attr_name=unknown
22156 for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
22157 cat >conftest.$ac_ext <<_ACEOF
22158 /* confdefs.h. */
22159 _ACEOF
22160 cat confdefs.h >>conftest.$ac_ext
22161 cat >>conftest.$ac_ext <<_ACEOF
22162 /* end confdefs.h. */
22163 #include <pthread.h>
22164 int
22165 main ()
22166 {
22167 int attr=$attr; return attr;
22168 ;
22169 return 0;
22170 }
22171 _ACEOF
22172 rm -f conftest.$ac_objext conftest$ac_exeext
22173 if { (ac_try="$ac_link"
22174 case "(($ac_try" in
22175 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22176 *) ac_try_echo=$ac_try;;
22177 esac
22178 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22179 (eval "$ac_link") 2>conftest.er1
22180 ac_status=$?
22181 grep -v '^ *+' conftest.er1 >conftest.err
22182 rm -f conftest.er1
22183 cat conftest.err >&5
22184 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22185 (exit $ac_status); } && {
22186 test -z "$ac_c_werror_flag" ||
22187 test ! -s conftest.err
22188 } && test -s conftest$ac_exeext &&
22189 $as_test_x conftest$ac_exeext; then
22190 attr_name=$attr; break
22191 else
22192 echo "$as_me: failed program was:" >&5
22193 sed 's/^/| /' conftest.$ac_ext >&5
22194
22195
22196 fi
22197
22198 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22199 conftest$ac_exeext conftest.$ac_ext
22200 done
22201 { echo "$as_me:$LINENO: result: $attr_name" >&5
22202 echo "${ECHO_T}$attr_name" >&6; }
22203 if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
22204
22205 cat >>confdefs.h <<_ACEOF
22206 #define PTHREAD_CREATE_JOINABLE $attr_name
22207 _ACEOF
22208
22209 fi
22210
22211 { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
22212 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; }
22213 flag=no
22214 case "${host_cpu}-${host_os}" in
22215 *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
22216 *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
22217 esac
22218 { echo "$as_me:$LINENO: result: ${flag}" >&5
22219 echo "${ECHO_T}${flag}" >&6; }
22220 if test "x$flag" != xno; then
22221 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
22222 fi
22223
22224 LIBS="$save_LIBS"
22225 CFLAGS="$save_CFLAGS"
22226
22227 # More AIX lossage: must compile with xlc_r or cc_r
22228 if test x"$GCC" != xyes; then
22229 for ac_prog in xlc_r cc_r
22230 do
22231 # Extract the first word of "$ac_prog", so it can be a program name with args.
22232 set dummy $ac_prog; ac_word=$2
22233 { echo "$as_me:$LINENO: checking for $ac_word" >&5
22234 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
22235 if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
22236 echo $ECHO_N "(cached) $ECHO_C" >&6
22237 else
22238 if test -n "$PTHREAD_CC"; then
22239 ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
22240 else
22241 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
22242 for as_dir in $PATH
22243 do
22244 IFS=$as_save_IFS
22245 test -z "$as_dir" && as_dir=.
22246 for ac_exec_ext in '' $ac_executable_extensions; do
22247 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
22248 ac_cv_prog_PTHREAD_CC="$ac_prog"
22249 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
22250 break 2
22251 fi
22252 done
22253 done
22254 IFS=$as_save_IFS
22255
22256 fi
22257 fi
22258 PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
22259 if test -n "$PTHREAD_CC"; then
22260 { echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
22261 echo "${ECHO_T}$PTHREAD_CC" >&6; }
22262 else
22263 { echo "$as_me:$LINENO: result: no" >&5
22264 echo "${ECHO_T}no" >&6; }
22265 fi
22266
22267
22268 test -n "$PTHREAD_CC" && break
22269 done
22270 test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
22271
22272 else
22273 PTHREAD_CC=$CC
22274 fi
22275 else
22276 PTHREAD_CC="$CC"
22277 fi
22278
22279
22280
22281
22282
22283 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
22284 if test x"$acx_pthread_ok" = xyes; then
22285
22286
22287 cat >>confdefs.h <<\_ACEOF
22288 #define HAVE_PTHREAD 1
22289 _ACEOF
22290
22291 LIBS="$PTHREAD_LIBS $LIBS"
22292 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
22293 CC="$PTHREAD_CC"
22294 ub_have_pthreads=yes
22295 { echo "$as_me:$LINENO: checking for pthread_spinlock_t" >&5
22296 echo $ECHO_N "checking for pthread_spinlock_t... $ECHO_C" >&6; }
22297 if test "${ac_cv_type_pthread_spinlock_t+set}" = set; then
22298 echo $ECHO_N "(cached) $ECHO_C" >&6
22299 else
22300 cat >conftest.$ac_ext <<_ACEOF
22301 /* confdefs.h. */
22302 _ACEOF
22303 cat confdefs.h >>conftest.$ac_ext
22304 cat >>conftest.$ac_ext <<_ACEOF
22305 /* end confdefs.h. */
22306 #include <pthread.h>
22307
22308 typedef pthread_spinlock_t ac__type_new_;
22309 int
22310 main ()
22311 {
22312 if ((ac__type_new_ *) 0)
22313 return 0;
22314 if (sizeof (ac__type_new_))
22315 return 0;
22316 ;
22317 return 0;
22318 }
22319 _ACEOF
22320 rm -f conftest.$ac_objext
22321 if { (ac_try="$ac_compile"
22322 case "(($ac_try" in
22323 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22324 *) ac_try_echo=$ac_try;;
22325 esac
22326 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22327 (eval "$ac_compile") 2>conftest.er1
22328 ac_status=$?
22329 grep -v '^ *+' conftest.er1 >conftest.err
22330 rm -f conftest.er1
22331 cat conftest.err >&5
22332 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22333 (exit $ac_status); } && {
22334 test -z "$ac_c_werror_flag" ||
22335 test ! -s conftest.err
22336 } && test -s conftest.$ac_objext; then
22337 ac_cv_type_pthread_spinlock_t=yes
22338 else
22339 echo "$as_me: failed program was:" >&5
22340 sed 's/^/| /' conftest.$ac_ext >&5
22341
22342 ac_cv_type_pthread_spinlock_t=no
22343 fi
22344
22345 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22346 fi
22347 { echo "$as_me:$LINENO: result: $ac_cv_type_pthread_spinlock_t" >&5
22348 echo "${ECHO_T}$ac_cv_type_pthread_spinlock_t" >&6; }
22349 if test $ac_cv_type_pthread_spinlock_t = yes; then
22350
22351 cat >>confdefs.h <<_ACEOF
22352 #define HAVE_PTHREAD_SPINLOCK_T 1
22353 _ACEOF
22354
22355
22356 fi
22357 { echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
22358 echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6; }
22359 if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then
22360 echo $ECHO_N "(cached) $ECHO_C" >&6
22361 else
22362 cat >conftest.$ac_ext <<_ACEOF
22363 /* confdefs.h. */
22364 _ACEOF
22365 cat confdefs.h >>conftest.$ac_ext
22366 cat >>conftest.$ac_ext <<_ACEOF
22367 /* end confdefs.h. */
22368 #include <pthread.h>
22369
22370 typedef pthread_rwlock_t ac__type_new_;
22371 int
22372 main ()
22373 {
22374 if ((ac__type_new_ *) 0)
22375 return 0;
22376 if (sizeof (ac__type_new_))
22377 return 0;
22378 ;
22379 return 0;
22380 }
22381 _ACEOF
22382 rm -f conftest.$ac_objext
22383 if { (ac_try="$ac_compile"
22384 case "(($ac_try" in
22385 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22386 *) ac_try_echo=$ac_try;;
22387 esac
22388 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22389 (eval "$ac_compile") 2>conftest.er1
22390 ac_status=$?
22391 grep -v '^ *+' conftest.er1 >conftest.err
22392 rm -f conftest.er1
22393 cat conftest.err >&5
22394 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22395 (exit $ac_status); } && {
22396 test -z "$ac_c_werror_flag" ||
22397 test ! -s conftest.err
22398 } && test -s conftest.$ac_objext; then
22399 ac_cv_type_pthread_rwlock_t=yes
22400 else
22401 echo "$as_me: failed program was:" >&5
22402 sed 's/^/| /' conftest.$ac_ext >&5
22403
22404 ac_cv_type_pthread_rwlock_t=no
22405 fi
22406
22407 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22408 fi
22409 { echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5
22410 echo "${ECHO_T}$ac_cv_type_pthread_rwlock_t" >&6; }
22411 if test $ac_cv_type_pthread_rwlock_t = yes; then
22412
22413 cat >>confdefs.h <<_ACEOF
22414 #define HAVE_PTHREAD_RWLOCK_T 1
22415 _ACEOF
22416
22417
22418 fi
22419
22420
22421 :
22422 else
22423 acx_pthread_ok=no
22424
22425 fi
22426 ac_ext=c
22427 ac_cpp='$CPP $CPPFLAGS'
22428 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
22429 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
22430 ac_compiler_gnu=$ac_cv_c_compiler_gnu
22431
22432
22433 fi
22434
22435 # check solaris thread library
22436
22437 # Check whether --with-solaris-threads was given.
22438 if test "${with_solaris_threads+set}" = set; then
22439 withval=$with_solaris_threads;
22440 else
22441 withval="no"
22442 fi
22443
22444 ub_have_sol_threads=no
22445 if test x_$withval != x_no; then
22446 if test x_$ub_have_pthreads != x_no; then
22447 { echo "$as_me:$LINENO: WARNING: Have pthreads already, ignoring --with-solaris-threads" >&5
22448 echo "$as_me: WARNING: Have pthreads already, ignoring --with-solaris-threads" >&2;}
22449 else
22450 { echo "$as_me:$LINENO: checking for library containing thr_create" >&5
22451 echo $ECHO_N "checking for library containing thr_create... $ECHO_C" >&6; }
22452 if test "${ac_cv_search_thr_create+set}" = set; then
22453 echo $ECHO_N "(cached) $ECHO_C" >&6
22454 else
22455 ac_func_search_save_LIBS=$LIBS
22456 cat >conftest.$ac_ext <<_ACEOF
22457 /* confdefs.h. */
22458 _ACEOF
22459 cat confdefs.h >>conftest.$ac_ext
22460 cat >>conftest.$ac_ext <<_ACEOF
22461 /* end confdefs.h. */
22462
22463 /* Override any GCC internal prototype to avoid an error.
22464 Use char because int might match the return type of a GCC
22465 builtin and then its argument prototype would still apply. */
22466 #ifdef __cplusplus
22467 extern "C"
22468 #endif
22469 char thr_create ();
22470 int
22471 main ()
22472 {
22473 return thr_create ();
22474 ;
22475 return 0;
22476 }
22477 _ACEOF
22478 for ac_lib in '' thread; do
22479 if test -z "$ac_lib"; then
22480 ac_res="none required"
22481 else
22482 ac_res=-l$ac_lib
22483 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
22484 fi
22485 rm -f conftest.$ac_objext conftest$ac_exeext
22486 if { (ac_try="$ac_link"
22487 case "(($ac_try" in
22488 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22489 *) ac_try_echo=$ac_try;;
22490 esac
22491 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22492 (eval "$ac_link") 2>conftest.er1
22493 ac_status=$?
22494 grep -v '^ *+' conftest.er1 >conftest.err
22495 rm -f conftest.er1
22496 cat conftest.err >&5
22497 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22498 (exit $ac_status); } && {
22499 test -z "$ac_c_werror_flag" ||
22500 test ! -s conftest.err
22501 } && test -s conftest$ac_exeext &&
22502 $as_test_x conftest$ac_exeext; then
22503 ac_cv_search_thr_create=$ac_res
22504 else
22505 echo "$as_me: failed program was:" >&5
22506 sed 's/^/| /' conftest.$ac_ext >&5
22507
22508
22509 fi
22510
22511 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22512 conftest$ac_exeext
22513 if test "${ac_cv_search_thr_create+set}" = set; then
22514 break
22515 fi
22516 done
22517 if test "${ac_cv_search_thr_create+set}" = set; then
22518 :
22519 else
22520 ac_cv_search_thr_create=no
22521 fi
22522 rm conftest.$ac_ext
22523 LIBS=$ac_func_search_save_LIBS
22524 fi
22525 { echo "$as_me:$LINENO: result: $ac_cv_search_thr_create" >&5
22526 echo "${ECHO_T}$ac_cv_search_thr_create" >&6; }
22527 ac_res=$ac_cv_search_thr_create
22528 if test "$ac_res" != no; then
22529 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
22530
22531
22532 cat >>confdefs.h <<\_ACEOF
22533 #define HAVE_SOLARIS_THREADS 1
22534 _ACEOF
22535
22536
22537
22538
22539 { echo "$as_me:$LINENO: checking whether $CC supports -mt" >&5
22540 echo $ECHO_N "checking whether $CC supports -mt... $ECHO_C" >&6; }
22541 cache=`echo mt | sed 'y%.=/+-%___p_%'`
22542 if { as_var=cv_prog_cc_flag_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
22543 echo $ECHO_N "(cached) $ECHO_C" >&6
22544 else
22545
22546 echo 'void f(){}' >conftest.c
22547 if test -z "`$CC -mt -c conftest.c 2>&1`"; then
22548 eval "cv_prog_cc_flag_$cache=yes"
22549 else
22550 eval "cv_prog_cc_flag_$cache=no"
22551 fi
22552 rm -f conftest*
22553
22554 fi
22555
22556 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
22557 { echo "$as_me:$LINENO: result: yes" >&5
22558 echo "${ECHO_T}yes" >&6; }
22559 :
22560 CFLAGS="$CFLAGS -mt"
22561 else
22562 { echo "$as_me:$LINENO: result: no" >&5
22563 echo "${ECHO_T}no" >&6; }
22564 :
22565 CFLAGS="$CFLAGS -D_REENTRANT"
22566 fi
22567
22568 ub_have_sol_threads=yes
22569
22570 else
22571
22572 { { echo "$as_me:$LINENO: error: no solaris threads found." >&5
22573 echo "$as_me: error: no solaris threads found." >&2;}
22574 { (exit 1); exit 1; }; }
22575
22576 fi
22577
22578 fi
22579 fi
22580
22581 # check windows threads
22582 if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then
22583
22584 for ac_header in windows.h
22585 do
22586 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
22587 { echo "$as_me:$LINENO: checking for $ac_header" >&5
22588 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
22589 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
22590 echo $ECHO_N "(cached) $ECHO_C" >&6
22591 else
22592 cat >conftest.$ac_ext <<_ACEOF
22593 /* confdefs.h. */
22594 _ACEOF
22595 cat confdefs.h >>conftest.$ac_ext
22596 cat >>conftest.$ac_ext <<_ACEOF
22597 /* end confdefs.h. */
22598 $ac_includes_default
22599
22600 #include <$ac_header>
22601 _ACEOF
22602 rm -f conftest.$ac_objext
22603 if { (ac_try="$ac_compile"
22604 case "(($ac_try" in
22605 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22606 *) ac_try_echo=$ac_try;;
22607 esac
22608 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22609 (eval "$ac_compile") 2>conftest.er1
22610 ac_status=$?
22611 grep -v '^ *+' conftest.er1 >conftest.err
22612 rm -f conftest.er1
22613 cat conftest.err >&5
22614 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22615 (exit $ac_status); } && {
22616 test -z "$ac_c_werror_flag" ||
22617 test ! -s conftest.err
22618 } && test -s conftest.$ac_objext; then
22619 eval "$as_ac_Header=yes"
22620 else
22621 echo "$as_me: failed program was:" >&5
22622 sed 's/^/| /' conftest.$ac_ext >&5
22623
22624 eval "$as_ac_Header=no"
22625 fi
22626
22627 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22628 fi
22629 ac_res=`eval echo '${'$as_ac_Header'}'`
23759 fi
23760 ac_res=`eval echo '${'$as_ac_var'}'`
2263023761 { echo "$as_me:$LINENO: result: $ac_res" >&5
2263123762 echo "${ECHO_T}$ac_res" >&6; }
22632 if test `eval echo '${'$as_ac_Header'}'` = yes; then
23763 if test `eval echo '${'$as_ac_var'}'` = yes; then
2263323764 cat >>confdefs.h <<_ACEOF
22634 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
22635 _ACEOF
22636
22637 fi
22638
23765 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
23766 _ACEOF
23767
23768 fi
2263923769 done
2264023770
22641 { echo "$as_me:$LINENO: checking for CreateThread" >&5
22642 echo $ECHO_N "checking for CreateThread... $ECHO_C" >&6; }
22643 cat >conftest.$ac_ext <<_ACEOF
22644 /* confdefs.h. */
22645 _ACEOF
22646 cat confdefs.h >>conftest.$ac_ext
22647 cat >>conftest.$ac_ext <<_ACEOF
22648 /* end confdefs.h. */
22649
22650 #ifdef HAVE_WINDOWS_H
22651 #include <windows.h>
22652 #endif
22653
22654 int
22655 main ()
22656 {
22657
22658 HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
22659
22660 ;
22661 return 0;
22662 }
22663 _ACEOF
22664 rm -f conftest.$ac_objext
22665 if { (ac_try="$ac_compile"
22666 case "(($ac_try" in
22667 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22668 *) ac_try_echo=$ac_try;;
23771
23772 # Check whether --enable-sha2 was given.
23773 if test "${enable_sha2+set}" = set; then
23774 enableval=$enable_sha2;
23775 fi
23776
23777 case "$enable_sha2" in
23778 yes)
23779
23780 cat >>confdefs.h <<_ACEOF
23781 #define USE_SHA2
23782 _ACEOF
23783
23784 ;;
23785 no|*)
23786 ;;
2266923787 esac
22670 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22671 (eval "$ac_compile") 2>conftest.er1
22672 ac_status=$?
22673 grep -v '^ *+' conftest.er1 >conftest.err
22674 rm -f conftest.er1
22675 cat conftest.err >&5
22676 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22677 (exit $ac_status); } && {
22678 test -z "$ac_c_werror_flag" ||
22679 test ! -s conftest.err
22680 } && test -s conftest.$ac_objext; then
22681 { echo "$as_me:$LINENO: result: yes" >&5
22682 echo "${ECHO_T}yes" >&6; }
22683
22684 cat >>confdefs.h <<\_ACEOF
22685 #define HAVE_WINDOWS_THREADS 1
22686 _ACEOF
22687
22688
22689 else
22690 echo "$as_me: failed program was:" >&5
22691 sed 's/^/| /' conftest.$ac_ext >&5
22692
22693 { echo "$as_me:$LINENO: result: no" >&5
22694 echo "${ECHO_T}no" >&6; }
22695
22696 fi
22697
22698 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
22699 fi
2270023788
2270123789 # check to see if libraries are needed for these functions.
2270223790 { echo "$as_me:$LINENO: checking for library containing inet_pton" >&5
2286623954 fi
2286723955
2286823956
23957
23958
2286923959 # check for libevent
2287023960
2287123961 # Check whether --with-libevent was given.
2288523975 thedir="$dir"
2288623976 if test -f "$dir/include/event.h"; then
2288723977 found_libevent="yes"
22888 CPPFLAGS="$CPPFLAGS -I$thedir/include"
23978 if test "$thedir" != "/usr"; then
23979 CPPFLAGS="$CPPFLAGS -I$thedir/include"
23980 fi
2288923981 break;
2289023982 fi
2289123983 done
2289523987 { echo "$as_me:$LINENO: result: found in $thedir" >&5
2289623988 echo "${ECHO_T}found in $thedir" >&6; }
2289723989 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
23990 BAK_LDFLAGS_SET="1"
2289823991 BAK_LDFLAGS="$LDFLAGS"
2289923992 # remove evdns from linking
2290023993 mkdir build >/dev/null 2>&1
2292224015 else
2292324016 { echo "$as_me:$LINENO: result: found in $thedir" >&5
2292424017 echo "${ECHO_T}found in $thedir" >&6; }
22925 LDFLAGS="$LDFLAGS -L$thedir/lib"
22926 if test "x$enable_rpath" = xyes; then
22927 RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib"
24018 if test "$thedir" != "/usr"; then
24019 LDFLAGS="$LDFLAGS -L$thedir/lib"
24020
24021 if test "x$enable_rpath" = xyes; then
24022 if echo "$thedir/lib" | grep "^/" >/dev/null; then
24023 RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib"
24024 fi
24025 fi
24026
2292824027 fi
2292924028 fi
22930
2293124029 # check for library used by libevent after 1.3c
2293224030 { echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
2293324031 echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6; }
2334124439
2334224440 fi
2334324441 done
23344 # only in libevent 1.4? and later
23345
23346 for ac_func in event_base_get_method
24442 # only in libevent 1.4.1 and later
24443
24444 for ac_func in event_base_new
2334724445 do
2334824446 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2334924447 { echo "$as_me:$LINENO: checking for $ac_func" >&5
2343524533
2343624534 fi
2343724535 done
23438 # only in libevent 1.4.3 and later
23439
23440 for ac_func in ev_loop
24536 # only in libevent 1.4.1 and later
24537
24538 for ac_func in event_base_get_method
2344124539 do
2344224540 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2344324541 { echo "$as_me:$LINENO: checking for $ac_func" >&5
2352924627
2353024628 fi
2353124629 done
24630 # only in libevent 1.4.3 and later
24631
24632 for ac_func in ev_loop
24633 do
24634 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
24635 { echo "$as_me:$LINENO: checking for $ac_func" >&5
24636 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
24637 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
24638 echo $ECHO_N "(cached) $ECHO_C" >&6
24639 else
24640 cat >conftest.$ac_ext <<_ACEOF
24641 /* confdefs.h. */
24642 _ACEOF
24643 cat confdefs.h >>conftest.$ac_ext
24644 cat >>conftest.$ac_ext <<_ACEOF
24645 /* end confdefs.h. */
24646 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
24647 For example, HP-UX 11i <limits.h> declares gettimeofday. */
24648 #define $ac_func innocuous_$ac_func
24649
24650 /* System header to define __stub macros and hopefully few prototypes,
24651 which can conflict with char $ac_func (); below.
24652 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
24653 <limits.h> exists even on freestanding compilers. */
24654
24655 #ifdef __STDC__
24656 # include <limits.h>
24657 #else
24658 # include <assert.h>
24659 #endif
24660
24661 #undef $ac_func
24662
24663 /* Override any GCC internal prototype to avoid an error.
24664 Use char because int might match the return type of a GCC
24665 builtin and then its argument prototype would still apply. */
24666 #ifdef __cplusplus
24667 extern "C"
24668 #endif
24669 char $ac_func ();
24670 /* The GNU C library defines this for functions which it implements
24671 to always fail with ENOSYS. Some functions are actually named
24672 something starting with __ and the normal name is an alias. */
24673 #if defined __stub_$ac_func || defined __stub___$ac_func
24674 choke me
24675 #endif
24676
24677 int
24678 main ()
24679 {
24680 return $ac_func ();
24681 ;
24682 return 0;
24683 }
24684 _ACEOF
24685 rm -f conftest.$ac_objext conftest$ac_exeext
24686 if { (ac_try="$ac_link"
24687 case "(($ac_try" in
24688 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24689 *) ac_try_echo=$ac_try;;
24690 esac
24691 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24692 (eval "$ac_link") 2>conftest.er1
24693 ac_status=$?
24694 grep -v '^ *+' conftest.er1 >conftest.err
24695 rm -f conftest.er1
24696 cat conftest.err >&5
24697 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24698 (exit $ac_status); } && {
24699 test -z "$ac_c_werror_flag" ||
24700 test ! -s conftest.err
24701 } && test -s conftest$ac_exeext &&
24702 $as_test_x conftest$ac_exeext; then
24703 eval "$as_ac_var=yes"
24704 else
24705 echo "$as_me: failed program was:" >&5
24706 sed 's/^/| /' conftest.$ac_ext >&5
24707
24708 eval "$as_ac_var=no"
24709 fi
24710
24711 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
24712 conftest$ac_exeext conftest.$ac_ext
24713 fi
24714 ac_res=`eval echo '${'$as_ac_var'}'`
24715 { echo "$as_me:$LINENO: result: $ac_res" >&5
24716 echo "${ECHO_T}$ac_res" >&6; }
24717 if test `eval echo '${'$as_ac_var'}'` = yes; then
24718 cat >>confdefs.h <<_ACEOF
24719 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
24720 _ACEOF
24721
24722 fi
24723 done
2353224724 # only in libev. (tested on 3.51)
23533 if test -n "$BAK_LDFLAGS"; then
24725 if test -n "$BAK_LDFLAGS_SET"; then
2353424726 LDFLAGS="$BAK_LDFLAGS"
2353524727 fi
2353624728 else
2355124743
2355224744 if test x_$enable_static_exe = x_yes; then
2355324745 staticexe="-static"
24746 if test "$on_mingw" = yes; then
24747 staticexe="-all-static"
24748 fi
2355424749 fi
2355524750
2355624751 # set lock checking if requested
2471525910
2471625911 fi
2471725912
25913
2471825914 # Check whether --enable-largefile was given.
2471925915 if test "${enable_largefile+set}" = set; then
2472025916 enableval=$enable_largefile;
2507026266
2507126267 { echo "$as_me:$LINENO: checking whether we need -D_LARGEFILE_SOURCE=1 as a flag for $CC" >&5
2507226268 echo $ECHO_N "checking whether we need -D_LARGEFILE_SOURCE=1 as a flag for $CC... $ECHO_C" >&6; }
25073 cache=`echo -D_LARGEFILE_SOURCE=1 | sed 'y%.=/+- %___p__%'`
26269 cache=_D_LARGEFILE_SOURCE_1
2507426270 if { as_var=cv_prog_cc_flag_needed_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
2507526271 echo $ECHO_N "(cached) $ECHO_C" >&6
2507626272 else
2509926295 fi
2510026296
2510126297 fi
25102 rm -f conftest
26298 rm -f conftest conftest.c conftest.o
2510326299
2510426300 fi
2510526301
2522226418 #define USE_WINSOCK 1
2522326419 _ACEOF
2522426420
26421 USE_WINSOCK="1"
2522526422
2522626423 else
2522726424 echo "$as_me: failed program was:" >&5
2525126448
2525226449 fi
2525326450
26451 if test "$USE_WINSOCK" = 1; then
26452
26453 cat >>confdefs.h <<\_ACEOF
26454 #define UB_ON_WINDOWS 1
26455 _ACEOF
26456
26457 UB_ON_WINDOWS=yes
26458
26459 fi
2525426460 if test $ac_cv_func_getaddrinfo = no; then
25255 case " $LIBOBJS " in
26461 case " $LIBOBJS " in
2525626462 *" fake-rfc2553.$ac_objext "* ) ;;
2525726463 *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext"
2525826464 ;;
2526026466
2526126467 fi
2526226468
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283 for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob
26469 # see if daemon(3) exists, and if it is deprecated.
26470
26471 for ac_func in daemon
2528426472 do
2528526473 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2528626474 { echo "$as_me:$LINENO: checking for $ac_func" >&5
2537326561 fi
2537426562 done
2537526563
26564 if test $ac_cv_func_daemon = yes; then
26565
26566
26567 { echo "$as_me:$LINENO: checking if daemon is deprecated" >&5
26568 echo $ECHO_N "checking if daemon is deprecated... $ECHO_C" >&6; }
26569 cache=`echo daemon | sed 'y%.=/+-%___p_%'`
26570 if { as_var=cv_cc_deprecated_$cache; eval "test \"\${$as_var+set}\" = set"; }; then
26571 echo $ECHO_N "(cached) $ECHO_C" >&6
26572 else
26573
26574 echo '
26575 #include <stdlib.h>
26576 ' >conftest.c
26577 echo 'void f(){ (void)daemon(0, 0); }' >>conftest.c
26578 if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then
26579 eval "cv_cc_deprecated_$cache=no"
26580 else
26581 eval "cv_cc_deprecated_$cache=yes"
26582 fi
26583 rm -f conftest conftest.o conftest.c
26584
26585 fi
26586
26587 if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then
26588 { echo "$as_me:$LINENO: result: yes" >&5
26589 echo "${ECHO_T}yes" >&6; }
26590
26591 cat >>confdefs.h <<_ACEOF
26592 #define DEPRECATED_DAEMON 1
26593 _ACEOF
26594
26595 :
26596
26597 else
26598 { echo "$as_me:$LINENO: result: no" >&5
26599 echo "${ECHO_T}no" >&6; }
26600 :
26601
26602 fi
26603
26604 fi
26605
26606 { echo "$as_me:$LINENO: checking for library containing setusercontext" >&5
26607 echo $ECHO_N "checking for library containing setusercontext... $ECHO_C" >&6; }
26608 if test "${ac_cv_search_setusercontext+set}" = set; then
26609 echo $ECHO_N "(cached) $ECHO_C" >&6
26610 else
26611 ac_func_search_save_LIBS=$LIBS
26612 cat >conftest.$ac_ext <<_ACEOF
26613 /* confdefs.h. */
26614 _ACEOF
26615 cat confdefs.h >>conftest.$ac_ext
26616 cat >>conftest.$ac_ext <<_ACEOF
26617 /* end confdefs.h. */
26618
26619 /* Override any GCC internal prototype to avoid an error.
26620 Use char because int might match the return type of a GCC
26621 builtin and then its argument prototype would still apply. */
26622 #ifdef __cplusplus
26623 extern "C"
26624 #endif
26625 char setusercontext ();
26626 int
26627 main ()
26628 {
26629 return setusercontext ();
26630 ;
26631 return 0;
26632 }
26633 _ACEOF
26634 for ac_lib in '' util; do
26635 if test -z "$ac_lib"; then
26636 ac_res="none required"
26637 else
26638 ac_res=-l$ac_lib
26639 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
26640 fi
26641 rm -f conftest.$ac_objext conftest$ac_exeext
26642 if { (ac_try="$ac_link"
26643 case "(($ac_try" in
26644 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26645 *) ac_try_echo=$ac_try;;
26646 esac
26647 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26648 (eval "$ac_link") 2>conftest.er1
26649 ac_status=$?
26650 grep -v '^ *+' conftest.er1 >conftest.err
26651 rm -f conftest.er1
26652 cat conftest.err >&5
26653 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26654 (exit $ac_status); } && {
26655 test -z "$ac_c_werror_flag" ||
26656 test ! -s conftest.err
26657 } && test -s conftest$ac_exeext &&
26658 $as_test_x conftest$ac_exeext; then
26659 ac_cv_search_setusercontext=$ac_res
26660 else
26661 echo "$as_me: failed program was:" >&5
26662 sed 's/^/| /' conftest.$ac_ext >&5
26663
26664
26665 fi
26666
26667 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
26668 conftest$ac_exeext
26669 if test "${ac_cv_search_setusercontext+set}" = set; then
26670 break
26671 fi
26672 done
26673 if test "${ac_cv_search_setusercontext+set}" = set; then
26674 :
26675 else
26676 ac_cv_search_setusercontext=no
26677 fi
26678 rm conftest.$ac_ext
26679 LIBS=$ac_func_search_save_LIBS
26680 fi
26681 { echo "$as_me:$LINENO: result: $ac_cv_search_setusercontext" >&5
26682 echo "${ECHO_T}$ac_cv_search_setusercontext" >&6; }
26683 ac_res=$ac_cv_search_setusercontext
26684 if test "$ac_res" != no; then
26685 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
26686
26687 fi
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715 for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups strftime localtime_r setusercontext _beginthreadex
26716 do
26717 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
26718 { echo "$as_me:$LINENO: checking for $ac_func" >&5
26719 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
26720 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
26721 echo $ECHO_N "(cached) $ECHO_C" >&6
26722 else
26723 cat >conftest.$ac_ext <<_ACEOF
26724 /* confdefs.h. */
26725 _ACEOF
26726 cat confdefs.h >>conftest.$ac_ext
26727 cat >>conftest.$ac_ext <<_ACEOF
26728 /* end confdefs.h. */
26729 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
26730 For example, HP-UX 11i <limits.h> declares gettimeofday. */
26731 #define $ac_func innocuous_$ac_func
26732
26733 /* System header to define __stub macros and hopefully few prototypes,
26734 which can conflict with char $ac_func (); below.
26735 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
26736 <limits.h> exists even on freestanding compilers. */
26737
26738 #ifdef __STDC__
26739 # include <limits.h>
26740 #else
26741 # include <assert.h>
26742 #endif
26743
26744 #undef $ac_func
26745
26746 /* Override any GCC internal prototype to avoid an error.
26747 Use char because int might match the return type of a GCC
26748 builtin and then its argument prototype would still apply. */
26749 #ifdef __cplusplus
26750 extern "C"
26751 #endif
26752 char $ac_func ();
26753 /* The GNU C library defines this for functions which it implements
26754 to always fail with ENOSYS. Some functions are actually named
26755 something starting with __ and the normal name is an alias. */
26756 #if defined __stub_$ac_func || defined __stub___$ac_func
26757 choke me
26758 #endif
26759
26760 int
26761 main ()
26762 {
26763 return $ac_func ();
26764 ;
26765 return 0;
26766 }
26767 _ACEOF
26768 rm -f conftest.$ac_objext conftest$ac_exeext
26769 if { (ac_try="$ac_link"
26770 case "(($ac_try" in
26771 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26772 *) ac_try_echo=$ac_try;;
26773 esac
26774 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26775 (eval "$ac_link") 2>conftest.er1
26776 ac_status=$?
26777 grep -v '^ *+' conftest.er1 >conftest.err
26778 rm -f conftest.er1
26779 cat conftest.err >&5
26780 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26781 (exit $ac_status); } && {
26782 test -z "$ac_c_werror_flag" ||
26783 test ! -s conftest.err
26784 } && test -s conftest$ac_exeext &&
26785 $as_test_x conftest$ac_exeext; then
26786 eval "$as_ac_var=yes"
26787 else
26788 echo "$as_me: failed program was:" >&5
26789 sed 's/^/| /' conftest.$ac_ext >&5
26790
26791 eval "$as_ac_var=no"
26792 fi
26793
26794 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
26795 conftest$ac_exeext conftest.$ac_ext
26796 fi
26797 ac_res=`eval echo '${'$as_ac_var'}'`
26798 { echo "$as_me:$LINENO: result: $ac_res" >&5
26799 echo "${ECHO_T}$ac_res" >&6; }
26800 if test `eval echo '${'$as_ac_var'}'` = yes; then
26801 cat >>confdefs.h <<_ACEOF
26802 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
26803 _ACEOF
26804
26805 fi
26806 done
26807
2537626808
2537726809 # check if setreuid en setregid fail, on MacOSX10.4(darwin8).
2537826810 if echo $build_os | grep darwin8 > /dev/null; then
2538326815
2538426816 fi
2538526817
25386 # check if select and nonblocking sockets actually work.
2538726818 { echo "$as_me:$LINENO: checking if nonblocking sockets work" >&5
2538826819 echo $ECHO_N "checking if nonblocking sockets work... $ECHO_C" >&6; }
2538926820 if test "$cross_compiling" = yes; then
2556927000
2557027001
2557127002
25572 # check mkdir
27003
2557327004 { echo "$as_me:$LINENO: checking whether mkdir has one arg" >&5
2557427005 echo $ECHO_N "checking whether mkdir has one arg... $ECHO_C" >&6; }
2557527006 cat >conftest.$ac_ext <<_ACEOF
2563427065
2563527066 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2563627067
27068
2563727069 # check ioctlsocket
2563827070 { echo "$as_me:$LINENO: checking for ioctlsocket" >&5
2563927071 echo $ECHO_N "checking for ioctlsocket... $ECHO_C" >&6; }
2641327845
2641427846 # check this after all other compilation checks, since the linking of the lib
2641527847 # may break checks after this.
27848 use_ldns_builtin="no"
2641627849
2641727850 # Check whether --with-ldns was given.
2641827851 if test "${with_ldns+set}" = set; then
2641927852 withval=$with_ldns; specialldnsdir="$withval"
26420 CPPFLAGS="$CPPFLAGS -I$withval/include"
26421 LDFLAGS="$LDFLAGS -L$withval -L$withval/lib -lldns"
27853 CPPFLAGS="-I$withval/include $CPPFLAGS"
27854 LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
27855
27856 if test "x$enable_rpath" = xyes; then
27857 if echo "$withval/lib" | grep "^/" >/dev/null; then
27858 RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib"
27859 fi
27860 fi
27861
2642227862 ldnsdir="$withval"
2642327863
2642427864
2642527865 fi
2642627866
27867
27868
27869 # Check whether --with-ldns-builtin was given.
27870 if test "${with_ldns_builtin+set}" = set; then
27871 withval=$with_ldns_builtin;
27872 use_ldns_builtin="yes"
27873
27874 fi
27875
27876
27877 # check if ldns is good enough
27878 if test "$use_ldns_builtin" = "no"; then
2642727879
2642827880 { echo "$as_me:$LINENO: checking for ldns_buffer_copy in -lldns" >&5
2642927881 echo $ECHO_N "checking for ldns_buffer_copy in -lldns... $ECHO_C" >&6; }
2648727939 { echo "$as_me:$LINENO: result: $ac_cv_lib_ldns_ldns_buffer_copy" >&5
2648827940 echo "${ECHO_T}$ac_cv_lib_ldns_ldns_buffer_copy" >&6; }
2648927941 if test $ac_cv_lib_ldns_ldns_buffer_copy = yes; then
26490
26491
26492 { echo "$as_me:$LINENO: checking for ldns_rr_free in -lldns" >&5
26493 echo $ECHO_N "checking for ldns_rr_free in -lldns... $ECHO_C" >&6; }
26494 if test "${ac_cv_lib_ldns_ldns_rr_free+set}" = set; then
26495 echo $ECHO_N "(cached) $ECHO_C" >&6
26496 else
26497 ac_check_lib_save_LIBS=$LIBS
26498 LIBS="-lldns $LIBS"
26499 cat >conftest.$ac_ext <<_ACEOF
26500 /* confdefs.h. */
26501 _ACEOF
26502 cat confdefs.h >>conftest.$ac_ext
26503 cat >>conftest.$ac_ext <<_ACEOF
26504 /* end confdefs.h. */
26505
26506 /* Override any GCC internal prototype to avoid an error.
26507 Use char because int might match the return type of a GCC
26508 builtin and then its argument prototype would still apply. */
26509 #ifdef __cplusplus
26510 extern "C"
26511 #endif
26512 char ldns_rr_free ();
26513 int
26514 main ()
26515 {
26516 return ldns_rr_free ();
26517 ;
26518 return 0;
26519 }
26520 _ACEOF
26521 rm -f conftest.$ac_objext conftest$ac_exeext
26522 if { (ac_try="$ac_link"
26523 case "(($ac_try" in
26524 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26525 *) ac_try_echo=$ac_try;;
26526 esac
26527 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26528 (eval "$ac_link") 2>conftest.er1
26529 ac_status=$?
26530 grep -v '^ *+' conftest.er1 >conftest.err
26531 rm -f conftest.er1
26532 cat conftest.err >&5
26533 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26534 (exit $ac_status); } && {
26535 test -z "$ac_c_werror_flag" ||
26536 test ! -s conftest.err
26537 } && test -s conftest$ac_exeext &&
26538 $as_test_x conftest$ac_exeext; then
26539 ac_cv_lib_ldns_ldns_rr_free=yes
26540 else
26541 echo "$as_me: failed program was:" >&5
26542 sed 's/^/| /' conftest.$ac_ext >&5
26543
26544 ac_cv_lib_ldns_ldns_rr_free=no
26545 fi
26546
26547 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
26548 conftest$ac_exeext conftest.$ac_ext
26549 LIBS=$ac_check_lib_save_LIBS
26550 fi
26551 { echo "$as_me:$LINENO: result: $ac_cv_lib_ldns_ldns_rr_free" >&5
26552 echo "${ECHO_T}$ac_cv_lib_ldns_ldns_rr_free" >&6; }
26553 if test $ac_cv_lib_ldns_ldns_rr_free = yes; then
2655427942 cat >>confdefs.h <<_ACEOF
2655527943 #define HAVE_LIBLDNS 1
2655627944 _ACEOF
2655927947
2656027948 fi
2656127949
26562 { echo "$as_me:$LINENO: checking for ldns_b32_ntop_extended_hex" >&5
27950 if test $ac_cv_lib_ldns_ldns_buffer_copy = yes; then
27951 { echo "$as_me:$LINENO: checking for ldns_b32_ntop_extended_hex" >&5
2656327952 echo $ECHO_N "checking for ldns_b32_ntop_extended_hex... $ECHO_C" >&6; }
2656427953 if test "${ac_cv_func_ldns_b32_ntop_extended_hex+set}" = set; then
2656527954 echo $ECHO_N "(cached) $ECHO_C" >&6
2664428033 :
2664528034 else
2664628035
26647 { { echo "$as_me:$LINENO: error: ldns version too old, need >=1.4.0" >&5
28036 { { echo "$as_me:$LINENO: error: ldns version too old, need >=1.4.0" >&5
2664828037 echo "$as_me: error: ldns version too old, need >=1.4.0" >&2;}
2664928038 { (exit 1); exit 1; }; }
2665028039 fi
2665128040
26652
26653 else
26654
28041 else
28042 use_ldns_builtin="yes"
28043 fi
28044 fi
28045
28046 if test "$use_ldns_builtin" = "yes"; then
2665528047 if test ! -f $srcdir/ldns-src.tar.gz; then
2665628048 { { echo "$as_me:$LINENO: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&5
2665728049 echo "$as_me: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&2;}
2665928051 fi
2666028052 echo "****************************************************************"
2666128053 echo "*** ***"
26662 echo "*** ldns library not found (--with-ldns= to specify by hand) ***"
2666328054 echo "*** Building ldns library from package included in this one. ***"
2666428055 echo "*** ***"
2666528056 echo "****************************************************************"
2667328064 CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
2667428065 LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
2667528066
26676
26677 fi
28067 fi
28068
28069 { echo "$as_me:$LINENO: Stripping extension flags..." >&5
28070 echo "$as_me: Stripping extension flags..." >&6;}
28071
28072 if echo $CFLAGS | grep " -D_GNU_SOURCE" >/dev/null 2>&1; then
28073 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_GNU_SOURCE//g'`"
28074
28075 cat >>confdefs.h <<\_ACEOF
28076 #define OMITTED__D_GNU_SOURCE 1
28077 _ACEOF
28078
28079 fi
28080
28081
28082 if echo $CFLAGS | grep " -D_BSD_SOURCE" >/dev/null 2>&1; then
28083 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_BSD_SOURCE//g'`"
28084
28085 cat >>confdefs.h <<\_ACEOF
28086 #define OMITTED__D_BSD_SOURCE 1
28087 _ACEOF
28088
28089 fi
28090
28091
28092 if echo $CFLAGS | grep " -D__EXTENSIONS__" >/dev/null 2>&1; then
28093 CFLAGS="`echo $CFLAGS | sed -e 's/ -D__EXTENSIONS__//g'`"
28094
28095 cat >>confdefs.h <<\_ACEOF
28096 #define OMITTED__D__EXTENSIONS__ 1
28097 _ACEOF
28098
28099 fi
28100
28101
28102 if echo $CFLAGS | grep " -D_POSIX_C_SOURCE=200112" >/dev/null 2>&1; then
28103 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_POSIX_C_SOURCE=200112//g'`"
28104
28105 cat >>confdefs.h <<\_ACEOF
28106 #define OMITTED__D_POSIX_C_SOURCE_200112 1
28107 _ACEOF
28108
28109 fi
28110
28111
28112 if echo $CFLAGS | grep " -D_XOPEN_SOURCE=600" >/dev/null 2>&1; then
28113 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_XOPEN_SOURCE=600//g'`"
28114
28115 cat >>confdefs.h <<\_ACEOF
28116 #define OMITTED__D_XOPEN_SOURCE_600 1
28117 _ACEOF
28118
28119 fi
28120
28121
28122 if echo $CFLAGS | grep " -D_XOPEN_SOURCE_EXTENDED=1" >/dev/null 2>&1; then
28123 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_XOPEN_SOURCE_EXTENDED=1//g'`"
28124
28125 cat >>confdefs.h <<\_ACEOF
28126 #define OMITTED__D_XOPEN_SOURCE_EXTENDED_1 1
28127 _ACEOF
28128
28129 fi
28130
28131
28132 if echo $CFLAGS | grep " -D_ALL_SOURCE" >/dev/null 2>&1; then
28133 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_ALL_SOURCE//g'`"
28134
28135 cat >>confdefs.h <<\_ACEOF
28136 #define OMITTED__D_ALL_SOURCE 1
28137 _ACEOF
28138
28139 fi
28140
28141
28142 if echo $CFLAGS | grep " -D_LARGEFILE_SOURCE=1" >/dev/null 2>&1; then
28143 CFLAGS="`echo $CFLAGS | sed -e 's/ -D_LARGEFILE_SOURCE=1//g'`"
28144
28145 cat >>confdefs.h <<\_ACEOF
28146 #define OMITTED__D_LARGEFILE_SOURCE_1 1
28147 _ACEOF
28148
28149 fi
28150
2667828151
2667928152 LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
2668028153
2708728560 # report actual input values of CONFIG_FILES etc. instead of their
2708828561 # values after options handling.
2708928562 ac_log="
27090 This file was extended by unbound $as_me 1.2.1, which was
28563 This file was extended by unbound $as_me 1.3.0, which was
2709128564 generated by GNU Autoconf 2.61. Invocation command line was
2709228565
2709328566 CONFIG_FILES = $CONFIG_FILES
2713628609 _ACEOF
2713728610 cat >>$CONFIG_STATUS <<_ACEOF
2713828611 ac_cs_version="\\
27139 unbound config.status 1.2.1
28612 unbound config.status 1.3.0
2714028613 configured by $0, generated by GNU Autoconf 2.61,
2714128614 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
2714228615
2736528838 ub_conf_file!$ub_conf_file$ac_delim
2736628839 UNBOUND_RUN_DIR!$UNBOUND_RUN_DIR$ac_delim
2736728840 UNBOUND_CHROOT_DIR!$UNBOUND_CHROOT_DIR$ac_delim
28841 UNBOUND_SHARE_DIR!$UNBOUND_SHARE_DIR$ac_delim
2736828842 UNBOUND_PIDFILE!$UNBOUND_PIDFILE$ac_delim
2736928843 UNBOUND_USERNAME!$UNBOUND_USERNAME$ac_delim
2737028844 DEPFLAG!$DEPFLAG$ac_delim
2737128845 debug_enabled!$debug_enabled$ac_delim
28846 LEX!$LEX$ac_delim
28847 LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
28848 LEXLIB!$LEXLIB$ac_delim
28849 YACC!$YACC$ac_delim
28850 YFLAGS!$YFLAGS$ac_delim
28851 doxygen!$doxygen$ac_delim
2737228852 libtool!$libtool$ac_delim
27373 AR!$AR$ac_delim
27374 doxygen!$doxygen$ac_delim
2737528853 build!$build$ac_delim
2737628854 build_cpu!$build_cpu$ac_delim
2737728855 build_vendor!$build_vendor$ac_delim
2738028858 host_cpu!$host_cpu$ac_delim
2738128859 host_vendor!$host_vendor$ac_delim
2738228860 host_os!$host_os$ac_delim
27383 LEX!$LEX$ac_delim
27384 LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
27385 LEXLIB!$LEXLIB$ac_delim
27386 YACC!$YACC$ac_delim
27387 YFLAGS!$YFLAGS$ac_delim
28861 AR!$AR$ac_delim
2738828862 SED!$SED$ac_delim
2738928863 LN_S!$LN_S$ac_delim
2739028864 ECHO!$ECHO$ac_delim
2739128865 RANLIB!$RANLIB$ac_delim
2739228866 STRIP!$STRIP$ac_delim
2739328867 LIBTOOL!$LIBTOOL$ac_delim
27394 HAVE_SSL!$HAVE_SSL$ac_delim
27395 RUNTIME_PATH!$RUNTIME_PATH$ac_delim
2739628868 acx_pthread_config!$acx_pthread_config$ac_delim
2739728869 PTHREAD_CC!$PTHREAD_CC$ac_delim
2739828870 PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim
2739928871 PTHREAD_CFLAGS!$PTHREAD_CFLAGS$ac_delim
27400 staticexe!$staticexe$ac_delim
27401 CHECKLOCK_SRC!$CHECKLOCK_SRC$ac_delim
27402 LIBOBJS!$LIBOBJS$ac_delim
27403 ldnsdir!$ldnsdir$ac_delim
27404 subdirs!$subdirs$ac_delim
27405 LTLIBOBJS!$LTLIBOBJS$ac_delim
27406 _ACEOF
27407
27408 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
28872 PYTHON_VERSION!$PYTHON_VERSION$ac_delim
28873 PYTHON!$PYTHON$ac_delim
28874 PYTHON_CPPFLAGS!$PYTHON_CPPFLAGS$ac_delim
28875 PYTHON_LDFLAGS!$PYTHON_LDFLAGS$ac_delim
28876 PYTHON_SITE_PKG!$PYTHON_SITE_PKG$ac_delim
28877 PYTHON_EXTRA_LIBS!$PYTHON_EXTRA_LIBS$ac_delim
28878 PYTHON_EXTRA_LDFLAGS!$PYTHON_EXTRA_LDFLAGS$ac_delim
28879 SWIG!$SWIG$ac_delim
28880 SWIG_LIB!$SWIG_LIB$ac_delim
28881 swig!$swig$ac_delim
28882 WITH_PYTHONMODULE!$WITH_PYTHONMODULE$ac_delim
28883 WITH_PYUNBOUND!$WITH_PYUNBOUND$ac_delim
28884 HAVE_SSL!$HAVE_SSL$ac_delim
28885 _ACEOF
28886
28887 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2740928888 break
2741028889 elif $ac_last_try; then
2741128890 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
2742428903
2742528904 cat >>$CONFIG_STATUS <<_ACEOF
2742628905 cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
28906 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
28907 _ACEOF
28908 sed '
28909 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
28910 s/^/s,@/; s/!/@,|#_!!_#|/
28911 :n
28912 t n
28913 s/'"$ac_delim"'$/,g/; t
28914 s/$/\\/; p
28915 N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
28916 ' >>$CONFIG_STATUS <conf$$subs.sed
28917 rm -f conf$$subs.sed
28918 cat >>$CONFIG_STATUS <<_ACEOF
28919 CEOF$ac_eof
28920 _ACEOF
28921
28922
28923 ac_delim='%!_!# '
28924 for ac_last_try in false false false false false :; do
28925 cat >conf$$subs.sed <<_ACEOF
28926 RUNTIME_PATH!$RUNTIME_PATH$ac_delim
28927 staticexe!$staticexe$ac_delim
28928 CHECKLOCK_SRC!$CHECKLOCK_SRC$ac_delim
28929 LIBOBJS!$LIBOBJS$ac_delim
28930 UB_ON_WINDOWS!$UB_ON_WINDOWS$ac_delim
28931 ldnsdir!$ldnsdir$ac_delim
28932 subdirs!$subdirs$ac_delim
28933 LTLIBOBJS!$LTLIBOBJS$ac_delim
28934 _ACEOF
28935
28936 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then
28937 break
28938 elif $ac_last_try; then
28939 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
28940 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
28941 { (exit 1); exit 1; }; }
28942 else
28943 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
28944 fi
28945 done
28946
28947 ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
28948 if test -n "$ac_eof"; then
28949 ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
28950 ac_eof=`expr $ac_eof + 1`
28951 fi
28952
28953 cat >>$CONFIG_STATUS <<_ACEOF
28954 cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
2742728955 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
2742828956 _ACEOF
2742928957 sed '
2768129209 s&@abs_builddir@&$ac_abs_builddir&;t t
2768229210 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
2768329211 $ac_datarootdir_hack
27684 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
29212 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
2768529213
2768629214 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
2768729215 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
00 # -*- Autoconf -*-
11 # Process this file with autoconf to produce a configure script.
22 AC_PREREQ(2.56)
3
4 AC_INIT(unbound, 1.2.1, unbound-bugs@nlnetlabs.nl, unbound)
5
6 LIBUNBOUND_CURRENT=0
7 LIBUNBOUND_REVISION=18
3 sinclude(acx_nlnetlabs.m4)
4 sinclude(acx_pthread.m4)
5 sinclude(acx_python.m4)
6 sinclude(ac_pkg_swig.m4)
7
8 AC_INIT(unbound, 1.3.0, unbound-bugs@nlnetlabs.nl, unbound)
9
10 LIBUNBOUND_CURRENT=1
11 LIBUNBOUND_REVISION=0
812 LIBUNBOUND_AGE=0
913 # 1.0.0 had 0:12:0
1014 # 1.0.1 had 0:13:0
1317 # 1.1.1 had 0:16:0
1418 # 1.2.0 had 0:17:0
1519 # 1.2.1 had 0:18:0
20 # 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
1621
1722 # Current -- the number of the binary API that we're implementing
1823 # Revision -- which iteration of the implementation of the binary
4853 ;;
4954 esac
5055
56 # are we on MinGW?
57 if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
58 else on_mingw="no"; fi
59
5160 #
5261 # Determine configuration file
5362 # the eval is to evaluate shell expansion twice
54 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
63 if test $on_mingw = "no"; then
64 ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
65 else
66 ub_conf_file="C:\\Program Files\\Unbound\\service.conf"
67 fi
5568 AC_ARG_WITH([conf_file],
5669 AC_HELP_STRING([--with-conf-file=path],
5770 [Pathname to the Unbound configuration file]),
5871 [ub_conf_file="$withval"])
5972 AC_SUBST(ub_conf_file)
60 AC_DEFINE_UNQUOTED(CONFIGFILE, ["$ub_conf_file"], [Pathname to the Unbound configuration file])
73 ACX_ESCAPE_BACKSLASH($ub_conf_file, hdr_config)
74 AC_DEFINE_UNQUOTED(CONFIGFILE, ["$hdr_config"], [Pathname to the Unbound configuration file])
6175
6276 # Determine run, chroot directory and pidfile locations
6377 AC_ARG_WITH(run-dir,
6478 AC_HELP_STRING([--with-run-dir=path],
6579 [set default directory to chdir to (by default dir part of cfg file)]),
6680 UNBOUND_RUN_DIR="$withval",
67 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`)
81 if test $on_mingw = no; then
82 UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`
83 else
84 UNBOUND_RUN_DIR=""
85 fi
86 )
6887 AC_SUBST(UNBOUND_RUN_DIR)
69 AC_DEFINE_UNQUOTED(RUN_DIR, ["$UNBOUND_RUN_DIR"], [Directory to chdir to])
88 ACX_ESCAPE_BACKSLASH($UNBOUND_RUN_DIR, hdr_run)
89 AC_DEFINE_UNQUOTED(RUN_DIR, ["$hdr_run"], [Directory to chdir to])
7090
7191 AC_ARG_WITH(chroot-dir,
7292 AC_HELP_STRING([--with-chroot-dir=path],
7393 [set default directory to chroot to (by default same as run-dir)]),
7494 UNBOUND_CHROOT_DIR="$withval",
75 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR")
95 if test $on_mingw = no; then
96 UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR"
97 else
98 UNBOUND_CHROOT_DIR=""
99 fi
100 )
76101 AC_SUBST(UNBOUND_CHROOT_DIR)
77 AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$UNBOUND_CHROOT_DIR"], [Directory to chroot to])
102 ACX_ESCAPE_BACKSLASH($UNBOUND_CHOOT_DIR, hdr_chroot)
103 AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$hdr_chroot"], [Directory to chroot to])
104
105 AC_ARG_WITH(share-dir,
106 AC_HELP_STRING([--with-share-dir=path],
107 [set default directory with shared data (by default same as share/unbound)]),
108 UNBOUND_SHARE_DIR="$withval",
109 UNBOUND_SHARE_DIR="$UNBOUND_RUN_DIR")
110 AC_SUBST(UNBOUND_SHARE_DIR)
111 AC_DEFINE_UNQUOTED(SHARE_DIR, ["$UNBOUND_SHARE_DIR"], [Shared data])
78112
79113 AC_ARG_WITH(pidfile,
80114 AC_HELP_STRING([--with-pidfile=filename],
81115 [set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
82116 UNBOUND_PIDFILE="$withval",
83 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid")
117 if test $on_mingw = no; then
118 UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid"
119 else
120 UNBOUND_PIDFILE=""
121 fi
122 )
84123 AC_SUBST(UNBOUND_PIDFILE)
85 AC_DEFINE_UNQUOTED(PIDFILE, ["$UNBOUND_PIDFILE"], [default pidfile location])
124 ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
125 AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
86126
87127 AC_ARG_WITH(username,
88128 AC_HELP_STRING([--with-username=user],
93133 AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
94134
95135 AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
96
97 dnl routine to help check for compiler flags.
98 AC_DEFUN([CHECK_COMPILER_FLAG],
99 [
100 AC_REQUIRE([AC_PROG_CC])
101 AC_MSG_CHECKING(whether $CC supports -$1)
102 cache=`echo $1 | sed 'y%.=/+-%___p_%'`
103 AC_CACHE_VAL(cv_prog_cc_flag_$cache,
104 [
105 echo 'void f(){}' >conftest.c
106 if test -z "`$CC -$1 -c conftest.c 2>&1`"; then
107 eval "cv_prog_cc_flag_$cache=yes"
108 else
109 eval "cv_prog_cc_flag_$cache=no"
110 fi
111 rm -f conftest*
112 ])
113 if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
114 AC_MSG_RESULT(yes)
115 :
116 $2
117 else
118 AC_MSG_RESULT(no)
119 :
120 $3
121 fi
122 ])
123
124 dnl setup flags for CHECK_COMPILER_FLAG_NEEDED
125 AC_DEFUN([CHECK_ERROR_FLAGS],
126 [
127 CHECK_COMPILER_FLAG(Werror, [ERRFLAG="-Werror"], [ERRFLAG="-errwarn"])
128 CHECK_COMPILER_FLAG(Wall, [ERRFLAG="$ERRFLAG -Wall"],
129 [ERRFLAG="$ERRFLAG -errfmt"])
130 ])
131
132 dnl routine to help check for needed compiler flags.
133 # if the given code compiles without the flag, execute argument 4
134 # if the given code only compiles with the flag, execute argument 3
135 # otherwise fail, execute argument 5.
136 AC_DEFUN([CHECK_COMPILER_FLAG_NEEDED],
137 [
138 AC_REQUIRE([AC_PROG_CC])
139 AC_REQUIRE([CHECK_ERROR_FLAGS])
140 AC_MSG_CHECKING(whether we need $1 as a flag for $CC)
141 cache=`echo $1 | sed 'y%.=/+- %___p__%'`
142 AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache,
143 [
144 echo '$2' > conftest.c
145 echo 'void f(){}' >>conftest.c
146 if test -z "`$CC $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
147 eval "cv_prog_cc_flag_needed_$cache=no"
148 else
149 [
150 if test -z "`$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then
151 eval "cv_prog_cc_flag_needed_$cache=yes"
152 else
153 eval "cv_prog_cc_flag_needed_$cache=fail"
154 #echo 'Test with flag fails too!'
155 #cat conftest.c
156 #echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
157 #echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
158 #exit 1
159 fi
160 ]
161 fi
162 rm -f conftest
163 ])
164 if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then
165 AC_MSG_RESULT(yes)
166 :
167 $3
168 else
169 if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
170 AC_MSG_RESULT(no)
171 #echo 'Test with flag is no!'
172 #cat conftest.c
173 #echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
174 #echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
175 #exit 1
176 :
177 $4
178 else
179 AC_MSG_RESULT(failed)
180 :
181 $5
182 fi
183 fi
184 ])
136 ACX_RSRC_VERSION(wnvs)
137 AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
185138
186139 # Checks for typedefs, structures, and compiler characteristics.
187140 AC_C_CONST
188141 AC_LANG_C
189 CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
190 CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
191
192 # test DEPFLAG
193 AC_MSG_CHECKING([$CC dependency flag])
194 echo 'void f(){}' >conftest.c
195 if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then
196 DEPFLAG="-MM"
197 else
198 if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then
199 DEPFLAG="-xM1"
200 else
201 DEPFLAG="-MM" # dunno do something
202 fi
203 fi
204 AC_MSG_RESULT($DEPFLAG)
205 rm -f conftest.c
206 AC_SUBST(DEPFLAG)
207
208 CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"])
209 CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"])
210
211 AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])
212
213 # MinGW32 tests
214 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
215 # end mingw32 tests
216
217 CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE,
218 [
219 #include "confdefs.h"
220 #include <stdlib.h>
221 #include <ctype.h>
222 #include <sys/time.h>
223 #ifdef HAVE_TIME_H
224 #include <time.h>
225 #endif
226 #include <unistd.h>
227 #include <netdb.h>
228 #ifdef HAVE_GETOPT_H
229 #include <getopt.h>
230 #endif
231
232 int test() {
233 int a;
234 char **opts = NULL;
235 struct timeval tv;
236 char *t;
237 time_t time = 0;
238 char *buf = NULL;
239 const char* str = NULL;
240 struct msghdr msg;
241 msg.msg_control = 0;
242 t = ctime_r(&time, buf);
243 tv.tv_usec = 10;
244 srandom(32);
245 a = getopt(2, opts, "a");
246 a = isascii(32);
247 str = gai_strerror(0);
248 return a;
249 }
250 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"])
251
252 CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE,
253 [
254 #include "confdefs.h"
255 #include <stdlib.h>
256 #include <ctype.h>
257 #include <sys/time.h>
258 #ifdef HAVE_TIME_H
259 #include <time.h>
260 #endif
261 #include <unistd.h>
262 #include <netdb.h>
263 #ifdef HAVE_GETOPT_H
264 #include <getopt.h>
265 #endif
266
267 int test() {
268 int a;
269 char **opts = NULL;
270 struct timeval tv;
271 char *t;
272 time_t time = 0;
273 char *buf = NULL;
274 const char* str = NULL;
275 struct msghdr msg;
276 msg.msg_control = 0;
277 t = ctime_r(&time, buf);
278 tv.tv_usec = 10;
279 srandom(32);
280 a = getopt(2, opts, "a");
281 a = isascii(32);
282 str = gai_strerror(0);
283 return a;
284 }
285 ], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"])
286
287 CHECK_COMPILER_FLAG_NEEDED($C99FLAG,
288 [
289 #include <stdbool.h>
290 #include <ctype.h>
291 int test() {
292 int a = 0;
293 return a;
294 }
295 ], [CFLAGS="$CFLAGS $C99FLAG"])
296
297 CHECK_COMPILER_FLAG_NEEDED(-D_BSD_SOURCE,
298 [
299 #include <ctype.h>
300
301 int test() {
302 int a;
303 a = isascii(32);
304 return a;
305 }
306 ], [CFLAGS="$CFLAGS -D_BSD_SOURCE"])
307
308 CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE,
309 [
310 #include <netinet/in.h>
311
312 int test() {
313 struct in6_pktinfo inf;
314 int a = (int)sizeof(inf);
315 return a;
316 }
317 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
318
319 # check again for GNU_SOURCE for setresgid. May fail if setresgid
320 # is not available at all. -D_FRSRESGID is to make this check unique.
321 # otherwise we would get the previous cached result.
322 CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE -D_FRSRESGID,
323 [
324 #include <unistd.h>
325
326 int test() {
327 int a = setresgid(0,0,0);
328 a = setresuid(0,0,0);
329 return a;
330 }
331 ], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
332
333 CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112,
334 [
335 #include "confdefs.h"
336 #ifdef HAVE_TIME_H
337 #include <time.h>
338 #endif
339 #include <netdb.h>
340
341 int test() {
342 int a = 0;
343 char *t;
344 time_t time = 0;
345 char *buf = NULL;
346 const char* str = NULL;
347 t = ctime_r(&time, buf);
348 str = gai_strerror(0);
349 return a;
350 }
351 ], [CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"])
352
353 CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__,
354 [
355 #include "confdefs.h"
356 #include <stdlib.h>
357 #include <ctype.h>
358 #include <sys/time.h>
359 #ifdef HAVE_TIME_H
360 #include <time.h>
361 #endif
362 #include <unistd.h>
363 #ifdef HAVE_GETOPT_H
364 #include <getopt.h>
365 #endif
366
367 int test() {
368 int a;
369 char **opts = NULL;
370 struct timeval tv;
371 tv.tv_usec = 10;
372 srandom(32);
373 a = getopt(2, opts, "a");
374 a = isascii(32);
375 return a;
376 }
377 ], [CFLAGS="$CFLAGS -D__EXTENSIONS__"])
142 ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="$CFLAGS -g"])
143 ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
144 AC_PROG_CC
145 ACX_DEPFLAG
146 ACX_DETERMINE_EXT_FLAGS_UNBOUND
378147
379148 # for Sun studio 11.
380 CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])
381 CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"])
382 # flag warnings.
149 ACX_CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])
150 ACX_CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"])
151
152 # debug mode flags warnings
383153 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debug warnings, asserts, makefile-dependencies]))
384154 debug_enabled="$enable_debug"
385155 AC_SUBST(debug_enabled)
386156 case "$enable_debug" in
387157 yes)
388 CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
389 CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
390 CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
391 CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
158 ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
159 ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
160 ACX_CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
161 ACX_CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
392162 AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
393163 ;;
394164 no|*)
397167 esac
398168
399169 AC_C_INLINE
400
401 AC_DEFUN([AC_CHECK_FORMAT_ATTRIBUTE],
402 [AC_REQUIRE([AC_PROG_CC])
403 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute)
404 AC_CACHE_VAL(ac_cv_c_format_attribute,
405 [ac_cv_c_format_attribute=no
406 AC_TRY_COMPILE(
407 [#include <stdio.h>
408 void f (char *format, ...) __attribute__ ((format (printf, 1, 2)));
409 void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2)));
410 ], [
411 f ("%s", "str");
412 ],
413 [ac_cv_c_format_attribute="yes"],
414 [ac_cv_c_format_attribute="no"])
415 ])
416
417 AC_MSG_RESULT($ac_cv_c_format_attribute)
418 if test $ac_cv_c_format_attribute = yes; then
419 AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute])
420 fi
421 ])dnl
422
423 AC_DEFUN([AC_CHECK_UNUSED_ATTRIBUTE],
424 [AC_REQUIRE([AC_PROG_CC])
425 AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute)
426 AC_CACHE_VAL(ac_cv_c_unused_attribute,
427 [ac_cv_c_unused_attribute=no
428 AC_TRY_COMPILE(
429 [#include <stdio.h>
430 void f (char *u __attribute__((unused)));
431 ], [
432 f ("x");
433 ],
434 [ac_cv_c_unused_attribute="yes"],
435 [ac_cv_c_unused_attribute="no"])
436 ])
437
438 AC_MSG_RESULT($ac_cv_c_unused_attribute)
439 if test $ac_cv_c_unused_attribute = yes; then
440 AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute])
441 fi
442 ])dnl
443
444 AC_CHECK_FORMAT_ATTRIBUTE
445 AC_CHECK_UNUSED_ATTRIBUTE
170 ACX_CHECK_FORMAT_ATTRIBUTE
171 ACX_CHECK_UNUSED_ATTRIBUTE
446172
447173 if test "$srcdir" != "."; then
448174 CPPFLAGS="$CPPFLAGS -I$srcdir"
449175 fi
450176
451 # skip these tests, we do not need them.
452 AC_DEFUN([AC_PROG_F77], [:])
453 AC_DEFUN([AC_PROG_FC], [:])
454 AC_DEFUN([AC_PROG_CXX], [:])
455 AC_DEFUN([AC_PROG_CXXCPP], [:])
456 AC_DEFUN([AC_PROG_OBJC], [:])
457 AC_DEFUN([AC_PROG_OBJCCPP], [:])
458 AC_DEFUN([AC_LIBTOOL_CXX], [:])
459 AC_DEFUN([AC_LIBTOOL_F77], [:])
460 # always use ./libtool unless override from commandline (libtool=mylibtool)
461 if test -z "$libtool"; then
462 libtool="./libtool"
463 fi
464 AC_SUBST(libtool)
465 AC_PATH_TOOL(AR, ar, [false])
466 if test $AR = false; then
467 AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it])
468 fi
469 AC_CHECK_PROG(doxygen, doxygen, doxygen)
470 # avoid libtool max commandline length test on systems that fork slowly.
471 AC_CANONICAL_HOST
472 if echo "$host_os" | grep "sunos4" >/dev/null; then
473 lt_cv_sys_max_cmd_len=32750;
474 fi
475177 AC_PROG_LEX
476178 AC_PROG_YACC
477 AC_PROG_LIBTOOL
179 AC_CHECK_PROG(doxygen, doxygen, doxygen)
180 ACX_LIBTOOL_C_ONLY
478181
479182 # Checks for header files.
480 AC_HEADER_STDC
481 AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h],,, [AC_INCLUDES_DEFAULT])
482
483 # check for types
484 AC_CHECK_TYPE(int8_t, char)
183 AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h netdb.h sys/wait.h pwd.h glob.h grp.h login_cap.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
184
185 # check for types.
186 # Using own tests for int64* because autoconf builtin only give 32bit.
187 AC_CHECK_TYPE(int8_t, signed char)
485188 AC_CHECK_TYPE(int16_t, short)
486189 AC_CHECK_TYPE(int32_t, int)
487190 AC_CHECK_TYPE(int64_t, long long)
494197 AC_TYPE_UID_T
495198 AC_TYPE_PID_T
496199 AC_TYPE_OFF_T
497 AC_CHECK_TYPE(u_char, unsigned char)
498
499 AC_CHECK_TYPE(rlim_t, ,
500 [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [
501 AC_INCLUDES_DEFAULT
502 #if HAVE_SYS_RESOURCE_H
503 # include <sys/resource.h>
504 #endif
505 ])
506 AC_CHECK_TYPE(socklen_t, ,
507 [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
508 AC_INCLUDES_DEFAULT
509 #if HAVE_SYS_SOCKET_H
510 # include <sys/socket.h>
511 #endif
512 ])
513 AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
514 AC_INCLUDES_DEFAULT
515 #if HAVE_SYS_TYPES_H
516 # include <sys/types.h>
517 #endif
518 #if HAVE_NETINET_IN_H
519 # include <netinet/in.h>
520 #endif
521 ])
522 AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
523 AC_INCLUDES_DEFAULT
524 #if HAVE_SYS_TYPES_H
525 # include <sys/types.h>
526 #endif
527 #if HAVE_NETINET_IN_H
528 # include <netinet/in.h>
529 #endif
530 ])
200 ACX_TYPE_U_CHAR
201 ACX_TYPE_RLIM_T
202 ACX_TYPE_SOCKLEN_T
203 ACX_TYPE_IN_ADDR_T
204 ACX_TYPE_IN_PORT_T
531205
532206 # add option to disable the evil rpath
533 dnl Check whether to use rpath or not
534 AC_ARG_ENABLE(rpath,
535 [ --disable-rpath disable hardcoded rpath (default=enabled)],
536 enable_rpath=$enableval, enable_rpath=yes)
537 if test "x$enable_rpath" = xno; then
538 AC_MSG_RESULT([Fixing libtool for -rpath problems.])
539 sed < libtool > libtool-2 \
540 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
541 mv libtool-2 libtool
542 chmod 755 libtool
543 libtool="./libtool"
544 fi
545
546 # Checks for libraries.
547 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
548 [enable SSL (will check /usr/local/ssl
549 /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
550 ],[
551 withval="yes"
552 ])
553 if test x_$withval = x_no; then
554 AC_MSG_ERROR([Need SSL library to do digital signature cryptography])
555 fi
556 if test x_$withval != x_no; then
557 AC_MSG_CHECKING(for SSL)
558 if test x_$withval = x_ -o x_$withval = x_yes; then
559 withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
560 fi
561 for dir in $withval; do
562 ssldir="$dir"
563 if test -f "$dir/include/openssl/ssl.h"; then
564 found_ssl="yes"
565 AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
566 CPPFLAGS="$CPPFLAGS -I$ssldir/include"
567 break;
568 fi
569 done
570 if test x_$found_ssl != x_yes; then
571 AC_MSG_ERROR(Cannot find the SSL libraries in $withval)
572 else
573 AC_MSG_RESULT(found in $ssldir)
574 HAVE_SSL=yes
575 LDFLAGS="$LDFLAGS -L$ssldir/lib"
576 if test "x$enable_rpath" = xyes; then
577 RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib"
578 fi
579
580 AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
581 LIBS="$LIBS -lcrypto"
582 AC_TRY_LINK(, [
583 int HMAC_CTX_init(void);
584 (void)HMAC_CTX_init();
585 ], [
586 AC_MSG_RESULT(yes)
587 AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
588 [If you have HMAC_CTX_init])
589 ], [
590 AC_MSG_RESULT(no)
591 # check if -lwsock32 or -lgdi32 are needed.
592 LIBS="$LIBS -lgdi32"
593 AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
594 AC_TRY_LINK([], [
595 int HMAC_CTX_init(void);
596 (void)HMAC_CTX_init();
597 ],[
598 AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
599 [If you have HMAC_CTX_init])
600 AC_MSG_RESULT(yes)
601 ],[
602 AC_MSG_RESULT(no)
603 AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
604 ])
605 ])
606 fi
607 AC_SUBST(HAVE_SSL)
608 AC_SUBST(RUNTIME_PATH)
609 fi
610 AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
611 AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
612 AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
613 AC_CHECK_FUNCS([EVP_sha1 EVP_sha256 EVP_sha512])
614
615 # check if libssl needs libdl
616 BAKLIBS="$LIBS"
617 LIBS="-lssl $LIBS"
618 AC_MSG_CHECKING([if libssl needs libdl])
619 AC_TRY_LINK_FUNC([SSL_CTX_new], [
620 AC_MSG_RESULT([no])
621 LIBS="$BAKLIBS"
622 ] , [
623 AC_MSG_RESULT([yes])
624 LIBS="$BAKLIBS"
625 AC_SEARCH_LIBS([dlopen], [dl])
626 ])
207 ACX_ARG_RPATH
627208
628209 # check for thread library.
210 # check this first, so that the pthread lib does not get linked in via
211 # libssl or libpython, and thus distorts the tests, and we end up using
212 # the non-threadsafe C libraries.
629213 AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
630214 [use pthreads library, or --without-pthreads to disable threading support.]),
631215 [ ],[ withval="yes" ])
632216 ub_have_pthreads=no
633217 if test x_$withval != x_no; then
634 sinclude(acx_pthread.m4)
635218 ACX_PTHREAD([
636219 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
637220 LIBS="$PTHREAD_LIBS $LIBS"
654237 [
655238 AC_DEFINE(HAVE_SOLARIS_THREADS, 1, [Using Solaris threads])
656239
657 CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
240 ACX_CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
658241 [CFLAGS="$CFLAGS -D_REENTRANT"])
659242 ub_have_sol_threads=yes
660243 ] , [
681264 )
682265 fi
683266
267 # Check for PyUnbound
268 AC_ARG_WITH(pyunbound,
269 AC_HELP_STRING([--with-pyunbound],
270 [build PyUnbound, or --without-pyunbound to skip it. (default=no)]),
271 [], [ withval="no" ])
272
273 ub_test_python=no
274 ub_with_pyunbound=no
275 if test x_$withval != x_no; then
276 ub_with_pyunbound=yes
277 ub_test_python=yes
278 fi
279
280 # Check for Python module
281 AC_ARG_WITH(pythonmodule,
282 AC_HELP_STRING([--with-pythonmodule],
283 [build Python module, or --without-pythonmodule to disable script engine. (default=no)]),
284 [], [ withval="no" ])
285
286 ub_with_pythonmod=no
287 if test x_$withval != x_no; then
288 ub_with_pythonmod=yes
289 ub_test_python=yes
290 fi
291
292 # Check for Python & SWIG only on PyUnbound or PyModule
293 if test x_$ub_test_python != x_no; then
294
295 # Check for Python
296 ub_have_python=no
297 AC_PYTHON_DEVEL
298 if test ! -z "$PYTHON_VERSION"; then
299 if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
300 AC_ERROR([Python version >= 2.4.0 is required])
301 fi
302
303 # Have Python
304 AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
305 LIBS="$PYTHON_LDFLAGS $LIBS"
306 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
307 ub_have_python=yes
308
309 # Check for SWIG
310 ub_have_swig=no
311 AC_PROG_SWIG
312 AC_MSG_CHECKING(SWIG)
313 if test ! -x "$SWIG"; then
314 AC_MSG_RESULT(failed, won't build Python module and PyUnbound)
315 AC_SUBST(swig, "")
316 ub_with_pyunbound=no
317 ub_with_pythonmod=no
318 else
319 AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
320 AC_SUBST(swig, "$SWIG")
321 AC_MSG_RESULT(present)
322
323 # If have Python & SWIG
324 # Declare PythonMod
325 if test x_$ub_with_pythonmod != x_no; then
326 AC_DEFINE(WITH_PYTHONMODULE, 1, [Define if you want Python module.])
327 WITH_PYTHONMODULE=yes
328 AC_SUBST(WITH_PYTHONMODULE)
329 fi
330
331 # Declare PyUnbound
332 if test x_$ub_with_pyunbound != x_no; then
333 AC_DEFINE(WITH_PYUNBOUND, 1, [Define if you want PyUnbound.])
334 WITH_PYUNBOUND=yes
335 AC_SUBST(WITH_PYUNBOUND)
336 fi
337 fi
338 else
339 AC_MSG_RESULT([*** Python libraries not found, won't build PythonMod or PyUnbound ***])
340 ub_with_pyunbound=no
341 ub_with_pythonmod=no
342 fi
343 fi
344
345 # Checks for libraries.
346 ACX_WITH_SSL
347 ACX_LIB_SSL
348 AC_CHECK_FUNCS([EVP_sha1 EVP_sha256 EVP_sha512 ENGINE_load_gost])
349
350 AC_ARG_ENABLE(sha2, AC_HELP_STRING([--enable-sha2], [Enable SHA256 and SHA512 RRSIG support]))
351 case "$enable_sha2" in
352 yes)
353 AC_DEFINE_UNQUOTED([USE_SHA2], [], [Define this to enable SHA256 and SHA512 support.])
354 ;;
355 no|*)
356 ;;
357 esac
358
684359 # check to see if libraries are needed for these functions.
685360 AC_SEARCH_LIBS([inet_pton], [nsl])
686361 AC_SEARCH_LIBS([socket], [socket])
362
363 AC_SUBST(RUNTIME_PATH)
687364
688365 # check for libevent
689366 AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
698375 thedir="$dir"
699376 if test -f "$dir/include/event.h"; then
700377 found_libevent="yes"
701 CPPFLAGS="$CPPFLAGS -I$thedir/include"
378 dnl assume /usr is in default path.
379 if test "$thedir" != "/usr"; then
380 CPPFLAGS="$CPPFLAGS -I$thedir/include"
381 fi
702382 break;
703383 fi
704384 done
707387 # libevent source directory
708388 AC_MSG_RESULT(found in $thedir)
709389 CPPFLAGS="$CPPFLAGS -I$thedir -I$thedir/include"
390 BAK_LDFLAGS_SET="1"
710391 BAK_LDFLAGS="$LDFLAGS"
711392 # remove evdns from linking
712393 mkdir build >/dev/null 2>&1
728409 fi
729410 else
730411 AC_MSG_RESULT(found in $thedir)
731 LDFLAGS="$LDFLAGS -L$thedir/lib"
732 if test "x$enable_rpath" = xyes; then
733 RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib"
412 dnl assume /usr is in default path.
413 if test "$thedir" != "/usr"; then
414 LDFLAGS="$LDFLAGS -L$thedir/lib"
415 ACX_RUNTIME_PATH_ADD([$thedir/lib])
734416 fi
735417 fi
736 AC_SUBST(RUNTIME_PATH)
737418 # check for library used by libevent after 1.3c
738419 AC_SEARCH_LIBS([clock_gettime], [rt])
739420
740421 AC_SEARCH_LIBS(event_set, [event])
741422 AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
742423 AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
743 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4? and later
424 AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
425 AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
744426 AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
745427 AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
746 if test -n "$BAK_LDFLAGS"; then
428 if test -n "$BAK_LDFLAGS_SET"; then
747429 LDFLAGS="$BAK_LDFLAGS"
748430 fi
749431 else
758440 , )
759441 if test x_$enable_static_exe = x_yes; then
760442 staticexe="-static"
443 if test "$on_mingw" = yes; then
444 staticexe="-all-static"
445 fi
761446 fi
762447
763448 # set lock checking if requested
784469 AC_FUNC_FORK
785470 AC_TYPE_SIGNAL
786471 AC_FUNC_FSEEKO
787 AC_SYS_LARGEFILE
788 dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko
789 CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1,
790 [
791 #include <stdio.h>
792 int test() {
793 int a = fseeko(stdin, 0, 0);
794 return a;
795 }
796 ], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"])
797
798 AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES],
799 [AC_REQUIRE([AC_PROG_CC])
800 AC_MSG_CHECKING(for getaddrinfo)
801 ac_cv_func_getaddrinfo=no
802 AC_LINK_IFELSE(
803 [
804 #ifdef __cplusplus
805 extern "C"
806 {
807 #endif
808 char* getaddrinfo();
809 char* (*f) () = getaddrinfo;
810 #ifdef __cplusplus
811 }
812 #endif
813 int main() {
814 ;
815 return 0;
816 }
817 ],
818 dnl this case on linux, solaris, bsd
819 [ac_cv_func_getaddrinfo="yes"],
820 dnl no quick getaddrinfo, try mingw32 and winsock2 library.
821 ORIGLIBS="$LIBS"
822 LIBS="$LIBS -lws2_32"
823 AC_LINK_IFELSE(
824 AC_LANG_PROGRAM(
825 [
826 #ifdef HAVE_WS2TCPIP_H
827 #include <ws2tcpip.h>
828 #endif
829 ],
830 [
831 (void)getaddrinfo(NULL, NULL, NULL, NULL);
832 ]
833 ),
834 [
835 ac_cv_func_getaddrinfo="yes"
836 dnl already: LIBS="$LIBS -lws2_32"
837 AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used])
838 ],
839 [
840 ac_cv_func_getaddrinfo="no"
841 LIBS="$ORIGLIBS"
472 ACX_SYS_LARGEFILE
473
474 ACX_CHECK_GETADDRINFO_WITH_INCLUDES
475 if test "$USE_WINSOCK" = 1; then
476 AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
477 UB_ON_WINDOWS=yes
478 AC_SUBST(UB_ON_WINDOWS)
479 fi
480 if test $ac_cv_func_getaddrinfo = no; then
481 AC_LIBOBJ([fake-rfc2553])
482 fi
483
484 # see if daemon(3) exists, and if it is deprecated.
485 AC_CHECK_FUNCS([daemon])
486 if test $ac_cv_func_daemon = yes; then
487 ACX_FUNC_DEPRECATED([daemon], [(void)daemon(0, 0);], [
488 #include <stdlib.h>
842489 ])
843 )
844
845 AC_MSG_RESULT($ac_cv_func_getaddrinfo)
846 if test $ac_cv_func_getaddrinfo = yes; then
847 AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available])
848 fi
849 ])dnl
850
851 AC_CHECK_GETADDRINFO_WITH_INCLUDES
852 if test $ac_cv_func_getaddrinfo = no; then
853 AC_LIBOBJ([fake-rfc2553])
854 fi
855 AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob])
490 fi
491
492 AC_SEARCH_LIBS([setusercontext], [util])
493 AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups strftime localtime_r setusercontext _beginthreadex])
856494
857495 # check if setreuid en setregid fail, on MacOSX10.4(darwin8).
858496 if echo $build_os | grep darwin8 > /dev/null; then
859497 AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
860498 fi
861
862 # check if select and nonblocking sockets actually work.
863 AC_MSG_CHECKING([if nonblocking sockets work])
864 AC_RUN_IFELSE(AC_LANG_PROGRAM([
865 #include <stdio.h>
866 #include <string.h>
867 #include <stdlib.h>
868 #include <fcntl.h>
869 #include <errno.h>
870 #ifdef HAVE_SYS_TYPES_H
871 #include <sys/types.h>
872 #endif
873 #ifdef HAVE_SYS_SOCKET_H
874 #include <sys/socket.h>
875 #endif
876 #ifdef HAVE_NETINET_IN_H
877 #include <netinet/in.h>
878 #endif
879 #ifdef HAVE_ARPA_INET_H
880 #include <arpa/inet.h>
881 #endif
882 #ifdef HAVE_UNISTD_H
883 #include <unistd.h>
884 #endif
885 #ifdef HAVE_TIME_H
886 #include <time.h>
887 #endif
888 ],[[
889 int port;
890 int sfd, cfd;
891 int num = 10;
892 int i, p;
893 struct sockaddr_in a;
894 /* test if select and nonblocking reads work well together */
895 /* open port.
896 fork child to send 10 messages.
897 select to read.
898 then try to nonblocking read the 10 messages
899 then, nonblocking read must give EAGAIN
900 */
901
902 port = 12345 + (time(0)%32);
903 sfd = socket(PF_INET, SOCK_DGRAM, 0);
904 if(sfd == -1) {
905 perror("socket");
906 return 1;
907 }
908 memset(&a, 0, sizeof(a));
909 a.sin_family = AF_INET;
910 a.sin_port = htons(port);
911 a.sin_addr.s_addr = inet_addr("127.0.0.1");
912 if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) {
913 perror("bind");
914 return 1;
915 }
916 if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) {
917 perror("fcntl");
918 return 1;
919 }
920
921 cfd = socket(PF_INET, SOCK_DGRAM, 0);
922 if(cfd == -1) {
923 perror("client socket");
924 return 1;
925 }
926 a.sin_port = 0;
927 if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) {
928 perror("client bind");
929 return 1;
930 }
931 a.sin_port = htons(port);
932
933 /* no handler, causes exit in 10 seconds */
934 alarm(10);
935
936 /* send and receive on the socket */
937 if((p=fork()) == 0) {
938 for(i=0; i<num; i++) {
939 if(sendto(cfd, &i, sizeof(i), 0,
940 (struct sockaddr*)&a, sizeof(a)) < 0) {
941 perror("sendto");
942 return 1;
943 }
944 }
945 } else {
946 /* parent */
947 fd_set rset;
948 int x;
949 if(p == -1) {
950 perror("fork");
951 return 1;
952 }
953 FD_ZERO(&rset);
954 FD_SET(sfd, &rset);
955 if(select(sfd+1, &rset, NULL, NULL, NULL) < 1) {
956 perror("select");
957 return 1;
958 }
959 i = 0;
960 while(i < num) {
961 if(recv(sfd, &x, sizeof(x), 0) != sizeof(x)) {
962 if(errno == EAGAIN)
963 continue;
964 perror("recv");
965 return 1;
966 }
967 i++;
968 }
969 /* now we want to get EAGAIN: nonblocking goodness */
970 errno = 0;
971 recv(sfd, &x, sizeof(x), 0);
972 if(errno != EAGAIN) {
973 perror("trying to recv again");
974 return 1;
975 }
976 /* EAGAIN encountered */
977 }
978
979 close(sfd);
980 close(cfd);
981 ]]), [
982 AC_MSG_RESULT([yes])
983 ], [
984 AC_MSG_RESULT([no])
985 AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).])
986 ], [
987 AC_MSG_RESULT([crosscompile(yes)])
988 ])
989
990 # check mkdir
991 AC_MSG_CHECKING([whether mkdir has one arg])
992 AC_TRY_COMPILE([
993 #include <stdio.h>
994 #include <unistd.h>
995 #ifdef HAVE_WINSOCK2_H
996 #include <winsock2.h>
997 #endif
998 #ifdef HAVE_SYS_STAT_H
999 #include <sys/stat.h>
1000 #endif
1001 ], [
1002 (void)mkdir("directory");
1003 ],
1004 AC_MSG_RESULT(yes)
1005 AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.])
1006 ,
1007 AC_MSG_RESULT(no)
1008 )
1009
1010 # check ioctlsocket
1011 AC_MSG_CHECKING(for ioctlsocket)
1012 AC_LINK_IFELSE(AC_LANG_PROGRAM([
1013 #ifdef HAVE_WINSOCK2_H
1014 #include <winsock2.h>
1015 #endif
1016 ], [
1017 (void)ioctlsocket(0, 0, NULL);
1018 ]), [
1019 AC_MSG_RESULT(yes)
1020 AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
1021 ],[AC_MSG_RESULT(no)])
1022
499 ACX_CHECK_NONBLOCKING_BROKEN
500 ACX_MKDIR_ONE_ARG
501 ACX_FUNC_IOCTLSOCKET
1023502 AC_REPLACE_FUNCS(inet_aton)
1024503 AC_REPLACE_FUNCS(inet_pton)
1025504 AC_REPLACE_FUNCS(inet_ntop)
1030509
1031510 # check this after all other compilation checks, since the linking of the lib
1032511 # may break checks after this.
1033 AC_ARG_WITH(ldns,
1034 AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use])
1035 , [ specialldnsdir="$withval"
1036 CPPFLAGS="$CPPFLAGS -I$withval/include"
1037 LDFLAGS="$LDFLAGS -L$withval -L$withval/lib -lldns"
512 use_ldns_builtin="no"
513 AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH],
514 [specify prefix of path of ldns library to use]),
515 [ specialldnsdir="$withval"
516 CPPFLAGS="-I$withval/include $CPPFLAGS"
517 LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
518 ACX_RUNTIME_PATH_ADD([$withval/lib])
1038519 ldnsdir="$withval"
1039520 AC_SUBST(ldnsdir)
1040521 ])
1041522
1042 AC_CHECK_LIB(ldns, ldns_buffer_copy, [
1043 dnl ldns was found, check compat functions
1044 AC_CHECK_LIB(ldns, [ldns_rr_free])
1045 AC_CHECK_FUNC([ldns_b32_ntop_extended_hex],, [
1046 AC_MSG_ERROR([ldns version too old, need >=1.4.0])])
1047 ] , [
523 AC_ARG_WITH(ldns-builtin, AC_HELP_STRING([--with-ldns-builtin],
524 [forces use of package included with this one]), [
525 use_ldns_builtin="yes"
526 ])
527
528 # check if ldns is good enough
529 if test "$use_ldns_builtin" = "no"; then
530 AC_CHECK_LIB(ldns, ldns_buffer_copy)
531 if test $ac_cv_lib_ldns_ldns_buffer_copy = yes; then
532 dnl ldns was found, check compat functions
533 AC_CHECK_FUNC([ldns_b32_ntop_extended_hex],, [
534 AC_MSG_ERROR([ldns version too old, need >=1.4.0])])
535 else
536 use_ldns_builtin="yes"
537 fi
538 fi
539
540 if test "$use_ldns_builtin" = "yes"; then
1048541 dnl use the builtin ldns-src.tar.gz file to build ldns.
1049542 if test ! -f $srcdir/ldns-src.tar.gz; then
1050543 AC_MSG_ERROR([No ldns library found and no ldns-src.tar.gz, use --with-ldns=path.])
1051544 fi
1052545 echo "****************************************************************"
1053546 echo "*** ***"
1054 echo "*** ldns library not found (--with-ldns= to specify by hand) ***"
1055547 echo "*** Building ldns library from package included in this one. ***"
1056548 echo "*** ***"
1057549 echo "****************************************************************"
1063555 CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
1064556 LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
1065557 AC_SUBST(ldnsdir)
1066 ])
558 fi dnl end of use_ldns_builtin == yes
559
560 ACX_STRIP_EXT_FLAGS
1067561 LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
1068562
1069563 AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
1070564
1071 AH_BOTTOM([
565 AH_BOTTOM(
566 dnl this must be first AH_CONFIG, to define the flags before any includes.
567 AHX_CONFIG_EXT_FLAGS
568
569 dnl includes
570 [
1072571 #ifndef UNBOUND_DEBUG
1073572 # define NDEBUG
1074573 #endif
1128627 #ifdef HAVE_OPENSSL_RAND_H
1129628 #include <openssl/rand.h>
1130629 #endif
1131
1132 #ifdef HAVE_ATTR_FORMAT
1133 # define ATTR_FORMAT(archetype, string_index, first_to_check) \
1134 __attribute__ ((format (archetype, string_index, first_to_check)))
1135 #else /* !HAVE_ATTR_FORMAT */
1136 # define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
1137 #endif /* !HAVE_ATTR_FORMAT */
1138 #if defined(DOXYGEN)
1139 # define ATTR_UNUSED(x) x
1140 #elif defined(__cplusplus)
1141 # define ATTR_UNUSED(x)
1142 #elif defined(HAVE_ATTR_UNUSED)
1143 # define ATTR_UNUSED(x) x __attribute__((unused))
1144 #else /* !HAVE_ATTR_UNUSED */
1145 # define ATTR_UNUSED(x) x
1146 #endif /* !HAVE_ATTR_UNUSED */
1147 #ifndef HAVE_FSEEKO
1148 #define fseeko fseek
1149 #define ftello ftell
1150 #endif /* HAVE_FSEEKO */
630 ]
631
632 AHX_CONFIG_FORMAT_ATTRIBUTE
633 AHX_CONFIG_UNUSED_ATTRIBUTE
634 AHX_CONFIG_FSEEKO
635 AHX_CONFIG_RAND_MAX
636 AHX_CONFIG_MAXHOSTNAMELEN
637 AHX_CONFIG_SNPRINTF(unbound)
638 AHX_CONFIG_INET_PTON(unbound)
639 AHX_CONFIG_INET_NTOP(unbound)
640 AHX_CONFIG_INET_ATON(unbound)
641 AHX_CONFIG_MEMMOVE(unbound)
642 AHX_CONFIG_STRLCPY(unbound)
643 AHX_CONFIG_GMTIME_R(unbound)
644 AHX_CONFIG_W32_SLEEP
645 AHX_CONFIG_W32_USLEEP
646 AHX_CONFIG_W32_RANDOM
647 AHX_CONFIG_W32_SRANDOM
648 AHX_CONFIG_W32_FD_SET_T
649 AHX_CONFIG_IPV6_MIN_MTU
650
651 [
1151652 #if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
1152653 /* using version of libevent that is not threadsafe. */
1153654 # define LIBEVENT_SIGNAL_PROBLEM 1
1154655 #endif
1155
1156 #ifndef RAND_MAX
1157 #define RAND_MAX 2147483647
1158 #endif
1159
1160 #ifndef MAXHOSTNAMELEN
1161 #define MAXHOSTNAMELEN 256
1162 #endif
1163
1164 #ifndef IPV6_MIN_MTU
1165 #define IPV6_MIN_MTU 1280
1166 #endif /* IPV6_MIN_MTU */
1167656
1168657 #ifndef CHECKED_INET6
1169658 # define CHECKED_INET6
1176665
1177666 /* maximum nesting of included files */
1178667 #define MAXINCLUDES 10
1179
1180 #ifndef HAVE_SNPRINTF
1181 #define snprintf snprintf_unbound
1182 #define vsnprintf vsnprintf_unbound
1183 #include <stdarg.h>
1184 int snprintf (char *str, size_t count, const char *fmt, ...);
1185 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
1186 #endif /* HAVE_SNPRINTF */
1187 #ifndef HAVE_INET_PTON
1188 #define inet_pton inet_pton_unbound
1189 int inet_pton(int af, const char* src, void* dst);
1190 #endif /* HAVE_INET_PTON */
1191 #ifndef HAVE_INET_NTOP
1192 #define inet_ntop inet_ntop_unbound
1193 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
1194 #endif
1195 #ifndef HAVE_INET_ATON
1196 #define inet_aton inet_aton_unbound
1197 int inet_aton(const char *cp, struct in_addr *addr);
1198 #endif
1199 #ifndef HAVE_MEMMOVE
1200 #define memmove memmove_unbound
1201 void *memmove(void *dest, const void *src, size_t n);
1202 #endif
1203 #ifndef HAVE_STRLCPY
1204 #define strlcpy strlcpy_unbound
1205 size_t strlcpy(char *dst, const char *src, size_t siz);
1206 #endif
1207 #ifndef HAVE_GMTIME_R
1208 #define gmtime_r gmtime_r_unbound
1209 struct tm *gmtime_r(const time_t *timep, struct tm *result);
1210 #endif
1211668 #ifndef HAVE_GETADDRINFO
1212669 struct sockaddr_storage;
1213670 #include "compat/fake-rfc2553.h"
1214 #endif
1215 #ifndef HAVE_SLEEP
1216 #define sleep(x) Sleep((x)*1000) /* on win32 */
1217 #endif /* HAVE_SLEEP */
1218 #ifndef HAVE_USLEEP
1219 #define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
1220 #endif /* HAVE_USLEEP */
1221 #ifndef HAVE_RANDOM
1222 #define random rand /* on win32, for tests only (bad random) */
1223 #endif /* HAVE_RANDOM */
1224 #ifndef HAVE_SRANDOM
1225 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
1226 #endif /* HAVE_SRANDOM */
1227
1228 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
1229 #ifdef HAVE_WINSOCK2_H
1230 #define FD_SET_T (u_int)
1231 #else
1232 #define FD_SET_T
1233671 #endif
1234672
1235673 #include "ldns/ldns.h"
66 * unbound.spec and unbound.init: RPM specfile and Linux rc.d initfile.
77 * update-anchor.sh: shell script that uses unbound-host to update a set
88 of trust anchor files. Run from cron twice a month.
9 * update-itar.sh: shell script that updates from itar.iana.org. Run from cron.
910 * unbound_munin_ : plugin for munin statistics report
11 * unbound_cacti.tar.gz : setup files for cacti statistics report
1012 * selinux: the .fc and .te files for SElinux protection of the unbound daemon
13 * unbound.plist: launchd configuration file for MacOSX.
0 <?xml version="1.0" encoding="UTF-8"?>
1 <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
2 <plist version="1.0">
3 <!--
4 Unbound plist file for use by MacOSX launchd(8) using launchctl(1).
5 Copy this file to /Library/LaunchDaemons. Launchd keeps unbound running.
6
7 Setup your unbound.conf with the following additional settings.
8 server:
9 do-daemonize: no
10 username: ""
11 chroot: ""
12 directory: ""
13 These actions are performed by launchd (for the option values, see below).
14
15 -->
16 <dict>
17 <key>Label</key>
18 <string>unbound</string>
19
20 <key>ProgramArguments</key>
21 <array>
22 <string>unbound</string>
23 </array>
24
25 <key>UserName</key>
26 <string>unbound</string>
27
28 <key>RootDirectory</key>
29 <string>/usr/local/etc/unbound</string>
30
31 <key>WorkingDirectory</key>
32 <string>/usr/local/etc/unbound</string>
33
34 <key>KeepAlive</key>
35 <true/>
36
37 <key>RunAtLoad</key>
38 <true/>
39
40 </dict>
41 </plist>
00 Summary: Validating, recursive, and caching DNS(SEC) resolver
11 Name: unbound
2 Version: 1.1.0
2 Version: 1.2.1rc1
33 Release: 1%{?dist}
44 License: BSD
55 Url: http://www.nlnetlabs.nl/unbound/
66 Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
77 Source1: unbound.init
88 Source2: unbound.conf
9 Source3: unbound.munin
910 Group: System Environment/Daemons
1011 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
11 BuildRequires: flex, openssl-devel, ldns-devel >= 1.3.0, libevent-devel
12 BuildRequires: flex, openssl-devel >= 0.9.8g-12, ldns-devel >= 1.5.0,
13 BuildRequires: libevent-devel >= 1.4.5
1214 Requires(post): chkconfig
1315 Requires(preun): chkconfig
1416 Requires(preun): initscripts
1517 Requires(postun): initscripts
16 Requires: ldns >= 1.3.0
18 Requires: ldns >= 1.5.0
1719 Requires(pre): shadow-utils
1820 # Is this obsolete?
1921 #Provides: caching-nameserver
2830 Unbound is designed as a set of modular components, so that also
2931 DNSSEC (secure DNS) validation and stub-resolvers (that do not run
3032 as a server, but are linked into an application) are easily possible.
33
34 %package munin
35 Summary: Plugin for the munin / munin-node monitoring package
36 Group: System Environment/Daemons
37 Requires: munin-node
38 Requires: %{name} = %{version}-%{release}, bc
39
40 %description munin
41 Plugin for the munin / munin-node monitoring package
3142
3243 %package devel
3344 Summary: Development package that includes the unbound header files
3445 Group: Development/Libraries
3546 Requires: %{name}-libs = %{version}-%{release}, openssl-devel, ldns-devel
36 Requires: libevent-devel
3747
3848 %description devel
3949 The devel package contains the unbound library and the include files
4353 Group: Applications/System
4454 Requires(post): /sbin/ldconfig
4555 Requires(postun): /sbin/ldconfig
56 Requires: openssl >= 0.9.8g-12
4657
4758 %description libs
4859 Contains libraries used by the unbound server and client applications
5162 %setup -q
5263
5364 %build
54 %configure --with-ldns= --with-libevent --with-pthreads --with-ssl \
65 %configure --with-ldns= -with-libevent --with-pthreads --with-ssl \
5566 --disable-rpath --enable-debug --disable-static \
56 --with-run-dir=%{_localstatedir}/lib/%{name}\
57 --with-conf-file=%{_localstatedir}/lib/%{name}/unbound.conf \
67 --with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
5868 --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid
5969 %{__make} CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" QUIET=no %{?_smp_mflags}
6070
6171 %install
6272 rm -rf %{buildroot}
6373 %{__make} DESTDIR=%{buildroot} install
64 install -d 0755 %{buildroot}%{_localstatedir}/lib/%{name}
6574 install -d 0755 %{buildroot}%{_initrddir}
66 #install -m 0755 contrib/unbound.init %{buildroot}%{_initrddir}/unbound
6775 install -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/unbound
68 #overwrite stock unbound.conf with our own
69 install -m 0755 %{SOURCE2} %{buildroot}%{_localstatedir}/lib/%{name}
70
71 # add symbolic link from /etc/unbound.conf -> /var/unbound/unbound.conf
72
73 ( cd %{buildroot}%{_sysconfdir}/ ; ln -s ..%{_localstatedir}/lib/unbound/unbound.conf )
76 install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/unbound
77 # Install munin plugin and its softlinks
78 install -d 0755 %{buildroot}%{_sysconfdir}/munin/plugin-conf.d
79 install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/munin/plugin-conf.d/unbound
80 install -d 0755 %{buildroot}%{_datadir}/munin/plugins/
81 install -m 0755 contrib/unbound_munin_ %{buildroot}%{_datadir}/munin/plugins/unbound
82 for plugin in unbound_munin_hits unbound_munin_queue unbound_munin_memory unbound_munin_by_type unbound_munin_by_class unbound_munin_by_opcode unbound_munin_by_rcode unbound_munin_by_flags unbound_munin_histogram; do
83 ln -s unbound %{buildroot}%{_datadir}/munin/plugins/$plugin
84 done
85
7486 # remove static library from install (fedora packaging guidelines)
7587 rm -rf %{buildroot}%{_libdir}/*.la
7688
77 # The chroot needs /dev/log, /dev/random, /etc/resolv.conf and /etc/localtime
78 # but the init script uses mount --bind, so just create empty files
79 mkdir -p %{buildroot}%{_localstatedir}/lib/unbound/etc \
80 %{buildroot}%{_localstatedir}/lib/unbound/dev
81 echo "Used for mount --bind in initscript" > %{buildroot}%{_localstatedir}/lib/unbound/etc/resolv.conf
82 echo "Used for mount --bind in initscript" > %{buildroot}%{_localstatedir}/lib/unbound/etc/localtime
83 echo "Used for mount --bind in initscript" > %{buildroot}%{_localstatedir}/lib/unbound/dev/log
84 echo "Used for mount --bind in initscript" > %{buildroot}%{_localstatedir}/lib/unbound/dev/random
85 mkdir -p %{buildroot}%{_localstatedir}/lib/unbound/var/run/unbound
8689 mkdir -p %{buildroot}%{_localstatedir}/run/unbound
8790
8891 %clean
9295 %defattr(-,root,root,-)
9396 %doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
9497 %attr(0755,root,root) %{_initrddir}/%{name}
95 # the chroot env
96 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}
98 %attr(0755,root,root) %dir %{_sysconfdir}/%{name}
9799 %attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
98 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}/dev
99 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}/etc
100 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}/var
101 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}/var/run
102 %attr(0755,root,root) %dir %{_localstatedir}/lib/%{name}/var/run/unbound
103 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/unbound.conf
104 %attr(0644,root,root) %config(noreplace) %{_localstatedir}/lib/%{name}/unbound.conf
105 %attr(0644,root,root) %{_localstatedir}/lib/%{name}/dev/*
106 %attr(0644,root,root) %{_localstatedir}/lib/%{name}/etc/*
100 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
107101 %{_sbindir}/*
108102 %{_mandir}/*/*
103
104 %files munin
105 %defattr(-,root,root,-)
106 %config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/unbound
107 %{_datadir}/munin/plugins/unbound*
109108
110109 %files devel
111110 %defattr(-,root,root,-)
121120 %pre
122121 getent group unbound >/dev/null || groupadd -r unbound
123122 getent passwd unbound >/dev/null || \
124 useradd -r -g unbound -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
123 useradd -r -g unbound -d %{_sysconfdir}/unbound -s /sbin/nologin \
125124 -c "Unbound DNS resolver" unbound
126125 exit 0
127126
132131
133132
134133 %preun
135 if [ $1 -eq 0 ]; then
134 if [ "$1" -eq 0 ]; then
136135 /sbin/service %{name} stop >/dev/null 2>&1
137136 /sbin/chkconfig --del %{name}
138137 fi
145144 %postun libs -p /sbin/ldconfig
146145
147146 %changelog
147 * Sun Jan 18 2009 Tomas Mraz <tmraz@redhat.com> - 1.2.0-2
148 - rebuild with new openssl
149
150 * Wed Jan 14 2009 Paul Wouters <paul@xelerance.com - 1.2.0-1
151 - Updated to 1.2.0
152 - Added dependancy on minimum SSL for CVE-2008-5077
153 - Added dependancy on bc for unbound-munin
154 - Added minimum requirement of libevent 1.4.5. Crashes with older versions
155 (note: libevent is stale in EL-4 and not in EL-5, needs fixing there)
156 - Removed dependancy on selinux-policy (will get used when available)
157 - Enable options as per draft-wijngaards-dnsext-resolver-side-mitigation-00.txt
158 - Enable unwanted-reply-threshold to mitigate against a Kaminsky attack
159 - Enable val-clean-additional to drop addition unsigned data from signed
160 response.
161 - Removed patches (got merged into upstream)
162
163 * Mon Jan 5 2009 Paul Wouters <paul@xelerance.com> - 1.1.1-7
164 - Modified scandir patch to silently fail when wildcard matches nothing
165 - Patch to allow unbound-checkconf to find empty wildcard matches
166
167 * Mon Jan 5 2009 Paul Wouters <paul@xelerance.com> - 1.1.1-6
168 - Added scandir patch for trusted-keys-file: option, which
169 is used to load multiple dnssec keys in bind file format
170
171 * Mon Dec 8 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-4
172 - Added Requires: for selinux-policy >= 3.5.13-33 for proper SElinux rules.
173
174 * Mon Dec 1 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-3
175 - We did not own the /etc/unbound directory (#474020)
176 - Fixed cvs anomalies
177
178 * Fri Nov 28 2008 Adam Tkac <atkac redhat com> - 1.1.1-2
179 - removed all obsolete chroot related stuff
180 - label control certs after generation correctly
181
182 * Thu Nov 20 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-1
183 - Updated to unbound 1.1.1 which fixes a crasher and
184 addresses nlnetlabs bug #219
185
186 * Wed Nov 19 2008 Paul Wouters <paul@xelerance.com> - 1.1.0-3
187 - Remove the chroot, obsoleted by SElinux
188 - Add additional munin plugin links supported by unbound plugin
189 - Move configuration directory from /var/lib/unbound to /etc/unbound
190 - Modified unbound.init and unbound.conf to account for chroot changes
191 - Updated unbound.conf with new available options
192 - Enabled dns-0x20 protection per default
193
194 * Wed Nov 19 2008 Adam Tkac <atkac redhat com> - 1.1.0-2
195 - unbound-1.1.0-log_open.patch
196 - make sure log is opened before chroot call
197 - tracked as http://www.nlnetlabs.nl/bugs/show_bug.cgi?id=219
198 - removed /dev/log and /var/run/unbound and /etc/resolv.conf from
199 chroot, not needed
200 - don't mount files in chroot, it causes problems during updates
201 - fixed typo in default config file
202
203 * Fri Nov 14 2008 Paul Wouters <paul@xelerance.com> - 1.1.0-1
204 - Updated to version 1.1.0
205 - Updated unbound.conf's statistics options and remote-control
206 to work properly for munin
207 - Added unbound-munin package
208 - Generate unbound remote-control key/certs on first startup
209 - Required ldns is now 1.4.0
210
148211 * Wed Oct 22 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-5
149212 - Only call ldconfig in -libs package
150213 - Move configure into build section
179242
180243 * Wed Apr 23 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.11
181244 - Initial version.
182
183
184
122122 get_state ( ) {
123123 # obtain lock for fetching the state
124124 # because there is a race condition in fetching and writing to file
125
126 # see if the lock is stale, if so, take it
127 if test -f $lock ; then
128 pid="`cat $lock 2>&1`"
129 kill -0 "$pid" >/dev/null 2>&1
130 if test $? -ne 0 -a "$pid" != $$ ; then
131 echo $$ >$lock
132 fi
133 fi
134
125135 i=0
126 while test ! -f $lock || test "`cat $lock`" != $$; do
136 while test ! -f $lock || test "`cat $lock 2>&1`" != $$; do
127137 while test -f $lock; do
128138 # wait
129139 i=`expr $i + 1`
0 #!/bin/sh
1 # update-itar.sh - update from the interim trust anchor repository
2 # Copyright 2009, W.C.A. Wijngaards
3 # This file is BSD licensed, see doc/LICENSE.
4
5 # --- Some settings
6
7 # directory where unbound works
8 thedir="."
9 # where is the file that unbound is going to read
10 ub_ta_file="$thedir/anchors.mf"
11 # where is the itar master file format
12 itar_url="ftp://iana.org/itar/anchors.mf"
13 # where is the itar PGP signature
14 itar_sig="ftp://iana.org/itar/anchors.mf.sig"
15
16 # which command to fetch urls, cmd $dest $url. "wget -O" "curl -o"
17 fetch_cmd="wget -O"
18 # file with pgp public key
19 pgp_pub_key_file="$thedir/update-itar.key"
20 # our pgp keyring (goes into .gnupg directory)
21 pgp_keyring_file="update-itar.ring"
22 # pgp command to use
23 pgp_cmd="gpg"
24
25
26 # --- The script is below
27 usage ( )
28 {
29 echo "usage: update-itar"
30 echo " Updates the trust anchors from the interim trust"
31 echo " anchor repository, https://itar.iana.org, and checks PGP sig."
32 echo
33 echo " Updates $ub_ta_file with the latest keys."
34 echo " Read that file from the unbound config with"
35 echo " trust-anchor-file: "'"'"$ub_ta_file"'"'
36 echo
37 echo " Exit code 0 means anchors updated, 1 no changes, "
38 echo " others are errors. So, in a cronjob you can do:"
39 echo " cd /usr/local/etc/unbound # your unbound work dir"
40 echo " ./update-itar.sh && unbound-control reload"
41 exit 2
42 }
43
44 if test $# -ne 0; then
45 usage
46 fi
47 tmpf="/tmp/update-itar.$$"
48
49 # one argument: explanation string
50 error_exit ( )
51 {
52 if test -f $tmpf.log; then cat $tmpf.log; fi
53 rm -f $tmpf $tmpf.sig $tmpf.log
54 echo "Error updating trust anchors: $1"
55 exit 2
56 }
57
58 if test ! -f $pgp_pub_key_file || test ! -f $HOME/.gnupg/$pgp_keyring_file || \
59 test "$pgp_pub_key_file" -nt $HOME/.gnupg/$pgp_keyring_file; then
60 # default key contents right here
61 if test ! -f $pgp_pub_key_file; then
62 echo "creating default IANA ITAR pgp key file"
63 cat >$pgp_pub_key_file <<EOF
64 -----BEGIN PGP PUBLIC KEY BLOCK-----
65 Version: GnuPG v1.4.5
66
67 mQGiBElr2DcRBAC+6YK6eSP7rzstvnMPQXMrpvVfuIR5FeTpGuwae9JP78V/iOXr
68 N0yW8Dn6kdAztCMuRizL1Ij9IgaD7pjn8h09VgR4cN4LDv75rcQeWLzNxKy4UNRF
69 aStL77RcIoTblBeCgHAK9FLzd0XfTGZCNaLNy9BYVSLyADOVDIqgBcrvBwCglz03
70 QhOMIgaSx/XuRh6kYtynZ6kD/2GXx6pFs57b7rww8yOpdurCSOMB1wuEXiIXznTI
71 06ARiib0G5VDvOdpy0LDU2526Q9f/WAERlhcExTgnTFigG4mRksUiDrrai4GIr+6
72 JaivcGFVYdZZ4mZ088jcwujS/UY3C0ryGR9ufYUDAnfx6frhSl6o6j5is+jeGndF
73 JYRAA/9B/1OXNVwFSiIxnP2aPUwsT1li1vaW8dhA/5PcuPLOVvEjPc1Pc16HGLhE
74 8CRmMn66LqB1ccInE5hLKGGvV3pctjan+IOhaq3OHt/a+buDtTPgykchMZ2k1AzT
75 RYk+gksxpIl6yTZsBH4hoRt8auxEJW8AiYbNtXXkNuWcoQL40bQsSUFOQSBUcnVz
76 dCBBbmNob3IgUmVwb3NpdG9yeSA8aXRhckBpYW5hLm9yZz6IYAQTEQIAIAUCSWvY
77 NwIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEPR9+zCB1GT0GUAAn29/TacF
78 Teh87dls8pmkjxS4pKf1AKCJS/MvzR54AblO4DNMyc9q0G4frrkCDQRJa9g3EAgA
79 ywoLxF4HVb9o926UIXw8JxNIzDPkt8galAcKRUmHQMNa/QA80WMl9Ia6DIxavGlV
80 I5O1fvms297RV2KSSBjKWn6G+0me80A7aw0eHNg7habM5VtzDz5DhJbQFdJV9aYV
81 DoTSnY6uR6iSSRrdZNaYdlCwDS8lBCnOKoGMArHzVCa2EdCBeCUY/eObOXtu8Gm3
82 nDkuWeLPv08/0lvtr6d6VoDUEVPEsJAPONEYtpz/D+EZddUraF+3JscWqfRApBOz
83 /8WHaeTNdzIH+h1ntktiizA6eH40EM6coQQxtIRsxg1DPTxofdovreMkcMI0EUUP
84 awDn8gDtgG3g6Ud5zCdknwAEDQf/W3rxrEN6OZxJvWti8Iu6KOgxtuINiAsimPPX
85 qy9KHowyEE9EMPzgADjWC9Reyusr4CwcootjWw7ryUwU0fXvVULKhg32NzLsx/Ci
86 WtgCPSR58WZ1KKhnoB05+PTrwzhU+u64Cd/vJtFqGxSrANl2FAkPswHJMr8dMwAz
87 uni7zzLJ+homW1T5AaixwmN3jeDHWshJH9E9JIhr5Y/8AzMl1V10r2u1c2ej0lBJ
88 Y4GegI5cYAEBerS9d+mrbPlvbJ8AfuAuEf0y/PWJh0z1+Kck5qIbXMn/rpMBYvLJ
89 Uj5CfqWlh8+hxqSYJDXtLm8hBiQFiMEew0jOc2Tw4F91OZ+jyYhJBBgRAgAJBQJJ
90 a9g3AhsMAAoJEPR9+zCB1GT0AUwAn2ZtBwAyVxppdeTqilXufUvAkvjbAJ9dUpR1
91 9a17/5BvDDJcIxSEKTJmDw==
92 =zCNZ
93 -----END PGP PUBLIC KEY BLOCK-----
94 EOF
95 fi
96 # import the new key
97 $pgp_cmd --no-default-keyring --keyring $pgp_keyring_file \
98 --primary-keyring $pgp_keyring_file \
99 --import $pgp_pub_key_file >$tmpf.log 2>&1 \
100 || error_exit "could not import pgp public key into keyring"
101 fi
102
103 $fetch_cmd $tmpf $itar_url >$tmpf.log 2>&1 \
104 || error_exit "fetching $itar_url failed"
105 tail -2 $tmpf | grep "; End of file" >/dev/null 2>&1 || \
106 error_exit "The file fetched from $itar_url was partial"
107 $fetch_cmd $tmpf.sig $itar_sig >$tmpf.log 2>&1 \
108 || error_exit "fetching $itar_sig failed"
109
110 # check the file with pgp
111 $pgp_cmd --no-default-keyring --keyring $pgp_keyring_file \
112 --verify $tmpf.sig $tmpf >$tmpf.log 2>&1 \
113 || error_exit "the PGP signature failed!"
114
115 # check for differences
116 val=1
117 if diff "$ub_ta_file" $tmpf 2>/dev/null ; then
118 # echo "The interim trust anchor repository did not change."
119 :
120 else
121 echo "Updating $ub_ta_file"
122 cp $tmpf $ub_ta_file
123 val=0
124 fi
125
126 rm -f $tmpf $tmpf.sig $tmpf.log
127 exit $val
170170 /* init timezone info while we are not chrooted yet */
171171 tzset();
172172 #endif
173 /* open /dev/random if needed */
174 ub_systemseed((unsigned)time(NULL)^(unsigned)getpid()^0xe67);
173175 daemon->need_to_exit = 0;
174176 modstack_init(&daemon->mods);
175177 if(!(daemon->env = (struct module_env*)calloc(1,
503505 }
504506 #endif
505507 }
508
509 void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg)
510 {
511 daemon->cfg = cfg;
512 config_apply(cfg);
513 if(!daemon->env->msg_cache ||
514 cfg->msg_cache_size != slabhash_get_size(daemon->env->msg_cache) ||
515 cfg->msg_cache_slabs != daemon->env->msg_cache->size) {
516 slabhash_delete(daemon->env->msg_cache);
517 daemon->env->msg_cache = slabhash_create(cfg->msg_cache_slabs,
518 HASH_DEFAULT_STARTARRAY, cfg->msg_cache_size,
519 msgreply_sizefunc, query_info_compare,
520 query_entry_delete, reply_info_delete, NULL);
521 if(!daemon->env->msg_cache) {
522 fatal_exit("malloc failure updating config settings");
523 }
524 }
525 if((daemon->env->rrset_cache = rrset_cache_adjust(
526 daemon->env->rrset_cache, cfg, &daemon->superalloc)) == 0)
527 fatal_exit("malloc failure updating config settings");
528 if((daemon->env->infra_cache = infra_adjust(daemon->env->infra_cache,
529 cfg))==0)
530 fatal_exit("malloc failure updating config settings");
531 }
4444 #include "util/locks.h"
4545 #include "util/alloc.h"
4646 #include "services/modstack.h"
47 #ifdef UB_ON_WINDOWS
48 # include "util/winsock_event.h"
49 #endif
4750 struct config_file;
4851 struct worker;
4952 struct listen_port;
131134 */
132135 void daemon_delete(struct daemon* daemon);
133136
137 /**
138 * Apply config settings.
139 * @param daemon: the daemon.
140 * @param cfg: new config settings.
141 */
142 void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg);
143
134144 #endif /* DAEMON_H */
6161 #include "validator/validator.h"
6262 #include "validator/val_kcache.h"
6363 #include "validator/val_kentry.h"
64 #include "iterator/iterator.h"
65 #include "iterator/iter_fwd.h"
66 #include "iterator/iter_delegpt.h"
67 #include "services/outbound_list.h"
68 #include "services/outside_network.h"
6469
6570 #ifdef HAVE_SYS_TYPES_H
6671 # include <sys/types.h>
278283 /* alloc */
279284 n = (struct listen_port*)calloc(1, sizeof(*n));
280285 if(!n) {
286 #ifndef USE_WINSOCK
281287 close(fd);
288 #else
289 closesocket(fd);
290 #endif
282291 log_err("out of memory");
283292 return 0;
284293 }
370379 if(rc->active >= rc->max_active) {
371380 log_warn("drop incoming remote control: too many connections");
372381 comm_point_stop_listening(c);
382 close_exit:
383 #ifndef USE_WINSOCK
373384 close(newfd);
385 #else
386 closesocket(newfd);
387 #endif
374388 return 0;
375389 }
376390
378392 n = (struct rc_state*)calloc(1, sizeof(*n));
379393 if(!n) {
380394 log_err("out of memory");
381 close(newfd);
382 return 0;
395 goto close_exit;
383396 }
384397 /* start in reading state */
385398 n->c = comm_point_create_raw(rc->worker->base, newfd, 0,
386399 &remote_control_callback, n);
387400 if(!n->c) {
388401 log_err("out of memory");
389 close(newfd);
390402 free(n);
391 return 0;
403 goto close_exit;
392404 }
393405 log_addr(VERB_QUERY, "new control connection from", &addr, addrlen);
394406 n->c->do_not_close = 0;
400412 n->ssl = SSL_new(rc->ctx);
401413 if(!n->ssl) {
402414 log_crypto_err("could not SSL_new");
403 close(newfd);
404415 free(n);
405 return 0;
416 goto close_exit;
406417 }
407418 SSL_set_accept_state(n->ssl);
408419 (void)SSL_set_mode(n->ssl, SSL_MODE_AUTO_RETRY);
409420 if(!SSL_set_fd(n->ssl, newfd)) {
410421 log_crypto_err("could not SSL_set_fd");
411 close(newfd);
412422 SSL_free(n->ssl);
413423 free(n);
414 return 0;
424 goto close_exit;
415425 }
416426
417427 n->rc = rc;
842852
843853 /** do the stats command */
844854 static void
845 do_stats(SSL* ssl, struct daemon_remote* rc)
855 do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
846856 {
847857 struct daemon* daemon = rc->worker->daemon;
848858 struct stats_info total;
850860 int i;
851861 /* gather all thread statistics in one place */
852862 for(i=0; i<daemon->num; i++) {
853 server_stats_obtain(rc->worker, daemon->workers[i], &s);
863 server_stats_obtain(rc->worker, daemon->workers[i], &s, reset);
854864 if(!print_thread_stats(ssl, i, &s))
855865 return;
856866 if(i == 0)
10441054 send_ok(ssl);
10451055 }
10461056
1057 /** flush statistics */
1058 static void
1059 do_flush_stats(SSL* ssl, struct worker* worker)
1060 {
1061 worker_stats_clear(worker);
1062 send_ok(ssl);
1063 }
1064
1065 /** flush requestlist */
1066 static void
1067 do_flush_requestlist(SSL* ssl, struct worker* worker)
1068 {
1069 mesh_delete_all(worker->env.mesh);
1070 send_ok(ssl);
1071 }
1072
10471073 /**
10481074 * Local info for deletion functions
10491075 */
10601086 uint32_t expired;
10611087 /** number of rrsets removed */
10621088 size_t num_rrsets;
1089 /** number of msgs removed */
1090 size_t num_msgs;
10631091 /** number of key entries removed */
10641092 size_t num_keys;
10651093 };
10791107 }
10801108 }
10811109
1110 /** callback to delete messages in a zone */
1111 static void
1112 zone_del_msg(struct lruhash_entry* e, void* arg)
1113 {
1114 /* entry is locked */
1115 struct del_info* inf = (struct del_info*)arg;
1116 struct msgreply_entry* k = (struct msgreply_entry*)e->key;
1117 if(dname_subdomain_c(k->key.qname, inf->name)) {
1118 struct reply_info* d = (struct reply_info*)e->data;
1119 d->ttl = inf->expired;
1120 inf->num_msgs++;
1121 }
1122 }
1123
10821124 /** callback to delete keys in zone */
10831125 static void
10841126 zone_del_kcache(struct lruhash_entry* e, void* arg)
10911133 d->ttl = inf->expired;
10921134 inf->num_keys++;
10931135 }
1094 }
1095
1096 /** traverse a lruhash */
1097 static void
1098 lruhash_traverse(struct lruhash* h, int wr,
1099 void (*func)(struct lruhash_entry*, void*), void* arg)
1100 {
1101 size_t i;
1102 struct lruhash_entry* e;
1103
1104 lock_quick_lock(&h->lock);
1105 for(i=0; i<h->size; i++) {
1106 lock_quick_lock(&h->array[i].lock);
1107 for(e = h->array[i].overflow_list; e; e = e->overflow_next) {
1108 if(wr) {
1109 lock_rw_wrlock(&e->lock);
1110 } else {
1111 lock_rw_rdlock(&e->lock);
1112 }
1113 (*func)(e, arg);
1114 lock_rw_unlock(&e->lock);
1115 }
1116 lock_quick_unlock(&h->array[i].lock);
1117 }
1118 lock_quick_unlock(&h->lock);
1119 }
1120
1121 /** traverse a slabhash */
1122 static void
1123 slabhash_traverse(struct slabhash* sh, int wr,
1124 void (*func)(struct lruhash_entry*, void*), void* arg)
1125 {
1126 size_t i;
1127 for(i=0; i<sh->size; i++)
1128 lruhash_traverse(sh->array[i], wr, func, arg);
11291136 }
11301137
11311138 /** remove all rrsets and keys from zone from cache */
11481155 inf.expired = *worker->env.now;
11491156 inf.expired -= 3; /* handle 3 seconds skew between threads */
11501157 inf.num_rrsets = 0;
1158 inf.num_msgs = 0;
11511159 inf.num_keys = 0;
11521160 slabhash_traverse(&worker->env.rrset_cache->table, 1,
11531161 &zone_del_rrset, &inf);
1162
1163 slabhash_traverse(worker->env.msg_cache, 1, &zone_del_msg, &inf);
11541164
11551165 /* and validator cache */
11561166 idx = modstack_find(&worker->daemon->mods, "validator");
11611171
11621172 free(nm);
11631173
1164 (void)ssl_printf(ssl, "ok removed %u rrsets and %u key entries\n",
1165 (unsigned)inf.num_rrsets, (unsigned)inf.num_keys);
1174 (void)ssl_printf(ssl, "ok removed %u rrsets, %u messages "
1175 "and %u key entries\n", (unsigned)inf.num_rrsets,
1176 (unsigned)inf.num_msgs, (unsigned)inf.num_keys);
11661177 }
11671178
11681179 /** remove name rrset from cache */
11991210 send_ok(ssl);
12001211 }
12011212
1213 /** print root forwards */
1214 static int
1215 print_root_fwds(SSL* ssl, struct iter_forwards* fwds, uint8_t* root)
1216 {
1217 char buf[257];
1218 struct delegpt* dp;
1219 struct delegpt_ns* ns;
1220 struct delegpt_addr* a;
1221 int f = 0;
1222 dp = forwards_lookup(fwds, root, LDNS_RR_CLASS_IN);
1223 if(!dp)
1224 return ssl_printf(ssl, "off (using root hints)\n");
1225 /* if dp is returned it must be the root */
1226 log_assert(query_dname_compare(dp->name, root)==0);
1227 for(ns = dp->nslist; ns; ns = ns->next) {
1228 dname_str(ns->name, buf);
1229 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf))
1230 return 0;
1231 f = 1;
1232 }
1233 for(a = dp->target_list; a; a = a->next_target) {
1234 addr_to_str(&a->addr, a->addrlen, buf, sizeof(buf));
1235 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf))
1236 return 0;
1237 f = 1;
1238 }
1239 return ssl_printf(ssl, "\n");
1240 }
1241
1242 /** parse args into delegpt */
1243 static struct delegpt*
1244 parse_delegpt(SSL* ssl, struct regional* region, char* args, uint8_t* root)
1245 {
1246 /* parse args and add in */
1247 char* p = args;
1248 char* todo;
1249 struct delegpt* dp = delegpt_create(region);
1250 struct sockaddr_storage addr;
1251 socklen_t addrlen;
1252 if(!dp || !delegpt_set_name(dp, region, root)) {
1253 (void)ssl_printf(ssl, "error out of memory\n");
1254 return NULL;
1255 }
1256 while(p) {
1257 todo = p;
1258 p = strchr(p, ' '); /* find next spot, if any */
1259 if(p) {
1260 *p++ = 0; /* end this spot */
1261 p = skipwhite(p); /* position at next spot */
1262 }
1263 /* parse address */
1264 if(!extstrtoaddr(todo, &addr, &addrlen)) {
1265 (void)ssl_printf(ssl, "error cannot parse"
1266 " IP address '%s'\n", todo);
1267 return NULL;
1268 }
1269 /* add address */
1270 if(!delegpt_add_addr(dp, region, &addr, addrlen, 0, 1)) {
1271 (void)ssl_printf(ssl, "error out of memory\n");
1272 return NULL;
1273 }
1274 }
1275 return dp;
1276 }
1277
1278 /** do the status command */
1279 static void
1280 do_forward(SSL* ssl, struct worker* worker, char* args)
1281 {
1282 struct iter_forwards* fwd = worker->env.fwds;
1283 uint8_t* root = (uint8_t*)"\000";
1284 if(!fwd) {
1285 (void)ssl_printf(ssl, "error: structure not allocated\n");
1286 return;
1287 }
1288 if(args == NULL || args[0] == 0) {
1289 (void)print_root_fwds(ssl, fwd, root);
1290 return;
1291 }
1292 /* set root forwards for this thread. since we are in remote control
1293 * the actual mesh is not running, so we can freely edit it. */
1294 /* delete all the existing queries first */
1295 mesh_delete_all(worker->env.mesh);
1296 /* reset the fwd structure ; the cfg is unchanged (shared by threads)*/
1297 /* this reset frees up memory */
1298 forwards_apply_cfg(fwd, worker->env.cfg);
1299 if(strcmp(args, "off") == 0) {
1300 forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, root);
1301 } else {
1302 struct delegpt* dp;
1303 if(!(dp = parse_delegpt(ssl, fwd->region, args, root)))
1304 return;
1305 if(!forwards_add_zone(fwd, LDNS_RR_CLASS_IN, dp)) {
1306 (void)ssl_printf(ssl, "error out of memory\n");
1307 return;
1308 }
1309 }
1310 send_ok(ssl);
1311 }
1312
12021313 /** do the status command */
12031314 static void
12041315 do_status(SSL* ssl, struct worker* worker)
12251336 if(!ssl_printf(ssl, "unbound (pid %d) is running...\n",
12261337 (int)getpid()))
12271338 return;
1339 }
1340
1341 /** get age for the mesh state */
1342 static void
1343 get_mesh_age(struct mesh_state* m, char* buf, size_t len,
1344 struct module_env* env)
1345 {
1346 if(m->reply_list) {
1347 struct timeval d;
1348 struct mesh_reply* r = m->reply_list;
1349 /* last reply is the oldest */
1350 while(r && r->next)
1351 r = r->next;
1352 timeval_subtract(&d, env->now_tv, &r->start_time);
1353 snprintf(buf, len, "%d.%6.6d", (int)d.tv_sec, (int)d.tv_usec);
1354 } else {
1355 snprintf(buf, len, "-");
1356 }
1357 }
1358
1359 /** get status of a mesh state */
1360 static void
1361 get_mesh_status(struct mesh_area* mesh, struct mesh_state* m,
1362 char* buf, size_t len)
1363 {
1364 enum module_ext_state s = m->s.ext_state[m->s.curmod];
1365 const char *modname = mesh->mods.mod[m->s.curmod]->name;
1366 size_t l;
1367 if(strcmp(modname, "iterator") == 0 && s == module_wait_reply &&
1368 m->s.minfo[m->s.curmod]) {
1369 /* break into iterator to find out who its waiting for */
1370 struct iter_qstate* qstate = (struct iter_qstate*)
1371 m->s.minfo[m->s.curmod];
1372 struct outbound_list* ol = &qstate->outlist;
1373 struct outbound_entry* e;
1374 snprintf(buf, len, "%s wait for", modname);
1375 l = strlen(buf);
1376 buf += l; len -= l;
1377 if(ol->first == NULL)
1378 snprintf(buf, len, " (empty_list)");
1379 for(e = ol->first; e; e = e->next) {
1380 snprintf(buf, len, " ");
1381 l = strlen(buf);
1382 buf += l; len -= l;
1383 addr_to_str(&e->qsent->addr, e->qsent->addrlen,
1384 buf, len);
1385 l = strlen(buf);
1386 buf += l; len -= l;
1387 }
1388 } else if(s == module_wait_subquery) {
1389 /* look in subs from mesh state to see what */
1390 char nm[257];
1391 struct mesh_state_ref* sub;
1392 snprintf(buf, len, "%s wants", modname);
1393 l = strlen(buf);
1394 buf += l; len -= l;
1395 if(m->sub_set.count == 0)
1396 snprintf(buf, len, " (empty_list)");
1397 RBTREE_FOR(sub, struct mesh_state_ref*, &m->sub_set) {
1398 char* t = ldns_rr_type2str(sub->s->s.qinfo.qtype);
1399 char* c = ldns_rr_class2str(sub->s->s.qinfo.qclass);
1400 dname_str(sub->s->s.qinfo.qname, nm);
1401 snprintf(buf, len, " %s %s %s", t, c, nm);
1402 l = strlen(buf);
1403 buf += l; len -= l;
1404 free(t);
1405 free(c);
1406 }
1407 } else {
1408 snprintf(buf, len, "%s is %s", modname, strextstate(s));
1409 }
1410 }
1411
1412 /** do the dump_requestlist command */
1413 static void
1414 do_dump_requestlist(SSL* ssl, struct worker* worker)
1415 {
1416 struct mesh_area* mesh;
1417 struct mesh_state* m;
1418 int num = 0;
1419 char buf[257];
1420 char timebuf[32];
1421 char statbuf[10240];
1422 if(!ssl_printf(ssl, "thread #%d\n", worker->thread_num))
1423 return;
1424 if(!ssl_printf(ssl, "# type cl name seconds module status\n"))
1425 return;
1426 /* show worker mesh contents */
1427 mesh = worker->env.mesh;
1428 if(!mesh) return;
1429 RBTREE_FOR(m, struct mesh_state*, &mesh->all) {
1430 char* t = ldns_rr_type2str(m->s.qinfo.qtype);
1431 char* c = ldns_rr_class2str(m->s.qinfo.qclass);
1432 dname_str(m->s.qinfo.qname, buf);
1433 get_mesh_age(m, timebuf, sizeof(timebuf), &worker->env);
1434 get_mesh_status(mesh, m, statbuf, sizeof(statbuf));
1435 if(!ssl_printf(ssl, "%3d %4s %2s %s %s %s\n",
1436 num, t, c, buf, timebuf, statbuf)) {
1437 free(t);
1438 free(c);
1439 return;
1440 }
1441 num++;
1442 free(t);
1443 free(c);
1444 }
12281445 }
12291446
12301447 /** tell other processes to execute the command */
12591476 } else if(strncmp(p, "reload", 6) == 0) {
12601477 do_reload(ssl, rc);
12611478 return;
1479 } else if(strncmp(p, "stats_noreset", 13) == 0) {
1480 do_stats(ssl, rc, 0);
1481 return;
12621482 } else if(strncmp(p, "stats", 5) == 0) {
1263 do_stats(ssl, rc);
1483 do_stats(ssl, rc, 1);
12641484 return;
12651485 } else if(strncmp(p, "status", 6) == 0) {
12661486 do_status(ssl, worker);
12701490 return;
12711491 } else if(strncmp(p, "load_cache", 10) == 0) {
12721492 if(load_cache(ssl, worker)) send_ok(ssl);
1493 return;
1494 } else if(strncmp(p, "forward", 7) == 0) {
1495 /* must always distribute this cmd */
1496 if(rc) distribute_cmd(rc, ssl, cmd);
1497 do_forward(ssl, worker, skipwhite(p+7));
1498 return;
1499 } else if(strncmp(p, "flush_stats", 11) == 0) {
1500 /* must always distribute this cmd */
1501 if(rc) distribute_cmd(rc, ssl, cmd);
1502 do_flush_stats(ssl, worker);
1503 return;
1504 } else if(strncmp(p, "flush_requestlist", 17) == 0) {
1505 /* must always distribute this cmd */
1506 if(rc) distribute_cmd(rc, ssl, cmd);
1507 do_flush_requestlist(ssl, worker);
12731508 return;
12741509 } else if(strncmp(p, "lookup", 6) == 0) {
12751510 do_lookup(ssl, worker, skipwhite(p+6));
13001535 do_flush_type(ssl, worker, skipwhite(p+10));
13011536 } else if(strncmp(p, "flush", 5) == 0) {
13021537 do_flush_name(ssl, worker, skipwhite(p+5));
1538 } else if(strncmp(p, "dump_requestlist", 16) == 0) {
1539 do_dump_requestlist(ssl, worker);
13031540 } else {
13041541 (void)ssl_printf(ssl, "error unknown command '%s'\n", p);
13051542 }
114114 }
115115
116116 void
117 server_stats_compile(struct worker* worker, struct stats_info* s)
117 server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
118118 {
119119 int i;
120120
142142 /* get and reset validator rrset bogus number */
143143 s->svr.rrset_bogus = get_rrset_bogus(worker);
144144
145 if(!worker->env.cfg->stat_cumulative) {
146 server_stats_init(&worker->stats, worker->env.cfg);
147 mesh_stats_clear(worker->env.mesh);
148 worker->back->unwanted_replies = 0;
145 if(reset && !worker->env.cfg->stat_cumulative) {
146 worker_stats_clear(worker);
149147 }
150148 }
151149
152150 void server_stats_obtain(struct worker* worker, struct worker* who,
153 struct stats_info* s)
151 struct stats_info* s, int reset)
154152 {
155153 uint8_t *reply = NULL;
156154 uint32_t len = 0;
157155 if(worker == who) {
158156 /* just fill it in */
159 server_stats_compile(worker, s);
157 server_stats_compile(worker, s, reset);
160158 return;
161159 }
162160 /* communicate over tube */
163161 verbose(VERB_ALGO, "write stats cmd");
164 worker_send_cmd(who, worker_cmd_stats);
162 if(reset)
163 worker_send_cmd(who, worker_cmd_stats);
164 else worker_send_cmd(who, worker_cmd_stats_noreset);
165165 verbose(VERB_ALGO, "wait for stats reply");
166166 if(!tube_read_msg(worker->cmd, &reply, &len, 0))
167167 fatal_exit("failed to read stats over cmd channel");
172172 free(reply);
173173 }
174174
175 void server_stats_reply(struct worker* worker)
175 void server_stats_reply(struct worker* worker, int reset)
176176 {
177177 struct stats_info s;
178 server_stats_compile(worker, &s);
178 server_stats_compile(worker, &s, reset);
179179 verbose(VERB_ALGO, "write stats replymsg");
180180 if(!tube_write_msg(worker->daemon->workers[0]->cmd,
181181 (uint8_t*)&s, sizeof(s), 0))
174174 * @param worker: the worker that is executing (the first worker).
175175 * @param who: on who to get the statistics info.
176176 * @param s: the stats block to fill in.
177 * @param reset: if stats can be reset.
177178 */
178179 void server_stats_obtain(struct worker* worker, struct worker* who,
179 struct stats_info* s);
180 struct stats_info* s, int reset);
180181
181182 /**
182183 * Compile stats into structure for this thread worker.
183184 * Also clears the statistics counters (if that is set by config file).
184185 * @param worker: the worker to compile stats for, also the executing worker.
185186 * @param s: stats block.
186 */
187 void server_stats_compile(struct worker* worker, struct stats_info* s);
187 * @param reset: if true, depending on config stats are reset.
188 * if false, statistics are not reset.
189 */
190 void server_stats_compile(struct worker* worker, struct stats_info* s,
191 int reset);
188192
189193 /**
190194 * Send stats over comm tube in reply to query cmd
191195 * @param worker: this worker.
192 */
193 void server_stats_reply(struct worker* worker);
196 * @param reset: if true, depending on config stats are reset.
197 * if false, statistics are not reset.
198 */
199 void server_stats_reply(struct worker* worker, int reset);
194200
195201 /**
196202 * Addup stat blocks.
5555 #ifdef HAVE_PWD_H
5656 #include <pwd.h>
5757 #endif
58 #ifdef HAVE_GRP_H
59 #include <grp.h>
60 #endif
5861
5962 #ifdef HAVE_SYS_RESOURCE_H
6063 #include <sys/resource.h>
64 #endif
65 #ifdef HAVE_LOGIN_CAP_H
66 #include <login_cap.h>
6167 #endif
6268
6369 #ifdef USE_MINI_EVENT
7076 # include <event.h>
7177 #endif
7278
79 #ifdef UB_ON_WINDOWS
80 # include "winrc/win_svc.h"
81 #endif
82
7383 /** global debug value to keep track of heap memory allocation */
7484 void* unbound_start_brk = 0;
7585
7686 /** print usage. */
7787 static void usage()
7888 {
89 const char** m;
7990 printf("usage: unbound [options]\n");
8091 printf(" start unbound daemon DNS resolver.\n");
8192 printf("-h this help\n");
8394 printf(" file format is described in unbound.conf(5).\n");
8495 printf("-d do not fork into the background.\n");
8596 printf("-v verbose (more times to increase verbosity)\n");
97 #ifdef UB_ON_WINDOWS
98 printf("-w opt windows option: \n");
99 printf(" install, remove - manage the services entry\n");
100 printf(" service - used to start from services control panel\n");
101 #endif
86102 printf("Version %s\n", PACKAGE_VERSION);
87 printf("libevent %s, libldns %s, %s\n",
88 event_get_version(), ldns_version(),
103 printf("linked libs: event %s, ldns %s, %s\n",
104 #ifdef USE_WINSOCK
105 "winsock",
106 #elif defined(USE_MINI_EVENT)
107 "internal",
108 #else
109 event_get_version(),
110 #endif
111 ldns_version(),
89112 SSLeay_version(SSLEAY_VERSION));
113 printf("linked modules:");
114 for(m = module_list_avail(); *m; m++)
115 printf(" %s", *m);
116 printf("\n");
90117 printf("BSD licensed, see LICENSE in source package for details.\n");
91118 printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
92119 }
174201 int cmdline_verbose)
175202 {
176203 /* apply if they have changed */
177 daemon->cfg = cfg;
178204 verbosity = cmdline_verbose + cfg->verbosity;
179 config_apply(cfg);
180 if(!daemon->env->msg_cache ||
181 cfg->msg_cache_size != slabhash_get_size(daemon->env->msg_cache) ||
182 cfg->msg_cache_slabs != daemon->env->msg_cache->size) {
183 slabhash_delete(daemon->env->msg_cache);
184 daemon->env->msg_cache = slabhash_create(cfg->msg_cache_slabs,
185 HASH_DEFAULT_STARTARRAY, cfg->msg_cache_size,
186 msgreply_sizefunc, query_info_compare,
187 query_entry_delete, reply_info_delete, NULL);
188 if(!daemon->env->msg_cache) {
189 fatal_exit("malloc failure updating config settings");
190 }
191 }
192 if((daemon->env->rrset_cache = rrset_cache_adjust(
193 daemon->env->rrset_cache, cfg, &daemon->superalloc)) == 0)
194 fatal_exit("malloc failure updating config settings");
195 if((daemon->env->infra_cache = infra_adjust(daemon->env->infra_cache,
196 cfg))==0)
197 fatal_exit("malloc failure updating config settings");
205 daemon_apply_cfg(daemon, cfg);
198206 checkrlimits(cfg);
199207 }
200208
290298 static void
291299 detach(void)
292300 {
301 #if defined(HAVE_DAEMON) && !defined(DEPRECATED_DAEMON)
302 /* use POSIX daemon(3) function */
303 if(daemon(1, 0) != 0)
304 fatal_exit("daemon failed: %s", strerror(errno));
305 #else /* no HAVE_DAEMON */
293306 #ifdef HAVE_WORKING_FORK
294307 int fd;
295308 /* Take off... */
315328 (void)close(fd);
316329 }
317330 #endif /* HAVE_WORKING_FORK */
331 #endif /* HAVE_DAEMON */
318332 }
319333
320334 /** daemonize, drop user priviliges and chroot if needed */
323337 const char** cfgfile)
324338 {
325339 #ifdef HAVE_GETPWNAM
340 struct passwd *pwd = NULL;
326341 uid_t uid;
327342 gid_t gid;
328343 /* initialize, but not to 0 (root) */
331346 log_assert(cfg);
332347
333348 if(cfg->username && cfg->username[0]) {
334 struct passwd *pwd;
335349 if((pwd = getpwnam(cfg->username)) == NULL)
336350 fatal_exit("user '%s' does not exist.", cfg->username);
337351 uid = pwd->pw_uid;
338352 gid = pwd->pw_gid;
339 endpwent();
353 /* endpwent below, in case we need pwd for setusercontext */
340354 }
341355 #endif
342356
386400 /* delete of pidfile could potentially work,
387401 * chown to get permissions */
388402 if(cfg->username && cfg->username[0]) {
389 if(chown(daemon->pidfile, uid, gid) == -1) {
403 if(chown(daemon->pidfile, uid, gid) == -1) {
390404 fatal_exit("cannot chown %u.%u %s: %s",
391405 (unsigned)uid, (unsigned)gid,
392406 daemon->pidfile, strerror(errno));
393 }
407 }
394408 }
395409 }
396410 }
450464 /* drop permissions after chroot, getpwnam, pidfile, syslog done*/
451465 #ifdef HAVE_GETPWNAM
452466 if(cfg->username && cfg->username[0]) {
467 #ifdef HAVE_SETUSERCONTEXT
468 /* setusercontext does initgroups, setuid, setgid, and
469 * also resource limits from login config, but we
470 * still call setresuid, setresgid to be sure to set all uid*/
471 if(setusercontext(NULL, pwd, uid, LOGIN_SETALL) != 0)
472 log_warn("unable to setusercontext %s: %s",
473 cfg->username, strerror(errno));
474 #else /* !HAVE_SETUSERCONTEXT */
475 # ifdef HAVE_INITGROUPS
476 if(initgroups(cfg->username, gid) != 0)
477 log_warn("unable to initgroups %s: %s",
478 cfg->username, strerror(errno));
479 # endif /* HAVE_INITGROUPS */
480 #endif /* HAVE_SETUSERCONTEXT */
481 endpwent();
482
453483 #ifdef HAVE_SETRESGID
454484 if(setresgid(gid,gid,gid) != 0)
455485 #elif defined(HAVE_SETREGID) && !defined(DARWIN_BROKEN_SETREUID)
471501 verbose(VERB_QUERY, "drop user privileges, run as %s",
472502 cfg->username);
473503 }
474 #endif
504 #endif /* HAVE_GETPWNAM */
475505 /* file logging inited after chroot,chdir,setuid is done so that
476506 * it would succeed on SIGHUP as well */
477507 if(!cfg->use_syslog)
560590 {
561591 int c;
562592 const char* cfgfile = CONFIGFILE;
593 const char* winopt = NULL;
563594 int cmdline_verbose = 0;
564595 int debug_mode = 0;
596 int cmdline_cfg = 0;
565597
566598 #ifdef HAVE_SBRK
567599 /* take debug snapshot of heap */
570602
571603 log_init(NULL, 0, NULL);
572604 /* parse the options */
573 while( (c=getopt(argc, argv, "c:dhv")) != -1) {
605 while( (c=getopt(argc, argv, "c:dhvw:")) != -1) {
574606 switch(c) {
575607 case 'c':
576608 cfgfile = optarg;
609 cmdline_cfg = 1;
577610 break;
578611 case 'v':
579612 cmdline_verbose ++;
582615 case 'd':
583616 debug_mode = 1;
584617 break;
618 case 'w':
619 winopt = optarg;
620 break;
585621 case '?':
586622 case 'h':
587623 default:
592628 argc -= optind;
593629 argv += optind;
594630
631 if(winopt) {
632 #ifdef UB_ON_WINDOWS
633 wsvc_command_option(winopt, cfgfile, cmdline_verbose,
634 cmdline_cfg);
635 #else
636 fatal_exit("option not supported");
637 #endif
638 }
639
595640 if(argc != 0) {
596641 usage();
597642 return 1;
6464 #include "util/data/dname.h"
6565 #include "util/fptr_wlist.h"
6666 #include "util/tube.h"
67 #include "iterator/iter_fwd.h"
6768
6869 #ifdef HAVE_SYS_TYPES_H
6970 # include <sys/types.h>
7273 #include <netdb.h>
7374 #endif
7475 #include <signal.h>
76 #ifdef UB_ON_WINDOWS
77 #include "winrc/win_svc.h"
78 #endif
7579
7680 /** Size of an UDP datagram */
7781 #define NORMAL_UDP_SIZE 512 /* bytes */
157161 + sizeof(worker->rndstate)
158162 + regional_get_mem(worker->scratchpad)
159163 + sizeof(*worker->env.scratch_buffer)
160 + ldns_buffer_capacity(worker->env.scratch_buffer);
164 + ldns_buffer_capacity(worker->env.scratch_buffer)
165 + forwards_get_mem(worker->env.fwds);
161166 if(cur_serv) {
162167 me += serviced_get_mem(cur_serv);
163168 }
341346 break;
342347 case worker_cmd_stats:
343348 verbose(VERB_ALGO, "got control cmd stats");
344 server_stats_reply(worker);
349 server_stats_reply(worker, 1);
345350 break;
346 #ifdef THREADS_DISABLED
351 case worker_cmd_stats_noreset:
352 verbose(VERB_ALGO, "got control cmd stats_noreset");
353 server_stats_reply(worker, 0);
354 break;
347355 case worker_cmd_remote:
348356 verbose(VERB_ALGO, "got control cmd remote");
349357 daemon_remote_exec(worker);
350358 break;
351 #endif
352359 default:
353360 log_err("bad command %d", (int)cmd);
354361 break;
746753 }
747754 if((ret=worker_check_request(c->buffer, worker)) != 0) {
748755 verbose(VERB_ALGO, "worker check request: bad query.");
756 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
749757 if(ret != -1) {
750758 LDNS_QR_SET(ldns_buffer_begin(c->buffer));
751759 LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret);
758766 /* see if query is in the cache */
759767 if(!query_info_parse(&qinfo, c->buffer)) {
760768 verbose(VERB_ALGO, "worker parse request: formerror.");
769 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
761770 ldns_buffer_rewind(c->buffer);
762771 LDNS_QR_SET(ldns_buffer_begin(c->buffer));
763772 LDNS_RCODE_SET(ldns_buffer_begin(c->buffer),
768777 if(qinfo.qtype == LDNS_RR_TYPE_AXFR ||
769778 qinfo.qtype == LDNS_RR_TYPE_IXFR) {
770779 verbose(VERB_ALGO, "worker request: refused zone transfer.");
780 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
771781 LDNS_QR_SET(ldns_buffer_begin(c->buffer));
772782 LDNS_RCODE_SET(ldns_buffer_begin(c->buffer),
773783 LDNS_RCODE_REFUSED);
779789 }
780790 if((ret=parse_edns_from_pkt(c->buffer, &edns)) != 0) {
781791 verbose(VERB_ALGO, "worker parse edns: formerror.");
792 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
782793 ldns_buffer_rewind(c->buffer);
783794 LDNS_QR_SET(ldns_buffer_begin(c->buffer));
784795 LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret);
791802 edns.udp_size = EDNS_ADVERTISED_SIZE;
792803 edns.bits &= EDNS_DO;
793804 verbose(VERB_ALGO, "query with bad edns version.");
805 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
794806 error_encode(c->buffer, EDNS_RCODE_BADVERS&0xf, &qinfo,
795807 *(uint16_t*)ldns_buffer_begin(c->buffer),
796808 ldns_buffer_read_u16_at(c->buffer, 2), NULL);
801813 worker->daemon->cfg->harden_short_bufsize) {
802814 verbose(VERB_QUERY, "worker request: EDNS bufsize %d ignored",
803815 (int)edns.udp_size);
816 log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
804817 edns.udp_size = NORMAL_UDP_SIZE;
805818 }
806819 if(edns.edns_present && edns.udp_size < LDNS_HEADER_SIZE) {
807820 verbose(VERB_ALGO, "worker request: edns is too small.");
821 log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen);
808822 LDNS_QR_SET(ldns_buffer_begin(c->buffer));
809823 LDNS_TC_SET(ldns_buffer_begin(c->buffer));
810824 LDNS_RCODE_SET(ldns_buffer_begin(c->buffer),
874888 }
875889 ldns_buffer_rewind(c->buffer);
876890 server_stats_querymiss(&worker->stats, worker);
891
892 if(verbosity >= VERB_CLIENT) {
893 if(c->type == comm_udp)
894 log_addr(VERB_CLIENT, "udp request from",
895 &repinfo->addr, repinfo->addrlen);
896 else log_addr(VERB_CLIENT, "tcp request from",
897 &repinfo->addr, repinfo->addrlen);
898 }
877899
878900 /* grab a work request structure for this new request */
879901 if(worker->env.mesh->num_reply_addrs>worker->request_size*16) {
948970 mesh_stats(worker->env.mesh, "mesh has");
949971 worker_mem_report(worker, NULL);
950972 if(!worker->daemon->cfg->stat_cumulative) {
951 server_stats_init(&worker->stats, worker->env.cfg);
952 mesh_stats_clear(worker->env.mesh);
953 worker->back->unwanted_replies = 0;
973 worker_stats_clear(worker);
954974 }
955975 /* start next timer */
956976 worker_restart_timer(worker);
10261046 worker_delete(worker);
10271047 return 0;
10281048 }
1049 #ifdef UB_ON_WINDOWS
1050 wsvc_setup_worker(worker);
1051 #endif /* UB_ON_WINDOWS */
10291052 } else { /* !do_sigs */
10301053 worker->comsig = NULL;
10311054 worker->rc = NULL;
11031126 worker->env.kill_sub = &mesh_state_delete;
11041127 worker->env.detect_cycle = &mesh_detect_cycle;
11051128 worker->env.scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size);
1129 if(!(worker->env.fwds = forwards_create()) ||
1130 !forwards_apply_cfg(worker->env.fwds, cfg)) {
1131 log_err("Could not set forward zones");
1132 worker_delete(worker);
1133 return 0;
1134 }
11061135 if(!worker->env.mesh || !worker->env.scratch_buffer) {
11071136 worker_delete(worker);
11081137 return 0;
11331162 mesh_stats(worker->env.mesh, "mesh has");
11341163 worker_mem_report(worker, NULL);
11351164 }
1165 outside_network_quit_prepare(worker->back);
11361166 mesh_delete(worker->env.mesh);
11371167 ldns_buffer_free(worker->env.scratch_buffer);
1168 forwards_delete(worker->env.fwds);
11381169 listen_delete(worker->front);
11391170 outside_network_delete(worker->back);
11401171 comm_signal_delete(worker->comsig);
11421173 comm_timer_delete(worker->stat_timer);
11431174 daemon_remote_delete(worker->rc);
11441175 free(worker->ports);
1145 if(worker->thread_num == 0)
1176 if(worker->thread_num == 0) {
11461177 log_set_time(NULL);
1178 #ifdef UB_ON_WINDOWS
1179 wsvc_desetup_worker(worker);
1180 #endif /* UB_ON_WINDOWS */
1181 }
11471182 comm_base_delete(worker->base);
11481183 ub_randfree(worker->rndstate);
11491184 alloc_clear(&worker->alloc);
12051240 slabhash_clear(worker->env.msg_cache);
12061241 }
12071242
1243 void worker_stats_clear(struct worker* worker)
1244 {
1245 server_stats_init(&worker->stats, worker->env.cfg);
1246 mesh_stats_clear(worker->env.mesh);
1247 worker->back->unwanted_replies = 0;
1248 }
1249
12081250 /* --- fake callbacks for fptr_wlist to work --- */
12091251 int libworker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
12101252 struct sockaddr_storage* ATTR_UNUSED(addr),
4242 #ifndef DAEMON_WORKER_H
4343 #define DAEMON_WORKER_H
4444
45 #include "config.h"
4645 #include "util/netevent.h"
4746 #include "util/locks.h"
4847 #include "util/alloc.h"
6665 worker_cmd_quit,
6766 /** obtain statistics */
6867 worker_cmd_stats,
68 /** obtain statistics without statsclear */
69 worker_cmd_stats_noreset,
6970 /** execute remote control command */
7071 worker_cmd_remote
7172 };
227228 /** cleanup the cache to remove all rrset IDs from it, arg is worker */
228229 void worker_alloc_cleanup(void* arg);
229230
231 /**
232 * Init worker stats - includes server_stats_init, outside network and mesh.
233 * @param worker: the worker to init
234 */
235 void worker_stats_clear(struct worker* worker);
236
230237 /** statistics timer callback handler */
231238 void worker_stat_timer_cb(void* arg);
232239
1010 reviewed the unbound C sources.
1111
1212 Jakob Schlyter - for advice on secure settings, random numbers and blacklists.
13
1413 Ondřej Surý - running coverity analysis tool on 0.9 dev version.
1514 Alexander Gall - multihomed, anycast testing of unbound resolver server.
15 Zdenek Vasicek and Marek Vavrusa - python module.
16 Brett Carr - windows beta testing.
0 8 June 2009: Wouter
1 - Removed RFC5011 REVOKE flag support. Partial 5011 support may cause
2 inadvertant behaviour.
3
4 3 June 2009: Wouter
5 - fixup bad free() when wrongly encoded DSA signature is seen.
6 Reported by Paul Wouters.
7 - review comments from Matthijs.
8
9 2 June 2009: Wouter
10 - --enable-sha2 option. The draft rsasha256 changed its algorithm
11 numbers too often. Therefore it is more prudent to disable the
12 RSASHA256 and RSASHA512 support by default.
13 - ldns trunk included as new tarball.
14 - recreated the 1.3.0 tag in svn. rc1 tarball generated at this point.
15
16 29 May 2009: Wouter
17 - fixup doc bug in README reported by Matthew Dempsky.
18
19 28 May 2009: Wouter
20 - update iana port list
21 - update ldns lib tarball
22
23 27 May 2009: Wouter
24 - detect lack of IPv6 support on XP (with a different error code).
25 - Fixup a crash-on-exit which was triggered by a very long queue.
26 Unbound would try to re-use ports that came free, but this is
27 of course not really possible because everything is deleted.
28 Most easily triggered on XP (not Vista), maybe because of the
29 network stack encouraging large messages backlogs.
30 - change in debug statements.
31 - Fixed bug that could cause a crash if root prime failed when there
32 were message backlogs.
33
34 26 May 2009: Wouter
35 - Thanks again to Brett Carr, found an assertion that was not true.
36 Assertion checked if recursion parent query still existed.
37
38 29 April 2009: Wouter
39 - Thanks to Brett Carr, caught windows resource leak, use
40 closesocket() and not close() on sockets or else the network stack
41 starts to leak handles.
42 - Removed usage of windows Mutex because windows cannot handle enough
43 mutexes open. Provide own mutex implementation using primitives.
44
45 28 April 2009: Wouter
46 - created svn tag for 1.3.0.
47
48 27 April 2009: Wouter
49 - optimised cname from cache.
50 - ifdef windows functions in testbound.
51
52 23 April 2009: Wouter
53 - fix for threadsafety in solaris thr_key_create() in tests.
54 - iana portlist updated.
55 - fix pylib test for Darwin.
56 - fix pymod test for Darwin and a python threading bug in pymod init.
57 - check python >= 2.4 in configure.
58 - -ldl check for libcrypto 1.0.0beta.
59
60 21 April 2009: Wouter
61 - fix for build outside sourcedir.
62 - fix for configure script swig detection.
63
64 17 April 2009: Wouter
65 - Fix reentrant in minievent handler for unix. Could have resulted
66 in spurious event callbacks.
67 - timers do not take up a fd slot for winsock handler.
68 - faster fix for winsock reentrant check.
69 - fix rsasha512 unit test for new (interim) algorithm number.
70 - fix test:ldns doesn't like DOS line endings in keyfiles on unix.
71 - fix compile warning on ubuntu (configlexer fwrite return value).
72 - move python include directives into CPPFLAGS instead of CFLAGS.
73
74 16 April 2009: Wouter
75 - winsock event handler exit very quickly on signal, even if
76 under heavy load.
77 - iana portlist updated.
78 - fixup windows winsock handler reentrant problem.
79
80 14 April 2009: Wouter
81 - bug #245: fix munin plugin, perform cleanup of stale lockfiles.
82 - makedist.sh; better help text.
83 - cache-min-ttl option and tests.
84 - mingw detect error condition on TCP sockets (NOTCONN).
85
86 9 April 2009: Wouter
87 - Fix for removal of RSASHA256_NSEC3 protonumber from ldns.
88 - ldns tarball updated.
89 - iana portlist update.
90 - detect GOST support in openssl-1.0.0-beta1, and fix compile problem
91 because that openssl defines the name STRING for itself.
92
93 6 April 2009: Wouter
94 - windows compile fix.
95 - Detect FreeBSD jail without ipv6 addresses assigned.
96 - python libunbound wrapper unit test.
97 - installs the following files. Default is to not build them.
98 from configure --with-pythonmodule:
99 /usr/lib/python2.x/site-packages/unboundmodule.py
100 from configure --with-pyunbound:
101 /usr/lib/python2.x/site-packages/unbound.py
102 /usr/lib/python2.x/site-packages/_unbound.so*
103 The example python scripts (pythonmod/examples and
104 libunbound/python/examples) are not installed.
105 - python invalidate routine respects packed rrset ids and locks.
106 - clock skew checks in unbound, config statements.
107 - nxdomain ttl considerations in requirements.txt
108
109 3 April 2009: Wouter
110 - Fixed a bug that caused messages to be stored in the cache too
111 long. Hard to trigger, but NXDOMAINs for nameservers or CNAME
112 targets have been more vulnerable to the TTL miscalculation bug.
113 - documentation test fixed for python addition.
114
115 2 April 2009: Wouter
116 - pyunbound (libunbound python plugin) compiles using libtool.
117 - documentation for pythonmod and pyunbound is generated in doc/html.
118 - iana portlist updated.
119 - fixed bug in unbound-control flush_zone where it would not flush
120 every message in the target domain. This especially impacted
121 NXDOMAIN messages which could remain in the cache regardless.
122 - python module test package.
123
124 1 April 2009: Wouter
125 - suppress errors when trying to contact authority servers that gave
126 ipv6 AAAA records for their nameservers with ipv4 mapped contents.
127 Still tries to do so, could work when deployed in intranet.
128 Higher verbosity shows the error.
129 - new libunbound calls documented.
130 - pyunbound in libunbound/python. Removed compile warnings.
131 Makefile to make it.
132
133 30 March 2009: Wouter
134 - Fixup LDFLAGS from libevent sourcedir compile configure restore.
135 - Fixup so no non-absolute rpaths are added.
136 - Fixup validation of RRSIG queries, they are let through.
137 - read /dev/random before chroot
138 - checkconf fix no python checks when no python module enabled.
139 - fix configure, pthread first, so other libs do not change outcome.
140
141 27 March 2009: Wouter
142 - nicer -h output. report linked libraries and modules.
143 - prints modules in intuitive order (config file friendly).
144 - python compiles easily on BSD.
145
146 26 March 2009: Wouter
147 - ignore swig varargs warnings with gcc.
148 - remove duplicate example.conf text from python example configs.
149 - outofdir compile fix for python.
150 - pyunbound works.
151 - print modules compiled in on -h. manpage.
152
153 25 March 2009: Wouter
154 - initial import of the python contribution from Zdenek Vasicek and
155 Marek Vavrusa.
156 - pythonmod in Makefile; changes to remove warnings/errors for 1.3.0.
157
158 24 March 2009: Wouter
159 - more neat configure.ac. Removed duplicate config.h includes.
160 - neater config.h.in.
161 - iana portlist updated.
162 - fix util/configlexer.c and solaris -std=c99 flag.
163 - fix postcommit aclocal errors.
164 - spaces stripped. Makefile cleaner, /usr omitted from -I, -L, -R.
165 - swap order of host detect and libtool generation.
166
167 23 March 2009: Wouter
168 - added launchd plist example file for MacOSX to contrib.
169 - deprecation test for daemon(3).
170 - moved common configure actions to m4 include, prettier Makefile.
171
172 20 March 2009: Wouter
173 - bug #239: module-config entries order is important. Documented.
174 - build fix for test asynclook.
175
176 19 March 2009: Wouter
177 - winrc/README.txt dos-format text file.
178 - iana portlist updated.
179 - use _beginthreadex() when available (performs stack alignment).
180 - defaults for windows baked into configure.ac (used if on mingw).
181
182 18 March 2009: Wouter
183 - Added tests, unknown algorithms become insecure. fallback works.
184 - Fix for and test for unknown algorithms in a trust anchor
185 definition. Trust anchors with no supported algos are ignored.
186 This means a (higher)DS or DLV entry for them could succeed, and
187 otherwise they are treated as insecure.
188 - domain-insecure: "example.com" statement added. Sets domain
189 insecure regardless of chain of trust DSs or DLVs. The inverse
190 of a trust-anchor.
191
192 17 March 2009: Wouter
193 - unit test for unsupported algorithm in anchor warning.
194 - fixed so queries do not fail on opportunistic target queries.
195
196 16 March 2009: Wouter
197 - fixup diff error printout in contrib/update-itar.sh.
198 - added contrib/unbound_cacti for statistics support in cacti,
199 contributed by Dmitriy Demidov.
200
201 13 March 2009: Wouter
202 - doxygen and lex/yacc on linux.
203 - strip update-anchor on makedist -w.
204 - fix testbound on windows.
205 - default log to syslog for windows.
206 - uninstaller can stop unbound - changed text on it to reflect that.
207 - remove debugging from windows 'cron' actions.
208
209 12 March 2009: Wouter
210 - log to App.logs on windows prints executable identity.
211 - fixup tests.
212 - munin plugin fix benign locking error printout.
213 - anchor-update for windows, called every 24 hours; unbound reloads.
214
215 11 March 2009: Wouter
216 - winsock event handler resets WSAevents after signalled.
217 - winsock event handler tests if signals are really signalled.
218 - install and service with log to file works on XP and Vista on
219 default install location.
220 - on windows logging to the Application logbook works (as a service).
221 - fix RUN_DIR on windows compile setting in makedist.
222 - windows registry has Software\Unbound\ConfigFile element.
223 If does not exist, the default is used. The -c switch overrides it.
224 - fix makedist version cleanup function.
225
226 10 March 2009: Wouter
227 - makedist -w strips out old rc.. and snapshot info from version.
228 - setup.exe starts and stops unbound after install, before uninstall.
229 - unbound-checkconf recognizes absolute pathnames on windows (C:...).
230
231 9 March 2009: Wouter
232 - Nullsoft NSIS installer creation script.
233
234 5 March 2009: Wouter
235 - fixup memory leak introduced on 18feb in mesh reentrant fix.
236
237 3 March 2009: Wouter
238 - combined icon with 16x16(4) 32x32(4) 48x48(8) 64x64(8).
239 - service works on xp/vista, no config necessary (using defaults).
240 - windows registry settings.
241
242 2 March 2009: Wouter
243 - fixup --export-symbols to be -export-symbls for libtool.
244 This should fix extraneous symbols exported from libunbound.
245 Thanks to Ondrej Sury and Robert Edmonds for finding it.
246 - iana portlist updated.
247 - document FAQ entry on stub/forward zones and default blocking.
248 - fix asynclook test app for libunbound not exporting symbols.
249 - service install and remove utils that work with vista UAC.
250
251 27 February 2009: Wouter
252 - Fixup lexer, to not give warnings about fwrite. Appeared in
253 new lexer features.
254 - makedistro functionality for mingw. Has RC support.
255 - support spaces and backslashes in configured defaults paths.
256 - register, deregister in service control manager.
257
258 25 February 2009: Wouter
259 - windres usage for application resources.
260
261 24 February 2009: Wouter
262 - isc moved their dlv key download location.
263 - fixup warning on vista/mingw.
264 - makedist -w for window zip distribution first version.
265
266 20 February 2009: Wouter
267 - Fixup contrib/update-itar.sh, the exit codes 1 and 0 were swapped.
268 Nicer script layout. Added url to site in -h output.
269
270 19 February 2009: Wouter
271 - unbound-checkconf and unbound print warnings when trust anchors
272 have unsupported algorithms.
273 - added contrib/update-itar.sh This script is similar to
274 update-anchor.sh, and updates from the IANA ITAR repository.
275 You can provide your own PGP key and trust repo, or can use the
276 builtin. The program uses wget and gpg to work.
277 - iana portlist updated.
278 - update-itar.sh: using ftp:// urls because https godaddy certificate
279 is not available everywhere and then gives fatal errors. The
280 security is provided by pgp signature.
281
282 18 February 2009: Wouter
283 - more cycle detection. Also for target queries.
284 - fixup bug where during deletion of the mesh queries the callbacks
285 that were reentrant caused assertion failures. Keep the mesh in
286 a reentrant safe state. Affects libunbound, reload of server,
287 on quit and flush_requestlist.
288 - iana portlist updated.
289
290 13 February 2009: Wouter
291 - forwarder information now per-thread duplicated.
292 This keeps it read only for speed, with no locking necessary.
293 - forward command for unbound control to change forwarders to use
294 on the fly.
295 - document that unbound-host reads no config file by default.
296 - updated iana portlist.
297
298 12 February 2009: Wouter
299 - call setusercontext if available (on BSD).
300 - small refactor of stats clearing.
301 - #227: flush_stats feature for unbound-control.
302 - stats_noreset feature for unbound-control.
303 - flush_requestlist feature for unbound-control.
304 - libunbound version upped API (was changed 5 feb).
305 - unbound-control status shows if root forwarding is in use.
306 - slightly nicer memory management in iter-fwd code.
307
308 10 February 2009: Wouter
309 - keys with rfc5011 REVOKE flag are skipped and not considered when
310 validating data.
311 - iana portlist updated
312 - #226: dump_requestlist feature for unbound-control.
313
314 6 February 2009: Wouter
315 - contrib contains specfile for fedora 1.2.1 (from Paul Wouters).
316 - iana portlist updated.
317 - fixup EOL in include directive (reported by Paul Wouters).
318 You can no longer specify newlines in the names of included files.
319 - config parser changed. Gives some syntax errors closer to where they
320 occurred. Does not enforce a space after keyword anymore.
321 Does not allow literal newlines inside quoted strings anymore.
322 - verbosity level 5 logs customer IP for new requestlist entries.
323 - test fix, lexer and cancel test.
324 - new option log-time-ascii: yes if you enable it prints timestamps
325 in the log file as Feb 06 13:45:26 (like syslog does).
326 - detect event_base_new in libevent-1.4.1 and later and use it.
327 - #231 unbound-checkconf -o option prints that value from config file.
328 Useful for scripting in management scripts and the like.
329
0330 5 February 2009: Wouter
1331 - ldns 1.5.0 rc as tarball included.
332 - 1.3.0 development continues:
333 change in libunbound API: ub_cancel can return an error, that
334 the async_id did not exist, or that it was already delivered.
335 The result could have been delivered just before the cancel
336 routine managed to acquire the lock, so a caller may get the
337 result at the same time they call cancel. For this case,
338 ub_cancel tries to return an error code.
339 Fixes race condition in ub_cancel() libunbound function.
340 - MacOSX Leopard cleaner text output from configure.
341 - initgroups(3) is called to drop secondary group permissions, if
342 applicable.
343 - configure option --with-ldns-builtin forces the use of the
344 inluded ldns package with the unbound source. The -I include
345 is put before the others, so it avoids bad include files from
346 an older ldns install.
347 - daemon(3) posix call is used when available.
348 - testbound test for older fix added.
2349
3350 4 February 2009: Wouter
4351 - tag for release 1.2.1.
352 - trunk setup for 1.3.0 development.
5353
6354 3 February 2009: Wouter
7355 - noted feature requests in doc/TODO.
0 README for Unbound 1.2.1
0 README for Unbound 1.3.0
11 Copyright 2007 NLnet Labs
22 http://unbound.net
33
5757 * --with-username=user
5858 Set default user name to change to,
5959 the default is the "unbound" user.
60 * --with-pyunbound
61 Create libunbound wrapper usable from python.
62 Needs python-devel and swig development tools.
63 * --with-pythonmodule
64 Compile the python module that processes responses in the server.
65 * --enable-sha2
66 Enable draft support for RSASHA256 and RSASHA512.
6067
6168 * 'make test' attempts to run a series of tests, depending on the support
6269 programs that are installed.
6370
6471 Known issues
6572 ------------
73 o If there are no replies for a forward or stub zone, for a reverse zone,
74 you may need to add a local-zone: name transparent or nodefault to the
75 server: section of the config file to unblock the reverse zone.
76 Only happens for (sub)zones that are blocked by default; e.g. 10.in-addr.arpa
6677 o If libevent is older (before 1.3c), unbound will exit instead of reload
6778 on sighup. On a restart 'did not exit gracefully last time' warning is
6879 printed. Perform ./configure --with-libevent=no or update libevent, rerun
6980 configure and recompile unbound to make sighup work correctly.
70 It is strongly suggested to use the latest version of libevent (1.4 or more)
71 on Solaris, because of fixes in the solaris event port code in libevent.
72 o If you receive no answers deploying unbound on a private network.
73 Check that the zone you configure as a stub zone is correct, listing working
74 ip-addresses. Check that the NS data in the zone, those hostnames, are
75 in fact those same, working, ip-addresses. Unbound will fetch the NS data
76 from the zone and use that information in preference to the config
77 information.
81 It is strongly suggested to use a recent version of libevent.
7882 o If you are not receiving the correct source IP address on replies (e.g.
7983 you are running a multihomed, anycast server), the interface-automatic
8084 option can be enabled to set socket options to achieve the correct
3737 o option to use builtin ldns explicitly. Or stop shipping builtin tarball.
3838 o cleaner code; return and func statements on newline.
3939 o memcached module that sits before validator module; checks for memcached
40 data (on local lan), stores recursion lookup. Provides one cache for
41 multiple resolver machines, coherent reply content in anycast setup.
40 data (on local lan), stores recursion lookup. Provides one cache for multiple resolver machines, coherent reply content in anycast setup.
4241 o no openssl_add_all_algorithms, but only the ones necessary, less space.
4342
4443 *** Features features, for later
5049 of responses over a time interval is collected, and each is validated.
5150 or try in TCP mode. Do not 'try all servers several times', since we must
5251 not create packet storms with operator errors.
53 * Windows port features
5452 o on windows version, implement that OS ancillary data capabilities for
5553 interface-automatic. IPPKTINFO, IP6PKTINFO for WSARecvMsg, WSASendMsg.
5654 o local-zone directive with authority service, full authority server
5755 is a non-goal.
58
59 o configure option to force use of builtin ldns tarball.
60 o make so revoke bit keys cannot verify signatures
61 o option to print UTC timestamps instead of epoch in seconds.
62 o print querier IP address on high loglevels.
56 o infra and lame cache: easier size config (in Mb), show usage in graphs.
6357
64 o infra and lame cache: easier size config (in Mb), show usage in graphs.
65 o #226: unbound_control dump_requestlist
66 o #227: unbound_control flush_stats
67 o unbound_control get_stats_noreset
68 o unbound_control forward [addr {addr}] | [off]
69 o #231: unbound_checkconf options to output config file data.
70 o config entry to denote that a zone is to be treated as unsigned (even if
71 a DS exists to higher trust anchor).
72 o see if we can use daemon(3), cleaner posix usage.
73 o see if we can include the python bindings (contrib).
74 o see if we can suport var:value (nospace) by parser.
75 o remote control read ssl information while priviledged.
76 o call initgroups(3) to drop secondary group permissions.
9999 # the number of slabs must be a power of 2.
100100 # more slabs reduce lock contention, but fragment memory usage.
101101 # rrset-cache-slabs: 4
102
102
103 # the time to live (TTL) value lower bound, in seconds. Default 0.
104 # If more than an hour could easily give trouble due to stale data.
105 # cache-min-ttl: 0
106
103107 # the time to live (TTL) value cap for RRsets and messages in the
104108 # cache. Items are not cached for longer. In seconds.
105109 # cache-max-ttl: 86400
190194 # Log to syslog(3) if yes. The log facility LOG_DAEMON is used to
191195 # log to, with identity "unbound". If yes, it overrides the logfile.
192196 # use-syslog: yes
197
198 # print UTC timestamp in ascii to logfile, default is epoch in seconds.
199 # log-time-ascii: no
193200
194201 # the pid file. Can be an absolute path outside of chroot/work dir.
195202 # pidfile: "@UNBOUND_PIDFILE@"
283290
284291 # File with DLV trusted keys. Same format as trust-anchor-file.
285292 # There can be only one DLV configured, it is trusted from root down.
286 # Download https://secure.isc.org/ops/dlv/dlv.isc.org.key
293 # Download http://ftp.isc.org/www/dlv/dlv.isc.org.key
287294 # dlv-anchor-file: "dlv.isc.org.key"
288295
289296 # File with trusted keys for validation. Specify more than one file
303310 # the trusted-keys { name flag proto algo "key"; }; clauses are read.
304311 # trusted-keys-file: ""
305312
313 # Ignore chain of trust. Domain is treated as insecure.
314 # domain-insecure: "example.com"
315
306316 # Override the date for validation with a specific fixed date.
307317 # Do not set this unless you are debugging signature inception
308318 # and expiration. "" or "0" turns the feature off.
311321 # The time to live for bogus data, rrsets and messages. This avoids
312322 # some of the revalidation, until the time interval expires. in secs.
313323 # val-bogus-ttl: 60
324
325 # The signature inception and expiration dates are allowed to be off
326 # by 10% of the lifetime of the signature from our local clock.
327 # This leeway is capped with a minimum and a maximum. In seconds.
328 # val-sig-skew-min: 3600
329 # val-sig-skew-max: 86400
314330
315331 # Should additional section of secure message also be kept clean of
316332 # unsecure data. Useful to shield the users of this validator from
379395 # you need to do the reverse notation yourself.
380396 # local-data-ptr: "192.0.2.3 www.example.com"
381397
398 # Python config section. To enable:
399 # o use --with-pythonmodule to configure before compiling.
400 # o list python in the module-config string (above) to enable.
401 # o and give a python-script to run.
402 python:
403 # Script file to load
404 # python-script: "@UNBOUND_SHARE_DIR@/ubmodule-tst.py"
405
382406 # Remote control config section.
383407 remote-control:
384408 # Enable remote control with unbound-control(8) here.
413437 # stub-zone:
414438 # name: "example.com"
415439 # stub-addr: 192.0.2.68
416 # stub-prime: "no"
440 # stub-prime: no
417441 # stub-zone:
418442 # name: "example.org"
419443 # stub-host: ns.example.com.
0 .TH "libunbound" "3" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "libunbound" "3" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" libunbound.3 -- unbound library functions manual
33 .\"
3434 .B ub_resolve_async,
3535 .B ub_cancel,
3636 .B ub_resolve_free,
37 .B ub_strerror
38 \- Unbound DNS validating resolver 1.2.1 functions.
37 .B ub_strerror,
38 .B ub_ctx_print_local_zones,
39 .B ub_ctx_zone_add,
40 .B ub_ctx_zone_remove,
41 .B ub_ctx_data_add,
42 .B ub_ctx_data_remove
43 \- Unbound DNS validating resolver 1.3.0 functions.
3944 .SH "SYNOPSIS"
4045 .LP
4146 .B #include <unbound.h>
113118 .LP
114119 \fIconst char *\fR
115120 \fBub_strerror\fR(\fIint\fR err);
121 .LP
122 \fIint\fR
123 \fBub_ctx_print_local_zones\fR(\fIstruct ub_ctx*\fR ctx);
124 .LP
125 \fIint\fR
126 \fBub_ctx_zone_add\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR zone_name, \fIchar*\fR zone_type);
127 .LP
128 \fIint\fR
129 \fBub_ctx_zone_remove\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR zone_name);
130 .LP
131 \fIint\fR
132 \fBub_ctx_data_add\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR data);
133 .LP
134 \fIint\fR
135 \fBub_ctx_data_remove\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR data);
116136 .SH "DESCRIPTION"
117137 .LP
118138 .B Unbound
277297 struct ub_result* result);
278298 .IP
279299 The async_id is returned so you can (at your option) decide to track it
280 and cancel the request if needed.
300 and cancel the request if needed. If you pass a NULL pointer the async_id
301 is not returned.
281302 .TP
282303 .B ub_cancel
283 Cancel an async query in progress.
304 Cancel an async query in progress. This may return an error if the query
305 does not exist, or the query is already being delivered, in that case you
306 may still get a callback for the query.
284307 .TP
285308 .B ub_resolve_free
286309 Free struct ub_result contents after use.
288311 .B ub_strerror
289312 Convert error value from one of the unbound library functions
290313 to a human readable string.
314 .TP
315 .B ub_ctx_print_local_zones
316 Debug printout the local authority information to debug output.
317 .TP
318 .B ub_ctx_zone_add
319 Add new zone to local authority info, like local\-zone \fIunbound.conf\fR(5)
320 statement.
321 .TP
322 .B ub_ctx_zone_remove
323 Delete zone from local authority info.
324 .TP
325 .B ub_ctx_data_add
326 Add resource record data to local authority info, like local\-data
327 \fIunbound.conf\fR(5) statement.
328 .TP
329 .B ub_ctx_data_remove
330 Delete local authority data from the name given.
291331 .SH "RESULT DATA STRUCTURE"
292332 .LP
293333 The result of the DNS resolution and validation is returned as
242242 They are sent to a random server, but no one address more than 4 times.
243243 It succeeds if one has 0x20 intact, or else all are equal.
244244 Otherwise, servfail is returned to the client.
245
246 o NXDOMAIN and SOA serial numbers.
247 Unbound keeps TTL values for message formats, and thus rcodes, such
248 as NXDOMAIN. Also it keeps the latest rrsets in the rrset cache.
249 So it will faithfully negative cache for the exact TTL as originally
250 specified for an NXDOMAIN message, but send a newer SOA record if
251 this has been found in the mean time. In point, this could lead to a
252 negative cached NXDOMAIN reply with a SOA RR where the serial number
253 indicates a zone version where this domain is not any longer NXDOMAIN.
254 These situations become consistent once the original TTL expires.
255 If the domain is DNSSEC signed, by the way, then NSEC records are
256 updated more carefully. If one of the NSEC records in an NXDOMAIN is
257 updated from another query, the NXDOMAIN is dropped from the cache,
258 and queried for again, so that its proof can be checked again.
0 .TH "unbound-checkconf" "8" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "unbound-checkconf" "8" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" unbound-checkconf.8 -- unbound configuration checker manual
33 .\"
1313 .SH "SYNOPSIS"
1414 .B unbound-checkconf
1515 .RB [ \-h ]
16 .IR cfgfile
16 .RB [ \-o
17 .IR option ]
18 .RI [ cfgfile ]
1719 .SH "DESCRIPTION"
1820 .B Unbound-checkconf
1921 checks the configuration file for the
2628 .TP
2729 .B \-h
2830 Show the version and commandline option help.
31 .TP
32 .B \-o\fI option
33 If given, after checking the config file the value of this option is
34 printed to stdout. For "" (disabled) options an empty line is printed.
2935 .TP
3036 .I cfgfile
3137 The config file to read with settings for unbound. It is checked.
0 .TH "unbound-control" "8" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "unbound-control" "8" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" unbound-control.8 -- unbound remote control manual
33 .\"
6060 controlled using the \fBstatistics\-cumulative\fR config statement.
6161 Statistics are printed with one [name]: [value] per line.
6262 .TP
63 .B stats_noreset
64 Peek at statistics. Prints them like the \fBstats\fR command does, but does not
65 reset the internal counters to zero.
66 .TP
6367 .B status
6468 Display server status. Exit code 3 if not running (the connection to the
6569 port is refused), 1 on error, 0 if running.
114118 Remove all information at or below the name from the cache.
115119 The rrsets and key entries are removed so that new lookups will be performed.
116120 This needs to walk and inspect the entire cache, and is a slow operation.
121 .TP
122 .B flush_stats
123 Reset statistics to zero.
124 .TP
125 .B flush_requestlist
126 Drop the queries that are worked on. Stops working on the queries that the
127 server is working on now. The cache is unaffected. No reply is sent for
128 those queries, probably making those users request again later.
129 Useful to make the server restart working on queries with new settings,
130 such as a higher verbosity level.
131 .TP
132 .B dump_requestlist
133 Show what is worked on. Prints all queries that the server is currently
134 working on. Prints the time that users have been waiting. For internal
135 requests, no time is printed. And then prints out the module status.
136 .TP
137 .B forward [off | addr ... ]
138 Setup forwarding mode. Configures if the server should ask other upstream
139 nameservers, should go to the internet root nameservers itself, or show
140 the current config. You could pass the nameservers after a DHCP update.
141 .IP
142 Without arguments the current list of addresses used to forward all queries
143 to is printed. On startup this is from the forward-zone "." configuration.
144 Afterwards it shows the status. It prints off when no forwarding is used.
145 .IP
146 If \fIoff\fR is passed, forwarding is disabled and the root nameservers
147 are used. This can be used to avoid to avoid buggy or non-DNSSEC supporting
148 nameservers returned from DHCP. But may not work in hotels or hotspots.
149 .IP
150 If one or more IPv4 or IPv6 addresses are given, those are then used to forward
151 queries to. The addresses must be separated with spaces. With '@port' the
152 port number can be set explicitly (default port is 53 (DNS)).
153 .IP
154 By default the forwarder information from the config file for the root "." is
155 used. The config file is not changed, so after a reload these changes are
156 gone. Other forward zones from the config file are not affected by this command.
117157 .SH "EXIT CODE"
118158 The unbound-control program exits with status code 1 on error, 0 on success.
119159 .SH "SET UP"
0 .TH "unbound\-host" "1" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "unbound\-host" "1" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" unbound-host.1 -- unbound DNS lookup utility
33 .\"
3333 uses the unbound validating resolver to query for the hostname and display
3434 results. With the \fB\-v\fR option it displays validation
3535 status: secure, insecure, bogus (security failure).
36 .P
37 By default it reads no configuration file whatsoever. It attempts to reach
38 the internet root servers. With \fB\-C\fR an unbound config file and with
39 \fB\-r\fR resolv.conf can be read.
3640 .P
3741 The available options are:
3842 .TP
0 .TH "unbound" "8" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "unbound" "8" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" unbound.8 -- unbound manual
33 .\"
99 .SH "NAME"
1010 .LP
1111 .B unbound
12 \- Unbound DNS validating resolver 1.2.1.
12 \- Unbound DNS validating resolver 1.3.0.
1313 .SH "SYNOPSIS"
1414 .LP
1515 .B unbound
0 .TH "unbound.conf" "5" "Feb 10, 2009" "NLnet Labs" "unbound 1.2.1"
0 .TH "unbound.conf" "5" "Jun 8, 2009" "NLnet Labs" "unbound 1.3.0"
11 .\"
22 .\" unbound.conf.5 -- unbound.conf manual
33 .\"
8585 The verbosity number, level 0 means no verbosity, only errors. Level 1
8686 gives operational information. Level 2 gives detailed operational
8787 information. Level 3 gives query level information, output per query.
88 Level 4 gives algorithm level information.
89 Default is level 1. The verbosity can also be increased from the commandline,
90 see
91 \fIunbound\fR(8).
88 Level 4 gives algorithm level information. Level 5 logs client
89 identification for cache misses. Default is level 1.
90 The verbosity can also be increased from the commandline, see \fIunbound\fR(8).
9291 .TP
9392 .B statistics\-interval: \fI<seconds>
9493 The number of seconds between printing statistics to the log for every thread.
214213 Can be set lower to force the resolver to query for data often, and not
215214 trust (very large) TTL values.
216215 .TP
216 .B cache\-min\-ttl: \fI<seconds>
217 Time to live minimum for RRsets and messages in the cache. Default is 0.
218 If the the minimum kicks in, the data is cached for longer than the domain
219 owner intended, and thus less queries are made to look up the data.
220 Zero makes sure the data in the cache is as the domain owner intended,
221 higher values, especially more than an hour or so, can lead to trouble as
222 the data in the cache does not match up with the actual data any more.
223 .TP
217224 .B infra\-host\-ttl: \fI<seconds>
218225 Time to live for entries in the host cache. The host cache contains
219226 roundtrip timing and EDNS support information. Default is 900.
336343 The log facility LOG_DAEMON is used, with identity "unbound".
337344 The logfile setting is overridden when use\-syslog is turned on.
338345 The default is to log to syslog.
346 .TP
347 .B log\-time\-ascii: \fI<yes or no>
348 Sets logfile lines to use a timestamp in UTC ascii. Default is no, which
349 prints the seconds since 1970 in brackets. No effect if using syslog, in
350 that case syslog formats the timestamp printed into the log files.
339351 .TP
340352 .B pidfile: \fI<filename>
341353 The process id is written to the file. Default is "@UNBOUND_PIDFILE@".
470482 the string with quotes (""). The modules can be validator, iterator.
471483 Setting this to "iterator" will result in a non\-validating server.
472484 Setting this to "validator iterator" will turn on DNSSEC validation.
485 The ordering of the modules is important.
473486 You must also set trust\-anchors for validation to be useful.
474487 .TP
475488 .B trust\-anchor\-file: \fI<filename>
503516 .B dlv\-anchor: \fI<"Resource Record">
504517 Much like trust\-anchor, this is a DLV anchor with the DS or DNSKEY inline.
505518 .TP
519 .B domain\-insecure: \fI<domain name>
520 Sets domain name to be insecure, DNSSEC chain of trust is ignored towards
521 the domain name. So a trust anchor above the domain name can not make the
522 domain secure with a DS record, such a DS record is then ignored.
523 Also keys from DLV are ignored for the domain. Can be given multiple times
524 to specify multiple domains that are treated as if unsigned. If you set
525 trust anchors for the domain they override this setting (and the domain
526 is secured).
527 .IP
528 This can be useful if you want to make sure a trust anchor for external
529 lookups does not affect an (unsigned) internal domain. A DS record
530 externally can create validation failures for that internal domain.
531 .TP
506532 .B val\-override\-date: \fI<rrsig\-style date spec>
507533 Default is "" or "0", which disables this debugging feature. If enabled by
508534 giving a RRSIG style date, that date is used for verifying RRSIG inception
509535 and expiration dates, instead of the current date. Do not set this unless
510536 you are debugging signature inception and expiration.
537 .TP
538 .B val\-sig\-skew\-min: \fI<seconds>
539 Minimum number of seconds of clock skew to apply to validated signatures.
540 A value of 10% of the signature lifetime is used, capped by this setting.
541 Default is 3600 (1 hour) which allows for daylight savings differences.
542 Lower this value for more strict checking of short lived signatures.
543 .TP
544 .B val\-sig\-skew\-max: \fI<seconds>
545 Maximum number of seconds of clock skew to apply to validated signatures.
546 A value of 10% of the signature lifetime is used, capped by this setting.
547 Default is 86400 (24 hours) which allows for timezone setting problems in
548 stable domains. Setting both min and max very low disables the clock skew
549 allowances. Setting both min and max very high makes the validator check
550 the signature timestamps less strictly.
511551 .TP
512552 .B val\-bogus\-ttl: \fI<number>
513553 The time to live for bogus data. This is data that has failed validation;
804844 .B forward\-addr: \fI<IP address>
805845 IP address of server to forward to. Can be IP 4 or IP 6.
806846 To use a nondefault port for DNS communication append '@' with the port number.
847 .SS "Python Module Options"
848 .LP
849 The
850 .B python:
851 clause gives the settings for the \fIpython\fR(1) script module. This module
852 acts like the iterator and validator modules do, on queries and answers.
853 To enable the script module it has to be compiled into the daemon,
854 and the word "python" has to be put in the \fBmodule\-conf:\fR option
855 (usually first, or between the validator and iterator).
856 .TP
857 .B python\-script: \fI<python file>\fR
858 The script file to load.
807859 .SH "MEMORY CONTROL EXAMPLE"
808860 In the example config settings below memory usage is reduced. Some service
809861 levels are lower, notable very large data and a high TCP load are no longer
494494 util/configparser.h \
495495 util/configlexer.c \
496496 util/locks.h \
497 pythonmod/unboundmodule.py \
498 pythonmod/interface.h \
499 pythonmod/examples/resgen.py \
500 pythonmod/examples/resmod.py \
501 libunbound/python/unbound.py \
502 libunbound/python/libunbound_wrap.c \
497503 ./ldns-src
498504
499505 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
912918 # generate an XML file that captures the structure of
913919 # the code including all documentation.
914920
915 GENERATE_XML = NO
921 GENERATE_XML = YES
916922
917923 # The XML_OUTPUT tag is used to specify where the XML pages will be put.
918924 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
237237 forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
238238 {
239239 free(fwd->tree);
240 regional_free_all(fwd->region);
240241 fwd->tree = rbtree_create(fwd_cmp);
241242 if(!fwd->tree)
242243 return 0;
287288 {
288289 if(!fwd)
289290 return 0;
290 return sizeof(*fwd) + regional_get_mem(fwd->region);
291 }
291 return sizeof(*fwd) + sizeof(*fwd->tree) +
292 regional_get_mem(fwd->region);
293 }
294
295 int
296 forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
297 {
298 if(!forwards_insert(fwd, c, dp))
299 return 0;
300 fwd_init_parents(fwd);
301 return 1;
302 }
303
304 void
305 forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
306 {
307 struct iter_forward_zone key;
308 key.node.key = &key;
309 key.dclass = c;
310 key.name = nm;
311 key.namelabs = dname_count_size_labels(nm, &key.namelen);
312 if(!rbtree_search(fwd->tree, &key))
313 return; /* nothing to do */
314 (void)rbtree_delete(fwd->tree, &key);
315 fwd_init_parents(fwd);
316 }
317
4242 #ifndef ITERATOR_ITER_FWD_H
4343 #define ITERATOR_ITER_FWD_H
4444 #include "util/rbtree.h"
45 struct iter_env;
4645 struct config_file;
4746 struct delegpt;
4847 struct regional;
127126 /** compare two fwd entries */
128127 int fwd_cmp(const void* k1, const void* k2);
129128
129 /**
130 * Add zone to forward structure. For external use since it recalcs
131 * the tree parents.
132 * @param fwd: the forward data structure
133 * @param c: class of zone
134 * @param dp: delegation point with name and target nameservers for new
135 * forward zone. This delegation point and all its data must be
136 * malloced in the fwd->region. (then it is freed when the fwd is
137 * deleted).
138 * @return false on failure (out of memory);
139 */
140 int forwards_add_zone(struct iter_forwards* fwd, uint16_t c,
141 struct delegpt* dp);
142
143 /**
144 * Remove zone from forward structure. For external use since it
145 * recalcs the tree parents. Does not actually release any memory, the region
146 * is unchanged.
147 * @param fwd: the forward data structure
148 * @param c: class of zone
149 * @param nm: name of zone (in uncompressed wireformat).
150 */
151 void forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm);
152
130153 #endif /* ITERATOR_ITER_FWD_H */
109109 iter_env->hints = hints_create();
110110 if(!iter_env->hints || !hints_apply_cfg(iter_env->hints, cfg)) {
111111 log_err("Could not set root or stub hints");
112 return 0;
113 }
114 if(!iter_env->fwds)
115 iter_env->fwds = forwards_create();
116 if(!iter_env->fwds || !forwards_apply_cfg(iter_env->fwds, cfg)) {
117 log_err("Could not set forward zones");
118112 return 0;
119113 }
120114 if(!iter_env->donotq)
8888 free(iter_env->target_fetch_policy);
8989 priv_delete(iter_env->priv);
9090 hints_delete(iter_env->hints);
91 forwards_delete(iter_env->fwds);
9291 donotq_delete(iter_env->donotq);
9392 free(iter_env);
9493 env->modinfo[id] = NULL;
459458 * @param subq_ret: if newly allocated, the subquerystate, or NULL if it does
460459 * not need initialisation.
461460 * @param v: if true, validation is done on the subquery.
462 * @param detcyc: if true, cycle detection is done on the subquery.
463461 * @return false on error (malloc).
464462 */
465463 static int
466464 generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
467465 uint16_t qclass, struct module_qstate* qstate, int id,
468466 struct iter_qstate* iq, enum iter_state initial_state,
469 enum iter_state final_state, struct module_qstate** subq_ret, int v,
470 int detcyc)
467 enum iter_state final_state, struct module_qstate** subq_ret, int v)
471468 {
472469 struct module_qstate* subq = NULL;
473470 struct iter_qstate* subiq = NULL;
490487 if(!v)
491488 qflags |= BIT_CD;
492489
493 if(detcyc) {
494 fptr_ok(fptr_whitelist_modenv_detect_cycle(
495 qstate->env->detect_cycle));
496 if((*qstate->env->detect_cycle)(qstate, &qinf, qflags, prime)){
497 log_query_info(VERB_DETAIL, "cycle detected", &qinf);
498 return 0;
499 }
490 fptr_ok(fptr_whitelist_modenv_detect_cycle(
491 qstate->env->detect_cycle));
492 if((*qstate->env->detect_cycle)(qstate, &qinf, qflags, prime)){
493 log_query_info(VERB_DETAIL, "cycle detected", &qinf);
494 return 0;
500495 }
501496
502497 /* attach subquery, lookup existing or make a new one */
555550 verbose(VERB_ALGO, "Cannot prime due to lack of hints");
556551 return 0;
557552 }
558 /* copy dp; to avoid messing up available list for other thr/queries */
559 dp = delegpt_copy(dp, qstate->region);
560 if(!dp) {
561 log_err("out of memory priming root, copydp");
562 return 0;
563 }
564553 /* Priming requests start at the QUERYTARGETS state, skipping
565554 * the normal INIT state logic (which would cause an infloop). */
566555 if(!generate_sub_request((uint8_t*)"\000", 1, LDNS_RR_TYPE_NS,
567556 qclass, qstate, id, iq, QUERYTARGETS_STATE, PRIME_RESP_STATE,
568 &subq, 0, 1)) {
557 &subq, 0)) {
569558 verbose(VERB_ALGO, "could not prime root");
570559 return 0;
571560 }
572561 if(subq) {
573562 struct iter_qstate* subiq =
574563 (struct iter_qstate*)subq->minfo[id];
575 /* Set the initial delegation point to the hint. */
576 subiq->dp = dp;
564 /* Set the initial delegation point to the hint.
565 * copy dp, it is now part of the root prime query.
566 * dp was part of in the fixed hints structure. */
567 subiq->dp = delegpt_copy(dp, subq->region);
568 if(!subiq->dp) {
569 log_err("out of memory priming root, copydp");
570 fptr_ok(fptr_whitelist_modenv_kill_sub(
571 qstate->env->kill_sub));
572 (*qstate->env->kill_sub)(subq);
573 return 0;
574 }
577575 /* there should not be any target queries. */
578576 subiq->num_target_queries = 0;
579577 subiq->dnssec_expected = iter_indicates_dnssec(
615613
616614 /* is it a noprime stub (always use) */
617615 if(stub->noprime) {
616 /* copy the dp out of the fixed hints structure, so that
617 * it can be changed when servicing this query */
618618 iq->dp = delegpt_copy(stub_dp, qstate->region);
619619 if(!iq->dp) {
620620 log_err("out of memory priming stub");
634634 * redundant INIT state processing. */
635635 if(!generate_sub_request(stub_dp->name, stub_dp->namelen,
636636 LDNS_RR_TYPE_NS, qclass, qstate, id, iq,
637 QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0, 1)) {
637 QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0)) {
638638 verbose(VERB_ALGO, "could not prime stub");
639639 (void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);
640640 return 1; /* return 1 to make module stop, with error */
712712 if(!generate_sub_request(s->rk.dname, s->rk.dname_len,
713713 ntohs(s->rk.type), ntohs(s->rk.rrset_class),
714714 qstate, id, iq,
715 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 1)) {
715 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
716716 verbose(VERB_ALGO, "could not generate addr check");
717717 return;
718718 }
747747 iq->dp->name, LDNS_RR_TYPE_NS, iq->qchase.qclass);
748748 if(!generate_sub_request(iq->dp->name, iq->dp->namelen,
749749 LDNS_RR_TYPE_NS, iq->qchase.qclass, qstate, id, iq,
750 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 1)) {
750 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
751751 verbose(VERB_ALGO, "could not generate ns check");
752752 return;
753753 }
774774 *
775775 * @param qstate: query state.
776776 * @param iq: iterator query state.
777 * @param ie: iterator shared global environment.
778777 * @return true if the request is forwarded, false if not.
779778 * If returns true but, iq->dp is NULL then a malloc failure occurred.
780779 */
781780 static int
782 forward_request(struct module_qstate* qstate, struct iter_qstate* iq,
783 struct iter_env* ie)
784 {
785 struct delegpt* dp = forwards_lookup(ie->fwds, iq->qchase.qname,
786 iq->qchase.qclass);
781 forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
782 {
783 struct delegpt* dp = forwards_lookup(qstate->env->fwds,
784 iq->qchase.qname, iq->qchase.qclass);
787785 if(!dp)
788786 return 0;
789787 /* send recursion desired to forward addr */
861859 /* handle positive cache response */
862860 enum response_type type = response_type_from_cache(msg,
863861 &iq->qchase);
864 if(verbosity >= VERB_ALGO)
862 if(verbosity >= VERB_ALGO) {
865863 log_dns_msg("msg from cache lookup", &msg->qinfo,
866864 msg->rep);
865 verbose(VERB_ALGO, "msg ttl is %d", (int)msg->rep->ttl);
866 }
867867
868868 if(type == RESPONSE_TYPE_CNAME) {
869869 uint8_t* sname = 0;
891891 }
892892
893893 /* attempt to forward the request */
894 if(forward_request(qstate, iq, ie))
894 if(forward_request(qstate, iq))
895895 {
896896 if(!iq->dp) {
897897 log_err("alloc failure for forward dp");
10961096 {
10971097 struct module_qstate* subq;
10981098 if(!generate_sub_request(name, namelen, qtype, qclass, qstate,
1099 id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0, 0))
1099 id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0))
11001100 return 0;
11011101 if(subq) {
11021102 struct iter_qstate* subiq =
12941294 /* if there is a policy to fetch missing targets
12951295 * opportunistically, do it. we rely on the fact that once a
12961296 * query (or queries) for a missing name have been issued,
1297 * they will not be show up again. */
1297 * they will not show up again. */
12981298 } else if(tf_policy != 0) {
12991299 int extra = 0;
13001300 verbose(VERB_ALGO, "attempt to get extra %d targets",
13011301 tf_policy);
1302 if(!query_for_targets(qstate, iq, ie, id, tf_policy, &extra)) {
1303 return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
1304 }
1302 (void)query_for_targets(qstate, iq, ie, id, tf_policy, &extra);
1303 /* errors ignored, these targets are not strictly necessary for
1304 * this result, we do not have to reply with SERVFAIL */
13051305 iq->num_target_queries += extra;
13061306 }
13071307
17311731 if(!generate_sub_request(qstate->qinfo.qname,
17321732 qstate->qinfo.qname_len, qstate->qinfo.qtype,
17331733 qstate->qinfo.qclass, qstate, id, iq,
1734 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1, 1)) {
1734 INIT_REQUEST_STATE, FINISHED_STATE, &subq, 1)) {
17351735 verbose(VERB_ALGO, "could not generate prime check");
17361736 }
17371737 generate_a_aaaa_check(qstate, iq, id);
17701770 log_query_info(VERB_ALGO, "processTargetResponse super", &forq->qinfo);
17711771
17721772 /* check to see if parent event is still interested (in orig name). */
1773 if(!foriq->dp) {
1774 verbose(VERB_ALGO, "subq: parent not interested, was reset");
1775 return; /* not interested anymore */
1776 }
17731777 dpns = delegpt_find_ns(foriq->dp, qstate->qinfo.qname,
17741778 qstate->qinfo.qname_len);
17751779 if(!dpns) {
1776 /* FIXME: maybe store this nameserver address in the cache
1777 * anyways? */
1778 /* If not, just stop processing this event */
1780 /* If not interested, just stop processing this event */
17791781 verbose(VERB_ALGO, "subq: parent not interested anymore");
1780 /* this is an error, and will cause parent to be reactivated
1781 * even though nothing has happened */
1782 log_assert(0);
1782 /* could be because parent was jostled out of the cache,
1783 and a new identical query arrived, that does not want it*/
17831784 return;
17841785 }
17851786
21282129 if(!ie)
21292130 return 0;
21302131 return sizeof(*ie) + sizeof(int)*((size_t)ie->max_dependency_depth+1)
2131 + hints_get_mem(ie->hints) + forwards_get_mem(ie->fwds)
2132 + donotq_get_mem(ie->donotq);
2132 + hints_get_mem(ie->hints) + donotq_get_mem(ie->donotq);
21332133 }
21342134
21352135 /**
8686 /** A flag to indicate whether or not we have an IPv6 route */
8787 int supports_ipv6;
8888
89 /** Mapping of forwarding zones to targets. */
90 struct iter_forwards* fwds;
91
9289 /** A set of inetaddrs that should never be queried. */
9390 struct iter_donotq* donotq;
9491
Binary diff not shown
183183 /** error in pipe communication with async bg worker */
184184 UB_PIPE = -8,
185185 /** error reading from file (resolv.conf) */
186 UB_READFILE = -9
186 UB_READFILE = -9,
187 /** error async_id does not exist or result already been delivered */
188 UB_NOID = -10
187189 };
188190
189191 /**
641641 if(!q || !q->async) {
642642 /* it is not there, so nothing to do */
643643 lock_basic_unlock(&ctx->cfglock);
644 return UB_NOERROR;
644 return UB_NOID;
645645 }
646646 log_assert(q->async);
647647 q->cancelled = 1;
702702 case UB_AFTERFINAL: return "setting change after finalize";
703703 case UB_PIPE: return "error in pipe communication with async";
704704 case UB_READFILE: return "error reading file";
705 case UB_NOID: return "error async_id does not exist";
705706 default: return "unknown error";
706707 }
707708 }
904905 fclose(in);
905906 return UB_NOERROR;
906907 }
908
909 /** finalize the context, if not already finalized */
910 static int ub_ctx_finalize(struct ub_ctx* ctx)
911 {
912 int res = 0;
913 lock_basic_lock(&ctx->cfglock);
914 if (!ctx->finalized) {
915 res = context_finalize(ctx);
916 }
917 lock_basic_unlock(&ctx->cfglock);
918 return res;
919 }
920
921 /* Print local zones and RR data */
922 int ub_ctx_print_local_zones(struct ub_ctx* ctx)
923 {
924 int res = ub_ctx_finalize(ctx);
925 if (res) return res;
926
927 local_zones_print(ctx->local_zones);
928
929 return UB_NOERROR;
930 }
931
932 /* Add a new zone */
933 int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type)
934 {
935 enum localzone_type t;
936 struct local_zone* z;
937 uint8_t* nm;
938 int nmlabs;
939 size_t nmlen;
940
941 int res = ub_ctx_finalize(ctx);
942 if (res) return res;
943
944 if(!local_zone_str2type(zone_type, &t)) {
945 return UB_SYNTAX;
946 }
947
948 if(!parse_dname(zone_name, &nm, &nmlen, &nmlabs)) {
949 return UB_SYNTAX;
950 }
951
952 lock_quick_lock(&ctx->local_zones->lock);
953 if((z=local_zones_find(ctx->local_zones, nm, nmlen, nmlabs,
954 LDNS_RR_CLASS_IN))) {
955 /* already present in tree */
956 lock_rw_wrlock(&z->lock);
957 z->type = t; /* update type anyway */
958 lock_rw_unlock(&z->lock);
959 lock_quick_unlock(&ctx->local_zones->lock);
960 free(nm);
961 return UB_NOERROR;
962 }
963 if(!local_zones_add_zone(ctx->local_zones, nm, nmlen, nmlabs,
964 LDNS_RR_CLASS_IN, t)) {
965 lock_quick_unlock(&ctx->local_zones->lock);
966 return UB_NOMEM;
967 }
968 lock_quick_unlock(&ctx->local_zones->lock);
969 return UB_NOERROR;
970 }
971
972 /* Remove zone */
973 int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name)
974 {
975 struct local_zone* z;
976 uint8_t* nm;
977 int nmlabs;
978 size_t nmlen;
979
980 int res = ub_ctx_finalize(ctx);
981 if (res) return res;
982
983 if(!parse_dname(zone_name, &nm, &nmlen, &nmlabs)) {
984 return UB_SYNTAX;
985 }
986
987 lock_quick_lock(&ctx->local_zones->lock);
988 if((z=local_zones_find(ctx->local_zones, nm, nmlen, nmlabs,
989 LDNS_RR_CLASS_IN))) {
990 /* present in tree */
991 local_zones_del_zone(ctx->local_zones, z);
992 }
993 lock_quick_unlock(&ctx->local_zones->lock);
994 free(nm);
995 return UB_NOERROR;
996 }
997
998 /* Add new RR data */
999 int ub_ctx_data_add(struct ub_ctx* ctx, char *data)
1000 {
1001 ldns_buffer* buf;
1002 int res = ub_ctx_finalize(ctx);
1003 if (res) return res;
1004
1005 lock_basic_lock(&ctx->cfglock);
1006 buf = ldns_buffer_new(ctx->env->cfg->msg_buffer_size);
1007 lock_basic_unlock(&ctx->cfglock);
1008 if(!buf) return UB_NOMEM;
1009
1010 res = local_zones_add_RR(ctx->local_zones, data, buf);
1011
1012 ldns_buffer_free(buf);
1013 return (!res) ? UB_NOMEM : UB_NOERROR;
1014 }
1015
1016 /* Remove RR data */
1017 int ub_ctx_data_remove(struct ub_ctx* ctx, char *data)
1018 {
1019 uint8_t* nm;
1020 int nmlabs;
1021 size_t nmlen;
1022 int res = ub_ctx_finalize(ctx);
1023 if (res) return res;
1024
1025 if(!parse_dname(data, &nm, &nmlen, &nmlabs))
1026 return UB_SYNTAX;
1027
1028 local_zones_del_data(ctx->local_zones, nm, nmlen, nmlabs,
1029 LDNS_RR_CLASS_IN);
1030
1031 free(nm);
1032 return UB_NOERROR;
1033 }
6060 #include "util/data/msgreply.h"
6161 #include "util/data/msgencode.h"
6262 #include "util/tube.h"
63 #include "iterator/iter_fwd.h"
6364
6465 /** handle new query command for bg worker */
6566 static void handle_newq(struct libworker* w, uint8_t* buf, uint32_t len);
7071 {
7172 if(!w) return;
7273 if(w->env) {
74 outside_network_quit_prepare(w->back);
7375 mesh_delete(w->env->mesh);
7476 context_release_alloc(w->ctx, w->env->alloc,
7577 !w->is_bg || w->is_bg_thread);
7678 ldns_buffer_free(w->env->scratch_buffer);
7779 regional_destroy(w->env->scratch);
80 forwards_delete(w->env->fwds);
7881 ub_randfree(w->env->rnd);
7982 free(w->env);
8083 }
113116 }
114117 w->env->scratch = regional_create_custom(cfg->msg_buffer_size);
115118 w->env->scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size);
119 w->env->fwds = forwards_create();
120 if(w->env->fwds && !forwards_apply_cfg(w->env->fwds, cfg)) {
121 forwards_delete(w->env->fwds);
122 w->env->fwds = NULL;
123 }
116124 if(!w->is_bg || w->is_bg_thread) {
117125 lock_basic_unlock(&ctx->cfglock);
118126 }
119 if(!w->env->scratch || !w->env->scratch_buffer) {
127 if(!w->env->scratch || !w->env->scratch_buffer || !w->env->fwds) {
120128 libworker_delete(w);
121129 return NULL;
122130 }
839847 return 0;
840848 }
841849
850 #ifdef UB_ON_WINDOWS
851 void
852 worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void*
853 ATTR_UNUSED(arg)) {
854 log_assert(0);
855 }
856
857 void
858 wsvc_cron_cb(void* ATTR_UNUSED(arg))
859 {
860 log_assert(0);
861 }
862 #endif /* UB_ON_WINDOWS */
0 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
1 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
2
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of the organization nor the names of its
14 contributors may be used to endorse or promote products derived from this
15 software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
0 #
1 # Makefile: compilation of pyUnbound and documentation, testing
2 #
3 # Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 # Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 #
6 # This software is open source.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright notice,
13 # this list of conditions and the following disclaimer.
14 #
15 # * Redistributions in binary form must reproduce the above copyright notice,
16 # this list of conditions and the following disclaimer in the documentation
17 # and/or other materials provided with the distribution.
18 #
19 # * Neither the name of the organization nor the names of its
20 # contributors may be used to endorse or promote products derived from this
21 # software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
34
35 help:
36 @echo "Please use \`make <target>' where <target> is one of"
37 @echo " testenv to make test environment and run bash "
38 @echo " usefull in case you don't want to install unbound but want to test examples"
39 @echo " doc to make documentation"
40 @echo " clean clean all"
41
42 .PHONY: testenv clean doc swig
43
44 _unbound.so: ../../Makefile
45 $(MAKE) -C ../..
46
47 ../../.libs/libunbound.so.0: ../../Makefile
48 $(MAKE) -C ../..
49
50 ../../ldns-src/lib/libldns.so: ../../ldns-src/Makefile
51 $(MAKE) -C ../../ldns-src
52
53 clean:
54 rm -rdf examples/unbound
55 rm -f _unbound.so libunbound_wrap.o
56 $(MAKE) -C ../.. clean
57
58 testenv: ../../.libs/libunbound.so.0 ../../ldns-src/lib/libldns.so _unbound.so
59 rm -rdf examples/unbound
60 cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.1 unbound/libunbound.so.1 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la
61 @echo "Run a script by typing ./script_name.py"
62 cd examples && LD_LIBRARY_PATH=unbound bash
63 rm -rdf examples/unbound
64
65 doc: ../../.libs/libunbound.so.0 _unbound.so
66 $(MAKE) -C docs html
67
68 #for development only
69 swig: libunbound.i
70 swig -python -o libunbound_wrap.c -I../.. libunbound.i
71 gcc -c libunbound_wrap.c -O9 -fPIC -I../.. -I/usr/include/python2.5 -I. -o libunbound_wrap.o
72 gcc -shared libunbound_wrap.o -L../../.libs -lunbound -o _unbound.so
73
0 this directory exists to pacify sphinx-build.
0 # -*- coding: utf-8 -*-
1 #
2 # Unbound documentation build configuration file
3 #
4 # This file is execfile()d with the current directory set to its containing dir.
5 #
6 # The contents of this file are pickled, so don't put values in the namespace
7 # that aren't pickleable (module imports are okay, they're removed automatically).
8 #
9 # All configuration values have a default value; values that are commented out
10 # serve to show the default value.
11
12 import sys, os
13
14 # If your extensions are in another directory, add it here. If the directory
15 # is relative to the documentation root, use os.path.abspath to make it
16 # absolute, like shown here.
17 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../')))
18 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../../../')))
19 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../../../.libs/')))
20 #print sys.path
21
22 # General configuration
23 # ---------------------
24
25 # Add any Sphinx extension module names here, as strings. They can be extensions
26 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
27 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
28
29 # Add any paths that contain templates here, relative to this directory.
30 templates_path = ['_templates']
31
32 # The suffix of source filenames.
33 source_suffix = '.rst'
34
35 # The master toctree document.
36 master_doc = 'index'
37
38 # General substitutions.
39 project = 'pyUnbound'
40 copyright = '2009, Zdenek Vasicek, Marek Vavrusa'
41
42 # The default replacements for |version| and |release|, also used in various
43 # other places throughout the built documents.
44 #
45 # The short X.Y version.
46 version = '1.0'
47 # The full version, including alpha/beta/rc tags.
48 release = '1.0.0'
49
50 # There are two options for replacing |today|: either, you set today to some
51 # non-false value, then it is used:
52 #today = ''
53 # Else, today_fmt is used as the format for a strftime call.
54 today_fmt = '%B %d, %Y'
55
56 # List of documents that shouldn't be included in the build.
57 #unused_docs = []
58
59 # List of directories, relative to source directories, that shouldn't be searched
60 # for source files.
61 #exclude_dirs = []
62
63 # The reST default role (used for this markup: `text`) to use for all documents.
64 #default_role = None
65
66 # If true, '()' will be appended to :func: etc. cross-reference text.
67 #add_function_parentheses = True
68
69 # If true, the current module name will be prepended to all description
70 # unit titles (such as .. function::).
71 #add_module_names = True
72
73 # If true, sectionauthor and moduleauthor directives will be shown in the
74 # output. They are ignored by default.
75 #show_authors = False
76
77 # The name of the Pygments (syntax highlighting) style to use.
78 pygments_style = 'sphinx'
79
80
81 # Options for HTML output
82 # -----------------------
83
84 # The style sheet to use for HTML and HTML Help pages. A file of that name
85 # must exist either in Sphinx' static/ path, or in one of the custom paths
86 # given in html_static_path.
87 html_style = 'default.css'
88
89 # The name for this set of Sphinx documents. If None, it defaults to
90 # "<project> v<release> documentation".
91 #html_title = None
92
93 # A shorter title for the navigation bar. Default is the same as html_title.
94 #html_short_title = None
95
96 # The name of an image file (within the static path) to place at the top of
97 # the sidebar.
98 #html_logo = None
99
100 # The name of an image file (within the static path) to use as favicon of the
101 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
102 # pixels large.
103 #html_favicon = None
104
105 # Add any paths that contain custom static files (such as style sheets) here,
106 # relative to this directory. They are copied after the builtin static files,
107 # so a file named "default.css" will overwrite the builtin "default.css".
108 html_static_path = ['_static']
109
110 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
111 # using the given strftime format.
112 html_last_updated_fmt = '%b %d, %Y'
113
114 # If true, SmartyPants will be used to convert quotes and dashes to
115 # typographically correct entities.
116 #html_use_smartypants = True
117
118 # Custom sidebar templates, maps document names to template names.
119 #html_sidebars = {}
120
121 # Additional templates that should be rendered to pages, maps page names to
122 # template names.
123 #html_additional_pages = {}
124
125 # If false, no module index is generated.
126 html_use_modindex = False
127
128 # If false, no index is generated.
129 #html_use_index = True
130
131 # If true, the index is split into individual pages for each letter.
132 #html_split_index = False
133
134 # If true, the reST sources are included in the HTML build as _sources/<name>.
135 html_copy_source = False
136
137 # If true, an OpenSearch description file will be output, and all pages will
138 # contain a <link> tag referring to it. The value of this option must be the
139 # base URL from which the finished HTML is served.
140 #html_use_opensearch = ''
141
142 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
143 #html_file_suffix = ''
144
145 # Output file base name for HTML help builder.
146 htmlhelp_basename = 'Unbounddoc'
147
148
149 # Options for LaTeX output
150 # ------------------------
151
152 # The paper size ('letter' or 'a4').
153 #latex_paper_size = 'letter'
154
155 # The font size ('10pt', '11pt' or '12pt').
156 #latex_font_size = '10pt'
157
158 # Grouping the document tree into LaTeX files. List of tuples
159 # (source start file, target name, title, author, document class [howto/manual]).
160 latex_documents = [
161 ('index', 'Unbound.tex', 'Unbound Documentation',
162 'Zdenek Vasicek, Marek Vavrusa', 'manual'),
163 ]
164
165 # The name of an image file (relative to this directory) to place at the top of
166 # the title page.
167 #latex_logo = None
168
169 # For "manual" documents, if this is true, then toplevel headings are parts,
170 # not chapters.
171 #latex_use_parts = False
172
173 # Additional stuff for the LaTeX preamble.
174 #latex_preamble = ''
175
176 # Documents to append as an appendix to all manuals.
177 #latex_appendices = []
178
179 # If false, no module index is generated.
180 #latex_use_modindex = True
0 .. _example_resolve_name:
1
2 ==============================
3 Resolve a name
4 ==============================
5
6 This basic example shows how to create a context and resolve a host address (DNS record of A type).
7
8 ::
9
10 #!/usr/bin/python
11 import unbound
12
13 ctx = unbound.ub_ctx()
14 ctx.resolvconf("/etc/resolv.conf")
15
16 status, result = ctx.resolve("www.google.com")
17 if status == 0 and result.havedata:
18 print "Result.data:", result.data.address_list
19 elif status != 0:
20 print "Resolve error:", unbound.ub_strerror(status)
21
22 In contrast with C API, the source code is more compact while the performance of C implementation is preserved.
23 The main advantage is that you need not take care about the deallocation and allocation of context and result structures; pyUnbound module do it automatically for you.
24
25 If only domain name is given, the :meth:`unbound.ub_ctx.resolve` looks for A records in IN class.
0 .. _example_reverse_lookup:
1
2 ==============================
3 Reverse DNS lookup
4 ==============================
5
6 Reverse DNS lookup involves determining the hostname associated with a given IP address.
7 This example shows how reverse lookup can be done using unbound module.
8
9 For the reverse DNS records, the special domain in-addr.arpa is reserved.
10 For example, a host name for the IP address 74.125.43.147 can be obtained by issuing a DNS query for the PTR record for address 147.43.125.74.in-addr.arpa.
11
12 ::
13
14 #!/usr/bin/python
15 import unbound
16
17 ctx = unbound.ub_ctx()
18 ctx.resolvconf("/etc/resolv.conf")
19
20 status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
21 if status == 0 and result.havedata:
22 print "Result.data:", result.data.domain_list
23 elif status != 0:
24 print "Resolve error:", unbound.ub_strerror(status)
25
26 In order to simplify the python code, unbound module contains function which reverses the hostname components.
27 This function is defined as follows::
28
29 def reverse(domain):
30 return '.'.join([a for a in domain.split(".")][::-1])
31
32
0 .. _example_setup_ctx:
1
2 ==============================
3 Lookup from threads
4 ==============================
5
6 This example shows how to use unbound module from a threaded program.
7 In this example, three lookup threads are created which work in background.
8 Each thread resolves different DNS record.
9
10 ::
11
12 #!/usr/bin/python
13 from unbound import ub_ctx, RR_TYPE_A, RR_CLASS_IN
14 from threading import Thread
15
16 ctx = ub_ctx()
17 ctx.resolvconf("/etc/resolv.conf")
18
19 class LookupThread(Thread):
20 def __init__(self,ctx, name):
21 Thread.__init__(self)
22 self.ctx = ctx
23 self.name = name
24
25 def run(self):
26 print "Thread lookup started:",self.name
27 status, result = self.ctx.resolve(self.name, RR_TYPE_A, RR_CLASS_IN)
28 if status == 0 and result.havedata:
29 print " Result:",self.name,":", result.data.address_list
30
31 threads = []
32 for name in ["www.fit.vutbr.cz","www.vutbr.cz","www.google.com"]:
33 thread = LookupThread(ctx, name)
34 thread.start()
35 threads.append(thread)
36
37 for thread in threads:
38 thread.join()
39
40
0 .. _example_asynch:
1
2 ==============================
3 Asynchronous lookup
4 ==============================
5
6 This example performs the name lookup in the background.
7 The main program keeps running while the name is resolved.
8
9 ::
10
11 #!/usr/bin/python
12 import time
13 import unbound
14
15 ctx = unbound.ub_ctx()
16 ctx.resolvconf("/etc/resolv.conf")
17
18 def call_back(my_data,status,result):
19 print "Call_back:", my_data
20 if status == 0 and result.havedata:
21 print "Result:", result.data.address_list
22 my_data['done_flag'] = True
23
24
25 my_data = {'done_flag':False,'arbitrary':"object"}
26 status, async_id = ctx.resolve_async("www.seznam.cz", my_data, call_back, unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
27
28 while (status == 0) and (not my_data['done_flag']):
29 status = ctx.process()
30 time.sleep(0.1)
31
32 if (status != 0):
33 print "Resolve error:", unbound.ub_strerror(status)
34
35 The :meth:`unbound.ub_ctx.resolve_async` method is able to pass on any Python object. In this example, we used a dictionary object `my_data`.
0 .. _example_examine:
1
2 ==============================
3 DNSSEC validator
4 ==============================
5
6 This example program performs DNSSEC validation of a DNS lookup.
7
8 ::
9
10 #!/usr/bin/python
11 import os
12 from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN
13
14 ctx = ub_ctx()
15 ctx.resolvconf("/etc/resolv.conf")
16 if (os.path.isfile("keys")):
17 ctx.add_ta_file("keys") #read public keys for DNSSEC verification
18
19 status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
20 if status == 0 and result.havedata:
21
22 print "Result:", result.data.address_list
23
24 if result.secure:
25 print "Result is secure"
26 elif result.bogus:
27 print "Result is bogus"
28 else:
29 print "Result is insecure"
30
31 More detailed informations can be seen in libUnbound DNSSEC tutorial `here`_.
32
33 .. _here: http://www.unbound.net/documentation/libunbound-tutorial-6.html
0 .. _example_resolver_only:
1
2 ==============================
3 Resolver only
4 ==============================
5
6 This example program shows how to perform DNS resolution only.
7 Unbound contains two basic modules: resolver and validator.
8 In case, the validator is not necessary, the validator module can be turned off using "module-config" option.
9 This option contains a list of module names separated by the space char. This list determined which modules should be employed and in what order.
10
11 ::
12
13 #!/usr/bin/python
14 import os
15 from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN
16
17 ctx = ub_ctx()
18 ctx.set_option("module-config:","iterator")
19 ctx.resolvconf("/etc/resolv.conf")
20
21 status, result = ctx.resolve("www.google.com", RR_TYPE_A, RR_CLASS_IN)
22 if status == 0 and result.havedata:
23
24 print "Result:", result.data.address_list
25
26 .. note::
27 The :meth:`unbound.ub_ctx.set_option` method must be used before the first resolution (i.e. before :meth:`unbound.ub_ctx.resolve` or :meth:`unbound.ub_ctx.resolve_async` call).
28
0 #!/usr/bin/python
1 from unbound import ub_ctx,ub_strerror,RR_TYPE_A,RR_CLASS_IN
2
3 ctx = ub_ctx()
4 ctx.resolvconf("/etc/resolv.conf")
5
6 status, result = ctx.resolve("test.record.xxx", RR_TYPE_A, RR_CLASS_IN)
7 if status == 0 and result.havedata:
8 print "Result:", result.data.address_list
9 else:
10 print "No record found"
11
12 #define new local zone
13 status = ctx.zone_add("xxx.","static")
14 if (status != 0): print "Error zone_add:",status, ub_strerror(status)
15
16 #add RR to the zone
17 status = ctx.data_add("test.record.xxx. IN A 1.2.3.4")
18 if (status != 0): print "Error data_add:",status, ub_strerror(status)
19
20 #lookup for an A record
21 status, result = ctx.resolve("test.record.xxx", RR_TYPE_A, RR_CLASS_IN)
22 if status == 0 and result.havedata:
23 print "Result:", result.data.as_address_list()
24 else:
25 print "No record found"
26
0 .. _example_localzone:
1
2 ==============================
3 Local zone manipulation
4 ==============================
5
6 This example program shows how to define local zone containing custom DNS records.
7
8 .. literalinclude:: example6-1.py
9 :language: python
10
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 #
3 # IDN (Internationalized Domain Name) lookup support
4 #
5 import unbound
6
7 ctx = unbound.ub_ctx()
8 ctx.resolvconf("/etc/resolv.conf")
9
10 status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
11 if status == 0 and result.havedata:
12 print "Result:"
13 print " raw data:", result.data
14 for k in result.data.address_list:
15 print " address:%s" % k
16
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 #
3 # IDN (Internationalized Domain Name) lookup support (lookup for MX)
4 #
5 import unbound
6
7 ctx = unbound.ub_ctx()
8 ctx.resolvconf("/etc/resolv.conf")
9
10 status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
11 if status == 0 and result.havedata:
12 print "Result:"
13 print " raw data:", result.data
14 for k in result.data.mx_list_idn:
15 print " priority:%d address:%s" % k
0 .. _example_idna:
1
2 =================================================
3 Internationalized domain name support
4 =================================================
5
6 Unlike the libUnbound, pyUnbound is able to handle IDN queries.
7
8 .. literalinclude:: example7-1.py
9 :language: python
10
11 If we use unicode string in :meth:`unbound.ub_ctx.resolve` method, the IDN DNAME conversion (if it is necessary) is performed on background.
12
13 .. literalinclude:: example7-2.py
14 :language: python
15
16 The :class:`unbound.ub_data` class contains attributes suffix which converts the dname to UTF string. These attributes have the '_idn' suffix.
17 Apart from this aproach, two conversion functions exist (:func:`unbound.idn2dname` and :func:`unbound.dname2idn`).
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 #
3 # Lookup for MX and NS records
4 #
5 import unbound
6
7 ctx = unbound.ub_ctx()
8 ctx.resolvconf("/etc/resolv.conf")
9
10 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
11 if status == 0 and result.havedata:
12 print "Result:"
13 print " raw data:", result.data
14 for k in result.data.mx_list:
15 print " priority:%d address:%s" % k
16
17 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
18 if status == 0 and result.havedata:
19 print "Result:"
20 print " raw data:", result.data
21 for k in result.data.address_list:
22 print " address:%s" % k
23
24 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
25 if status == 0 and result.havedata:
26 print "Result:"
27 print " raw data:", result.data
28 for k in result.data.domain_list:
29 print " host: %s" % k
30
0 .. _example_mxlookup:
1
2 =================================================
3 Lookup for MX and NS records
4 =================================================
5
6 The pyUnbound extension provides functions which are able to encode RAW RDATA produces by unbound resolver (see :class:`unbound.ub_data`).
7
8 .. literalinclude:: example8-1.py
9 :language: python
10
11 Previous example produces following output::
12
13 Result:
14 raw data: 00 0F 05 6D 61 69 6C 34 03 6E 69 63 02 63 7A 00;00 14 02 6D 78 05 63 7A 6E 69 63 03 6F 72 67 00;00 0A 04 6D 61 69 6C 03 6E 69 63 02 63 7A 00
15 priority:15 address: mail4.nic.cz.
16 priority:20 address: mx.cznic.org.
17 priority:10 address: mail.nic.cz.
18
19 Result:
20 raw data: D9 1F CD 32
21 address: 217.31.205.50
22
23 Result:
24 raw data: 01 61 02 6E 73 03 6E 69 63 02 63 7A 00;01 65 02 6E 73 03 6E 69 63 02 63 7A 00;01 63 02 6E 73 03 6E 69 63 02 63 7A 00
25 host: a.ns.nic.cz.
26 host: e.ns.nic.cz.
27 host: c.ns.nic.cz.
0 Examples
1 ==============================
2
3 Here you can find several examples which utilizes the unbound library in Python environment.
4 Unbound is a caching validator and resolver and can be linked into an application, as a library where can answer DNS queries for the application.
5 This set of examples shows how to use the functions from Python environment.
6
7 `Tutorials`
8
9 .. toctree::
10 :maxdepth: 1
11 :glob:
12
13 example*
0 PyUnbound documentation
1 =======================================
2
3 This project contains an Unbound wrapper providing the thinnest layer over the library possible.
4 Everything you can do from the libUnbound C API, you can do from Python, even more.
5
6 Contents
7 ----------
8 .. toctree::
9 :maxdepth: 2
10
11 intro.rst
12 install.rst
13 examples/index.rst
14 modules/unbound
15
16 Module Documentation
17 -----------------------
18
19 * Module :mod:`unbound`
20
21 Indices and tables
22 -------------------
23
24 * :ref:`genindex`
25 * :ref:`search`
26
0 Installation
1 ===================================
2
3 **Prerequisites**
4
5 Python 2.4 or higher, SWIG 1.3 or higher, GNU make
6
7 **Download**
8
9 You can download the source codes `here`_.
10 The latest release is 1.1.1, Jan 15, 2009.
11
12 .. _here: unbound-1.1.1-py.tar.gz
13
14 **Compiling**
15
16 After downloading, you can compile the pyUnbound library by doing::
17
18 > tar -xzf unbound-1.1.1-py.tar.gz
19 > cd unbound-1.1.1
20 > ./configure --with-pyunbound
21 > make
22
23 You need GNU make to compile sources; SWIG and Python devel libraries to compile extension module.
24
25
26 **Testing**
27
28 If the compilation is successfull, you can test the python LDNS extension module by::
29
30 > cd contrib/python
31 > make testenv
32 > ./dns-lookup.py
33
34 In contrib/examples you can find simple applications written in Python using the Unbound extension.
0 Introduction
1 ===================================
2
3 **Unbound**
4
5 `Unbound`_ is an implementation of a DNS resolver, that performs caching and DNSSEC validation.
6 Together with unbound, the libunbound library is provided.
7 This library can be used to convert hostnames to ip addresses, and back, as well as obtain other information.
8 Since the resolver allows to specify the class and type of a query (A record, NS, MX, ...), this library offers powerful resolving tool.
9 The library also performs public-key validation of results with DNSSEC.
10
11 .. _Unbound: http://www.unbound.net/documentation
12
13 **pyUnbound**
14
15 The pyUnbound is an extension module for Python which provides an object-oriented interface to libunbound.
16 It is the first Python module which offers thread-safe caching resolver.
17
18 The interface was designed with the emphasis on the simplicity of use.
19 There are two main classes :class:`unbound.ub_ctx` (a validation and resolution context) and :class:`unbound.ub_result` which contains the validation and resolution results.
20 The objects are thread-safe, and a context can be used in non-threaded as well as threaded environment.
21 Resolution can be performed blocking and non-blocking (i.e. asynchronous).
22 The asynchronous method returns from the call immediately, so that processing can go on, while the results become available later.
23
24 **Features**
25 * customizable caching validation resolver for synchronous and asynchronous lookups
26 * easy to use object interface
27 * easy to integrate extension module
28 * designed for thread environment (i.e. thread-safe)
29 * allows define and customize of local zone and its RR's during the operation (i.e. without restart)
30 * includes encoding functions to simplify the results retrieval
31 * Internationalized domain name (`IDN`_) support
32
33 .. _IDN: http://en.wikipedia.org/wiki/Internationalized_domain_name
34
35 **Application area**
36 * DNS-based applications performing DNS lookups; the caching resolver can reduce overhead
37 * Applications where the validation of DNS records is required
38 * Great solution for customizable and dynamic DNS-based white/blacklists (spam rejection, connection rejection, ...) using the dynamic local zone manipulation
0 Unbound module documentation
1 ================================
2
3 .. automodule:: unbound
4
5 Class ub_ctx
6 --------------
7 .. autoclass:: ub_ctx
8 :members:
9 :undoc-members:
10
11 .. automethod:: __init__
12
13 Class ub_result
14 ----------------------
15 .. autoclass:: ub_result
16 :members:
17
18 .. attribute:: qname
19
20 The original question, name text string.
21
22 .. attribute:: qtype
23
24 The class asked for.
25
26 .. attribute:: canonname
27
28 Canonical name for the result (the final cname). May be empty if no canonical name exists.
29
30 .. attribute:: answer_packet
31
32 The DNS answer packet. Network formatted. Can contain DNSSEC types.
33
34 .. attribute:: havedata
35
36 If there is any data, this property is true. If false, there was no data (nxdomain may be true, rcode can be set).
37
38 .. attribute:: secure
39
40 True, if the result is validated securely.
41 False, if validation failed or domain queried has no security info.
42
43 It is possible to get a result with no data (havedata is false),
44 and secure is true. This means that the non-existance of the data
45 was cryptographically proven (with signatures).
46
47 .. attribute:: bogus
48
49 If the result was not secure (secure==0), and this result is due to a security failure, bogus is true.
50 This means the data has been actively tampered with, signatures
51 failed, expected signatures were not present, timestamps on
52 signatures were out of date and so on.
53
54 If secure==0 and bogus==0, this can happen if the data is not secure
55 because security is disabled for that domain name.
56 This means the data is from a domain where data is not signed.
57
58 .. attribute:: nxdomain
59
60 If there was no data, and the domain did not exist, this is true.
61 If it is false, and there was no data, then the domain name is purported to exist, but the requested data type is not available.
62
63 .. attribute:: rcode
64
65 DNS RCODE for the result. May contain additional error code if there was no data due to an error.
66 0 (RCODE_NOERROR) if okay. See predefined `RCODE_` constants.
67
68 RCODE can be represented in display representation form (string) using :attr:`rcode_str` attribute.
69
70 Class ub_data
71 ----------------------
72 .. autoclass:: ub_data
73 :members:
74
75 Functions
76 ----------------------
77 .. autofunction:: reverse
78 .. autofunction:: idn2dname
79 .. autofunction:: dname2idn
80
81 Predefined constants
82 -----------------------
83
84 **RCODE**
85 * RCODE_FORMERR = 1
86 * RCODE_NOERROR = 0
87 * RCODE_NOTAUTH = 9
88 * RCODE_NOTIMPL = 4
89 * RCODE_NOTZONE = 10
90 * RCODE_NXDOMAIN = 3
91 * RCODE_NXRRSET = 8
92 * RCODE_REFUSED = 5
93 * RCODE_SERVFAIL = 2
94 * RCODE_YXDOMAIN = 6
95 * RCODE_YXRRSET = 7
96
97 **RR_CLASS**
98 * RR_CLASS_ANY = 255
99 * RR_CLASS_CH = 3
100 * RR_CLASS_HS = 4
101 * RR_CLASS_IN = 1
102 * RR_CLASS_NONE = 254
103
104 **RR_TYPE**
105 * RR_TYPE_A = 1
106 * RR_TYPE_A6 = 38
107 * RR_TYPE_AAAA = 28
108 * RR_TYPE_AFSDB = 18
109 * RR_TYPE_ANY = 255
110 * RR_TYPE_APL = 42
111 * RR_TYPE_ATMA = 34
112 * RR_TYPE_AXFR = 252
113 * RR_TYPE_CERT = 37
114 * RR_TYPE_CNAME = 5
115 * RR_TYPE_DHCID = 49
116 * RR_TYPE_DLV = 32769
117 * RR_TYPE_DNAME = 39
118 * RR_TYPE_DNSKEY = 48
119 * RR_TYPE_DS = 43
120 * RR_TYPE_EID = 31
121 * RR_TYPE_GID = 102
122 * RR_TYPE_GPOS = 27
123 * RR_TYPE_HINFO = 13
124 * RR_TYPE_IPSECKEY = 45
125 * RR_TYPE_ISDN = 20
126 * RR_TYPE_IXFR = 251
127 * RR_TYPE_KEY = 25
128 * RR_TYPE_KX = 36
129 * RR_TYPE_LOC = 29
130 * RR_TYPE_MAILA = 254
131 * RR_TYPE_MAILB = 253
132 * RR_TYPE_MB = 7
133 * RR_TYPE_MD = 3
134 * RR_TYPE_MF = 4
135 * RR_TYPE_MG = 8
136 * RR_TYPE_MINFO = 14
137 * RR_TYPE_MR = 9
138 * RR_TYPE_MX = 15
139 * RR_TYPE_NAPTR = 35
140 * RR_TYPE_NIMLOC = 32
141 * RR_TYPE_NS = 2
142 * RR_TYPE_NSAP = 22
143 * RR_TYPE_NSAP_PTR = 23
144 * RR_TYPE_NSEC = 47
145 * RR_TYPE_NSEC3 = 50
146 * RR_TYPE_NSEC3PARAMS = 51
147 * RR_TYPE_NULL = 10
148 * RR_TYPE_NXT = 30
149 * RR_TYPE_OPT = 41
150 * RR_TYPE_PTR = 12
151 * RR_TYPE_PX = 26
152 * RR_TYPE_RP = 17
153 * RR_TYPE_RRSIG = 46
154 * RR_TYPE_RT = 21
155 * RR_TYPE_SIG = 24
156 * RR_TYPE_SINK = 40
157 * RR_TYPE_SOA = 6
158 * RR_TYPE_SRV = 33
159 * RR_TYPE_SSHFP = 44
160 * RR_TYPE_TSIG = 250
161 * RR_TYPE_TXT = 16
162 * RR_TYPE_UID = 101
163 * RR_TYPE_UINFO = 100
164 * RR_TYPE_UNSPEC = 103
165 * RR_TYPE_WKS = 11
166 * RR_TYPE_X25 = 19
0 #!/usr/bin/python
1 '''
2 async-lookup.py : This example shows how to use asynchronous lookups
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 import unbound
35 import time
36
37 ctx = unbound.ub_ctx()
38 ctx.resolvconf("/etc/resolv.conf")
39
40 def call_back(my_data,status,result):
41 print "Call_back:", my_data
42 if status == 0 and result.havedata:
43 print "Result:", result.data.address_list
44 my_data['done_flag'] = True
45
46
47 my_data = {'done_flag':False,'arbitrary':"object"}
48 status, async_id = ctx.resolve_async("www.nic.cz", my_data, call_back, unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
49
50 while (status == 0) and (not my_data['done_flag']):
51 status = ctx.process()
52 time.sleep(0.1)
53
54 if (status != 0):
55 print "Resolve error:", unbound.ub_strerror(status)
0 #!/usr/bin/python
1 '''
2 dns-lookup.py : This example shows how to resolve IP address
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 import unbound
35
36 ctx = unbound.ub_ctx()
37 ctx.resolvconf("/etc/resolv.conf")
38
39 status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
40 if status == 0 and result.havedata:
41 print "Result:", result.data.address_list
42 elif status != 0:
43 print "Error:", unbound.ub_strerror(status)
0 #!/usr/bin/python
1 '''
2 dnssec-valid.py: DNSSEC validation
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 import os
35 from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN
36
37 ctx = ub_ctx()
38 ctx.resolvconf("/etc/resolv.conf")
39
40 fw = open("dnssec-valid.txt","wb")
41 ctx.debugout(fw)
42 ctx.debuglevel(2)
43
44 if os.path.isfile("keys"):
45 ctx.add_ta_file("keys") #read public keys for DNSSEC verificatio
46
47 status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
48 if status == 0 and result.havedata:
49
50 print "Result:", result.data.address_list
51
52 if result.secure:
53 print "Result is secure"
54 elif result.bogus:
55 print "Result is bogus"
56 else:
57 print "Result is insecure"
58
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 '''
3 example8-1.py: Example shows how to lookup for MX and NS records
4
5 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
6 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
7
8 Copyright (c) 2008. All rights reserved.
9
10 This software is open source.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
18
19 Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35 import unbound
36
37 ctx = unbound.ub_ctx()
38 ctx.resolvconf("/etc/resolv.conf")
39
40 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
41 if status == 0 and result.havedata:
42 print "Result:"
43 print " raw data:", result.data
44 for k in result.data.mx_list:
45 print " priority:%d address:%s" % k
46
47 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
48 if status == 0 and result.havedata:
49 print "Result:"
50 print " raw data:", result.data
51 for k in result.data.address_list:
52 print " address:%s" % k
53
54 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
55 if status == 0 and result.havedata:
56 print "Result:"
57 print " raw data:", result.data
58 for k in result.data.domain_list:
59 print " host: %s" % k
60
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 '''
3 idn-lookup.py: IDN (Internationalized Domain Name) lookup support
4
5 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
6 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
7
8 Copyright (c) 2008. All rights reserved.
9
10 This software is open source.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
18
19 Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35 import unbound
36 import locale
37
38 ctx = unbound.ub_ctx()
39 ctx.set_option("module-config:","iterator") #We don't need validation
40 ctx.resolvconf("/etc/resolv.conf")
41
42 #The unicode IDN string is automatically converted (if necessary)
43 status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
44 if status == 0 and result.havedata:
45 print "Result:"
46 print " raw data:", result.data
47 for k in result.data.address_list:
48 print " address:%s" % k
49
50 status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
51 if status == 0 and result.havedata:
52 print "Result:"
53 print " raw data:", result.data
54 for k in result.data.mx_list_idn:
55 print " priority:%d address:%s" % k
56
57 status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
58 if status == 0 and result.havedata:
59 print "Result.data:", result.data
60 for k in result.data.domain_list_idn:
61 print " dname:%s" % k
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 '''
3 mx-lookup.py: Lookup for MX records
4
5 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
6 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
7
8 Copyright (c) 2008. All rights reserved.
9
10 This software is open source.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
18
19 Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35 import unbound
36
37 ctx = unbound.ub_ctx()
38 ctx.resolvconf("/etc/resolv.conf")
39
40 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
41 if status == 0 and result.havedata:
42 print "Result:"
43 print " raw data:", result.data
44 for k in result.data.mx_list:
45 print " priority:%d address:%s" % k
46
47 status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
48 if status == 0 and result.havedata:
49 print "Result:"
50 print " raw data:", result.data
51 for k in result.data.address_list:
52 print " address:%s" % k
0 #!/usr/bin/python
1 # vim:fileencoding=utf-8
2 '''
3 ns-lookup.py: Example shows how to lookup for NS records
4
5 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
6 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
7
8 Copyright (c) 2008. All rights reserved.
9
10 This software is open source.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
18
19 Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35 import unbound
36
37 ctx = unbound.ub_ctx()
38 ctx.resolvconf("/etc/resolv.conf")
39
40 status, result = ctx.resolve("vutbr.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
41 if status == 0 and result.havedata:
42 print "Result:"
43 print " raw data:", result.data
44 for k in result.data.domain_list:
45 print " host: %s" % k
46
0 #!/usr/bin/python
1 '''
2 reverse-lookup.py: Example shows how to resolve reverse record
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 import unbound
35
36 ctx = unbound.ub_ctx()
37 ctx.resolvconf("/etc/resolv.conf")
38
39 status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
40 if status == 0 and result.havedata:
41 print "Result.data:", result.data, result.data.domain_list
42
0 /*
1 * libounbound.i: pyUnbound module (libunbound wrapper for Python)
2 *
3 * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 * Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * * Neither the name of the organization nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35 %module unbound
36 %{
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
41 #include "libunbound/unbound.h"
42 %}
43
44 %pythoncode %{
45 import encodings.idna
46 %}
47
48 //%include "doc.i"
49 %include "file.i"
50
51 %feature("docstring") strerror "Convert error value to a human readable string."
52
53 // ================================================================================
54 // ub_resolve - perform resolution and validation
55 // ================================================================================
56 %typemap(in,numinputs=0,noblock=1) (struct ub_result** result)
57 {
58 struct ub_result* newubr;
59 $1 = &newubr;
60 }
61
62 /* result generation */
63 %typemap(argout,noblock=1) (struct ub_result** result)
64 {
65 if(1) { /* new code block for variable on stack */
66 PyObject* tuple;
67 tuple = PyTuple_New(2);
68 PyTuple_SetItem(tuple, 0, $result);
69 if (result == 0) {
70 PyTuple_SetItem(tuple, 1, SWIG_NewPointerObj(SWIG_as_voidptr(newubr), SWIGTYPE_p_ub_result, SWIG_POINTER_OWN | 0 ));
71 } else {
72 PyTuple_SetItem(tuple, 1, Py_None);
73 }
74 $result = tuple;
75 }
76 }
77
78
79 // ================================================================================
80 // ub_ctx - validation context
81 // ================================================================================
82 %nodefaultctor ub_ctx; //no default constructor & destructor
83 %nodefaultdtor ub_ctx;
84
85 %newobject ub_ctx_create;
86 %delobject ub_ctx_delete;
87 %rename(_ub_ctx_delete) ub_ctx_delete;
88
89 %newobject ub_resolve;
90
91 %inline %{
92 void ub_ctx_free_dbg (struct ub_ctx* c) {
93 printf("******** UB_CTX free 0x%lX ************\n", (long unsigned int)c);
94 ub_ctx_delete(c);
95 }
96
97 //RR types
98 enum enum_rr_type
99 {
100 /** a host address */
101 RR_TYPE_A = 1,
102 /** an authoritative name server */
103 RR_TYPE_NS = 2,
104 /** a mail destination (Obsolete - use MX) */
105 RR_TYPE_MD = 3,
106 /** a mail forwarder (Obsolete - use MX) */
107 RR_TYPE_MF = 4,
108 /** the canonical name for an alias */
109 RR_TYPE_CNAME = 5,
110 /** marks the start of a zone of authority */
111 RR_TYPE_SOA = 6,
112 /** a mailbox domain name (EXPERIMENTAL) */
113 RR_TYPE_MB = 7,
114 /** a mail group member (EXPERIMENTAL) */
115 RR_TYPE_MG = 8,
116 /** a mail rename domain name (EXPERIMENTAL) */
117 RR_TYPE_MR = 9,
118 /** a null RR (EXPERIMENTAL) */
119 RR_TYPE_NULL = 10,
120 /** a well known service description */
121 RR_TYPE_WKS = 11,
122 /** a domain name pointer */
123 RR_TYPE_PTR = 12,
124 /** host information */
125 RR_TYPE_HINFO = 13,
126 /** mailbox or mail list information */
127 RR_TYPE_MINFO = 14,
128 /** mail exchange */
129 RR_TYPE_MX = 15,
130 /** text strings */
131 RR_TYPE_TXT = 16,
132 /** RFC1183 */
133 RR_TYPE_RP = 17,
134 /** RFC1183 */
135 RR_TYPE_AFSDB = 18,
136 /** RFC1183 */
137 RR_TYPE_X25 = 19,
138 /** RFC1183 */
139 RR_TYPE_ISDN = 20,
140 /** RFC1183 */
141 RR_TYPE_RT = 21,
142 /** RFC1706 */
143 RR_TYPE_NSAP = 22,
144 /** RFC1348 */
145 RR_TYPE_NSAP_PTR = 23,
146 /** 2535typecode */
147 RR_TYPE_SIG = 24,
148 /** 2535typecode */
149 RR_TYPE_KEY = 25,
150 /** RFC2163 */
151 RR_TYPE_PX = 26,
152 /** RFC1712 */
153 RR_TYPE_GPOS = 27,
154 /** ipv6 address */
155 RR_TYPE_AAAA = 28,
156 /** LOC record RFC1876 */
157 RR_TYPE_LOC = 29,
158 /** 2535typecode */
159 RR_TYPE_NXT = 30,
160 /** draft-ietf-nimrod-dns-01.txt */
161 RR_TYPE_EID = 31,
162 /** draft-ietf-nimrod-dns-01.txt */
163 RR_TYPE_NIMLOC = 32,
164 /** SRV record RFC2782 */
165 RR_TYPE_SRV = 33,
166 /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */
167 RR_TYPE_ATMA = 34,
168 /** RFC2915 */
169 RR_TYPE_NAPTR = 35,
170 /** RFC2230 */
171 RR_TYPE_KX = 36,
172 /** RFC2538 */
173 RR_TYPE_CERT = 37,
174 /** RFC2874 */
175 RR_TYPE_A6 = 38,
176 /** RFC2672 */
177 RR_TYPE_DNAME = 39,
178 /** dnsind-kitchen-sink-02.txt */
179 RR_TYPE_SINK = 40,
180 /** Pseudo OPT record... */
181 RR_TYPE_OPT = 41,
182 /** RFC3123 */
183 RR_TYPE_APL = 42,
184 /** draft-ietf-dnsext-delegation */
185 RR_TYPE_DS = 43,
186 /** SSH Key Fingerprint */
187 RR_TYPE_SSHFP = 44,
188 /** draft-richardson-ipseckey-rr-11.txt */
189 RR_TYPE_IPSECKEY = 45,
190 /** draft-ietf-dnsext-dnssec-25 */
191 RR_TYPE_RRSIG = 46,
192 RR_TYPE_NSEC = 47,
193 RR_TYPE_DNSKEY = 48,
194 RR_TYPE_DHCID = 49,
195
196 RR_TYPE_NSEC3 = 50,
197 RR_TYPE_NSEC3PARAMS = 51,
198
199 RR_TYPE_UINFO = 100,
200 RR_TYPE_UID = 101,
201 RR_TYPE_GID = 102,
202 RR_TYPE_UNSPEC = 103,
203
204 RR_TYPE_TSIG = 250,
205 RR_TYPE_IXFR = 251,
206 RR_TYPE_AXFR = 252,
207 /** A request for mailbox-related records (MB, MG or MR) */
208 RR_TYPE_MAILB = 253,
209 /** A request for mail agent RRs (Obsolete - see MX) */
210 RR_TYPE_MAILA = 254,
211 /** any type (wildcard) */
212 RR_TYPE_ANY = 255,
213
214 /* RFC 4431, 5074, DNSSEC Lookaside Validation */
215 RR_TYPE_DLV = 32769,
216 };
217
218 // RR classes
219 enum enum_rr_class
220 {
221 /** the Internet */
222 RR_CLASS_IN = 1,
223 /** Chaos class */
224 RR_CLASS_CH = 3,
225 /** Hesiod (Dyer 87) */
226 RR_CLASS_HS = 4,
227 /** None class, dynamic update */
228 RR_CLASS_NONE = 254,
229 /** Any class */
230 RR_CLASS_ANY = 255,
231 };
232 %}
233
234 %feature("docstring") ub_ctx "Unbound resolving and validation context.
235
236 The validation context is created to hold the resolver status, validation keys and a small cache (containing messages, rrsets, roundtrip times, trusted keys, lameness information).
237
238 **Usage**
239
240 >>> import unbound
241 >>> ctx = unbound.ub_ctx()
242 >>> ctx.resolvconf(\"/etc/resolv.conf\")
243 >>> status, result = ctx.resolve(\"www.google.com\", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
244 >>> if status==0 and result.havedata:
245 >>> print \"Result:\",result.data.address_list
246 Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
247 "
248
249 %extend ub_ctx
250 {
251 %pythoncode %{
252 def __init__(self):
253 """Creates a resolving and validation context.
254
255 An exception is invoked if the process of creation an ub_ctx instance fails.
256 """
257 self.this = _unbound.ub_ctx_create()
258 if not self.this:
259 raise Exception("Fatal error: unbound context initialization failed")
260
261 #__swig_destroy__ = _unbound.ub_ctx_free_dbg
262 __swig_destroy__ = _unbound._ub_ctx_delete
263
264 #UB_CTX_METHODS_#
265 def add_ta(self,ta):
266 """Add a trust anchor to the given context.
267
268 The trust anchor is a string, on one line, that holds a valid DNSKEY or DS RR.
269
270 :param ta:
271 string, with zone-format RR on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
272 :returns: (int) 0 if OK, else error.
273 """
274 return _unbound.ub_ctx_add_ta(self,ta)
275 #parameters: struct ub_ctx *,char *,
276 #retvals: int
277
278 def add_ta_file(self,fname):
279 """Add trust anchors to the given context.
280
281 Pass name of a file with DS and DNSKEY records (like from dig or drill).
282
283 :param fname:
284 filename of file with keyfile with trust anchors.
285 :returns: (int) 0 if OK, else error.
286 """
287 return _unbound.ub_ctx_add_ta_file(self,fname)
288 #parameters: struct ub_ctx *,char *,
289 #retvals: int
290
291 def config(self,fname):
292 """setup configuration for the given context.
293
294 :param fname:
295 unbound config file (not all settings applicable). This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist.
296 :returns: (int) 0 if OK, else error.
297 """
298 return _unbound.ub_ctx_config(self,fname)
299 #parameters: struct ub_ctx *,char *,
300 #retvals: int
301
302 def debuglevel(self,d):
303 """Set debug verbosity for the context Output is directed to stderr.
304
305 :param d:
306 debug level, 0 is off, 1 is very minimal, 2 is detailed, and 3 is lots.
307 :returns: (int) 0 if OK, else error.
308 """
309 return _unbound.ub_ctx_debuglevel(self,d)
310 #parameters: struct ub_ctx *,int,
311 #retvals: int
312
313 def debugout(self,out):
314 """Set debug output (and error output) to the specified stream.
315
316 Pass None to disable. Default is stderr.
317
318 :param out:
319 File stream to log to.
320 :returns: (int) 0 if OK, else error.
321
322 **Usage:**
323
324 In order to log into file, use
325
326 ::
327
328 ctx = unbound.ub_ctx()
329 fw = fopen("debug.log")
330 ctx.debuglevel(3)
331 ctx.debugout(fw)
332
333 Another option is to print the debug informations to stderr output
334
335 ::
336
337 ctx = unbound.ub_ctx()
338 ctx.debuglevel(10)
339 ctx.debugout(sys.stderr)
340 """
341 return _unbound.ub_ctx_debugout(self,out)
342 #parameters: struct ub_ctx *,void *,
343 #retvals: int
344
345 def hosts(self,fname="/etc/hosts"):
346 """Read list of hosts from the filename given.
347
348 Usually "/etc/hosts". These addresses are not flagged as DNSSEC secure when queried for.
349
350 :param fname:
351 file name string. If None "/etc/hosts" is used.
352 :returns: (int) 0 if OK, else error.
353 """
354 return _unbound.ub_ctx_hosts(self,fname)
355 #parameters: struct ub_ctx *,char *,
356 #retvals: int
357
358 def print_local_zones(self):
359 """Print the local zones and their content (RR data) to the debug output.
360
361 :returns: (int) 0 if OK, else error.
362 """
363 return _unbound.ub_ctx_print_local_zones(self)
364 #parameters: struct ub_ctx *,
365 #retvals: int
366
367 def resolvconf(self,fname="/etc/resolv.conf"):
368 """Read list of nameservers to use from the filename given.
369
370 Usually "/etc/resolv.conf". Uses those nameservers as caching proxies. If they do not support DNSSEC, validation may fail.
371
372 Only nameservers are picked up, the searchdomain, ndots and other settings from resolv.conf(5) are ignored.
373
374 :param fname:
375 file name string. If None "/etc/resolv.conf" is used.
376 :returns: (int) 0 if OK, else error.
377 """
378 return _unbound.ub_ctx_resolvconf(self,fname)
379 #parameters: struct ub_ctx *,char *,
380 #retvals: int
381
382 def set_async(self,dothread):
383 """Set a context behaviour for asynchronous action.
384
385 :param dothread:
386 if True, enables threading and a call to :meth:`resolve_async` creates a thread to handle work in the background.
387 If False, a process is forked to handle work in the background.
388 Changes to this setting after :meth:`async` calls have been made have no effect (delete and re-create the context to change).
389 :returns: (int) 0 if OK, else error.
390 """
391 return _unbound.ub_ctx_async(self,dothread)
392 #parameters: struct ub_ctx *,int,
393 #retvals: int
394
395 def set_fwd(self,addr):
396 """Set machine to forward DNS queries to, the caching resolver to use.
397
398 IP4 or IP6 address. Forwards all DNS requests to that machine, which is expected to run a recursive resolver. If the is not DNSSEC-capable, validation may fail. Can be called several times, in that case the addresses are used as backup servers.
399
400 To read the list of nameservers from /etc/resolv.conf (from DHCP or so), use the call :meth:`resolvconf`.
401
402 :param addr:
403 address, IP4 or IP6 in string format. If the addr is None, forwarding is disabled.
404 :returns: (int) 0 if OK, else error.
405 """
406 return _unbound.ub_ctx_set_fwd(self,addr)
407 #parameters: struct ub_ctx *,char *,
408 #retvals: int
409
410 def set_option(self,opt,val):
411 """Set an option for the context.
412
413 Changes to the options after :meth:`resolve`, :meth:`resolve_async`, :meth:`zone_add`, :meth:`zone_remove`, :meth:`data_add` or :meth:`data_remove` have no effect (you have to delete and re-create the context).
414
415 :param opt:
416 option name from the unbound.conf config file format. (not all settings applicable). The name includes the trailing ':' for example set_option("logfile:", "mylog.txt"); This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist.
417 :param val:
418 value of the option.
419 :returns: (int) 0 if OK, else error.
420 """
421 return _unbound.ub_ctx_set_option(self,opt,val)
422 #parameters: struct ub_ctx *,char *,char *,
423 #retvals: int
424
425 def trustedkeys(self,fname):
426 """Add trust anchors to the given context.
427
428 Pass the name of a bind-style config file with trusted-keys{}.
429
430 :param fname:
431 filename of file with bind-style config entries with trust anchors.
432 :returns: (int) 0 if OK, else error.
433 """
434 return _unbound.ub_ctx_trustedkeys(self,fname)
435 #parameters: struct ub_ctx *,char *,
436 #retvals: int
437 #_UB_CTX_METHODS#
438
439 def zone_print(self):
440 """Print local zones using debougout"""
441 _unbound.ub_ctx_print_local_zones(self)
442
443 def zone_add(self,zonename,zonetype):
444 """Add new local zone
445
446 :param zonename: zone domain name (e.g. myzone.)
447 :param zonetype: type of the zone ("static",...)
448 :returns: (int) 0 if OK, else error.
449 """
450 return _unbound.ub_ctx_zone_add(self,zonename, zonetype)
451 #parameters: struct ub_ctx *,char*, char*
452 #retvals: int
453
454 def zone_remove(self,zonename):
455 """Remove local zone
456
457 If exists, removes local zone with all the RRs.
458
459 :param zonename: zone domain name
460 :returns: (int) 0 if OK, else error.
461 """
462 return _unbound.ub_ctx_zone_remove(self,zonename)
463 #parameters: struct ub_ctx *,char*
464 #retvals: int
465
466 def data_add(self,rrdata):
467 """Add new local RR data
468
469 :param rrdata: string, in zone-format on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
470 :returns: (int) 0 if OK, else error.
471
472 **Usage**
473 The local data ...
474
475 ::
476
477 >>> ctx = unbound.ub_ctx()
478 >>> ctx.zone_add("mydomain.net.","static")
479 0
480 >>> status = ctx.data_add("test.mydomain.net. IN A 192.168.1.1")
481 0
482 >>> status, result = ctx.resolve("test.mydomain.net")
483 >>> if status==0 and result.havedata:
484 >>> print \"Result:\",result.data.address_list
485 Result: ['192.168.1.1']
486
487 """
488 return _unbound.ub_ctx_data_add(self,rrdata)
489 #parameters: struct ub_ctx *,char*
490 #retvals: int
491
492 def data_remove(self,rrdata):
493 """Remove local RR data
494
495 If exists, remove resource record from local zone
496
497 :param rrdata: string, in zone-format on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
498 :returns: (int) 0 if OK, else error.
499 """
500 return _unbound.ub_ctx_data_remove(self,rrdata)
501 #parameters: struct ub_ctx *,char*
502 #retvals: int
503
504 #UB_METHODS_#
505 def cancel(self,async_id):
506 """Cancel an async query in progress.
507
508 Its callback will not be called.
509
510 :param async_id:
511 which query to cancel.
512 :returns: (int) 0 if OK, else error.
513 """
514 return _unbound.ub_cancel(self,async_id)
515 #parameters: struct ub_ctx *,int,
516 #retvals: int
517
518 def get_fd(self):
519 """Get file descriptor.
520
521 Wait for it to become readable, at this point answers are returned from the asynchronous validating resolver. Then call the ub_process to continue processing. This routine works immediately after context creation, the fd does not change.
522
523 :returns: (int) -1 on error, or file descriptor to use select(2) with.
524 """
525 return _unbound.ub_fd(self)
526 #parameters: struct ub_ctx *,
527 #retvals: int
528
529 def poll(self):
530 """Poll a context to see if it has any new results Do not poll in a loop, instead extract the fd below to poll for readiness, and then check, or wait using the wait routine.
531
532 :returns: (int) 0 if nothing to read, or nonzero if a result is available. If nonzero, call ctx_process() to do callbacks.
533 """
534 return _unbound.ub_poll(self)
535 #parameters: struct ub_ctx *,
536 #retvals: int
537
538 def process(self):
539 """Call this routine to continue processing results from the validating resolver (when the fd becomes readable).
540
541 Will perform necessary callbacks.
542
543 :returns: (int) 0 if OK, else error.
544 """
545 return _unbound.ub_process(self)
546 #parameters: struct ub_ctx *,
547 #retvals: int
548
549 def resolve(self,name,rrtype=RR_TYPE_A,rrclass=RR_CLASS_IN):
550 """Perform resolution and validation of the target name.
551
552 :param name:
553 domain name in text format (a string or unicode string). IDN domain name have to be passed as a unicode string.
554 :param rrtype:
555 type of RR in host order (optional argument). Default value is RR_TYPE_A (A class).
556 :param rrclass:
557 class of RR in host order (optional argument). Default value is RR_CLASS_IN (for internet).
558 :returns: * (int) 0 if OK, else error.
559 * (:class:`ub_result`) the result data is returned in a newly allocated result structure. May be None on return, return value is set to an error in that case (out of memory).
560 """
561 if isinstance(name, unicode): #probably IDN
562 return _unbound.ub_resolve(self,idn2dname(name),rrtype,rrclass)
563 else:
564 return _unbound.ub_resolve(self,name,rrtype,rrclass)
565 #parameters: struct ub_ctx *,char *,int,int,
566 #retvals: int,struct ub_result **
567
568 def resolve_async(self,name,mydata,callback,rrtype=RR_TYPE_A,rrclass=RR_CLASS_IN):
569 """Perform resolution and validation of the target name.
570
571 Asynchronous, after a while, the callback will be called with your data and the result.
572 If an error happens during processing, your callback will be called with error set to a nonzero value (and result==None).
573
574 :param name:
575 domain name in text format (a string or unicode string). IDN domain name have to be passed as a unicode string.
576 :param mydata:
577 this data is your own data (you can pass arbitrary python object or None) which are passed on to the callback function.
578 :param callback:
579 call-back function which is called on completion of the resolution.
580 :param rrtype:
581 type of RR in host order (optional argument). Default value is RR_TYPE_A (A class).
582 :param rrclass:
583 class of RR in host order (optional argument). Default value is RR_CLASS_IN (for internet).
584 :returns: * (int) 0 if OK, else error.
585 * (int) async_id, an identifier number is returned for the query as it is in progress. It can be used to cancel the query.
586
587 **Call-back function:**
588 The call-back function looks as the follows::
589
590 def call_back(mydata, status, result):
591 pass
592
593 **Parameters:**
594 * `mydata` - mydata object
595 * `status` - 0 when a result has been found
596 * `result` - the result structure. The result may be None, in that case err is set.
597
598 """
599 if isinstance(name, unicode): #probably IDN
600 return _unbound._ub_resolve_async(self,idn2dname(name),rrtype,rrclass,mydata,callback)
601 else:
602 return _unbound._ub_resolve_async(self,name,rrtype,rrclass,mydata,callback)
603 #parameters: struct ub_ctx *,char *,int,int,void *,ub_callback_t,
604 #retvals: int, int
605
606 def wait(self):
607 """Wait for a context to finish with results.
608
609 Calls after the wait for you. After the wait, there are no more outstanding asynchronous queries.
610
611 :returns: (int) 0 if OK, else error.
612 """
613 return _unbound.ub_wait(self)
614 #parameters: struct ub_ctx *,
615 #retvals: int
616
617 #_UB_METHODS#
618 %}
619 }
620
621
622 // ================================================================================
623 // ub_result - validation and resolution results
624 // ================================================================================
625 %nodefaultctor ub_result; //no default constructor & destructor
626 %nodefaultdtor ub_result;
627
628 %delobject ub_resolve_free;
629 %rename(_ub_resolve_free) ub_resolve_free;
630
631 %inline %{
632 void ub_resolve_free_dbg (struct ub_result* r) {
633 printf("******** UB_RESOLVE free 0x%lX ************\n", (long unsigned int)r);
634 ub_resolve_free(r);
635 }
636 %}
637
638 %feature("docstring") ub_result "The validation and resolution results."
639
640 //ub_result.rcode
641 %inline %{
642 enum result_enum_rcode {
643 RCODE_NOERROR = 0,
644 RCODE_FORMERR = 1,
645 RCODE_SERVFAIL = 2,
646 RCODE_NXDOMAIN = 3,
647 RCODE_NOTIMPL = 4,
648 RCODE_REFUSED = 5,
649 RCODE_YXDOMAIN = 6,
650 RCODE_YXRRSET = 7,
651 RCODE_NXRRSET = 8,
652 RCODE_NOTAUTH = 9,
653 RCODE_NOTZONE = 10
654 };
655 %}
656
657 %pythoncode %{
658 class ub_data:
659 """Class which makes the resolution results accessible"""
660 def __init__(self, data):
661 """Creates ub_data class
662 :param data: a list of the result data in RAW format
663 """
664 if data == None:
665 raise Exception("ub_data init: No data")
666 self.data = data
667
668 def __str__(self):
669 """Represents data as string"""
670 return ';'.join([' '.join(map(lambda x:"%02X" % ord(x),a)) for a in self.data])
671
672 @staticmethod
673 def dname2str(s, ofs=0, maxlen=0):
674 """Parses DNAME and produces a list of labels
675
676 :param ofs: where the conversion should start to parse data
677 :param maxlen: maximum length (0 means parse to the end)
678 :returns: list of labels (string)
679 """
680 if not s:
681 return []
682
683 res = []
684 slen = len(s)
685 if maxlen > 0:
686 slen = min(slen, maxlen)
687
688 idx = ofs
689 while (idx < slen):
690 complen = ord(s[idx])
691 res.append(s[idx+1:idx+1+complen])
692 idx += complen + 1
693
694 return res
695
696 def as_raw_data(self):
697 """Returns a list of RAW strings"""
698 return self.data
699
700 raw = property(as_raw_data, doc="Returns RAW data (a list of binary encoded strings). See :meth:`as_raw_data`")
701
702 def as_mx_list(self):
703 """Represents data as a list of MX records (query for RR_TYPE_MX)
704
705 :returns: list of tuples (priority, dname)
706 """
707 return [(256*ord(rdf[0])+ord(rdf[1]),'.'.join([a for a in self.dname2str(rdf,2)])) for rdf in self.data]
708
709 mx_list = property(as_mx_list, doc="Returns a list of tuples containing priority and domain names. See :meth:`as_mx_list`")
710
711 def as_idn_mx_list(self):
712 """Represents data as a list of MX records (query for RR_TYPE_MX)
713
714 :returns: list of tuples (priority, unicode dname)
715 """
716 return [(256*ord(rdf[0])+ord(rdf[1]),'.'.join([encodings.idna.ToUnicode(a) for a in self.dname2str(rdf,2)])) for rdf in self.data]
717
718 mx_list_idn = property(as_idn_mx_list, doc="Returns a list of tuples containing priority and IDN domain names. See :meth:`as_idn_mx_list`")
719
720 def as_address_list(self):
721 """Represents data as a list of IP addresses (query for RR_TYPE_PTR)
722
723 :returns: list of strings
724 """
725 return ['.'.join(map(lambda x:str(ord(x)),a)) for a in self.data]
726
727 address_list = property(as_address_list, doc="Returns a list of IP addresses. See :meth:`as_address_list`")
728
729 def as_domain_list(self):
730 """Represents data as a list of domain names (query for RR_TYPE_A)
731
732 :returns: list of strings
733 """
734 return map(lambda x:'.'.join(self.dname2str(x)), self.data)
735
736 domain_list = property(as_domain_list, doc="Returns a list of domain names. See :meth:`as_domain_list`")
737
738 def as_idn_domain_list(self):
739 """Represents data as a list of unicode domain names (query for RR_TYPE_A)
740
741 :returns: list of strings
742 """
743 return map(lambda x: '.'.join([encodings.idna.ToUnicode(a) for a in self.dname2str(x)]), self.data)
744
745 domain_list_idn = property(as_idn_domain_list, doc="Returns a list of IDN domain names. See :meth:`as_idn_domain_list`")
746 %}
747
748 %extend ub_result
749 {
750
751 %rename(_data) data;
752
753 PyObject* _ub_result_data(struct ub_result* result) {
754 PyObject *list;
755 int i,cnt;
756 (void)self;
757 if ((result == 0) || (!result->havedata) || (result->data == 0))
758 return Py_None;
759
760 for (cnt=0,i=0;;i++,cnt++)
761 if (result->data[i] == 0)
762 break;
763
764 list = PyList_New(cnt);
765 for (i=0;i<cnt;i++)
766 PyList_SetItem(list, i, PyString_FromStringAndSize(result->data[i],result->len[i]));
767
768 return list;
769 }
770
771 %pythoncode %{
772 def __init__(self):
773 raise Exception("This class can't be created directly.")
774
775 #__swig_destroy__ = _unbound.ub_resolve_free_dbg
776 __swig_destroy__ = _unbound._ub_resolve_free
777
778 #havedata = property(_unbound.ub_result_havedata_get, _unbound.ub_result_havedata_set, "Havedata property")
779
780 rcode2str = {RCODE_NOERROR:'no error', RCODE_FORMERR:'form error', RCODE_SERVFAIL:'serv fail', RCODE_NXDOMAIN:'nx domain', RCODE_NOTIMPL:'not implemented', RCODE_REFUSED:'refused', RCODE_YXDOMAIN:'yxdomain', RCODE_YXRRSET:'yxrrset', RCODE_NXRRSET:'nxrrset', RCODE_NOTAUTH:'not auth', RCODE_NOTZONE:'not zone'}
781
782 def _get_rcode_str(self):
783 """Returns rcode in display representation form
784
785 :returns: string
786 """
787 return self.rcode2str[self.rcode]
788
789 __swig_getmethods__["rcode_str"] = _get_rcode_str
790 if _newclass:rcode_str = _swig_property(_get_rcode_str)
791
792 def _get_raw_data(self):
793 """Result data, a list of network order DNS rdata items.
794
795 Data are represented as a list of strings. To decode RAW data to the list of IP addresses use :attr:`data` attribute which returns an :class:`ub_data` instance containing conversion function.
796 """
797 return self._ub_result_data(self)
798
799 __swig_getmethods__["rawdata"] = _get_raw_data
800 rawdata = property(_get_raw_data, doc="Returns raw data, a list of rdata items. To decode RAW data use the :attr:`data` attribute which returns an instance of :class:`ub_data` containing the conversion functions.")
801
802 def _get_data(self):
803 if not self.havedata: return None
804 return ub_data(self._ub_result_data(self))
805
806 __swig_getmethods__["data"] = _get_data
807 data = property(_get_data, doc="Returns :class:`ub_data` instance containing various decoding functions or None")
808
809 %}
810
811 }
812
813 %exception ub_resolve
814 %{
815 //printf("resolve_start(%lX)\n",(long unsigned int)arg1);
816 Py_BEGIN_ALLOW_THREADS
817 $function
818 Py_END_ALLOW_THREADS
819 //printf("resolve_stop()\n");
820 %}
821
822 %include "libunbound/unbound.h"
823
824 %inline %{
825 //SWIG will see the ub_ctx as a class
826 struct ub_ctx {
827 };
828 %}
829
830 //ub_ctx_debugout void* parameter correction
831 int ub_ctx_debugout(struct ub_ctx* ctx, FILE* out);
832
833 // ================================================================================
834 // ub_resolve_async - perform asynchronous resolution and validation
835 // ================================================================================
836
837 %typemap(in,numinputs=0,noblock=1) (int* async_id)
838 {
839 int asyncid = -1;
840 $1 = &asyncid;
841 }
842
843 %apply PyObject* {void* mydata}
844
845 /* result generation */
846 %typemap(argout,noblock=1) (int* async_id)
847 {
848 if(1) { /* new code block for variable on stack */
849 PyObject* tuple;
850 tuple = PyTuple_New(2);
851 PyTuple_SetItem(tuple, 0, $result);
852 PyTuple_SetItem(tuple, 1, SWIG_From_int(asyncid));
853 $result = tuple;
854 }
855 }
856
857 // Grab a Python function object as a Python object.
858 %typemap(in) (PyObject *pyfunc) {
859 if (!PyCallable_Check($input))
860 {
861 PyErr_SetString(PyExc_TypeError, "Need a callable object!");
862 return NULL;
863 }
864 $1 = $input;
865 }
866
867 // Python callback workaround
868 int _ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype, int rrclass, void* mydata, PyObject *pyfunc, int* async_id);
869
870 %{
871 struct cb_data {
872 PyObject* data;
873 PyObject* func;
874 };
875
876 static void PythonCallBack(void* iddata, int status, struct ub_result* result)
877 {
878 PyObject *arglist;
879 PyObject *fresult;
880 struct cb_data* id;
881 id = (struct cb_data*) iddata;
882 arglist = Py_BuildValue("(OiO)",id->data,status, SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ub_result, 0 | 0 )); // Build argument list
883 fresult = PyEval_CallObject(id->func,arglist); // Call Python
884 Py_DECREF(id->func);
885 Py_DECREF(id->data);
886 free(id);
887 ub_resolve_free(result); //free ub_result
888 //ub_resolve_free_dbg(result); //free ub_result
889 Py_DECREF(arglist); // Trash arglist
890 Py_XDECREF(fresult);
891 }
892
893 int _ub_resolve_async(struct ub_ctx* ctx, char* name, int rrtype, int rrclass, PyObject* mydata, PyObject *pyfunc, int* async_id) {
894 int r;
895 struct cb_data* id;
896 id = (struct cb_data*) malloc(sizeof(struct cb_data));
897 id->data = mydata;
898 id->func = pyfunc;
899
900 r = ub_resolve_async(ctx,name,rrtype,rrclass, (void *) id, PythonCallBack, async_id);
901 Py_INCREF(mydata);
902 Py_INCREF(pyfunc);
903 return r;
904 }
905
906 %}
907
908 %pythoncode %{
909 ub_resolve_async = _unbound._ub_resolve_async
910
911 def reverse(domain):
912 """Reverse domain name
913
914 Usable for reverse lookups when the IP address should be reversed
915 """
916 return '.'.join([a for a in domain.split(".")][::-1])
917
918 def idn2dname(idnname):
919 """Converts domain name in IDN format to canonic domain name
920
921 :param idnname: (unicode string) IDN name
922 :returns: (string) domain name
923 """
924 return '.'.join([encodings.idna.ToASCII(a) for a in idnname.split('.')])
925
926 def dname2idn(name):
927 """Converts canonic domain name in IDN format to unicode string
928
929 :param name: (string) domain name
930 :returns: (unicode string) domain name
931 """
932 return '.'.join([encodings.idna.ToUnicode(a) for a in name.split('.')])
933
934 %}
935
1919 ub_cancel
2020 ub_resolve_free
2121 ub_strerror
22 ub_ctx_print_local_zones
23 ub_ctx_zone_add
24 ub_ctx_zone_remove
25 ub_ctx_data_add
26 ub_ctx_data_remove
448448 * @param ctx: context.
449449 * @param async_id: which query to cancel.
450450 * @return 0 if OK, else error.
451 * This routine can return an error if the async_id passed does not exist
452 * or has already been delivered. If another thread is processing results
453 * at the same time, the result may be delivered at the same time and the
454 * cancel fails with an error. Also the cancel can fail due to a system
455 * error, no memory or socket failures.
451456 */
452457 int ub_cancel(struct ub_ctx* ctx, int async_id);
453458
464469 */
465470 const char* ub_strerror(int err);
466471
472 /**
473 * Debug routine. Print the local zone information to debug output.
474 * @param ctx: context. Is finalized by the routine.
475 * @return 0 if OK, else error.
476 */
477 int ub_ctx_print_local_zones(struct ub_ctx* ctx);
478
479 /**
480 * Add a new zone with the zonetype to the local authority info of the
481 * library.
482 * @param ctx: context. Is finalized by the routine.
483 * @param zone_name: name of the zone in text, "example.com"
484 * If it already exists, the type is updated.
485 * @param zone_type: type of the zone (like for unbound.conf) in text.
486 * @return 0 if OK, else error.
487 */
488 int ub_ctx_zone_add(struct ub_ctx* ctx, char *zone_name, char *zone_type);
489
490 /**
491 * Remove zone from local authority info of the library.
492 * @param ctx: context. Is finalized by the routine.
493 * @param zone_name: name of the zone in text, "example.com"
494 * If it does not exist, nothing happens.
495 * @return 0 if OK, else error.
496 */
497 int ub_ctx_zone_remove(struct ub_ctx* ctx, char *zone_name);
498
499 /**
500 * Add localdata to the library local authority info.
501 * Similar to local-data config statement.
502 * @param ctx: context. Is finalized by the routine.
503 * @param data: the resource record in text format, for example
504 * "www.example.com IN A 127.0.0.1"
505 * @return 0 if OK, else error.
506 */
507 int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
508
509 /**
510 * Remove localdata from the library local authority info.
511 * @param ctx: context. Is finalized by the routine.
512 * @param data: the name to delete all data from, like "www.example.com".
513 * @return 0 if OK, else error.
514 */
515 int ub_ctx_data_remove(struct ub_ctx* ctx, char *data);
516
467517 #endif /* _UB_UNBOUND_H */
0 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
1 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
2
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of the organization nor the names of its
14 contributors may be used to endorse or promote products derived from this
15 software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
0 # Makefile: tests unbound python module (please edit SCRIPT variable)
1 #
2 # Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
3 # Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
4 #
5 # This software is open source.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 # * Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 #
14 # * Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 #
18 # * Neither the name of the organization nor the names of its
19 # contributors may be used to endorse or promote products derived from this
20 # software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 # POSSIBILITY OF SUCH DAMAGE.
33
34 SUEXEC = sudo
35 UNBOUND = ../unbound
36 SCRIPT = ./test-dict.conf
37
38 UNBOUND_OPTS = -dv -c $(SCRIPT)
39
40 .PHONY: test sudo suexec doc
41
42 all: test
43
44 $(UNBOUND):
45 make -C ..
46
47 test: $(UNBOUND)
48 $(UNBOUND) $(UNBOUND_OPTS)
49
50 sudo: $(UNBOUND)
51 sudo $(UNBOUND) $(UNBOUND_OPTS)
52
53 suexec: $(UNBOUND)
54 su -c "$(UNBOUND) $(UNBOUND_OPTS)"
55
56 doc:
57 $(MAKE) -C doc html
0 this directory exists to pacify sphinx-build.
0 # -*- coding: utf-8 -*-
1 #
2 # Unbound scripting interface documentation build configuration file
3 #
4 # This file is execfile()d with the current directory set to its containing dir.
5 #
6 # The contents of this file are pickled, so don't put values in the namespace
7 # that aren't pickleable (module imports are okay, they're removed automatically).
8 #
9 # All configuration values have a default value; values that are commented out
10 # serve to show the default value.
11
12 import sys, os
13
14 # If your extensions are in another directory, add it here. If the directory
15 # is relative to the documentation root, use os.path.abspath to make it
16 # absolute, like shown here.
17 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../..')))
18 #print sys.path
19
20 # General configuration
21 # ---------------------
22
23 # Add any Sphinx extension module names here, as strings. They can be extensions
24 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
25 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
26
27 # Add any paths that contain templates here, relative to this directory.
28 templates_path = ['_templates']
29
30 # The suffix of source filenames.
31 source_suffix = '.rst'
32
33 # The master toctree document.
34 master_doc = 'index'
35
36 # General substitutions.
37 project = 'Unbound scriptable interface'
38 copyright = '2009, Zdenek Vasicek, Marek Vavrusa'
39
40 # The default replacements for |version| and |release|, also used in various
41 # other places throughout the built documents.
42 #
43 # The short X.Y version.
44 version = '1.0'
45 # The full version, including alpha/beta/rc tags.
46 release = '1.0.0'
47
48 # There are two options for replacing |today|: either, you set today to some
49 # non-false value, then it is used:
50 #today = ''
51 # Else, today_fmt is used as the format for a strftime call.
52 today_fmt = '%B %d, %Y'
53
54 # List of documents that shouldn't be included in the build.
55 #unused_docs = []
56
57 # List of directories, relative to source directories, that shouldn't be searched
58 # for source files.
59 #exclude_dirs = []
60
61 # The reST default role (used for this markup: `text`) to use for all documents.
62 #default_role = None
63
64 # If true, '()' will be appended to :func: etc. cross-reference text.
65 #add_function_parentheses = True
66
67 # If true, the current module name will be prepended to all description
68 # unit titles (such as .. function::).
69 #add_module_names = True
70
71 # If true, sectionauthor and moduleauthor directives will be shown in the
72 # output. They are ignored by default.
73 #show_authors = False
74
75 # The name of the Pygments (syntax highlighting) style to use.
76 pygments_style = 'sphinx'
77
78
79 # Options for HTML output
80 # -----------------------
81
82 # The style sheet to use for HTML and HTML Help pages. A file of that name
83 # must exist either in Sphinx' static/ path, or in one of the custom paths
84 # given in html_static_path.
85 html_style = 'default.css'
86
87 # The name for this set of Sphinx documents. If None, it defaults to
88 # "<project> v<release> documentation".
89 #html_title = None
90
91 # A shorter title for the navigation bar. Default is the same as html_title.
92 #html_short_title = None
93
94 # The name of an image file (within the static path) to place at the top of
95 # the sidebar.
96 #html_logo = None
97
98 # The name of an image file (within the static path) to use as favicon of the
99 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
100 # pixels large.
101 #html_favicon = None
102
103 # Add any paths that contain custom static files (such as style sheets) here,
104 # relative to this directory. They are copied after the builtin static files,
105 # so a file named "default.css" will overwrite the builtin "default.css".
106 html_static_path = ['_static']
107
108 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
109 # using the given strftime format.
110 html_last_updated_fmt = '%b %d, %Y'
111
112 # If true, SmartyPants will be used to convert quotes and dashes to
113 # typographically correct entities.
114 #html_use_smartypants = True
115
116 # Custom sidebar templates, maps document names to template names.
117 #html_sidebars = {}
118
119 # Additional templates that should be rendered to pages, maps page names to
120 # template names.
121 #html_additional_pages = {}
122
123 # If false, no module index is generated.
124 html_use_modindex = False
125
126 # If false, no index is generated.
127 html_use_index = True
128
129 # If true, the index is split into individual pages for each letter.
130 #html_split_index = False
131
132 # If true, the reST sources are included in the HTML build as _sources/<name>.
133 html_copy_source = False
134
135 # If true, an OpenSearch description file will be output, and all pages will
136 # contain a <link> tag referring to it. The value of this option must be the
137 # base URL from which the finished HTML is served.
138 #html_use_opensearch = ''
139
140 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
141 #html_file_suffix = ''
142
143 # Output file base name for HTML help builder.
144 htmlhelp_basename = 'unbound_interface'
145
146
147 # Options for LaTeX output
148 # ------------------------
149
150 # The paper size ('letter' or 'a4').
151 #latex_paper_size = 'letter'
152
153 # The font size ('10pt', '11pt' or '12pt').
154 #latex_font_size = '10pt'
155
156 # Grouping the document tree into LaTeX files. List of tuples
157 # (source start file, target name, title, author, document class [howto/manual]).
158 latex_documents = [
159 ('index', 'Unbound_interface.tex', 'Unbound scriptable interface',
160 'Zdenek Vasicek, Marek Vavrusa', 'manual'),
161 ]
162
163 # The name of an image file (relative to this directory) to place at the top of
164 # the title page.
165 #latex_logo = None
166
167 # For "manual" documents, if this is true, then toplevel headings are parts,
168 # not chapters.
169 #latex_use_parts = False
170
171 # Additional stuff for the LaTeX preamble.
172 #latex_preamble = ''
173
174 # Documents to append as an appendix to all manuals.
175 #latex_appendices = []
176
177 # If false, no module index is generated.
178 #latex_use_modindex = True
0
1 print mod_env.fname # Print module script name
2 mod_env.data = "test" # Store global module data
3
4 def init(id, cfg):
5 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
6 return True
7
8 def deinit(id):
9 log_info("pythonmod: deinit called, module id is %d" % id)
10 return True
11
12 def inform_super(id, qstate, superqstate, qdata):
13 return True
14
15 def operate(id, event, qstate, qdata):
16 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
17
18 if event == MODULE_EVENT_NEW:
19 qstate.ext_state[id] = MODULE_WAIT_MODULE
20 return True
21
22 if event == MODULE_EVENT_MODDONE:
23 log_info("pythonmod: module we are waiting for is done")
24 qstate.ext_state[id] = MODULE_FINISHED
25 return True
26
27 if event == MODULE_EVENT_PASS:
28 log_info("pythonmod: event_pass")
29 qstate.ext_state[id] = MODULE_ERROR
30 return True
31
32 log_err("pythonmod: BAD event")
33 qstate.ext_state[id] = MODULE_ERROR
34 return True
35
36 log_info("pythonmod: script loaded.")
0 .. _example_handler:
1
2 Fundamentals
3 ================
4
5 This basic example shows how to create simple python module which will pass on the requests to the iterator.
6
7 How to enable python module
8 ----------------------------
9 If you look into unbound configuration file, you can find the option `module-config` which specifies the names and the order of modules to be used.
10 Example configuration::
11
12 module-config: "validator python iterator"
13
14 As soon as the DNS query arrives, Unbound calls modules starting from leftmost - the validator *(it is the first module on the list)*.
15 The validator does not know the answer *(it can only validate)*, thus it will pass on the event to the next module.
16 Next module is python which can
17
18 a) generate answer *(response)*
19 When python module generates the response unbound calls validator. Validator grabs the answer and determines the security flag.
20
21 b) pass on the event to the iterator.
22 When iterator resolves the query, Unbound informs python module (event :data:`module_event_moddone`). In the end, when the python module is done, validator is called.
23
24 Note that the python module is called with :data:`module_event_pass` event, because new DNS event was already handled by validator.
25
26 Another situation occurs when we use the following configuration::
27
28 module-config: "python validator iterator"
29
30 Python module is the first module here, so it's invoked with :data:`module_event_new` event *(new query)*.
31
32 On Python module initialization, module loads script from `python-script` option::
33
34 python-script: "/unbound/test/ubmodule.py"
35
36 Simple python module step by step
37 ---------------------------------
38
39 Script file must contain four compulsory functions:
40
41 .. function:: init(id, cfg)
42
43 Initialize module internals, like database etc.
44 Called just once on module load.
45
46 :param id: module identifier (integer)
47 :param cfg: :class:`config_file` configuration structure
48
49 ::
50
51 def init(id, cfg):
52 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
53 return True
54
55
56 .. function:: deinit(id)
57
58 Deinitialize module internals.
59 Called just once on module unload.
60
61 :param id: module identifier (integer)
62
63 ::
64
65 def deinit(id):
66 log_info("pythonmod: deinit called, module id is %d" % id)
67 return True
68
69
70 .. function:: inform_super(id, qstate, superqstate, qdata)
71
72 Inform super querystate about the results from this subquerystate.
73 Is called when the querystate is finished.
74
75 :param id: module identifier (integer)
76 :param qstate: :class:`module_qstate` Query state
77 :param superqstate: :class:`pythonmod_qstate` Mesh state
78 :param qdata: :class:`query_info` Query data
79
80 ::
81
82 def inform_super(id, qstate, superqstate, qdata):
83 return True
84
85
86
87 .. function:: operate(id, event, qstate, qdata)
88
89 Perform action on pending query. Accepts a new query, or work on pending query.
90
91 You have to set qstate.ext_state on exit.
92 The state informs unbound about result and controls the following states.
93
94 :param id: module identifier (integer)
95 :param qstate: :class:`module_qstate` query state structure
96 :param qdata: :class:`query_info` per query data, here you can store your own data
97
98 ::
99
100 def operate(id, event, qstate, qdata):
101 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
102 if event == MODULE_EVENT_NEW:
103 qstate.ext_state[id] = MODULE_WAIT_MODULE
104 return True
105
106 if event == MODULE_EVENT_MODDONE:
107 qstate.ext_state[id] = MODULE_FINISHED
108 return True
109
110 if event == MODULE_EVENT_PASS:
111 qstate.ext_state[id] = MODULE_ERROR
112 return True
113
114 log_err("pythonmod: BAD event")
115 qstate.ext_state[id] = MODULE_ERROR
116 return True
117
118
119 Complete source code
120 --------------------
121
122 .. literalinclude:: example0-1.py
123 :language: python
124
125 As you can see, the source code is much more flexible in contrast to C modules.
126 Moreover, compulsory functions called on appropriate module events allows to handle almost
127 anything from web control to query analysis.
128
0 .. _log_handler:
1
2 Packet logger
3 =========================
4
5 This example shows how to log and print details about query and response.
6 As soon as the ``iterator`` has finished (event is :data:`module_event_moddone`), ``qstate.return_msg`` contains response packet or ``None``.
7 This packet will be send to a client that asked for it.
8
9 Complete source code
10 --------------------
11
12 .. literalinclude:: ../../examples/log.py
13 :language: python
14
15 Testing
16 ------------------
17 Run the unbound server:
18
19 ``root@localhost>unbound -dv -c ./test-log.conf``
20
21 In case you use own configuration file, don't forget to enable python module: ``module-config: "validator python iterator"`` and use valid script path: ``python-script: "./examples/log.py"``.
22
23 Example of output::
24
25 [1231790168] unbound[7941:0] info: response for <f.gtld-servers.NET. AAAA IN>
26 [1231790168] unbound[7941:0] info: reply from <gtld-servers.NET.> 192.5.6.31#53
27 [1231790168] unbound[7941:0] info: query response was ANSWER
28 [1231790168] unbound[7941:0] info: pythonmod: operate called, id: 1, event:module_event_moddone
29 ----------------------------------------------------------------------------------------------------
30 Query: f.gtld-servers.NET., type: AAAA (28), class: IN (1)
31 ----------------------------------------------------------------------------------------------------
32 Return reply :: flags: 8080, QDcount: 1, Security:0, TTL=86400
33 qinfo :: qname: ['f', 'gtld-servers', 'NET', ''] f.gtld-servers.NET., qtype: AAAA, qclass: IN
34 Reply:
35 0 : ['gtld-servers', 'NET', ''] gtld-servers.NET. flags: 0000 type: SOA (6) class: IN (1)
36 0 : TTL= 86400
37 0x00 | 00 3A 02 41 32 05 4E 53 54 4C 44 03 43 4F 4D 00 05 | . : . A 2 . N S T L D . C O M . .
38 0x10 | 05 6E 73 74 6C 64 0C 76 65 72 69 73 69 67 6E 2D 67 | . n s t l d . v e r i s i g n - g
39 0x20 | 67 72 73 03 43 4F 4D 00 77 74 2D 64 00 00 0E 10 00 | g r s . C O M . w t - d . . . . .
40 0x30 | 00 00 03 84 00 12 75 00 00 01 51 80 | . . . . . . u . . . Q .
41
0 Response generation
1 =====================
2
3 This example shows how to handle queries and generate response packet.
4
5 .. note::
6 If the python module is the first module and validator module is enabled (``module-config: "python validator iterator"``),
7 a return_msg security flag has to be set at least to 2. Leaving security flag untouched causes that the
8 response will be refused by unbound worker as unbound will consider it as non-valid response.
9
10 Complete source code
11 --------------------
12
13 .. literalinclude:: ../../examples/resgen.py
14 :language: python
15
16 Testing
17 -------
18
19 Run the unbound server:
20
21 ``root@localhost>unbound -dv -c ./test-resgen.conf``
22
23 Query for a A record ending with .localdomain
24
25 ``dig A test.xxx.localdomain @127.0.0.1``
26
27 Dig produces the following output::
28
29 ;; global options: printcmd
30 ;; Got answer:
31 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48426
32 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
33
34 ;; QUESTION SECTION:
35 ;test.xxx.localdomain. IN A
36
37 ;; ANSWER SECTION:
38 test.xxx.localdomain. 10 IN A 127.0.0.1
39
40 ;; Query time: 2 msec
41 ;; SERVER: 127.0.0.1#53(127.0.0.1)
42 ;; WHEN: Mon Jan 01 12:46:02 2009
43 ;; MSG SIZE rcvd: 54
44
45 As we handle (override) in python module only queries ending with "localdomain.", the unboud can still resolve host names.
0 Response modification
1 =====================
2
3 This example shows how to modify the response produced by the ``iterator`` module.
4
5 As soon as the iterator module returns the response, we :
6
7 1. invalidate the data in cache
8 2. modify the response *TTL*
9 3. rewrite the data in cache
10 4. return modified packet
11
12 Note that the steps 1 and 3 are neccessary only in case, the python module is the first module in the processing chain.
13 In other cases, the validator module guarantees updating data which are produced by iterator module.
14
15 Complete source code
16 --------------------
17
18 .. literalinclude:: ../../examples/resmod.py
19 :language: python
20
21 Testing
22 -------
23
24 Run Unbound server:
25
26 ``root@localhost>unbound -dv -c ./test-resmod.conf``
27
28 Issue a query for name ending with "nic.cz."
29
30 ``>>>dig A @127.0.0.1 www.nic.cz``
31
32 ::
33
34 ;; global options: printcmd
35 ;; Got answer:
36 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48831
37 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 5
38
39 ;; QUESTION SECTION:
40 ;www.nic.cz. IN A
41
42 ;; ANSWER SECTION:
43 www.nic.cz. 10 IN A 217.31.205.50
44
45 ;; AUTHORITY SECTION:
46 nic.cz. 10 IN NS e.ns.nic.cz.
47 nic.cz. 10 IN NS a.ns.nic.cz.
48 nic.cz. 10 IN NS c.ns.nic.cz.
49
50 ;; ADDITIONAL SECTION:
51 a.ns.nic.cz. 10 IN A 217.31.205.180
52 a.ns.nic.cz. 10 IN AAAA 2001:1488:dada:176::180
53 c.ns.nic.cz. 10 IN A 195.66.241.202
54 c.ns.nic.cz. 10 IN AAAA 2a01:40:1000::2
55 e.ns.nic.cz. 10 IN A 194.146.105.38
56
57 ;; Query time: 166 msec
58 ;; SERVER: 127.0.0.1#53(127.0.0.1)
59 ;; WHEN: Mon Jan 02 13:39:43 2009
60 ;; MSG SIZE rcvd: 199
61
62 As you can see, TTL of all the records is set to 10.
0 DNS-based language dictionary
1 ===============================
2
3 This example shows how to create a simple language dictionary based on **DNS**
4 service within 15 minutes. The translation will be performed using TXT resource records.
5
6 Key parts
7 -----------
8
9 Initialization
10 ~~~~~~~~~~~~~~~~~~~~~~~
11 On **init()** module loads dictionary from a text file containing records in ``word [tab] translation`` format.
12 ::
13
14 def init(id, cfg):
15 log_info("pythonmod: dict init")
16 f = open("examples/dict_data.txt", "r")
17 ...
18
19 The suitable file can be found at http://slovnik.zcu.cz
20
21 DNS query and word lookup
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24 Let's define the following format od DNS queries: ``word1[.]word2[.] ... wordN[.]{en,cs}[._dict_.cz.]``.
25 Word lookup is done by simple ``dict`` lookup from broken DNS request.
26 Query name is divided into a list of labels. This list is accesible as qname_list attribute.
27 ::
28
29 aword = ' '.join(qstate.qinfo.qname_list[0:-4]) #skip last four labels
30 adict = qstate.qinfo.qname_list[-4] #get 4th label from the end
31
32 words = [] #list of words
33 if (adict == "en") and (aword in en_dict):
34 words = en_dict[aword]
35
36 if (adict == "cs") and (aword in cz_dict):
37 words = cz_dict[aword] # CS -> EN
38
39 In the first step, we get a string in the form: ``word1[space]word2[space]...word[space]``.
40 In the second assignment, fourth label from the end is obtained. This label should contains *"cs"* or *"en"*.
41 This label determines the direction of translation.
42
43
44 Forming of a DNS reply
45 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
47 DNS reply is formed only on valid match and added as TXT answer.
48 ::
49
50 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_TXT, RR_CLASS_IN, PKT_AA)
51
52 for w in words:
53 msg.answer.append("%s 300 IN TXT \"%s\"" % (qstate.qinfo.qname_str, w.replace("\"", "\\\"")))
54
55 if not msg.set_return_msg(qstate):
56 qstate.ext_state[id] = MODULE_ERROR
57 return True
58
59 qstate.return_rcode = RCODE_NOERROR
60 qstate.ext_state[id] = MODULE_FINISHED
61 return True
62
63 In the first step, a :class:`DNSMessage` instance is created for a given query *(type TXT)*.
64 The fourth argument specifies the flags *(authoritative answer)*.
65 In the second step, we append TXT records containing the translation *(on the right side of RR)*.
66 Then, the response is finished and ``qstate.return_msg`` contains new response.
67 If no error, the module sets :attr:`module_qstate.return_rcode` and :attr:`module_qstate.ext_state`.
68
69 **Steps:**
70
71 1. create :class:`DNSMessage` instance
72 2. append TXT records containing the translation
73 3. set response to ``qstate.return_msg``
74
75 Testing
76 -------
77
78 Run the Unbound server:
79
80 ``root@localhost>unbound -dv -c ./test-dict.conf``
81
82 In case you use own configuration file, don't forget to enable Python module::
83
84 module-config: "validator python iterator"
85
86 and use valid script path::
87
88 python-script: "./examples/dict.py"
89
90 The translation from english word *"a bar fly"* to Czech can be done by doing:
91
92 ``>>>dig TXT @127.0.0.1 a.bar.fly.en._dict_.cz``
93
94 ::
95
96 ; (1 server found)
97 ;; global options: printcmd
98 ;; Got answer:
99 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48691
100 ;; flags: aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
101
102 ;; QUESTION SECTION:
103 ;a.bar.fly.en._dict_.cz. IN TXT
104
105 ;; ANSWER SECTION:
106 a.bar.fly.en._dict_.cz. 300 IN TXT "barov\253 povale\232"
107
108 ;; Query time: 5 msec
109 ;; SERVER: 127.0.0.1#53(127.0.0.1)
110 ;; WHEN: Mon Jan 01 17:44:18 2009
111 ;; MSG SIZE rcvd: 67
112
113 ``>>>dig TXT @127.0.0.1 nic.cs._dict_.cz``
114 ::
115
116 ; <<>> DiG 9.5.0-P2 <<>> TXT @127.0.0.1 nic.cs._dict_.cz
117 ; (1 server found)
118 ;; global options: printcmd
119 ;; Got answer:
120 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58710
121 ;; flags: aa rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0
122
123 ;; QUESTION SECTION:
124 ;nic.cs._dict_.cz. IN TXT
125
126 ;; ANSWER SECTION:
127 nic.cs._dict_.cz. 300 IN TXT "aught"
128 nic.cs._dict_.cz. 300 IN TXT "naught"
129 nic.cs._dict_.cz. 300 IN TXT "nihil"
130 nic.cs._dict_.cz. 300 IN TXT "nix"
131 nic.cs._dict_.cz. 300 IN TXT "nothing"
132 nic.cs._dict_.cz. 300 IN TXT "zilch"
133
134 ;; Query time: 0 msec
135 ;; SERVER: 127.0.0.1#53(127.0.0.1)
136 ;; WHEN: Mon Jan 01 17:45:39 2009
137 ;; MSG SIZE rcvd: 143
138
139 Proof that the unbound still works as resolver.
140
141 ``>>>dig A @127.0.0.1 www.nic.cz``
142 ::
143
144 ; (1 server found)
145 ;; global options: printcmd
146 ;; Got answer:
147 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19996
148 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 5
149
150 ;; QUESTION SECTION:
151 ;www.nic.cz. IN A
152
153 ;; ANSWER SECTION:
154 www.nic.cz. 1662 IN A 217.31.205.50
155
156 ;; AUTHORITY SECTION:
157 ...
158
159 Complete source code
160 --------------------
161
162 .. literalinclude:: ../../examples/dict.py
163 :language: python
0 .. _Tutorials:
1
2 ==============================
3 Tutorials
4 ==============================
5
6 Here you can find several tutorials which clarify the usage and capabilities of Unbound scriptable interface.
7
8 `Tutorials`
9
10 .. toctree::
11 :maxdepth: 2
12 :glob:
13
14 example*
0 Unbound scriptable interface
1 =======================================
2
3 Python module for **Unbound** provides easy-to-use flexible solution,
4 for scripting query events and much more!
5
6 Along with extensible **SWIG** interface, it turns **Unbound** into dynamic *DNS* service
7 designed for rapid development of *DNS* based applications, like detailed *(per query/domain)* statistics,
8 monitoring with anything Python can offer *(database backend, http server)*.
9
10 **Key features**
11 * Rapid dynamic DNS-based application development in **Python**
12 * Extensible interface with **SWIG**
13 * Easy to use debugging and analysis tool
14 * Capable to produce authoritative answers
15 * Support for logging or doing detailed statistics
16 * Allows to manipulate with content of cache memory
17
18 Contents
19 --------
20 .. toctree::
21 :maxdepth: 2
22
23 install
24 examples/index
25 usecase
26 modules/index
27
28 Indices and tables
29 -------------------
30
31 * :ref:`genindex`
32 * :ref:`search`
33
0 Installation
1 ===================================
2
3 **Prerequisites**
4
5 Python 2.4 or higher, SWIG 1.3 or higher, GNU make
6
7 **Download**
8
9 You can download the source codes `here`_.
10 The latest release is 1.1.1, Jan 15, 2009.
11
12 .. _here: unbound-1.1.1-py.tar.gz
13
14 **Compiling**
15
16 After downloading, you can compile the Unbound library by doing::
17
18 > tar -xzf unbound-1.1.1-py.tar.gz
19 > cd unbound-1.1.1
20 > ./configure --with-pythonmodule
21 > make
22
23 You need GNU make to compile sources.
24 SWIG and Python devel libraries to compile extension module.
25
26 **Testing**
27
28 If the compilation is successful, you can test the extension module by::
29
30 > cd pythonmod
31 > make sudo # or "make test" or "make suexec"
32
33 This will start unbound server with language dictionary service (see :ref:`Tutorials`).
34 In order to test this service, type::
35
36 > dig TXT @127.0.0.1 aught.en._dict_.cz
37
38 Dig should print this message (czech equivalent of aught)::
39
40 ; <<>> DiG 9.5.0-P2 <<>> TXT @127.0.0.1 aught.en._dict_.cz
41 ; (1 server found)
42 ;; global options: printcmd
43 ;; Got answer:
44 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30085
45 ;; flags: aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
46
47 ;; QUESTION SECTION:
48 ;aught.en._dict_.cz. IN TXT
49
50 ;; ANSWER SECTION:
51 aught.en._dict_.cz. 300 IN TXT "nic"
52
53 ;; Query time: 11 msec
54 ;; SERVER: 127.0.0.1#53(127.0.0.1)
55 ;; WHEN: Thu Jan 10 16:45:58 2009
56 ;; MSG SIZE rcvd: 52
57
58 The ``pythonmod/examples`` directory contains simple applications written in Python.
0 Configuration interface
1 =======================
2
3 Currently passed to Python module in init(module_id, cfg).
4
5 config_file
6 --------------------
7
8 .. class:: config_file
9
10 This class provides these data attributes:
11
12 .. attribute:: verbosity
13
14 Verbosity level as specified in the config file.
15
16 .. attribute:: stat_interval
17
18 Statistics interval (in seconds).
19
20 .. attribute:: stat_cumulative
21
22 If false, statistics values are reset after printing them.
23
24 .. attribute:: stat_extended
25
26 If true, the statistics are kept in greater detail.
27
28 .. attribute:: num_threads
29
30 Number of threads to create.
31
32 .. attribute:: port
33
34 Port on which queries are answered.
35
36 .. attribute:: do_ip4
37
38 Do ip4 query support.
39
40 .. attribute:: do_ip6
41
42 Do ip6 query support.
43
44 .. attribute:: do_udp
45
46 Do udp query support.
47
48 .. attribute:: do_tcp
49
50 Do tcp query support.
51
52 .. attribute:: outgoing_num_ports
53
54 Outgoing port range number of ports (per thread).
55
56 .. attribute:: outgoing_num_tcp
57
58 Number of outgoing tcp buffers per (per thread).
59
60 .. attribute:: incoming_num_tcp
61
62 Number of incoming tcp buffers per (per thread).
63
64 .. attribute:: outgoing_avail_ports
65
66 Allowed udp port numbers, array with 0 if not allowed.
67
68 .. attribute:: msg_buffer_size
69
70 Number of bytes buffer size for DNS messages.
71
72 .. attribute:: msg_cache_size
73
74 Size of the message cache.
75
76 .. attribute:: msg_cache_slabs
77
78 Slabs in the message cache.
79
80 .. attribute:: num_queries_per_thread
81
82 Number of queries every thread can service.
83
84 .. attribute:: jostle_time
85
86 Number of msec to wait before items can be jostled out.
87
88 .. attribute:: rrset_cache_size
89
90 Size of the rrset cache.
91
92 .. attribute:: rrset_cache_slabs
93
94 Slabs in the rrset cache.
95
96 .. attribute:: host_ttl
97
98 Host cache ttl in seconds.
99
100 .. attribute:: lame_ttl
101
102 Host is lame for a zone ttl, in seconds.
103
104 .. attribute:: infra_cache_slabs
105
106 Number of slabs in the infra host cache.
107
108 .. attribute:: infra_cache_numhosts
109
110 Max number of hosts in the infra cache.
111
112 .. attribute:: infra_cache_lame_size
113
114 Max size of lame zones per host in the infra cache.
115
116 .. attribute:: target_fetch_policy
117
118 The target fetch policy for the iterator.
119
120 .. attribute:: if_automatic
121
122 Automatic interface for incoming messages. Uses ipv6 remapping,
123 and recvmsg/sendmsg ancillary data to detect interfaces, boolean.
124
125 .. attribute:: num_ifs
126
127 Number of interfaces to open. If 0 default all interfaces.
128
129 .. attribute:: ifs
130
131 Interface description strings (IP addresses).
132
133 .. attribute:: num_out_ifs
134
135 Number of outgoing interfaces to open.
136 If 0 default all interfaces.
137
138 .. attribute:: out_ifs
139
140 Outgoing interface description strings (IP addresses).
141
142 .. attribute:: root_hints
143
144 The root hints.
145
146 .. attribute:: stubs
147
148 The stub definitions, linked list.
149
150 .. attribute:: forwards
151
152 The forward zone definitions, linked list.
153
154 .. attribute:: donotqueryaddrs
155
156 List of donotquery addresses, linked list.
157
158 .. attribute:: acls
159
160 List of access control entries, linked list.
161
162 .. attribute:: donotquery_localhost
163
164 Use default localhost donotqueryaddr entries.
165
166 .. attribute:: harden_short_bufsize
167
168 Harden against very small edns buffer sizes.
169
170 .. attribute:: harden_large_queries
171
172 Harden against very large query sizes.
173
174 .. attribute:: harden_glue
175
176 Harden against spoofed glue (out of zone data).
177
178 .. attribute:: harden_dnssec_stripped
179
180 Harden against receiving no DNSSEC data for trust anchor.
181
182 .. attribute:: harden_referral_path
183
184 Harden the referral path, query for NS,A,AAAA and validate.
185
186 .. attribute:: use_caps_bits_for_id
187
188 Use 0x20 bits in query as random ID bits.
189
190 .. attribute:: private_address
191
192 Strip away these private addrs from answers, no DNS Rebinding.
193
194 .. attribute:: private_domain
195
196 Allow domain (and subdomains) to use private address space.
197
198 .. attribute:: unwanted_threshold
199
200 What threshold for unwanted action.
201
202 .. attribute:: chrootdir
203
204 Chrootdir, if not "" or chroot will be done.
205
206 .. attribute:: username
207
208 Username to change to, if not "".
209
210 .. attribute:: directory
211
212 Working directory.
213
214 .. attribute:: logfile
215
216 Filename to log to.
217
218 .. attribute:: pidfile
219
220 Pidfile to write pid to.
221
222 .. attribute:: use_syslog
223
224 Should log messages be sent to syslogd.
225
226 .. attribute:: hide_identity
227
228 Do not report identity (id.server, hostname.bind).
229
230 .. attribute:: hide_version
231
232 Do not report version (version.server, version.bind).
233
234 .. attribute:: identity
235
236 Identity, hostname is returned if "".
237
238 .. attribute:: version
239
240 Version, package version returned if "".
241
242 .. attribute:: module_conf
243
244 The module configuration string.
245
246 .. attribute:: trust_anchor_file_list
247
248 Files with trusted DS and DNSKEYs in zonefile format, list.
249
250 .. attribute:: trust_anchor_list
251
252 List of trustanchor keys, linked list.
253
254 .. attribute:: trusted_keys_file_list
255
256 Files with trusted DNSKEYs in named.conf format, list.
257
258 .. attribute:: dlv_anchor_file
259
260 DLV anchor file.
261
262 .. attribute:: dlv_anchor_list
263
264 DLV anchor inline.
265
266 .. attribute:: max_ttl
267
268 The number of seconds maximal TTL used for RRsets and messages.
269
270 .. attribute:: val_date_override
271
272 If not 0, this value is the validation date for RRSIGs.
273
274 .. attribute:: bogus_ttl
275
276 This value sets the number of seconds before revalidating bogus.
277
278 .. attribute:: val_clean_additional
279
280 Should validator clean additional section for secure msgs.
281
282 .. attribute:: val_permissive_mode
283
284 Should validator allow bogus messages to go through.
285
286 .. attribute:: val_nsec3_key_iterations
287
288 Nsec3 maximum iterations per key size, string.
289
290 .. attribute:: key_cache_size
291
292 Size of the key cache.
293
294 .. attribute:: key_cache_slabs
295
296 Slabs in the key cache.
297
298 .. attribute:: neg_cache_size
299
300 Size of the neg cache.
301
302
303 .. attribute:: local_zones
304
305 Local zones config.
306
307 .. attribute:: local_zones_nodefault
308
309 Local zones nodefault list.
310
311 .. attribute:: local_data
312
313 Local data RRs configged.
314
315 .. attribute:: remote_control_enable
316
317 Remote control section. enable toggle.
318
319 .. attribute:: control_ifs
320
321 The interfaces the remote control should listen on.
322
323 .. attribute:: control_port
324
325 Port number for the control port.
326
327 .. attribute:: server_key_file
328
329 Private key file for server.
330
331 .. attribute:: server_cert_file
332
333 Certificate file for server.
334
335 .. attribute:: control_key_file
336
337 Private key file for unbound-control.
338
339 .. attribute:: control_cert_file
340
341 Certificate file for unbound-control.
342
343 .. attribute:: do_daemonize
344
345 Daemonize, i.e. fork into the background.
346
347 .. attribute:: python_script
348
349 Python script file.
0 Global environment
1 ==================
2
3 Global variables
4 ----------------
5
6 .. envvar:: mod_env
7
8 Module environment, contains data pointer for module-specific data.
9 See :class:`pythonmod_env`.
10
11
12 Predefined constants
13 -----------------------
14
15 Module extended state
16 ~~~~~~~~~~~~~~~~~~~~~~~
17
18 .. data:: module_state_initial
19
20 Initial state - new DNS query.
21
22 .. data:: module_wait_reply
23
24 Waiting for reply to outgoing network query.
25
26 .. data:: module_wait_module
27
28 Module is waiting for another module.
29
30 .. data:: module_wait_subquery
31
32 Module is waiting for sub-query.
33
34 .. data:: module_error
35
36 Module could not finish the query.
37
38 .. data:: module_finished
39
40 Module is finished with query.
41
42 Module event
43 ~~~~~~~~~~~~~
44 .. data:: module_event_new
45
46 New DNS query.
47
48 .. data:: module_event_pass
49
50 Query passed by other module.
51
52 .. data:: module_event_reply
53
54 Reply inbound from server.
55
56 .. data:: module_event_noreply
57
58 No reply, timeout or other error.
59
60 .. data:: module_event_capsfail
61
62 Reply is there, but capitalisation check failed.
63
64 .. data:: module_event_moddone
65
66 Next module is done, and its reply is awaiting you.
67
68 .. data:: module_event_error
69
70 Error occured.
71
72 Security status
73 ~~~~~~~~~~~~~~~~
74
75 .. data:: sec_status_unchecked
76
77 Means that object has yet to be validated.
78
79 .. data:: sec_status_bogus
80
81 Means that the object *(RRset or message)* failed to validate
82 *(according to local policy)*, but should have validated.
83
84 .. data:: sec_status_indeterminate
85
86 Means that the object is insecure, but not
87 authoritatively so. Generally this means that the RRset is not
88 below a configured trust anchor.
89
90 .. data:: sec_status_insecure
91
92 Means that the object is authoritatively known to be
93 insecure. Generally this means that this RRset is below a trust
94 anchor, but also below a verified, insecure delegation.
95
96 .. data:: sec_status_secure
97
98 Means that the object (RRset or message) validated according to local policy.
99
100 Resource records (RR sets)
101 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
103 The different RR classes.
104
105 .. data:: RR_CLASS_IN
106
107 Internet.
108
109 .. data:: RR_CLASS_CH
110
111 Chaos.
112
113 .. data:: RR_CLASS_HS
114
115 Hesiod (Dyer 87)
116
117 .. data:: RR_CLASS_NONE
118
119 None class, dynamic update.
120
121 .. data:: RR_CLASS_ANY
122
123 Any class.
124
125
126 The different RR types.
127
128
129 .. data:: RR_TYPE_A
130
131 A host address.
132
133 .. data:: RR_TYPE_NS
134
135 An authoritative name server.
136
137 .. data:: RR_TYPE_MD
138
139 A mail destination (Obsolete - use MX).
140
141 .. data:: RR_TYPE_MF
142
143 A mail forwarder (Obsolete - use MX).
144
145 .. data:: RR_TYPE_CNAME
146
147 The canonical name for an alias.
148
149 .. data:: RR_TYPE_SOA
150
151 Marks the start of a zone of authority.
152
153 .. data:: RR_TYPE_MB
154
155 A mailbox domain name (EXPERIMENTAL).
156
157 .. data:: RR_TYPE_MG
158
159 A mail group member (EXPERIMENTAL).
160
161 .. data:: RR_TYPE_MR
162
163 A mail rename domain name (EXPERIMENTAL).
164
165 .. data:: RR_TYPE_NULL
166
167 A null RR (EXPERIMENTAL).
168
169 .. data:: RR_TYPE_WKS
170
171 A well known service description.
172
173 .. data:: RR_TYPE_PTR
174
175 A domain name pointer.
176
177 .. data:: RR_TYPE_HINFO
178
179 Host information.
180
181 .. data:: RR_TYPE_MINFO
182
183 Mailbox or mail list information.
184
185 .. data:: RR_TYPE_MX
186
187 Mail exchange.
188
189 .. data:: RR_TYPE_TXT
190
191 Text strings.
192
193 .. data:: RR_TYPE_RP
194
195 RFC1183.
196
197 .. data:: RR_TYPE_AFSDB
198
199 RFC1183.
200
201 .. data:: RR_TYPE_X25
202
203 RFC1183.
204
205 .. data:: RR_TYPE_ISDN
206
207 RFC1183.
208
209 .. data:: RR_TYPE_RT
210
211 RFC1183.
212
213 .. data:: RR_TYPE_NSAP
214
215 RFC1706.
216
217 .. data:: RR_TYPE_NSAP_PTR
218
219 RFC1348.
220
221 .. data:: RR_TYPE_SIG
222
223 2535typecode.
224
225 .. data:: RR_TYPE_KEY
226
227 2535typecode.
228
229 .. data:: RR_TYPE_PX
230
231 RFC2163.
232
233 .. data:: RR_TYPE_GPOS
234
235 RFC1712.
236
237 .. data:: RR_TYPE_AAAA
238
239 IPv6 address.
240
241 .. data:: RR_TYPE_LOC
242
243 LOC record RFC1876.
244
245 .. data:: RR_TYPE_NXT
246
247 2535typecode.
248
249 .. data:: RR_TYPE_EID
250
251 draft-ietf-nimrod-dns-01.txt.
252
253 .. data:: RR_TYPE_NIMLOC
254
255 draft-ietf-nimrod-dns-01.txt.
256
257 .. data:: RR_TYPE_SRV
258
259 SRV record RFC2782.
260
261 .. data:: RR_TYPE_ATMA
262
263 http://www.jhsoft.com/rfc/af-saa-0069.000.rtf.
264
265 .. data:: RR_TYPE_NAPTR
266
267 RFC2915.
268
269 .. data:: RR_TYPE_KX
270
271 RFC2230.
272
273 .. data:: RR_TYPE_CERT
274
275 RFC2538.
276
277 .. data:: RR_TYPE_A6
278
279 RFC2874.
280
281 .. data:: RR_TYPE_DNAME
282
283 RFC2672.
284
285 .. data:: RR_TYPE_SINK
286
287 dnsind-kitchen-sink-02.txt.
288
289 .. data:: RR_TYPE_OPT
290
291 Pseudo OPT record.
292
293 .. data:: RR_TYPE_APL
294
295 RFC3123.
296
297 .. data:: RR_TYPE_DS
298
299 draft-ietf-dnsext-delegation.
300
301 .. data:: RR_TYPE_SSHFP
302
303 SSH Key Fingerprint.
304
305 .. data:: RR_TYPE_IPSECKEY
306
307 draft-richardson-ipseckey-rr-11.txt.
308
309 .. data:: RR_TYPE_RRSIG
310
311 draft-ietf-dnsext-dnssec-25.
312
313 .. data:: RR_TYPE_NSEC
314 .. data:: RR_TYPE_DNSKEY
315 .. data:: RR_TYPE_DHCID
316 .. data:: RR_TYPE_NSEC3
317 .. data:: RR_TYPE_NSEC3PARAMS
318 .. data:: RR_TYPE_UINFO
319 .. data:: RR_TYPE_UID
320 .. data:: RR_TYPE_GID
321 .. data:: RR_TYPE_UNSPEC
322 .. data:: RR_TYPE_TSIG
323 .. data:: RR_TYPE_IXFR
324 .. data:: RR_TYPE_AXFR
325 .. data:: RR_TYPE_MAILB
326
327 A request for mailbox-related records (MB, MG or MR).
328
329 .. data:: RR_TYPE_MAILA
330
331 A request for mail agent RRs (Obsolete - see MX).
332
333 .. data:: RR_TYPE_ANY
334
335 Any type *(wildcard)*.
336
337 .. data:: RR_TYPE_DLV
338
339 RFC 4431, 5074, DNSSEC Lookaside Validation.
340
341 Return codes
342 ~~~~~~~~~~~~
343
344 Return codes for packets.
345
346 .. data:: RCODE_NOERROR
347 .. data:: RCODE_FORMERR
348 .. data:: RCODE_SERVFAIL
349 .. data:: RCODE_NXDOMAIN
350 .. data:: RCODE_NOTIMPL
351 .. data:: RCODE_REFUSED
352 .. data:: RCODE_YXDOMAIN
353 .. data:: RCODE_YXRRSET
354 .. data:: RCODE_NXRRSET
355 .. data:: RCODE_NOTAUTH
356 .. data:: RCODE_NOTZONE
357
358 Packet data
359 ~~~~~~~~~~~~
360
361 .. data:: PKT_QR
362
363 Query - query flag.
364
365 .. data:: PKT_AA
366
367 Authoritative Answer - server flag.
368
369 .. data:: PKT_TC
370
371 Truncated - server flag.
372
373 .. data:: PKT_RD
374
375 Recursion desired - query flag.
376
377 .. data:: PKT_CD
378
379 Checking disabled - query flag.
380
381 .. data:: PKT_RA
382
383 Recursion available - server flag.
384
385 .. data:: PKT_AD
386
387 Authenticated data - server flag.
388
389
390 Verbosity value
391 ~~~~~~~~~~~~~~~~
392
393 .. data:: NO_VERBOSE
394
395 No verbose messages.
396
397 .. data:: VERB_OPS
398
399 Operational information.
400
401 .. data:: VERB_DETAIL
402
403 Detailed information.
404
405 .. data:: VERB_QUERY
406
407 Query level information.
408
409 .. data:: VERB_ALGO
410
411 Algorithm level information.
0 Scriptable functions
1 ====================
2
3 Network
4 -------
5
6 .. function:: ntohs(netshort)
7
8 This subroutine converts values between the host and network byte order.
9 Specifically, **ntohs()** converts 16-bit quantities from network byte order to host byte order.
10
11 :param netshort: 16-bit short addr
12 :rtype: converted addr
13
14
15 Cache
16 -----
17
18 .. function:: storeQueryInCache(qstate, qinfo, msgrep, is_referral)
19
20 Store pending query in local cache.
21
22 :param qstate: :class:`module_qstate`
23 :param qinfo: :class:`query_info`
24 :param msgrep: :class:`reply_info`
25 :param is_referal: integer
26 :rtype: boolean
27
28 .. function:: invalidateQueryInCache(qstate, qinfo)
29
30 Invalidate record in local cache.
31
32 :param qstate: :class:`module_qstate`
33 :param qinfo: :class:`query_info`
34
35
36 Logging
37 -------
38
39 .. function:: verbose(level, msg)
40
41 Log a verbose message, pass the level for this message.
42 No trailing newline is needed.
43
44 :param level: verbosity level for this message, compared to global verbosity setting.
45 :param msg: string message
46
47 .. function:: log_info(msg)
48
49 Log informational message. No trailing newline is needed.
50
51 :param msg: string message
52
53 .. function:: log_err(msg)
54
55 Log error message. No trailing newline is needed.
56
57 :param msg: string message
58
59 .. function:: log_warn(msg)
60
61 Log warning message. No trailing newline is needed.
62
63 :param msg: string message
64
65 .. function:: log_hex(msg, data, length)
66
67 Log a hex-string to the log. Can be any length.
68 performs mallocs to do so, slow. But debug useful.
69
70 :param msg: string desc to accompany the hexdump.
71 :param data: data to dump in hex format.
72 :param length: length of data.
73
74 .. function:: log_dns_msg(str, qinfo, reply)
75
76 Log DNS message.
77
78 :param str: string message
79 :param qinfo: :class:`query_info`
80 :param reply: :class:`reply_info`
81
82 .. function:: log_query_info(verbosity_value, str, qinf)
83
84 Log query information.
85
86 :param verbosity_value: see constants
87 :param str: string message
88 :param qinf: :class:`query_info`
89
90 .. function:: regional_log_stats(r)
91
92 Log regional statistics.
93
94 :param r: :class:`regional`
95
96 Debugging
97 ---------
98
99 .. function:: strextstate(module_ext_state)
100
101 Debug utility, module external qstate to string.
102
103 :param module_ext_state: the state value.
104 :rtype: descriptive string.
105
106 .. function:: strmodulevent(module_event)
107
108 Debug utility, module event to string.
109
110 :param module_event: the module event value.
111 :rtype: descriptive string.
112
113 .. function:: ldns_rr_type2str(atype)
114
115 Convert RR type to string.
116
117 .. function:: ldns_rr_class2str(aclass)
118
119 Convert RR class to string.
0 Unbound module documentation
1 =======================================
2
3 .. toctree::
4 :maxdepth: 2
5
6 env
7 struct
8 functions
9 config
10
0 Scriptable structures
1 =====================
2
3 module_qstate
4 -----------------------
5
6 .. class:: module_qstate
7
8 Module state, per query.
9
10 This class provides these data attributes:
11
12 .. attribute:: qinfo
13
14 (:class:`query_info`) Informations about query being answered. Name, RR type, RR class.
15
16 .. attribute:: query_flags
17
18 (uint16) Flags for query. See QF_BIT\_ predefined constants.
19
20 .. attribute:: is_priming
21
22 If this is a (stub or root) priming query (with hints).
23
24 .. attribute:: reply
25
26 comm_reply contains server replies.
27
28 .. attribute:: return_msg
29
30 (:class:`dns_msg`) The reply message, with message for client and calling module (read-only attribute).
31 Note that if you want to create of modify return_msg you should use :class:`DNSMessage`.
32
33 .. attribute:: return_rcode
34
35 The rcode, in case of error, instead of a reply message. Determines whether the return_msg contains reply.
36
37 .. attribute:: region
38
39 Region for this query. Cleared when query process finishes.
40
41 .. attribute:: curmod
42
43 Which module is executing.
44
45 .. attribute:: ext_state[]
46
47 Module states.
48
49 .. attribute:: env
50
51 Environment for this query.
52
53 .. attribute:: mesh_info
54
55 Mesh related information for this query.
56
57
58 query_info
59 ----------------
60
61 .. class:: query_info
62
63 This class provides these data attributes:
64
65 .. attribute:: qname
66
67 The original question in the wireformat format (e.g. \\x03www\\x03nic\\x02cz\\x00 for www.nic.cz)
68
69 .. attribute:: qname_len
70
71 Lenght of question name (number of bytes).
72
73 .. attribute:: qname_list[]
74
75 The question ``qname`` converted into list of labels (e.g. ['www','nic','cz',''] for www.nic.cz)
76
77 .. attribute:: qname_str
78
79 The question ``qname`` converted into string (e.g. www.nic.cz. for www.nic.cz)
80
81 .. attribute:: qtype
82
83 The class type asked for. See RR_TYPE\_ predefined constants.
84
85 .. attribute:: qtype_str
86
87 The ``qtype`` in display presentation format (string) (e.g 'A' for RR_TYPE_A)
88
89 .. attribute:: qclass
90
91 The question class. See RR_CLASS\_ predefined constants.
92
93 .. attribute:: qclass_str
94
95 The ``qclass`` in display presentation format (string).
96
97 reply_info
98 --------------------
99
100 .. class:: reply_info
101
102 This class provides these data attributes:
103
104 .. attribute:: flags
105
106 The flags for the answer, host byte order.
107
108 .. attribute:: qdcount
109
110 Number of RRs in the query section.
111 If qdcount is not 0, then it is 1, and the data that appears
112 in the reply is the same as the query_info.
113 Host byte order.
114
115 .. attribute:: ttl
116
117 TTL of the entire reply (for negative caching).
118 only for use when there are 0 RRsets in this message.
119 if there are RRsets, check those instead.
120
121 .. attribute:: security
122
123 The security status from DNSSEC validation of this message. See sec_status\_ predefined constants.
124
125 .. attribute:: an_numrrsets
126
127 Number of RRsets in each section.
128 The answer section. Add up the RRs in every RRset to calculate
129 the number of RRs, and the count for the dns packet.
130 The number of RRs in RRsets can change due to RRset updates.
131
132 .. attribute:: ns_numrrsets
133
134 Count of authority section RRsets
135
136 .. attribute:: ar_numrrsets
137
138 Count of additional section RRsets
139
140 .. attribute:: rrset_count
141
142 Number of RRsets: an_numrrsets + ns_numrrsets + ar_numrrsets
143
144 .. attribute:: rrsets[]
145
146 (:class:`ub_packed_rrset_key`) List of RR sets in the order in which they appear in the reply message.
147 Number of elements is ancount + nscount + arcount RRsets.
148
149 .. attribute:: ref[]
150
151 (:class:`rrset_ref`) Packed array of ids (see counts) and pointers to packed_rrset_key.
152 The number equals ancount + nscount + arcount RRsets.
153 These are sorted in ascending pointer, the locking order. So
154 this list can be locked (and id, ttl checked), to see if
155 all the data is available and recent enough.
156
157
158 dns_msg
159 --------------
160
161 .. class:: dns_msg
162
163 Region allocated message reply
164
165 This class provides these data attributes:
166
167 .. attribute:: qinfo
168
169 (:class:`query_info`) Informations about query.
170
171 .. attribute:: rep
172
173 (:class:`reply_info`) This attribute points to the packed reply structure.
174
175
176 packed_rrset_key
177 ----------------------
178
179 .. class:: packed_rrset_key
180
181 The identifying information for an RRset.
182
183 This class provides these data attributes:
184
185 .. attribute:: dname
186
187 The domain name. If not empty (for ``id = None``) it is allocated, and
188 contains the wireformat domain name. This dname is not canonicalized.
189 E.g., the dname contains \\x03www\\x03nic\\x02cz\\x00 for www.nic.cz.
190
191 .. attribute:: dname_len
192
193 Length of the domain name, including last 0 root octet.
194
195 .. attribute:: dname_list[]
196
197 The domain name ``dname`` converted into list of labels (see :attr:`query_info.qname_list`).
198
199 .. attribute:: dname_str
200
201 The domain name ``dname`` converted into string (see :attr:`query_info.qname_str`).
202
203 .. attribute:: flags
204
205 Flags.
206
207 .. attribute:: type
208
209 The rrset type in network format.
210
211 .. attribute:: type_str
212
213 The rrset type in display presentation format.
214
215 .. attribute:: rrset_class
216
217 The rrset class in network format.
218
219 .. attribute:: rrset_class_str
220
221 The rrset class in display presentation format.
222
223 ub_packed_rrset_key
224 -------------------------
225
226 .. class:: ub_packed_rrset_key
227
228 This structure contains an RRset. A set of resource records that
229 share the same domain name, type and class.
230 Due to memory management and threading, the key structure cannot be
231 deleted, although the data can be. The id can be set to 0 to store and the
232 structure can be recycled with a new id.
233
234 The :class:`ub_packed_rrset_key` provides these data attributes:
235
236 .. attribute:: entry
237
238 (:class:`lruhash_entry`) Entry into hashtable. Note the lock is never destroyed,
239 even when this key is retired to the cache.
240 the data pointer (if not None) points to a :class:`packed_rrset`.
241
242 .. attribute:: id
243
244 The ID of this rrset. unique, based on threadid + sequenceno.
245 ids are not reused, except after flushing the cache.
246 zero is an unused entry, and never a valid id.
247 Check this value after getting entry.lock.
248 The other values in this struct may only be altered after changing
249 the id (which needs a writelock on entry.lock).
250
251 .. attribute:: rk
252
253 (:class:`packed_rrset_key`) RR set data.
254
255
256 lruhash_entry
257 -------------------------
258
259 .. class:: lruhash_entry
260
261 The :class:`ub_packed_rrset_key` provides these data attributes:
262
263 .. attribute:: lock
264
265 rwlock for access to the contents of the entry. Note that you cannot change hash and key, if so, you have to delete it to change hash or key.
266
267 .. attribute:: data
268
269 (:class:`packed_rrset_data`) entry data stored in wireformat (RRs and RRsigs).
270
271 packed_rrset_data
272 -----------------------
273
274 .. class:: packed_rrset_data
275
276 Rdata is stored in wireformat. The dname is stored in wireformat.
277
278 TTLs are stored as absolute values (and could be expired).
279
280 RRSIGs are stored in the arrays after the regular rrs.
281
282 You need the packed_rrset_key to know dname, type, class of the
283 resource records in this RRset. (if signed the rrsig gives the type too).
284
285 The :class:`packed_rrset_data` provides these data attributes:
286
287 .. attribute:: ttl
288
289 TTL (in seconds like time()) of the RRset.
290 Same for all RRs see rfc2181(5.2).
291
292 .. attribute:: count
293
294 Number of RRs.
295
296 .. attribute:: rrsig_count
297
298 Number of rrsigs, if 0 no rrsigs.
299
300 .. attribute:: trust
301
302 The trustworthiness of the RRset data.
303
304 .. attribute:: security
305
306 Security status of the RRset data. See sec_status\_ predefined constants.
307
308 .. attribute:: rr_len[]
309
310 Length of every RR's rdata, rr_len[i] is size of rr_data[i].
311
312 .. attribute:: rr_ttl[]
313
314 TTL of every rr. rr_ttl[i] ttl of rr i.
315
316 .. attribute:: rr_data[]
317
318 Array of RR's rdata (list of strings). The rdata is stored in uncompressed wireformat.
319 The first 16B of rr_data[i] is rdlength in network format.
320
321
322 DNSMessage
323 ----------------
324
325 .. class:: DNSMessage
326
327 Abstract representation of DNS message.
328
329 **Usage**
330
331 This example shows how to create an authoritative answer response
332
333 ::
334
335 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_A, RR_CLASS_IN, PKT_AA)
336
337 #append RR
338 if (qstate.qinfo.qtype == RR_TYPE_A) or (qstate.qinfo.qtype == RR_TYPE_ANY):
339 msg.answer.append("%s 10 IN A 127.0.0.1" % qstate.qinfo.qname_str)
340
341 #set qstate.return_msg
342 if not msg.set_return_msg(qstate):
343 raise Exception("Can't create response")
344
345 The :class:`DNSMessage` provides these methods and data attributes:
346
347 .. method:: __init__(self, rr_name, rr_type, rr_class = RR_CLASS_IN, query_flags = 0, default_ttl = 0)
348
349 Prepares an answer (DNS packet) from qiven information. Query flags are combination of PKT_xx contants.
350
351 .. method:: set_return_msg(self, qstate)
352
353 This method fills qstate return message according to the given informations.
354 It takes lists of RRs in each section of answer, created necessray RRsets in wire format and store the result in :attr:`qstate.return_msg`.
355 Returns 1 if OK.
356
357 .. attribute:: rr_name
358
359 RR name of question.
360
361 .. attribute:: rr_type
362
363 RR type of question.
364
365 .. attribute:: rr_class
366
367 RR class of question.
368
369 .. attribute:: default_ttl
370
371 Default time-to-live.
372
373 .. attribute:: query_flags
374
375 Query flags. See PKT\_ predefined constants.
376
377 .. attribute:: question[]
378
379 List of resource records that should appear (in the same order) in question section of answer.
380
381 .. attribute:: answer[]
382
383 List of resource records that should appear (in the same order) in answer section of answer.
384
385 .. attribute:: authority[]
386
387 List of resource records that should appear (in the same order) in authority section of answer.
388
389 .. attribute:: additional[]
390
391 List of resource records that should appear (in the same order) in additional section of answer.
392
393 pythonmod_env
394 -----------------------
395
396 .. class:: pythonmod_env
397
398 Global state for the module.
399
400 This class provides these data attributes:
401
402 .. attribute:: data
403
404 Here you can keep your own data shared across each thread.
405
406 .. attribute:: fname
407
408 Python script filename.
409
410 .. attribute:: qstate
411
412 Module query state.
413
414 pythonmod_qstate
415 -----------------------
416
417 .. class:: pythonmod_qstate
418
419 Per query state for the iterator module.
420
421 This class provides these data attributes:
422
423 .. attribute:: data
424
425 Here you can keep your own private data (each thread has own data object).
426
0 Use cases (examples)
1 ====================
2
3 Dynamic DNS Service discovery (DNS-SD_)
4 -------------------------------------------
5 Synchronized with database engine, for example *MySQL*.
6
7 .. _DNS-SD: http://www.dns-sd.org/
8
9 Firewall control
10 ----------------
11 Control firewall (e.g. enable incomming SSH connection) with DNS query signed with private key.
12 So firewall can blocks every service during normal operation.
13
14 Scriptable DNS-based blacklist (DNS-BL_)
15 -------------------------------------------
16 Scripted in Python with already provided features, takes advantage of DNS reply, because
17 almost every mail server supports DNS based blacklisting.
18
19 .. _DNS-BL: http://www.dnsbl.org
20
21 DNS based Wake-On-Lan
22 ---------------------
23 Controled by secured queries secured with private key.
24
25 Dynamic translation service
26 ---------------------------
27 DNS request can be translated to virtualy any answer, that's easy to implement in client side
28 because of many DNS libraries available.
29
30 Examples :
31 * **Dictionary** - using *IDN* for non-ascii strings transfer, ``dig TXT slovo.en._dict_.nic.cz`` returns translation of "slovo" to EN.
32 * **Translation** - Extends *DNS-SD*, for example DNS to Jabber to find out people logged in.
33 * **Exchange rate calculator** - ``dig TXT 1000.99.czk.eur._rates_.nic.cz`` returns the given sum (1000.99 CZK) in EURs.
34
35 Dynamic ENUM service
36 --------------------
37 Support for redirection, synchronization, etc.
0 # -*- coding: utf-8 -*-
1 '''
2 calc.py: DNS-based calculator
3
4 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 This software is open source.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright notice,
14 this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19
20 * Neither the name of the organization nor the names of its
21 contributors may be used to endorse or promote products derived from this
22 software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 '''
36
37 #Try: dig @localhost 1*25._calc_.cz.
38
39 def init(id, cfg): return True
40 def deinit(id): return True
41 def inform_super(id, qstate, superqstate, qdata): return True
42
43 def operate(id, event, qstate, qdata):
44
45 if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
46
47 if qstate.qinfo.qname_str.endswith("._calc_.cz."):
48 try:
49 res = eval(''.join(qstate.qinfo.qname_list[0:-3]))
50 except:
51 res = "exception"
52
53 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_TXT, RR_CLASS_IN, PKT_QR | PKT_RA | PKT_AA) #, 300)
54 msg.answer.append("%s 300 IN TXT \"%s\"" % (qstate.qinfo.qname_str,res))
55 if not msg.set_return_msg(qstate):
56 qstate.ext_state[id] = MODULE_ERROR
57 return True
58
59 qstate.return_rcode = RCODE_NOERROR
60 qstate.ext_state[id] = MODULE_FINISHED
61 return True
62
63 else:
64 #Pass on the unknown query to the iterator
65 qstate.ext_state[id] = MODULE_WAIT_MODULE
66 return True
67
68 elif event == MODULE_EVENT_MODDONE:
69 #the iterator has finished
70 qstate.ext_state[id] = MODULE_FINISHED
71 return True
72
73 log_err("pythonmod: Unknown event")
74 qstate.ext_state[id] = MODULE_ERROR
75 return True
76
0 # -*- coding: utf-8 -*-
1 '''
2 calc.py: DNS-based czech-english dictionary
3
4 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 This software is open source.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright notice,
14 this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19
20 * Neither the name of the organization nor the names of its
21 contributors may be used to endorse or promote products derived from this
22 software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 '''
36 import os
37 cz_dict = {}
38 en_dict = {}
39
40 def init(id, cfg):
41 log_info("pythonmod: dict init")
42 f = open("examples/dict_data.txt", "r")
43 try:
44 for line in f:
45 if line.startswith('#'):
46 continue
47 itm = line.split("\t", 3)
48 if len(itm) < 2:
49 continue
50 en,cs = itm[0:2]
51
52 if not (cs in cz_dict):
53 cz_dict[cs] = [en] # [cs] = en
54 else:
55 cz_dict[cs].append(en) # [cs] = en
56
57 if not (en in en_dict):
58 en_dict[en] = [cs] # [en] = cs
59 else:
60 en_dict[en].append(cs) # [en] = cs
61
62 finally:
63 f.close()
64 return True
65
66 def deinit(id):
67 log_info("pythonmod: dict deinit")
68 return True
69
70 def operate(id, event, qstate, qdata):
71 if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
72
73 if qstate.qinfo.qname_str.endswith("._dict_.cz."):
74
75 aword = ' '.join(qstate.qinfo.qname_list[0:-4])
76 adict = qstate.qinfo.qname_list[-4]
77
78 log_info("pythonmod: dictionary look up; word:%s dict:%s" % (aword,adict))
79
80 words = []
81 if (adict == "en") and (aword in en_dict):
82 words = en_dict[aword] # EN -> CS
83 if (adict == "cs") and (aword in cz_dict):
84 words = cz_dict[aword] # CS -> EN
85
86 if len(words) and ((qstate.qinfo.qtype == RR_TYPE_TXT) or (qstate.qinfo.qtype == RR_TYPE_ANY)):
87
88 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_TXT, RR_CLASS_IN, PKT_RD | PKT_RA | PKT_AA)
89 for w in words:
90 msg.answer.append("%s 300 IN TXT \"%s\"" % (qstate.qinfo.qname_str,w.replace("\"","\\\"")))
91
92 if not msg.set_return_msg(qstate):
93 qstate.ext_state[id] = MODULE_ERROR
94 return True
95
96 qstate.return_rcode = RCODE_NOERROR
97 qstate.ext_state[id] = MODULE_FINISHED
98 return True
99
100 else:
101 qstate.return_rcode = RCODE_SERVFAIL
102 qstate.ext_state[id] = MODULE_FINISHED
103 return True
104
105 else: #Pass on the unknown query to the iterator
106 qstate.ext_state[id] = MODULE_WAIT_MODULE
107 return True
108
109 elif event == MODULE_EVENT_MODDONE: #the iterator has finished
110 #we don't need modify result
111 qstate.ext_state[id] = MODULE_FINISHED
112 return True
113
114 log_err("pythonmod: Unknown event")
115 qstate.ext_state[id] = MODULE_ERROR
116 return True
117
118 def inform_super(id, qstate, superqstate, qdata):
119 return True
120
0 * * web
1 computer poèítaèovı adj: Zdenìk Bro¾
2 computer poèítaè n:
3 domain doména n: Zdenìk Bro¾
4 query otazník n: Zdenìk Bro¾
5 network sн» n: [it.] poинtaиovб
0 import os
1 '''
2 calc.py: Response packet logger
3
4 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 This software is open source.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright notice,
14 this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19
20 * Neither the name of the organization nor the names of its
21 contributors may be used to endorse or promote products derived from this
22 software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 '''
36
37 def dataHex(data, prefix=""):
38 """Converts binary string data to display representation form"""
39 res = ""
40 for i in range(0, (len(data)+15)/16):
41 res += "%s0x%02X | " % (prefix, i*16)
42 d = map(lambda x:ord(x), data[i*16:i*16+17])
43 for ch in d:
44 res += "%02X " % ch
45 for i in range(0,17-len(d)):
46 res += " "
47 res += "| "
48 for ch in d:
49 if (ch < 32) or (ch > 127):
50 res += ". "
51 else:
52 res += "%c " % ch
53 res += "\n"
54 return res
55
56 def logDnsMsg(qstate):
57 """Logs response"""
58
59 r = qstate.return_msg.rep
60 q = qstate.return_msg.qinfo
61
62 print "-"*100
63 print("Query: %s, type: %s (%d), class: %s (%d) " % (
64 qstate.qinfo.qname_str, qstate.qinfo.qtype_str, qstate.qinfo.qtype,
65 qstate.qinfo.qclass_str, qstate.qinfo.qclass))
66 print "-"*100
67 print "Return reply :: flags: %04X, QDcount: %d, Security:%d, TTL=%d" % (r.flags, r.qdcount, r.security, r.ttl)
68 print " qinfo :: qname: %s %s, qtype: %s, qclass: %s" % (str(q.qname_list), q.qname_str, q.qtype_str, q.qclass_str)
69
70 if (r):
71 print "Reply:"
72 for i in range(0, r.rrset_count):
73 rr = r.rrsets[i]
74
75 rk = rr.rk
76 print i,":",rk.dname_list, rk.dname_str, "flags: %04X" % rk.flags,
77 print "type:",rk.type_str,"(%d)" % ntohs(rk.type), "class:",rk.rrset_class_str,"(%d)" % ntohs(rk.rrset_class)
78
79 d = rr.entry.data
80 for j in range(0,d.count+d.rrsig_count):
81 print " ",j,":","TTL=",d.rr_ttl[j],
82 if (j >= d.count): print "rrsig",
83 print
84 print dataHex(d.rr_data[j]," ")
85
86 print "-"*100
87
88 def init(id, cfg):
89 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
90 return True
91
92 def deinit(id):
93 log_info("pythonmod: deinit called, module id is %d" % id)
94 return True
95
96 def inform_super(id, qstate, superqstate, qdata):
97 return True
98
99 def operate(id, event, qstate, qdata):
100 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
101
102 if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
103 #Pass on the new event to the iterator
104 qstate.ext_state[id] = MODULE_WAIT_MODULE
105 return True
106
107 if event == MODULE_EVENT_MODDONE:
108 #Iterator finished, show response (if any)
109
110 if (qstate.return_msg):
111 logDnsMsg(qstate)
112
113 qstate.ext_state[id] = MODULE_FINISHED
114 return True
115
116 qstate.ext_state[id] = MODULE_ERROR
117 return True
118
0 '''
1 resgen.py: This example shows how to generate authoritative response
2
3 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5
6 This software is open source.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions
10 are met:
11
12 * Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
18
19 * Neither the name of the organization nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35 def init(id, cfg): return True
36
37 def deinit(id): return True
38
39 def inform_super(id, qstate, superqstate, qdata): return True
40
41 def operate(id, event, qstate, qdata):
42 if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
43 if (qstate.qinfo.qname_str.endswith(".localdomain.")): #query name ends with localdomain
44 #create instance of DNS message (packet) with given parameters
45 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_A, RR_CLASS_IN, PKT_QR | PKT_RA | PKT_AA)
46 #append RR
47 if (qstate.qinfo.qtype == RR_TYPE_A) or (qstate.qinfo.qtype == RR_TYPE_ANY):
48 msg.answer.append("%s 10 IN A 127.0.0.1" % qstate.qinfo.qname_str)
49 #set qstate.return_msg
50 if not msg.set_return_msg(qstate):
51 qstate.ext_state[id] = MODULE_ERROR
52 return True
53
54 #we don't need validation, result is valid
55 qstate.return_msg.rep.security = 2
56
57 qstate.return_rcode = RCODE_NOERROR
58 qstate.ext_state[id] = MODULE_FINISHED
59 return True
60 else:
61 #pass the query to validator
62 qstate.ext_state[id] = MODULE_WAIT_MODULE
63 return True
64
65 if event == MODULE_EVENT_MODDONE:
66 log_info("pythonmod: iterator module done")
67 qstate.ext_state[id] = MODULE_FINISHED
68 return True
69
70 log_err("pythonmod: bad event")
71 qstate.ext_state[id] = MODULE_ERROR
72 return True
0 '''
1 resmod.py: This example shows how to modify the response from iterator
2
3 Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5
6 This software is open source.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions
10 are met:
11
12 * Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
18
19 * Neither the name of the organization nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 '''
35
36 def init(id, cfg): return True
37
38 def deinit(id): return True
39
40 def inform_super(id, qstate, superqstate, qdata): return True
41
42 def setTTL(qstate, ttl):
43 """Updates return_msg TTL and the TTL of all the RRs"""
44 if qstate.return_msg:
45 qstate.return_msg.rep.ttl = ttl
46 if (qstate.return_msg.rep):
47 for i in range(0,qstate.return_msg.rep.rrset_count):
48 d = qstate.return_msg.rep.rrsets[i].entry.data
49 for j in range(0,d.count+d.rrsig_count):
50 d.rr_ttl[j] = ttl
51
52 def operate(id, event, qstate, qdata):
53 if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
54 #pass the query to validator
55 qstate.ext_state[id] = MODULE_WAIT_MODULE
56 return True
57
58 if event == MODULE_EVENT_MODDONE:
59 log_info("pythonmod: iterator module done")
60
61 if not qstate.return_msg:
62 qstate.ext_state[id] = MODULE_FINISHED
63 return True
64
65 #modify the response
66
67 qdn = qstate.qinfo.qname_str
68 if qdn.endswith(".nic.cz."):
69 #invalidate response in cache added by iterator
70 #invalidateQueryInCache(qstate, qstate.return_msg.qinfo)
71
72 #modify TTL to 10 secs and store response in cache
73 #setTTL(qstate, 5)
74 #if not storeQueryInCache(qstate, qstate.return_msg.qinfo, qstate.return_msg.rep, 0):
75 # qstate.ext_state[id] = MODULE_ERROR
76 # return False
77
78 #modify TTL of response, which will be send to a) validator and then b) client
79 setTTL(qstate, 10)
80 qstate.return_rcode = RCODE_NOERROR
81
82 qstate.ext_state[id] = MODULE_FINISHED
83 return True
84
85 log_err("pythonmod: bad event")
86 qstate.ext_state[id] = MODULE_ERROR
87 return True
0 /*
1 * interface.i: unbound python module
2 */
3
4 %module unboundmodule
5 %{
6 /**
7 * \file
8 * This is the interface between the unbound server and a python module
9 * called to perform operations on queries.
10 */
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 #include <netinet/in.h>
14 #include <arpa/inet.h>
15 #include <stdarg.h>
16 #include "config.h"
17 #include "util/log.h"
18 #include "util/module.h"
19 #include "util/regional.h"
20 #include "util/config_file.h"
21 #include "util/data/msgreply.h"
22 #include "util/data/packed_rrset.h"
23 #include "util/data/dname.h"
24 #include "util/storage/lruhash.h"
25 #include "services/cache/dns.h"
26 %}
27
28 %include "stdint.i" // uint_16_t can be known type now
29
30 %inline %{
31 //converts [len][data][len][data][0] string to a List of labels (PyStrings)
32 PyObject* GetNameAsLabelList(const char* name, int len) {
33 PyObject* list;
34 int cnt=0, i;
35
36 i = 0;
37 while (i < len) {
38 i += name[i] + 1;
39 cnt++;
40 }
41
42 list = PyList_New(cnt);
43 i = 0; cnt = 0;
44 while (i < len) {
45 PyList_SetItem(list, cnt, PyString_FromStringAndSize(name + i + 1, name[i]));
46 i += name[i] + 1;
47 cnt++;
48 }
49 return list;
50 }
51 %}
52
53 /* ************************************************************************************ *
54 Structure query_info
55 * ************************************************************************************ */
56 /* Query info */
57 %ignore query_info::qname;
58 %ignore query_info::qname_len;
59
60
61 struct query_info {
62 %immutable;
63 char* qname;
64 size_t qname_len;
65 uint16_t qtype;
66 uint16_t qclass;
67 %mutable;
68 };
69
70 %inline %{
71 enum enum_rr_class {
72 RR_CLASS_IN = 1,
73 RR_CLASS_CH = 3,
74 RR_CLASS_HS = 4,
75 RR_CLASS_NONE = 254,
76 RR_CLASS_ANY = 255,
77 };
78
79 enum enum_rr_type {
80 RR_TYPE_A = 1,
81 RR_TYPE_NS = 2,
82 RR_TYPE_MD = 3,
83 RR_TYPE_MF = 4,
84 RR_TYPE_CNAME = 5,
85 RR_TYPE_SOA = 6,
86 RR_TYPE_MB = 7,
87 RR_TYPE_MG = 8,
88 RR_TYPE_MR = 9,
89 RR_TYPE_NULL = 10,
90 RR_TYPE_WKS = 11,
91 RR_TYPE_PTR = 12,
92 RR_TYPE_HINFO = 13,
93 RR_TYPE_MINFO = 14,
94 RR_TYPE_MX = 15,
95 RR_TYPE_TXT = 16,
96 RR_TYPE_RP = 17,
97 RR_TYPE_AFSDB = 18,
98 RR_TYPE_X25 = 19,
99 RR_TYPE_ISDN = 20,
100 RR_TYPE_RT = 21,
101 RR_TYPE_NSAP = 22,
102 RR_TYPE_NSAP_PTR = 23,
103 RR_TYPE_SIG = 24,
104 RR_TYPE_KEY = 25,
105 RR_TYPE_PX = 26,
106 RR_TYPE_GPOS = 27,
107 RR_TYPE_AAAA = 28,
108 RR_TYPE_LOC = 29,
109 RR_TYPE_NXT = 30,
110 RR_TYPE_EID = 31,
111 RR_TYPE_NIMLOC = 32,
112 RR_TYPE_SRV = 33,
113 RR_TYPE_ATMA = 34,
114 RR_TYPE_NAPTR = 35,
115 RR_TYPE_KX = 36,
116 RR_TYPE_CERT = 37,
117 RR_TYPE_A6 = 38,
118 RR_TYPE_DNAME = 39,
119 RR_TYPE_SINK = 40,
120 RR_TYPE_OPT = 41,
121 RR_TYPE_APL = 42,
122 RR_TYPE_DS = 43,
123 RR_TYPE_SSHFP = 44,
124 RR_TYPE_IPSECKEY = 45,
125 RR_TYPE_RRSIG = 46,
126 RR_TYPE_NSEC = 47,
127 RR_TYPE_DNSKEY = 48,
128 RR_TYPE_DHCID = 49,
129 RR_TYPE_NSEC3 = 50,
130 RR_TYPE_NSEC3PARAMS = 51,
131 RR_TYPE_UINFO = 100,
132 RR_TYPE_UID = 101,
133 RR_TYPE_GID = 102,
134 RR_TYPE_UNSPEC = 103,
135 RR_TYPE_TSIG = 250,
136 RR_TYPE_IXFR = 251,
137 RR_TYPE_AXFR = 252,
138 RR_TYPE_MAILB = 253,
139 RR_TYPE_MAILA = 254,
140 RR_TYPE_ANY = 255,
141 RR_TYPE_DLV = 32769,
142 };
143
144 PyObject* _get_qname(struct query_info* q) {
145 return PyString_FromStringAndSize((char*)q->qname, q->qname_len);
146 }
147
148 PyObject* _get_qname_components(struct query_info* q) {
149 return GetNameAsLabelList((const char*)q->qname, q->qname_len);
150 }
151 %}
152
153 %inline %{
154 PyObject* dnameAsStr(const char* dname) {
155 char buf[LDNS_MAX_DOMAINLEN+1];
156 buf[0] = '\0';
157 dname_str((uint8_t*)dname, buf);
158 return PyString_FromString(buf);
159 }
160 %}
161
162 %extend query_info {
163 %pythoncode %{
164 def _get_qtype_str(self): return ldns_rr_type2str(self.qtype)
165 __swig_getmethods__["qtype_str"] = _get_qtype_str
166 if _newclass:qtype_str = _swig_property(_get_qtype_str)
167
168 def _get_qclass_str(self): return ldns_rr_class2str(self.qclass)
169 __swig_getmethods__["qclass_str"] = _get_qclass_str
170 if _newclass:qclass_str = _swig_property(_get_qclass_str)
171
172 __swig_getmethods__["qname"] = _unboundmodule._get_qname
173 if _newclass:qname = _swig_property(_unboundmodule._get_qname)
174
175 __swig_getmethods__["qname_list"] = _unboundmodule._get_qname_components
176 if _newclass:qname_list = _swig_property(_unboundmodule._get_qname_components)
177
178 def _get_qname_str(self): return dnameAsStr(self.qname)
179 __swig_getmethods__["qname_str"] = _get_qname_str
180 if _newclass:qname_str = _swig_property(_get_qname_str)
181 %}
182 }
183
184 /* ************************************************************************************ *
185 Structure packed_rrset_key
186 * ************************************************************************************ */
187 %ignore packed_rrset_key::dname;
188 %ignore packed_rrset_key::dname_len;
189
190 /* RRsets */
191 struct packed_rrset_key {
192 %immutable;
193 char* dname;
194 size_t dname_len;
195 uint32_t flags;
196 uint16_t type; //rrset type in network format
197 uint16_t rrset_class; //rrset class in network format
198 %mutable;
199 };
200
201 //This subroutine converts values between the host and network byte order.
202 //Specifically, ntohs() converts 16-bit quantities from network byte order to host byte order.
203 uint16_t ntohs(uint16_t netshort);
204
205 %inline %{
206 PyObject* _get_dname(struct packed_rrset_key* k) {
207 return PyString_FromStringAndSize((char*)k->dname, k->dname_len);
208 }
209 PyObject* _get_dname_components(struct packed_rrset_key* k) {
210 return GetNameAsLabelList((char*)k->dname, k->dname_len);
211 }
212 %}
213
214 %extend packed_rrset_key {
215 %pythoncode %{
216 def _get_type_str(self): return ldns_rr_type2str(_unboundmodule.ntohs(self.type))
217 __swig_getmethods__["type_str"] = _get_type_str
218 if _newclass:type_str = _swig_property(_get_type_str)
219
220 def _get_class_str(self): return ldns_rr_class2str(_unboundmodule.ntohs(self.rrset_class))
221 __swig_getmethods__["rrset_class_str"] = _get_class_str
222 if _newclass:rrset_class_str = _swig_property(_get_class_str)
223
224 __swig_getmethods__["dname"] = _unboundmodule._get_dname
225 if _newclass:dname = _swig_property(_unboundmodule._get_dname)
226
227 __swig_getmethods__["dname_list"] = _unboundmodule._get_dname_components
228 if _newclass:dname_list = _swig_property(_unboundmodule._get_dname_components)
229
230 def _get_dname_str(self): return dnameAsStr(self.dname)
231 __swig_getmethods__["dname_str"] = _get_dname_str
232 if _newclass:dname_str = _swig_property(_get_dname_str)
233 %}
234 }
235
236 #if defined(SWIGWORDSIZE64)
237 typedef long int rrset_id_t;
238 #else
239 typedef long long int rrset_id_t;
240 #endif
241
242 struct ub_packed_rrset_key {
243 struct lruhash_entry entry;
244 rrset_id_t id;
245 struct packed_rrset_key rk;
246 };
247
248 struct lruhash_entry {
249 lock_rw_t lock;
250 struct lruhash_entry* overflow_next;
251 struct lruhash_entry* lru_next;
252 struct lruhash_entry* lru_prev;
253 hashvalue_t hash;
254 void* key;
255 struct packed_rrset_data* data;
256 };
257
258 %ignore packed_rrset_data::rr_len;
259 %ignore packed_rrset_data::rr_ttl;
260 %ignore packed_rrset_data::rr_data;
261
262 struct packed_rrset_data {
263 uint32_t ttl; //TTL (in seconds like time())
264
265 size_t count; //number of rrs
266 size_t rrsig_count; //number of rrsigs
267
268 enum rrset_trust trust;
269 enum sec_status security;
270
271 size_t* rr_len; //length of every rr's rdata
272 uint32_t *rr_ttl; //ttl of every rr
273 uint8_t** rr_data; //array of pointers to every rr's rdata; The rr_data[i] rdata is stored in uncompressed wireformat.
274 };
275
276 %pythoncode %{
277 class RRSetData_RRLen:
278 def __init__(self, obj): self.obj = obj
279 def __getitem__(self, index): return _unboundmodule._get_data_rr_len(self.obj, index)
280 def __len__(self): return obj.count + obj.rrsig_count
281 class RRSetData_RRTTL:
282 def __init__(self, obj): self.obj = obj
283 def __getitem__(self, index): return _unboundmodule._get_data_rr_ttl(self.obj, index)
284 def __setitem__(self, index, value): _unboundmodule._set_data_rr_ttl(self.obj, index, value)
285 def __len__(self): return obj.count + obj.rrsig_count
286 class RRSetData_RRData:
287 def __init__(self, obj): self.obj = obj
288 def __getitem__(self, index): return _unboundmodule._get_data_rr_data(self.obj, index)
289 def __len__(self): return obj.count + obj.rrsig_count
290 %}
291
292 %inline %{
293 PyObject* _get_data_rr_len(struct packed_rrset_data* d, int idx) {
294 if ((d != NULL) && (idx >= 0) &&
295 ((size_t)idx < (d->count+d->rrsig_count)))
296 return PyInt_FromLong(d->rr_len[idx]);
297 return Py_None;
298 }
299 void _set_data_rr_ttl(struct packed_rrset_data* d, int idx, uint32_t ttl)
300 {
301 if ((d != NULL) && (idx >= 0) &&
302 ((size_t)idx < (d->count+d->rrsig_count)))
303 d->rr_ttl[idx] = ttl;
304 }
305 PyObject* _get_data_rr_ttl(struct packed_rrset_data* d, int idx) {
306 if ((d != NULL) && (idx >= 0) &&
307 ((size_t)idx < (d->count+d->rrsig_count)))
308 return PyInt_FromLong(d->rr_ttl[idx]);
309 return Py_None;
310 }
311 PyObject* _get_data_rr_data(struct packed_rrset_data* d, int idx) {
312 if ((d != NULL) && (idx >= 0) &&
313 ((size_t)idx < (d->count+d->rrsig_count)))
314 return PyString_FromStringAndSize((char*)d->rr_data[idx],
315 d->rr_len[idx]);
316 return Py_None;
317 }
318 %}
319
320 %extend packed_rrset_data {
321 %pythoncode %{
322 def _get_data_rr_len(self): return RRSetData_RRLen(self)
323 __swig_getmethods__["rr_len"] = _get_data_rr_len
324 if _newclass:rr_len = _swig_property(_get_data_rr_len)
325 def _get_data_rr_ttl(self): return RRSetData_RRTTL(self)
326 __swig_getmethods__["rr_ttl"] =_get_data_rr_ttl
327 if _newclass:rr_len = _swig_property(_get_data_rr_ttl)
328 def _get_data_rr_data(self): return RRSetData_RRData(self)
329 __swig_getmethods__["rr_data"] = _get_data_rr_data
330 if _newclass:rr_len = _swig_property(_get_data_rr_data)
331 %}
332 }
333
334 /* ************************************************************************************ *
335 Structure reply_info
336 * ************************************************************************************ */
337 /* Messages */
338 %ignore reply_info::rrsets;
339 %ignore reply_info::ref;
340
341 struct reply_info {
342 uint16_t flags;
343 uint16_t qdcount;
344 uint32_t ttl;
345
346 uint16_t authoritative;
347 enum sec_status security;
348
349 size_t an_numrrsets;
350 size_t ns_numrrsets;
351 size_t ar_numrrsets;
352 size_t rrset_count; // an_numrrsets + ns_numrrsets + ar_numrrsets
353
354 struct ub_packed_rrset_key** rrsets;
355 struct rrset_ref ref[1]; //?
356 };
357
358 struct rrset_ref {
359 struct ub_packed_rrset_key* key;
360 rrset_id_t id;
361 };
362
363 struct dns_msg {
364 struct query_info qinfo;
365 struct reply_info *rep;
366 };
367
368 %pythoncode %{
369 class ReplyInfo_RRSet:
370 def __init__(self, obj): self.obj = obj
371 def __getitem__(self, index): return _unboundmodule._rrset_rrsets_get(self.obj, index)
372 def __len__(self): return obj.rrset_count
373
374 class ReplyInfo_Ref:
375 def __init__(self, obj): self.obj = obj
376 def __getitem__(self, index): return _unboundmodule._rrset_ref_get(self.obj, index)
377 def __len__(self): return obj.rrset_count
378 %}
379
380 %inline %{
381 struct ub_packed_rrset_key* _rrset_rrsets_get(struct reply_info* r, int idx) {
382 if ((r != NULL) && (idx >= 0) && ((size_t)idx < r->rrset_count))
383 return r->rrsets[idx];
384 return NULL;
385 }
386
387 struct rrset_ref* _rrset_ref_get(struct reply_info* r, int idx) {
388 if ((r != NULL) && (idx >= 0) && ((size_t)idx < r->rrset_count)) {
389 //printf("_rrset_ref_get: %lX key:%lX\n", r->ref + idx, r->ref[idx].key);
390 return &(r->ref[idx]);
391 // return &(r->ref[idx]);
392 }
393 //printf("_rrset_ref_get: NULL\n");
394 return NULL;
395 }
396 %}
397
398 %extend reply_info {
399 %pythoncode %{
400 def _rrset_ref_get(self): return ReplyInfo_Ref(self)
401 __swig_getmethods__["ref"] = _rrset_ref_get
402 if _newclass:ref = _swig_property(_rrset_ref_get)
403
404 def _rrset_rrsets_get(self): return ReplyInfo_RRSet(self)
405 __swig_getmethods__["rrsets"] = _rrset_rrsets_get
406 if _newclass:rrsets = _swig_property(_rrset_rrsets_get)
407 %}
408 }
409
410 /* ************************************************************************************ *
411 Structure module_qstate
412 * ************************************************************************************ */
413 %ignore module_qstate::ext_state;
414 %ignore module_qstate::minfo;
415
416 /* Query state */
417 struct module_qstate {
418 struct query_info qinfo;
419 uint16_t query_flags; //See QF_BIT_xx constants
420 int is_priming;
421
422 struct comm_reply* reply;
423 struct dns_msg* return_msg;
424 int return_rcode;
425 struct regional* region; /* unwrapped */
426
427 int curmod;
428
429 enum module_ext_state ext_state[MAX_MODULE];
430 void* minfo[MAX_MODULE];
431
432 struct module_env* env; /* unwrapped */
433 struct mesh_state* mesh_info;
434 };
435
436 %constant int MODULE_COUNT = MAX_MODULE;
437
438 %constant int QF_BIT_CD = 0x0010;
439 %constant int QF_BIT_AD = 0x0020;
440 %constant int QF_BIT_Z = 0x0040;
441 %constant int QF_BIT_RA = 0x0080;
442 %constant int QF_BIT_RD = 0x0100;
443 %constant int QF_BIT_TC = 0x0200;
444 %constant int QF_BIT_AA = 0x0400;
445 %constant int QF_BIT_QR = 0x8000;
446
447 %inline %{
448 enum enum_return_rcode {
449 RCODE_NOERROR = 0,
450 RCODE_FORMERR = 1,
451 RCODE_SERVFAIL = 2,
452 RCODE_NXDOMAIN = 3,
453 RCODE_NOTIMPL = 4,
454 RCODE_REFUSED = 5,
455 RCODE_YXDOMAIN = 6,
456 RCODE_YXRRSET = 7,
457 RCODE_NXRRSET = 8,
458 RCODE_NOTAUTH = 9,
459 RCODE_NOTZONE = 10
460 };
461 %}
462
463 %pythoncode %{
464 class ExtState:
465 def __init__(self, obj): self.obj = obj
466 def __str__(self):
467 return ", ".join([_unboundmodule.strextstate(_unboundmodule._ext_state_get(self.obj,a)) for a in range(0, _unboundmodule.MODULE_COUNT)])
468 def __getitem__(self, index): return _unboundmodule._ext_state_get(self.obj, index)
469 def __setitem__(self, index, value): _unboundmodule._ext_state_set(self.obj, index, value)
470 def __len__(self): return _unboundmodule.MODULE_COUNT
471 %}
472
473 %inline %{
474 enum module_ext_state _ext_state_get(struct module_qstate* q, int idx) {
475 if ((q != NULL) && (idx >= 0) && (idx < MAX_MODULE)) {
476 return q->ext_state[idx];
477 }
478 return 0;
479 }
480
481 void _ext_state_set(struct module_qstate* q, int idx, enum module_ext_state state) {
482 if ((q != NULL) && (idx >= 0) && (idx < MAX_MODULE)) {
483 q->ext_state[idx] = state;
484 }
485 }
486 %}
487
488 %extend module_qstate {
489 %pythoncode %{
490 def set_ext_state(self, id, state):
491 """Sets the ext state"""
492 _unboundmodule._ext_state_set(self, id, state)
493
494 def __ext_state_get(self): return ExtState(self)
495 __swig_getmethods__["ext_state"] = __ext_state_get
496 if _newclass:ext_state = _swig_property(__ext_state_get)#, __ext_state_set)
497 %}
498 }
499
500 /* ************************************************************************************ *
501 Structure config_strlist
502 * ************************************************************************************ */
503 struct config_strlist {
504 struct config_strlist* next;
505 char* str;
506 };
507
508 /* ************************************************************************************ *
509 Structure config_str2list
510 * ************************************************************************************ */
511 struct config_str2list {
512 struct config_str2list* next;
513 char* str;
514 char* str2;
515 };
516
517 /* ************************************************************************************ *
518 Structure config_file
519 * ************************************************************************************ */
520 struct config_file {
521 int verbosity;
522 int stat_interval;
523 int stat_cumulative;
524 int stat_extended;
525 int num_threads;
526 int port;
527 int do_ip4;
528 int do_ip6;
529 int do_udp;
530 int do_tcp;
531 int outgoing_num_ports;
532 size_t outgoing_num_tcp;
533 size_t incoming_num_tcp;
534 int* outgoing_avail_ports;
535 size_t msg_buffer_size;
536 size_t msg_cache_size;
537 size_t msg_cache_slabs;
538 size_t num_queries_per_thread;
539 size_t jostle_time;
540 size_t rrset_cache_size;
541 size_t rrset_cache_slabs;
542 int host_ttl;
543 int lame_ttl;
544 size_t infra_cache_slabs;
545 size_t infra_cache_numhosts;
546 size_t infra_cache_lame_size;
547 char* target_fetch_policy;
548 int if_automatic;
549 int num_ifs;
550 char **ifs;
551 int num_out_ifs;
552 char **out_ifs;
553 struct config_strlist* root_hints;
554 struct config_stub* stubs;
555 struct config_stub* forwards;
556 struct config_strlist* donotqueryaddrs;
557 struct config_str2list* acls;
558 int donotquery_localhost;
559 int harden_short_bufsize;
560 int harden_large_queries;
561 int harden_glue;
562 int harden_dnssec_stripped;
563 int harden_referral_path;
564 int use_caps_bits_for_id;
565 struct config_strlist* private_address;
566 struct config_strlist* private_domain;
567 size_t unwanted_threshold;
568 char* chrootdir;
569 char* username;
570 char* directory;
571 char* logfile;
572 char* pidfile;
573 int use_syslog;
574 int hide_identity;
575 int hide_version;
576 char* identity;
577 char* version;
578 char* module_conf;
579 struct config_strlist* trust_anchor_file_list;
580 struct config_strlist* trust_anchor_list;
581 struct config_strlist* trusted_keys_file_list;
582 char* dlv_anchor_file;
583 struct config_strlist* dlv_anchor_list;
584 int max_ttl;
585 int32_t val_date_override;
586 int bogus_ttl;
587 int val_clean_additional;
588 int val_permissive_mode;
589 char* val_nsec3_key_iterations;
590 size_t key_cache_size;
591 size_t key_cache_slabs;
592 size_t neg_cache_size;
593 struct config_str2list* local_zones;
594 struct config_strlist* local_zones_nodefault;
595 struct config_strlist* local_data;
596 int remote_control_enable;
597 struct config_strlist* control_ifs;
598 int control_port;
599 char* server_key_file;
600 char* server_cert_file;
601 char* control_key_file;
602 char* control_cert_file;
603 int do_daemonize;
604 char* python_script;
605 };
606
607 /* ************************************************************************************ *
608 Enums
609 * ************************************************************************************ */
610 %rename ("MODULE_STATE_INITIAL") "module_state_initial";
611 %rename ("MODULE_WAIT_REPLY") "module_wait_reply";
612 %rename ("MODULE_WAIT_MODULE") "module_wait_module";
613 %rename ("MODULE_WAIT_SUBQUERY") "module_wait_subquery";
614 %rename ("MODULE_ERROR") "module_error";
615 %rename ("MODULE_FINISHED") "module_finished";
616
617 enum module_ext_state {
618 module_state_initial = 0,
619 module_wait_reply,
620 module_wait_module,
621 module_wait_subquery,
622 module_error,
623 module_finished
624 };
625
626 %rename ("MODULE_EVENT_NEW") "module_event_new";
627 %rename ("MODULE_EVENT_PASS") "module_event_pass";
628 %rename ("MODULE_EVENT_REPLY") "module_event_reply";
629 %rename ("MODULE_EVENT_NOREPLY") "module_event_noreply";
630 %rename ("MODULE_EVENT_CAPSFAIL") "module_event_capsfail";
631 %rename ("MODULE_EVENT_MODDONE") "module_event_moddone";
632 %rename ("MODULE_EVENT_ERROR") "module_event_error";
633
634 enum module_ev {
635 module_event_new = 0,
636 module_event_pass,
637 module_event_reply,
638 module_event_noreply,
639 module_event_capsfail,
640 module_event_moddone,
641 module_event_error
642 };
643
644 enum sec_status {
645 sec_status_unchecked = 0,
646 sec_status_bogus,
647 sec_status_indeterminate,
648 sec_status_insecure,
649 sec_status_secure
650 };
651
652 enum verbosity_value {
653 NO_VERBOSE = 0,
654 VERB_OPS,
655 VERB_DETAIL,
656 VERB_QUERY,
657 VERB_ALGO
658 };
659
660 %{
661 int checkList(PyObject *l)
662 {
663 PyObject* item;
664 int i;
665
666 if (l == Py_None)
667 return 1;
668
669 if (PyList_Check(l))
670 {
671 for (i=0; i < PyList_Size(l); i++)
672 {
673 item = PyList_GetItem(l, i);
674 if (!PyString_Check(item))
675 return 0;
676 }
677 return 1;
678 }
679
680 return 0;
681 }
682
683 ldns_rr_list* createRRList(PyObject *l, uint32_t default_ttl)
684 {
685 PyObject* item;
686 ldns_status status;
687 ldns_rr_list* rr_list;
688 ldns_rr* rr;
689 int i;
690
691 if (PyList_Size(l) == 0)
692 return NULL;
693
694 rr_list = ldns_rr_list_new();
695
696 for (i=0; i < PyList_Size(l); i++)
697 {
698 item = PyList_GetItem(l, i);
699
700 status = ldns_rr_new_frm_str(&rr, PyString_AsString(item), default_ttl, 0, 0);
701 if (status != LDNS_STATUS_OK)
702 continue;
703
704 if (!ldns_rr_list_push_rr(rr_list, rr))
705 continue;
706
707 }
708 return rr_list;
709 }
710
711 int set_return_msg(struct module_qstate* qstate,
712 const char* rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags, uint32_t default_ttl,
713 PyObject* question, PyObject* answer, PyObject* authority, PyObject* additional)
714 {
715 ldns_pkt* pkt = 0;
716 ldns_status status;
717 ldns_rr_list* rr_list1 = 0,*rr_list2 = 0,*rr_list3 = 0,*rr_list4 = 0;
718 ldns_buffer *qb = 0;
719 int res = 1;
720
721 if ((!checkList(question)) || (!checkList(answer)) || (!checkList(authority)) || (!checkList(additional)))
722 return 0;
723
724 status = ldns_pkt_query_new_frm_str(&pkt, rr_name, rr_type, rr_class, flags);
725 if ((status != LDNS_STATUS_OK) || (pkt == 0))
726 return 0;
727
728 rr_list1 = createRRList(question, default_ttl);
729 if ((rr_list1) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_QUESTION, rr_list1);
730 rr_list2 = createRRList(answer, default_ttl);
731 if ((rr_list2) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ANSWER, rr_list2);
732 rr_list3 = createRRList(authority, default_ttl);
733 if ((rr_list3) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_AUTHORITY, rr_list3);
734 rr_list4 = createRRList(additional, default_ttl);
735 if ((rr_list4) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ADDITIONAL, rr_list4);
736
737 if ((res) && ((qb = ldns_buffer_new(LDNS_MIN_BUFLEN)) == 0)) res = 0;
738 if ((res) && (ldns_pkt2buffer_wire(qb, pkt) != LDNS_STATUS_OK)) res = 0;
739
740 if (res) res = createResponse(qstate, qb);
741
742 if (qb) ldns_buffer_free(qb);
743
744 ldns_pkt_free(pkt); //this function dealocates pkt as well as rr_lists
745 return res;
746 }
747 %}
748
749 %constant uint16_t PKT_QR = 1; /* QueRy - query flag */
750 %constant uint16_t PKT_AA = 2; /* Authoritative Answer - server flag */
751 %constant uint16_t PKT_TC = 4; /* TrunCated - server flag */
752 %constant uint16_t PKT_RD = 8; /* Recursion Desired - query flag */
753 %constant uint16_t PKT_CD = 16; /* Checking Disabled - query flag */
754 %constant uint16_t PKT_RA = 32; /* Recursion Available - server flag */
755 %constant uint16_t PKT_AD = 64; /* Authenticated Data - server flag */
756
757 int set_return_msg(struct module_qstate* qstate,
758 const char* rr_name, int rr_type, int rr_class , uint16_t flags, uint32_t default_ttl,
759 PyObject* question, PyObject* answer, PyObject* authority, PyObject* additional);
760
761 %pythoncode %{
762 class DNSMessage:
763 def __init__(self, rr_name, rr_type, rr_class = RR_CLASS_IN, query_flags = 0, default_ttl = 0):
764 """Query flags is a combination of PKT_xx contants"""
765 self.rr_name = rr_name
766 self.rr_type = rr_type
767 self.rr_class = rr_class
768 self.default_ttl = default_ttl
769 self.query_flags = query_flags
770 self.question = []
771 self.answer = []
772 self.authority = []
773 self.additional = []
774
775 def set_return_msg(self, qstate):
776 """Returns 1 if OK"""
777 status = _unboundmodule.set_return_msg(qstate, self.rr_name, self.rr_type, self.rr_class,
778 self.query_flags, self.default_ttl,
779 self.question, self.answer, self.authority, self.additional)
780
781 if (status) and (PKT_AA & self.query_flags):
782 qstate.return_msg.rep.authoritative = 1
783
784 return status
785
786 %}
787 /* ************************************************************************************ *
788 Functions
789 * ************************************************************************************ */
790
791 // Various debuging functions
792 void verbose(enum verbosity_value level, const char* format, ...);
793 void log_info(const char* format, ...);
794 void log_err(const char* format, ...);
795 void log_warn(const char* format, ...);
796 void log_hex(const char* msg, void* data, size_t length);
797 void log_dns_msg(const char* str, struct query_info* qinfo, struct reply_info* rep);
798 void log_query_info(enum verbosity_value v, const char* str, struct query_info* qinf);
799 void regional_log_stats(struct regional *r);
800
801 // LDNS functions
802 char *ldns_rr_type2str(const uint16_t atype);
803 char *ldns_rr_class2str(const uint16_t aclass);
804
805 // Functions from pythonmod_utils
806 int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, struct reply_info* msgrep, int is_referral);
807 void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qinfo);
808
809 // Module conversion functions
810 const char* strextstate(enum module_ext_state s);
811 const char* strmodulevent(enum module_ev e);
812
0 /*
1 * pythonmod.c: unbound module C wrapper
2 *
3 * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 * Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * * Neither the name of the organization nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**
36 * \file
37 * Python module for unbound. Calls python script.
38 */
39
40 /* ignore the varargs unused warning from SWIGs internal vararg support */
41 #ifdef __GNUC__
42 #pragma GCC diagnostic ignored "-Wunused-parameter"
43 #endif
44
45 #include "config.h"
46 #include "pythonmod/pythonmod.h"
47 #include "util/module.h"
48 #include "util/config_file.h"
49 #include "pythonmod_utils.h"
50 #include <Python.h>
51
52 /* Generated */
53 #ifndef S_SPLINT_S
54 #include "pythonmod/interface.h"
55 #endif
56
57 int pythonmod_init(struct module_env* env, int id)
58 {
59 /* Initialize module */
60 FILE* script_py = NULL;
61 PyObject* py_cfg, *res;
62 struct pythonmod_env* pe = (struct pythonmod_env*)calloc(1, sizeof(struct pythonmod_env));
63 if (!pe)
64 {
65 log_err("pythonmod: malloc failure");
66 return 0;
67 }
68
69 env->modinfo[id] = (void*) pe;
70
71 /* Initialize module */
72 pe->fname = env->cfg->python_script;
73 if(pe->fname==NULL || pe->fname[0]==0) {
74 log_err("pythonmod: no script given.");
75 return 0;
76 }
77
78 /* Initialize Python libraries */
79 if (!Py_IsInitialized())
80 {
81 Py_SetProgramName("unbound");
82 Py_NoSiteFlag = 1;
83 Py_Initialize();
84 PyEval_InitThreads();
85 PyEval_ReleaseLock();
86 SWIG_init();
87 }
88
89 PyEval_AcquireLock();
90
91 /* Initialize Python */
92 PyRun_SimpleString("import sys \n");
93 PyRun_SimpleString("sys.path.append('.') \n");
94 if(env->cfg->directory && env->cfg->directory[0]) {
95 char wdir[1524];
96 snprintf(wdir, sizeof(wdir), "sys.path.append('%s') \n",
97 env->cfg->directory);
98 PyRun_SimpleString(wdir);
99 }
100 PyRun_SimpleString("sys.path.append('"RUN_DIR"') \n");
101 PyRun_SimpleString("sys.path.append('"SHARE_DIR"') \n");
102 if (PyRun_SimpleString("from unboundmodule import *\n") < 0)
103 {
104 log_err("pythonmod: cannot initialize core module: unboundmodule.py");
105 PyEval_ReleaseLock();
106 return 0;
107 }
108
109 /* Check Python file load */
110 if ((script_py = fopen(pe->fname, "r")) == NULL)
111 {
112 log_err("pythonmod: can't open file %s for reading", pe->fname);
113 PyEval_ReleaseLock();
114 return 0;
115 }
116
117 /* Load file */
118 pe->module = PyImport_AddModule("__main__");
119 pe->dict = PyModule_GetDict(pe->module);
120 pe->data = Py_None;
121 Py_INCREF(pe->data);
122 PyModule_AddObject(pe->module, "mod_env", pe->data);
123
124 /* TODO: deallocation of pe->... if an error occurs */
125
126 if (PyRun_SimpleFile(script_py, pe->fname) < 0)
127 {
128 log_err("pythonmod: can't parse Python script %s", pe->fname);
129 PyEval_ReleaseLock();
130 return 0;
131 }
132
133 fclose(script_py);
134
135 if ((pe->func_init = PyDict_GetItemString(pe->dict, "init")) == NULL)
136 {
137 log_err("pythonmod: function init is missing in %s", pe->fname);
138 PyEval_ReleaseLock();
139 return 0;
140 }
141 if ((pe->func_deinit = PyDict_GetItemString(pe->dict, "deinit")) == NULL)
142 {
143 log_err("pythonmod: function deinit is missing in %s", pe->fname);
144 PyEval_ReleaseLock();
145 return 0;
146 }
147 if ((pe->func_operate = PyDict_GetItemString(pe->dict, "operate")) == NULL)
148 {
149 log_err("pythonmod: function operate is missing in %s", pe->fname);
150 PyEval_ReleaseLock();
151 return 0;
152 }
153 if ((pe->func_inform = PyDict_GetItemString(pe->dict, "inform_super")) == NULL)
154 {
155 log_err("pythonmod: function inform_super is missing in %s", pe->fname);
156 PyEval_ReleaseLock();
157 return 0;
158 }
159
160 py_cfg = SWIG_NewPointerObj((void*) env->cfg, SWIGTYPE_p_config_file, 0);
161 res = PyObject_CallFunction(pe->func_init, "iO", id, py_cfg);
162 if (PyErr_Occurred())
163 {
164 log_err("pythonmod: Exception occurred in function init");
165 PyErr_Print();
166 }
167
168 Py_XDECREF(res);
169 Py_XDECREF(py_cfg);
170 PyEval_ReleaseLock();
171
172 return 1;
173 }
174
175 void pythonmod_deinit(struct module_env* env, int id)
176 {
177 struct pythonmod_env* pe = env->modinfo[id];
178 if(pe == NULL)
179 return;
180
181 /* Free Python resources */
182 if(pe->module != NULL)
183 {
184 PyObject* res;
185
186 /* Deinit module */
187 PyEval_AcquireLock();
188 res = PyObject_CallFunction(pe->func_deinit, "i", id);
189 if (PyErr_Occurred()) {
190 log_err("pythonmod: Exception occurred in function deinit");
191 PyErr_Print();
192 }
193 /* Free result if any */
194 Py_XDECREF(res);
195 /* Free shared data if any */
196 Py_XDECREF(pe->data);
197
198 Py_Finalize();
199 }
200
201 /* Module is deallocated in Python */
202 env->modinfo[id] = NULL;
203 }
204
205 void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_qstate* super)
206 {
207 struct pythonmod_env* pe = (struct pythonmod_env*)qstate->env->modinfo[id];
208 struct pythonmod_qstate* pq = (struct pythonmod_qstate*)qstate->minfo[id];
209 PyObject* py_qstate, *py_sqstate, *res;
210
211 log_query_info(VERB_ALGO, "pythonmod: inform_super, sub is", &qstate->qinfo);
212 log_query_info(VERB_ALGO, "super is", &super->qinfo);
213
214 py_qstate = SWIG_NewPointerObj((void*) qstate, SWIGTYPE_p_module_qstate, 0);
215 py_sqstate = SWIG_NewPointerObj((void*) super, SWIGTYPE_p_module_qstate, 0);
216
217 PyEval_AcquireLock();
218 res = PyObject_CallFunction(pe->func_inform, "iOOO", id, py_qstate,
219 py_sqstate, pq->data);
220
221 if (PyErr_Occurred())
222 {
223 log_err("pythonmod: Exception occurred in function inform_super");
224 PyErr_Print();
225 qstate->ext_state[id] = module_error;
226 }
227 else if ((res == NULL) || (!PyObject_IsTrue(res)))
228 {
229 log_err("pythonmod: python returned bad code in inform_super");
230 qstate->ext_state[id] = module_error;
231 }
232
233 Py_XDECREF(res);
234 Py_XDECREF(py_sqstate);
235 Py_XDECREF(py_qstate);
236
237 PyEval_ReleaseLock();
238 }
239
240 void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
241 int id, struct outbound_entry* ATTR_UNUSED(outbound))
242 {
243 struct pythonmod_env* pe = (struct pythonmod_env*)qstate->env->modinfo[id];
244 struct pythonmod_qstate* pq = (struct pythonmod_qstate*)qstate->minfo[id];
245 PyObject* py_qstate, *res;
246
247 if ( pq == NULL)
248 {
249 /* create qstate */
250 pq = qstate->minfo[id] = malloc(sizeof(struct pythonmod_qstate));
251
252 /* Initialize per query data */
253 pq->data = Py_None;
254 Py_INCREF(pq->data);
255 }
256
257 /* Lock Python */
258 PyEval_AcquireLock();
259
260 /* Call operate */
261 py_qstate = SWIG_NewPointerObj((void*) qstate, SWIGTYPE_p_module_qstate, 0);
262 res = PyObject_CallFunction(pe->func_operate, "iiOO", id, (int) event,
263 py_qstate, pq->data);
264 if (PyErr_Occurred())
265 {
266 log_err("pythonmod: Exception occurred in function operate, event: %s", strmodulevent(event));
267 PyErr_Print();
268 qstate->ext_state[id] = module_error;
269 }
270 else if ((res == NULL) || (!PyObject_IsTrue(res)))
271 {
272 log_err("pythonmod: python returned bad code, event: %s", strmodulevent(event));
273 qstate->ext_state[id] = module_error;
274 }
275 Py_XDECREF(res);
276 Py_XDECREF(py_qstate);
277
278 /* Unlock Python */
279 PyEval_ReleaseLock();
280 }
281
282 void pythonmod_clear(struct module_qstate* qstate, int id)
283 {
284 struct pythonmod_qstate* pq;
285 if (qstate == NULL)
286 return;
287
288 pq = (struct pythonmod_qstate*)qstate->minfo[id];
289 verbose(VERB_ALGO, "pythonmod: clear, id: %d, pq:%lX", id,
290 (unsigned long int)pq);
291 if(pq != NULL)
292 {
293 Py_DECREF(pq->data);
294 /* Free qstate */
295 free(pq);
296 }
297
298 qstate->minfo[id] = NULL;
299 }
300
301 size_t pythonmod_get_mem(struct module_env* env, int id)
302 {
303 struct pythonmod_env* pe = (struct pythonmod_env*)env->modinfo[id];
304 verbose(VERB_ALGO, "pythonmod: get_mem, id: %d, pe:%lX", id,
305 (unsigned long int)pe);
306 if(!pe)
307 return 0;
308 return sizeof(*pe);
309 }
310
311 /**
312 * The module function block
313 */
314 static struct module_func_block pythonmod_block = {
315 "python",
316 &pythonmod_init, &pythonmod_deinit, &pythonmod_operate, &pythonmod_inform_super,
317 &pythonmod_clear, &pythonmod_get_mem
318 };
319
320 struct module_func_block* pythonmod_get_funcblock()
321 {
322 return &pythonmod_block;
323 }
0 /*
1 * pythonmod.h: module header file
2 *
3 * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 * Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * * Neither the name of the organization nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**
36 * \file
37 * Python module for unbound. Calls python script.
38 */
39 #ifndef PYTHONMOD_H
40 #define PYTHONMOD_H
41 #include "util/module.h"
42 #include "services/outbound_list.h"
43 #include <Python.h>
44
45 struct PyObject;
46 #if S_SPLINT_S
47 typedef struct PyObject PyObject;
48 #endif
49
50 /**
51 * Global state for the module.
52 */
53 struct pythonmod_env {
54
55 /** Python script filename. */
56 const char* fname;
57
58 /** Python module. */
59 PyObject* module;
60
61 /** Module init function */
62 PyObject* func_init;
63 /** Module deinit function */
64 PyObject* func_deinit;
65 /** Module operate function */
66 PyObject* func_operate;
67 /** Module super_inform function */
68 PyObject* func_inform;
69
70 /** Python dictionary. */
71 PyObject* dict;
72
73 /** Module data. */
74 PyObject* data;
75
76 /** Module qstate. */
77 struct module_qstate* qstate;
78 };
79
80 /**
81 * Per query state for the iterator module.
82 */
83 struct pythonmod_qstate {
84
85 /** Module per query data. */
86 PyObject* data;
87 };
88
89 /**
90 * Get the module function block.
91 * @return: function block with function pointers to module methods.
92 */
93 struct module_func_block* pythonmod_get_funcblock();
94
95 /** python module init */
96 int pythonmod_init(struct module_env* env, int id);
97
98 /** python module deinit */
99 void pythonmod_deinit(struct module_env* env, int id);
100
101 /** python module operate on a query */
102 void pythonmod_operate(struct module_qstate* qstate, enum module_ev event, int id, struct outbound_entry* outbound);
103
104 /** python module */
105 void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_qstate* super);
106
107 /** python module cleanup query state */
108 void pythonmod_clear(struct module_qstate* qstate, int id);
109
110 /** python module alloc size routine */
111 size_t pythonmod_get_mem(struct module_env* env, int id);
112 #endif /* PYTHONMOD_H */
0 /*
1 * pythonmod_utils.c: utilities used by wrapper
2 *
3 * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 * Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * * Neither the name of the organization nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**
36 * \file
37 * Utility functions for the python module that perform stores and loads and
38 * conversions.
39 */
40 #include "config.h"
41 #include "util/module.h"
42 #include "util/net_help.h"
43 #include "services/cache/dns.h"
44 #include "services/cache/rrset.h"
45 #include "util/data/msgparse.h"
46 #include "util/data/msgreply.h"
47 #include "util/storage/slabhash.h"
48 #include "util/regional.h"
49 #include <Python.h>
50
51 /** Store the reply_info and query_info pair in message cache (qstate->msg_cache) */
52 int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, struct reply_info* msgrep, int is_referral)
53 {
54 if (!msgrep)
55 return 0;
56
57 if (msgrep->authoritative) //authoritative answer can't be stored in cache
58 {
59 PyErr_SetString(PyExc_ValueError, "Authoritative answer can't be stored");
60 return 0;
61 }
62
63 return dns_cache_store(qstate->env, qinfo, msgrep, is_referral);
64 }
65
66 /** Invalidate the message associated with query_info stored in message cache */
67 void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qinfo)
68 {
69 hashvalue_t h;
70 struct lruhash_entry* e;
71 struct reply_info *r;
72 size_t i, j;
73
74 h = query_info_hash(qinfo);
75 if ((e=slabhash_lookup(qstate->env->msg_cache, h, qinfo, 0)))
76 {
77 r = (struct reply_info*)(e->data);
78 if (r)
79 {
80 r->ttl = 0;
81 if(rrset_array_lock(r->ref, r->rrset_count, *qstate->env->now)) {
82 for(i=0; i< r->rrset_count; i++)
83 {
84 struct packed_rrset_data* data =
85 (struct packed_rrset_data*) r->ref[i].key->entry.data;
86 if(i>0 && r->ref[i].key == r->ref[i-1].key)
87 continue;
88
89 data->ttl = r->ttl;
90 for(j=0; j<data->count + data->rrsig_count; j++)
91 data->rr_ttl[j] = r->ttl;
92 }
93 rrset_array_unlock(r->ref, r->rrset_count);
94 }
95 }
96 lock_rw_unlock(&e->lock);
97 } else {
98 log_info("invalidateQueryInCache: qinfo is not in cache");
99 }
100 }
101
102 /** Create response according to the ldns packet content */
103 int createResponse(struct module_qstate* qstate, ldns_buffer* pkt)
104 {
105 struct msg_parse* prs;
106 struct edns_data edns;
107
108 /* parse message */
109 prs = (struct msg_parse*) regional_alloc(qstate->env->scratch, sizeof(struct msg_parse));
110 if (!prs) {
111 log_err("storeResponse: out of memory on incoming message");
112 return 0;
113 }
114
115 memset(prs, 0, sizeof(*prs));
116 memset(&edns, 0, sizeof(edns));
117
118 ldns_buffer_set_position(pkt, 0);
119 if (parse_packet(pkt, prs, qstate->env->scratch) != LDNS_RCODE_NOERROR) {
120 verbose(VERB_ALGO, "storeResponse: parse error on reply packet");
121 return 0;
122 }
123 /* edns is not examined, but removed from message to help cache */
124 if(parse_extract_edns(prs, &edns) != LDNS_RCODE_NOERROR)
125 return 0;
126
127 /* remove CD-bit, we asked for in case we handle validation ourself */
128 prs->flags &= ~BIT_CD;
129
130 /* allocate response dns_msg in region */
131 qstate->return_msg = (struct dns_msg*)regional_alloc(qstate->region, sizeof(struct dns_msg));
132 if (!qstate->return_msg)
133 return 0;
134
135 memset(qstate->return_msg, 0, sizeof(*qstate->return_msg));
136 if(!parse_create_msg(pkt, prs, NULL, &(qstate->return_msg)->qinfo, &(qstate->return_msg)->rep, qstate->region)) {
137 log_err("storeResponse: malloc failure: allocating incoming dns_msg");
138 return 0;
139 }
140
141 /* Make sure that the RA flag is set (since the presence of
142 * this module means that recursion is available) */
143 //qstate->return_msg->rep->flags |= BIT_RA;
144
145 /* Clear the AA flag */
146 /* FIXME: does this action go here or in some other module? */
147 //qstate->return_msg->rep->flags &= ~BIT_AA;
148
149 /* make sure QR flag is on */
150 //qstate->return_msg->rep->flags |= BIT_QR;
151
152 if(verbosity >= VERB_ALGO)
153 log_dns_msg("storeResponse: packet:", &qstate->return_msg->qinfo, qstate->return_msg->rep);
154
155 return 1;
156 }
0 /*
1 * pythonmod_utils.h: utils header file
2 *
3 * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 * Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * * Neither the name of the organization nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**
36 * \file
37 * Utility functions for the python module that perform stores and loads and
38 * conversions.
39 */
40 #ifndef PYTHONMOD_UTILS_H
41 #define PYTHONMOD_UTILS_H
42
43 #include "util/module.h"
44
45 /**
46 * Store the reply_info and query_info pair in message cache (qstate->msg_cache)
47 *
48 * @param qstate: module environment
49 * @param qinfo: query info, the query for which answer is stored.
50 * @param msgrep: reply in dns_msg
51 * @param is_referral: If true, then the given message to be stored is a
52 * referral. The cache implementation may use this as a hint.
53 * It will store only the RRsets, not the message.
54 * @return 0 on alloc error (out of memory).
55 */
56 int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, struct reply_info* msgrep, int is_referral);
57
58
59 /**
60 * Invalidate the message associated with query_info stored in message cache.
61 *
62 * This function invalidates the record in message cache associated with the given query only if such a record exists.
63 *
64 * @param qstate: module environment
65 * @param qinfo: query info, the query for which answer is stored.
66 */
67 void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qinfo);
68
69 /**
70 * Create response according to the ldns packet content
71 *
72 * This function fills qstate.return_msg up with data of a given packet
73 *
74 * @param qstate: module environment
75 * @param pkt: a ldns_buffer which contains ldns_packet data
76 */
77 int createResponse(struct module_qstate* qstate, ldns_buffer* pkt);
78
79 #endif /* PYTHONMOD_UTILS_H */
0 # Example configuration file for calc.py
1 server:
2 verbosity: 1
3 interface: 0.0.0.0
4 do-daemonize: no
5 access-control: 0.0.0.0/0 allow
6 chroot: ""
7 username: ""
8 directory: ""
9 logfile: ""
10 pidfile: "unbound.pid"
11 module-config: "validator python iterator"
12
13 # Python config section
14 python:
15 # Script file to load
16 python-script: "./examples/calc.py"
17
0 # Example configuration file for dict.py
1 server:
2 verbosity: 1
3 interface: 0.0.0.0
4 do-daemonize: no
5 access-control: 0.0.0.0/0 allow
6 chroot: ""
7 username: ""
8 directory: ""
9 logfile: ""
10 pidfile: "unbound.pid"
11 module-config: "validator python iterator"
12
13 # Python config section
14 python:
15 # Script file to load
16 python-script: "./examples/dict.py"
17
0 # Example configuration file for log.py
1 server:
2 verbosity: 1
3 interface: 0.0.0.0
4 do-daemonize: no
5 access-control: 0.0.0.0/0 allow
6 chroot: ""
7 username: ""
8 directory: ""
9 logfile: ""
10 pidfile: "unbound.pid"
11 module-config: "validator python iterator"
12
13 # Python config section
14 python:
15 # Script file to load
16 python-script: "./examples/log.py"
0 # Example configuration file for resgen.py
1 server:
2 verbosity: 1
3 interface: 0.0.0.0
4 do-daemonize: no
5 access-control: 0.0.0.0/0 allow
6 chroot: ""
7 username: ""
8 directory: ""
9 logfile: ""
10 pidfile: "unbound.pid"
11 module-config: "validator python iterator"
12
13 # Python config section
14 python:
15 # Script file to load
16 python-script: "./examples/resgen.py"
17
0 # Example configuration file for resmod.py
1 server:
2 verbosity: 1
3 interface: 0.0.0.0
4 do-daemonize: no
5 access-control: 0.0.0.0/0 allow
6 chroot: ""
7 username: ""
8 directory: ""
9 logfile: ""
10 pidfile: "unbound.pid"
11 #module-config: "python iterator"
12 module-config: "validator python iterator"
13
14 # Python config section
15 python:
16 # Script file to load
17 python-script: "./examples/resmod.py"
18
0 # -*- coding: utf-8 -*-
1 '''
2 ubmodule-msg.py: simple response packet logger
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 import os
35
36 def init(id, cfg):
37 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
38 return True
39
40 def deinit(id):
41 log_info("pythonmod: deinit called, module id is %d" % id)
42 return True
43
44 def inform_super(id, qstate, superqstate, qdata):
45 return True
46
47 def setTTL(qstate, ttl):
48 """Sets return_msg TTL and all the RRs TTL"""
49 if qstate.return_msg:
50 qstate.return_msg.rep.ttl = ttl
51 if (qstate.return_msg.rep):
52 for i in range(0,qstate.return_msg.rep.rrset_count):
53 d = qstate.return_msg.rep.rrsets[i].entry.data
54 for j in range(0,d.count+d.rrsig_count):
55 d.rr_ttl[j] = ttl
56
57 def dataHex(data, prefix=""):
58 res = ""
59 for i in range(0, (len(data)+15)/16):
60 res += "%s0x%02X | " % (prefix, i*16)
61 d = map(lambda x:ord(x), data[i*16:i*16+17])
62 for ch in d:
63 res += "%02X " % ch
64 for i in range(0,17-len(d)):
65 res += " "
66 res += "| "
67 for ch in d:
68 if (ch < 32) or (ch > 127):
69 res += ". "
70 else:
71 res += "%c " % ch
72 res += "\n"
73 return res
74
75 def printReturnMsg(qstate):
76 print "Return MSG rep :: flags: %04X, QDcount: %d, Security:%d, TTL=%d" % (qstate.return_msg.rep.flags, qstate.return_msg.rep.qdcount,qstate.return_msg.rep.security, qstate.return_msg.rep.ttl)
77 print " qinfo :: qname:",qstate.return_msg.qinfo.qname_list, qstate.return_msg.qinfo.qname_str, "type:",qstate.return_msg.qinfo.qtype_str, "class:",qstate.return_msg.qinfo.qclass_str
78 if (qstate.return_msg.rep):
79 print "RRSets:",qstate.return_msg.rep.rrset_count
80 prevkey = None
81 for i in range(0,qstate.return_msg.rep.rrset_count):
82 r = qstate.return_msg.rep.rrsets[i]
83 rk = r.rk
84 print i,":",rk.dname_list, rk.dname_str, "flags: %04X" % rk.flags,
85 print "type:",rk.type_str,"(%d)" % ntohs(rk.type), "class:",rk.rrset_class_str,"(%d)" % ntohs(rk.rrset_class)
86
87 d = r.entry.data
88 print " RRDatas:",d.count+d.rrsig_count
89 for j in range(0,d.count+d.rrsig_count):
90 print " ",j,":","TTL=",d.rr_ttl[j],"RR data:"
91 print dataHex(d.rr_data[j]," ")
92
93
94 def operate(id, event, qstate, qdata):
95 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
96 #print "pythonmod: per query data", qdata
97
98 print "Query:", ''.join(map(lambda x:chr(max(32,ord(x))),qstate.qinfo.qname)), qstate.qinfo.qname_list, qstate.qinfo.qname_str,
99 print "Type:",qstate.qinfo.qtype_str,"(%d)" % qstate.qinfo.qtype,
100 print "Class:",qstate.qinfo.qclass_str,"(%d)" % qstate.qinfo.qclass
101 print
102
103 #if event == MODULE_EVENT_PASS: #pokud mame "validator python iterator"
104 if (event == MODULE_EVENT_NEW) and (qstate.qinfo.qname_str.endswith(".seznam.cz.")): #pokud mame "python validator iterator"
105 print qstate.qinfo.qname_str
106
107 qstate.ext_state[id] = MODULE_FINISHED
108
109 msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_A, RR_CLASS_IN, PKT_QR | PKT_RA | PKT_AA) #, 300)
110 #msg.authority.append("xxx.seznam.cz. 10 IN A 192.168.1.1")
111 #msg.additional.append("yyy.seznam.cz. 10 IN A 1.1.1.2.")
112
113 if qstate.qinfo.qtype == RR_TYPE_A:
114 msg.answer.append("%s 10 IN A 192.168.1.1" % qstate.qinfo.qname_str)
115 if (qstate.qinfo.qtype == RR_TYPE_SRV) or (qstate.qinfo.qtype == RR_TYPE_ANY):
116 msg.answer.append("%s 10 IN SRV 0 0 80 neinfo.example.com." % qstate.qinfo.qname_str)
117 if (qstate.qinfo.qtype == RR_TYPE_TXT) or (qstate.qinfo.qtype == RR_TYPE_ANY):
118 msg.answer.append("%s 10 IN TXT path=/" % qstate.qinfo.qname_str)
119
120 if not msg.set_return_msg(qstate):
121 qstate.ext_state[id] = MODULE_ERROR
122 return True
123
124 #qstate.return_msg.rep.security = 2 #pokud nebude nasledovat validator, je zapotrebi nastavit security, aby nebyl paket zahozen v mesh_send_reply
125 printReturnMsg(qstate)
126
127 #Authoritative result can't be stored in cache
128 #if (not storeQueryInCache(qstate, qstate.return_msg.qinfo, qstate.return_msg.rep, 0)):
129 # print "Can't store in cache"
130 # qstate.ext_state[id] = MODULE_ERROR
131 # return False
132 #print "Store OK"
133
134 qstate.return_rcode = RCODE_NOERROR
135 return True
136
137 if event == MODULE_EVENT_NEW:
138 qstate.ext_state[id] = MODULE_WAIT_MODULE
139 return True
140
141 if event == MODULE_EVENT_MODDONE:
142 log_info("pythonmod: previous module done")
143 qstate.ext_state[id] = MODULE_FINISHED
144 return True
145
146 if event == MODULE_EVENT_PASS:
147 log_info("pythonmod: event_pass")
148 qstate.ext_state[id] = MODULE_WAIT_MODULE
149 return True
150
151 log_err("pythonmod: BAD event")
152 qstate.ext_state[id] = MODULE_ERROR
153 return True
154
155 log_info("pythonmod: script loaded.")
0 # -*- coding: utf-8 -*-
1 '''
2 ubmodule-tst.py:
3
4 Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5 Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
6
7 Copyright (c) 2008. All rights reserved.
8
9 This software is open source.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
14
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 Redistributions in binary form must reproduce the above copyright notice,
19 this list of conditions and the following disclaimer in the documentation
20 and/or other materials provided with the distribution.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33 '''
34 def init(id, cfg):
35 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
36 return True
37
38 def deinit(id):
39 log_info("pythonmod: deinit called, module id is %d" % id)
40 return True
41
42 def inform_super(id, qstate, superqstate, qdata):
43 return True
44
45 def setTTL(qstate, ttl):
46 """Sets return_msg TTL and all the RRs TTL"""
47 if qstate.return_msg:
48 qstate.return_msg.rep.ttl = ttl
49 if (qstate.return_msg.rep):
50 for i in range(0,qstate.return_msg.rep.rrset_count):
51 d = qstate.return_msg.rep.rrsets[i].entry.data
52 for j in range(0,d.count+d.rrsig_count):
53 d.rr_ttl[j] = ttl
54
55 def dataHex(data, prefix=""):
56 res = ""
57 for i in range(0, (len(data)+15)/16):
58 res += "%s0x%02X | " % (prefix, i*16)
59 d = map(lambda x:ord(x), data[i*16:i*16+17])
60 for ch in d:
61 res += "%02X " % ch
62 for i in range(0,17-len(d)):
63 res += " "
64 res += "| "
65 for ch in d:
66 if (ch < 32) or (ch > 127):
67 res += ". "
68 else:
69 res += "%c " % ch
70 res += "\n"
71 return res
72
73 def printReturnMsg(qstate):
74 print "Return MSG rep :: flags: %04X, QDcount: %d, Security:%d, TTL=%d" % (qstate.return_msg.rep.flags, qstate.return_msg.rep.qdcount,qstate.return_msg.rep.security, qstate.return_msg.rep.ttl)
75 print " qinfo :: qname:",qstate.return_msg.qinfo.qname_list, qstate.return_msg.qinfo.qname_str, "type:",qstate.return_msg.qinfo.qtype_str, "class:",qstate.return_msg.qinfo.qclass_str
76 if (qstate.return_msg.rep):
77 print "RRSets:",qstate.return_msg.rep.rrset_count
78 prevkey = None
79 for i in range(0,qstate.return_msg.rep.rrset_count):
80 r = qstate.return_msg.rep.rrsets[i]
81 rk = r.rk
82 print i,":",rk.dname_list, rk.dname_str, "flags: %04X" % rk.flags,
83 print "type:",rk.type_str,"(%d)" % ntohs(rk.type), "class:",rk.rrset_class_str,"(%d)" % ntohs(rk.rrset_class)
84
85 d = r.entry.data
86 print " RRDatas:",d.count+d.rrsig_count
87 for j in range(0,d.count+d.rrsig_count):
88 print " ",j,":","TTL=",d.rr_ttl[j],"RR data:"
89 print dataHex(d.rr_data[j]," ")
90
91 def operate(id, event, qstate, qdata):
92 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
93 #print "pythonmod: per query data", qdata
94
95 print "Query:", ''.join(map(lambda x:chr(max(32,ord(x))),qstate.qinfo.qname)), qstate.qinfo.qname_list,
96 print "Type:",qstate.qinfo.qtype_str,"(%d)" % qstate.qinfo.qtype,
97 print "Class:",qstate.qinfo.qclass_str,"(%d)" % qstate.qinfo.qclass
98 print
99
100 # TEST:
101 # > dig @127.0.0.1 www.seznam.cz A
102 # > dig @127.0.0.1 3.76.75.77.in-addr.arpa. PTR
103 # prvni dva dotazy vrati TTL 100
104 # > dig @127.0.0.1 www.seznam.cz A
105 # > dig @127.0.0.1 3.76.75.77.in-addr.arpa. PTR
106 # dalsi dva dotazy vrati TTL 10, ktere se bude s dalsimi dotazy snizovat, nez vyprsi a znovu se zaktivuje mesh
107
108 if qstate.return_msg:
109 printReturnMsg(qstate)
110
111 #qdn = '.'.join(qstate.qinfo.qname_list)
112 qdn = qstate.qinfo.qname_str
113
114 #Pokud dotaz konci na nasledujici, pozmenime TTL zpravy, ktera se posle klientovi (return_msg) i zpravy v CACHE
115 if qdn.endswith(".seznam.cz.") or qdn.endswith('.in-addr.arpa.'):
116 #pokud je v cache odpoved z iteratoru, pak ji zneplatnime, jinak se moduly nazavolaji do te doby, nez vyprsi TTL
117 invalidateQueryInCache(qstate, qstate.return_msg.qinfo)
118
119 if (qstate.return_msg.rep.authoritative):
120 print "X"*300
121
122 setTTL(qstate, 10) #do cache nastavime TTL na 10
123 if not storeQueryInCache(qstate, qstate.return_msg.qinfo, qstate.return_msg.rep, 0):
124 qstate.ext_state[id] = MODULE_ERROR
125 return False
126
127 setTTL(qstate, 100) #odpoved klientovi prijde s TTL 100
128 qstate.return_rcode = RCODE_NOERROR
129
130 if event == MODULE_EVENT_NEW:
131 qstate.ext_state[id] = MODULE_WAIT_MODULE
132 return True
133
134 if event == MODULE_EVENT_MODDONE:
135 log_info("pythonmod: previous module done")
136 qstate.ext_state[id] = MODULE_FINISHED
137 return True
138
139 if event == MODULE_EVENT_PASS:
140 log_info("pythonmod: event_pass")
141 qstate.ext_state[id] = MODULE_WAIT_MODULE
142 return True
143
144 log_err("pythonmod: BAD event")
145 qstate.ext_state[id] = MODULE_ERROR
146 return True
147
148 log_info("pythonmod: script loaded.")
425425 return NULL;
426426 msg->rep->flags = r->flags;
427427 msg->rep->qdcount = r->qdcount;
428 msg->rep->ttl = r->ttl;
428 msg->rep->ttl = r->ttl - now;
429429 msg->rep->security = r->security;
430430 msg->rep->an_numrrsets = r->an_numrrsets;
431431 msg->rep->ns_numrrsets = r->ns_numrrsets;
432432 msg->rep->ar_numrrsets = r->ar_numrrsets;
433433 msg->rep->rrset_count = r->rrset_count;
434 msg->rep->authoritative = r->authoritative;
434435 if(!rrset_array_lock(r->ref, r->rrset_count, now))
435436 return NULL;
436437 for(i=0; i<msg->rep->rrset_count; i++) {
460461 if(!msg)
461462 return NULL;
462463 msg->rep->flags = BIT_QR; /* reply, no AA, no error */
464 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
463465 msg->rep->qdcount = 1;
464466 msg->rep->ttl = d->ttl - now;
465467 msg->rep->security = sec_status_unchecked;
494496 if(!msg)
495497 return NULL;
496498 msg->rep->flags = BIT_QR; /* reply, no AA, no error */
499 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
497500 msg->rep->qdcount = 1;
498501 msg->rep->ttl = d->ttl - now;
499502 msg->rep->security = sec_status_unchecked;
3737 *
3838 * This file has functions to get queries from clients.
3939 */
40
40 #include "config.h"
4141 #include "services/listen_dnsport.h"
4242 #include "services/outside_network.h"
4343 #include "util/netevent.h"
125125 #ifndef USE_WINSOCK
126126 log_err("setsockopt(..., IPV6_V6ONLY"
127127 ", ...) failed: %s", strerror(errno));
128 close(s);
128129 #else
129130 log_err("setsockopt(..., IPV6_V6ONLY"
130131 ", ...) failed: %s",
131132 wsa_strerror(WSAGetLastError()));
132 #endif
133 close(s);
133 closesocket(s);
134 #endif
134135 *noproto = 0;
135136 *inuse = 0;
136137 return -1;
151152 #ifndef USE_WINSOCK
152153 log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
153154 "...) failed: %s", strerror(errno));
155 close(s);
154156 #else
155157 log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
156158 "...) failed: %s",
157159 wsa_strerror(WSAGetLastError()));
158 #endif
159 close(s);
160 closesocket(s);
161 #endif
160162 *noproto = 0;
161163 *inuse = 0;
162164 return -1;
168170 #ifndef USE_WINSOCK
169171 #ifdef EADDRINUSE
170172 *inuse = (errno == EADDRINUSE);
171 if(errno != EADDRINUSE)
173 /* detect freebsd jail with no ipv6 permission */
174 if(family==AF_INET6 && errno==EINVAL)
175 *noproto = 1;
176 else if(errno != EADDRINUSE)
172177 log_err("can't bind socket: %s", strerror(errno));
173 #endif
178 #endif /* EADDRINUSE */
179 close(s);
174180 #else /* USE_WINSOCK */
175181 if(WSAGetLastError() != WSAEADDRINUSE &&
176182 WSAGetLastError() != WSAEADDRNOTAVAIL)
177183 log_err("can't bind socket: %s",
178184 wsa_strerror(WSAGetLastError()));
179 #endif
180 close(s);
185 closesocket(s);
186 #endif
181187 return -1;
182188 }
183189 if(!fd_set_nonblock(s)) {
184190 *noproto = 0;
185191 *inuse = 0;
192 #ifndef USE_WINSOCK
186193 close(s);
194 #else
195 closesocket(s);
196 #endif
187197 return -1;
188198 }
189199 return s;
248258 #endif /* IPV6_V6ONLY */
249259 if(bind(s, addr->ai_addr, addr->ai_addrlen) != 0) {
250260 #ifndef USE_WINSOCK
251 log_err("can't bind socket: %s", strerror(errno));
261 /* detect freebsd jail with no ipv6 permission */
262 if(addr->ai_family==AF_INET6 && errno==EINVAL)
263 *noproto = 1;
264 else log_err("can't bind socket: %s", strerror(errno));
252265 #else
253266 log_err("can't bind socket: %s",
254267 wsa_strerror(WSAGetLastError()));
281294 hints->ai_socktype = stype;
282295 *noip6 = 0;
283296 if((r=getaddrinfo(ifname, port, hints, &res)) != 0 || !res) {
297 #ifdef USE_WINSOCK
298 if(r == EAI_NONAME && hints->ai_family == AF_INET6){
299 *noip6 = 1; /* 'Host not found' for IP6 on winXP */
300 return -1;
301 }
302 #endif
284303 log_err("node %s:%s getaddrinfo: %s %s",
285304 ifname?ifname:"default", port, gai_strerror(r),
286305 #ifdef EAI_SYSTEM
419438 if(!set_recvpktinfo(s, hints->ai_family))
420439 return 0;
421440 if(!port_insert(list, s, listen_type_udpancil)) {
441 #ifndef USE_WINSOCK
422442 close(s);
443 #else
444 closesocket(s);
445 #endif
423446 return 0;
424447 }
425448 } else if(do_udp) {
433456 return 0;
434457 }
435458 if(!port_insert(list, s, listen_type_udp)) {
459 #ifndef USE_WINSOCK
436460 close(s);
461 #else
462 closesocket(s);
463 #endif
437464 return 0;
438465 }
439466 }
447474 return 0;
448475 }
449476 if(!port_insert(list, s, listen_type_tcp)) {
477 #ifndef USE_WINSOCK
450478 close(s);
479 #else
480 closesocket(s);
481 #endif
451482 return 0;
452483 }
453484 }
654685 struct listen_port* nx;
655686 while(list) {
656687 nx = list->next;
657 if(list->fd != -1)
688 if(list->fd != -1) {
689 #ifndef USE_WINSOCK
658690 close(list->fd);
691 #else
692 closesocket(list->fd);
693 #endif
694 }
659695 free(list);
660696 list = nx;
661697 }
4141 #ifndef LISTEN_DNSPORT_H
4242 #define LISTEN_DNSPORT_H
4343
44 #include "config.h"
4544 #include "util/netevent.h"
4645 struct listen_list;
4746 struct config_file;
118118 b->namelabs, &m);
119119 }
120120
121 /** form wireformat from text format domain name */
122 static int
121 /* form wireformat from text format domain name */
122 int
123123 parse_dname(const char* str, uint8_t** res, size_t* len, int* labs)
124124 {
125125 ldns_rdf* rdf;
293293 void local_zones_del_data(struct local_zones* zones,
294294 uint8_t* name, size_t len, int labs, uint16_t dclass);
295295
296
297 /**
298 * Form wireformat from text format domain name.
299 * @param str: the domain name in text "www.example.com"
300 * @param res: resulting wireformat is stored here with malloc.
301 * @param len: length of resulting wireformat.
302 * @param labs: number of labels in resulting wireformat.
303 * @return false on error, syntax or memory. Also logged.
304 */
305 int parse_dname(const char* str, uint8_t** res, size_t* len, int* labs);
306
296307 #endif /* SERVICES_LOCALZONE_H */
187187
188188 /** help mesh delete delete mesh states */
189189 static void
190 mesh_delete_helper(rbnode_t* n, void* ATTR_UNUSED(arg))
190 mesh_delete_helper(rbnode_t* n)
191191 {
192192 struct mesh_state* mstate = (struct mesh_state*)n->key;
193 mesh_state_cleanup(mstate);
193 /* perform a full delete, not only 'cleanup' routine,
194 * because other callbacks expect a clean state in the mesh.
195 * For 're-entrant' calls */
196 mesh_state_delete(&mstate->s);
197 /* but because these delete the items from the tree, postorder
198 * traversal and rbtree rebalancing do not work together */
194199 }
195200
196201 void
199204 if(!mesh)
200205 return;
201206 /* free all query states */
202 traverse_postorder(&mesh->all, &mesh_delete_helper, NULL);
207 while(mesh->all.count)
208 mesh_delete_helper(mesh->all.root);
203209 timehist_delete(mesh->histogram);
204210 free(mesh);
211 }
212
213 void
214 mesh_delete_all(struct mesh_area* mesh)
215 {
216 /* free all query states */
217 while(mesh->all.count)
218 mesh_delete_helper(mesh->all.root);
219 mesh->stats_dropped += mesh->num_reply_addrs;
220 /* clear mesh area references */
221 rbtree_init(&mesh->run, &mesh_state_compare);
222 rbtree_init(&mesh->all, &mesh_state_compare);
223 mesh->num_reply_addrs = 0;
224 mesh->num_reply_states = 0;
225 mesh->num_detached_states = 0;
226 mesh->num_forever_states = 0;
227 mesh->forever_first = NULL;
228 mesh->forever_last = NULL;
229 mesh->jostle_first = NULL;
230 mesh->jostle_last = NULL;
205231 }
206232
207233 int mesh_make_new_space(struct mesh_area* mesh)
391391 void mesh_state_cleanup(struct mesh_state* mstate);
392392
393393 /**
394 * Delete all mesh states from the mesh.
395 * @param mesh: the mesh area to clear
396 */
397 void mesh_delete_all(struct mesh_area* mesh);
398
399 /**
394400 * Find a mesh state in the mesh area. Pass relevant flags.
395401 *
396402 * @param mesh: the mesh area to look in.
4444 #include "iterator/iterator.h"
4545 #include "validator/validator.h"
4646
47 #ifdef WITH_PYTHONMODULE
48 #include "pythonmod/pythonmod.h"
49 #endif
50
4751 /** count number of modules (words) in the string */
4852 static int
4953 count_modules(const char* s)
104108 return 1;
105109 }
106110
111 /** The list of module names */
112 const char**
113 module_list_avail(void)
114 {
115 /* these are the modules available */
116 static const char* names[] = {
117 #ifdef WITH_PYTHONMODULE
118 "python",
119 #endif
120 "validator",
121 "iterator",
122 NULL};
123 return names;
124 }
125
126 /** func block get function type */
127 typedef struct module_func_block* (*fbgetfunctype)(void);
128
129 /** The list of module func blocks */
130 static fbgetfunctype*
131 module_funcs_avail(void)
132 {
133 static struct module_func_block* (*fb[])(void) = {
134 #ifdef WITH_PYTHONMODULE
135 &pythonmod_get_funcblock,
136 #endif
137 &val_get_funcblock,
138 &iter_get_funcblock,
139 NULL};
140 return fb;
141 }
142
107143 struct
108144 module_func_block* module_factory(const char** str)
109145 {
110 /* these are the modules available */
111 int num = 2;
112 const char* names[] = {"iterator", "validator", NULL};
113 struct module_func_block* (*fb[])(void) =
114 {&iter_get_funcblock, &val_get_funcblock, NULL};
115
116 int i;
146 int i = 0;
117147 const char* s = *str;
148 const char** names = module_list_avail();
149 fbgetfunctype* fb = module_funcs_avail();
118150 while(*s && isspace((int)*s))
119151 s++;
120 for(i=0; i<num; i++) {
152 while(names[i]) {
121153 if(strncmp(names[i], s, strlen(names[i])) == 0) {
122154 s += strlen(names[i]);
123155 *str = s;
124156 return (*fb[i])();
125157 }
158 i++;
126159 }
127160 return NULL;
128161 }
7676 struct module_func_block* module_factory(const char** str);
7777
7878 /**
79 * Get list of modules available.
80 * @return list of modules available. Static strings, ends with NULL.
81 */
82 const char** module_list_avail(void);
83
84 /**
7985 * Setup modules. Assigns ids and calls module_init.
8086 * @param stack: if not empty beforehand, it will be desetup()ed.
8187 * It is then modstack_configged().
3838 * This file has functions to send queries to authoritative servers and
3939 * wait for the pending answer events.
4040 */
41
41 #include "config.h"
4242 #include "services/outside_network.h"
4343 #include "services/listen_dnsport.h"
4444 #include "services/cache/infra.h"
161161 if(1) {
162162 #endif
163163 log_err("outgoing tcp: connect: %s", strerror(errno));
164 close(s);
164165 #else /* USE_WINSOCK */
165166 if(WSAGetLastError() != WSAEINPROGRESS &&
166167 WSAGetLastError() != WSAEWOULDBLOCK) {
168 closesocket(s);
167169 #endif
168170 log_addr(0, "failed address", &w->addr, w->addrlen);
169 close(s);
170171 return 0;
171172 }
172173 }
192193 use_free_buffer(struct outside_network* outnet)
193194 {
194195 struct waiting_tcp* w;
195 while(outnet->tcp_free && outnet->tcp_wait_first) {
196 while(outnet->tcp_free && outnet->tcp_wait_first
197 && !outnet->want_to_quit) {
196198 w = outnet->tcp_wait_first;
197199 outnet->tcp_wait_first = w->next_waiting;
198200 if(outnet->tcp_wait_last == w)
274276 {
275277 struct pending* pend;
276278 /* process waiting queries */
277 while(outnet->udp_wait_first && outnet->unused_fds) {
279 while(outnet->udp_wait_first && outnet->unused_fds
280 && !outnet->want_to_quit) {
278281 pend = outnet->udp_wait_first;
279282 outnet->udp_wait_first = pend->next_waiting;
280283 if(!pend->next_waiting) outnet->udp_wait_last = NULL;
481484 outnet->infra = infra;
482485 outnet->rnd = rnd;
483486 outnet->svcd_overhead = 0;
487 outnet->want_to_quit = 0;
484488 outnet->unwanted_threshold = unwanted_threshold;
485489 outnet->unwanted_action = unwanted_action;
486490 outnet->unwanted_param = unwanted_param;
607611 }
608612
609613 void
610 outside_network_delete(struct outside_network* outnet)
614 outside_network_quit_prepare(struct outside_network* outnet)
611615 {
612616 if(!outnet)
613617 return;
618 /* prevent queued items from being sent */
619 outnet->want_to_quit = 1;
620 }
621
622 void
623 outside_network_delete(struct outside_network* outnet)
624 {
625 if(!outnet)
626 return;
627 outnet->want_to_quit = 1;
614628 /* check every element, since we can be called on malloc error */
615629 if(outnet->pending) {
616630 /* free pending elements, but do no unlink from tree. */
11151129 if(p->pc)
11161130 portcomm_loweruse(sq->outnet, p->pc);
11171131 pending_delete(sq->outnet, p);
1132 /* this call can cause reentrant calls back into the
1133 * mesh */
11181134 outnet_send_wait_udp(sq->outnet);
11191135 } else {
11201136 struct waiting_tcp* p = (struct waiting_tcp*)
4242 #ifndef OUTSIDE_NETWORK_H
4343 #define OUTSIDE_NETWORK_H
4444
45 #include "config.h"
4645 #include "util/rbtree.h"
4746 #include "util/netevent.h"
4847 struct pending;
7574 size_t svcd_overhead;
7675 /** use x20 bits to encode additional ID random bits */
7776 int use_caps_for_id;
77 /** outside network wants to quit. Stop queued msgs from sent. */
78 int want_to_quit;
7879
7980 /** number of unwanted replies received (for statistics) */
8081 size_t unwanted_replies;
361362 void outside_network_delete(struct outside_network* outnet);
362363
363364 /**
365 * Prepare for quit. Sends no more queries, even if queued up.
366 * @param outnet: object to prepare for removal
367 */
368 void outside_network_quit_prepare(struct outside_network* outnet);
369
370 /**
364371 * Send UDP query, create pending answer.
365372 * Changes the ID for the query to be random and unique for that destination.
366373 * @param outnet: provides the event handling
4848 #include "util/net_help.h"
4949 #include "util/regional.h"
5050 #include "iterator/iterator.h"
51 #include "iterator/iter_fwd.h"
5152 #include "validator/validator.h"
5253 #include "services/localzone.h"
5354 #ifdef HAVE_PWD_H
5960 #ifdef HAVE_GLOB_H
6061 #include <glob.h>
6162 #endif
63 #ifdef WITH_PYTHONMODULE
64 #include "pythonmod/pythonmod.h"
65 #endif
6266
6367 /** Give checkconf usage, and exit (1). */
6468 static void
6771 printf("Usage: unbound-checkconf [file]\n");
6872 printf(" Checks unbound configuration file for errors.\n");
6973 printf("file if omitted %s is used.\n", CONFIGFILE);
70 printf("-h show this usage help.\n");
74 printf("-o option print value of option to stdout.\n");
75 printf("-h show this usage help.\n");
7176 printf("Version %s\n", PACKAGE_VERSION);
7277 printf("BSD licensed, see LICENSE in source package for details.\n");
7378 printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
7479 exit(1);
80 }
81
82 /** compare and print decimal option */
83 #define O_DEC(opt, str, var) if(strcmp(opt, str)==0) \
84 {printf("%d\n", (int)cfg->var);}
85 /** compare and print unsigned option */
86 #define O_UNS(opt, str, var) if(strcmp(opt, str)==0) \
87 {printf("%u\n", (unsigned)cfg->var);}
88 /** compare and print yesno option */
89 #define O_YNO(opt, str, var) if(strcmp(opt, str)==0) \
90 {printf("%s\n", cfg->var?"yes":"no");}
91 /** compare and print string option */
92 #define O_STR(opt, str, var) if(strcmp(opt, str)==0) \
93 {printf("%s\n", cfg->var?cfg->var:"");}
94 /** compare and print array option */
95 #define O_IFC(opt, str, num, arr) if(strcmp(opt, str)==0) \
96 {int i; for(i=0; i<cfg->num; i++) printf("%s\n", cfg->arr[i]);}
97 /** compare and print memorysize option */
98 #define O_MEM(opt, str, var) if(strcmp(opt, str)==0) { \
99 if(cfg->var > 1024*1024*1024) { \
100 size_t f=cfg->var/(size_t)1000000, b=cfg->var%(size_t)1000000; \
101 printf("%u%6.6u\n", (unsigned)f, (unsigned)b); \
102 } else printf("%u\n", (unsigned)cfg->var);}
103 /** compare and print list option */
104 #define O_LST(opt, name, lst) if(strcmp(opt, name)==0) { \
105 struct config_strlist* p = cfg->lst; \
106 for(p = cfg->lst; p; p = p->next) \
107 printf("%s\n", p->str); \
108 }
109 /** compare and print list option */
110 #define O_LS2(opt, name, lst) if(strcmp(opt, name)==0) { \
111 struct config_str2list* p = cfg->lst; \
112 for(p = cfg->lst; p; p = p->next) \
113 printf("%s %s\n", p->str, p->str2); \
114 }
115
116 /**
117 * Print given option to stdout
118 * @param cfg: config
119 * @param opt: option name without trailing :.
120 * This is different from config_set_option.
121 */
122 static void
123 print_option(struct config_file* cfg, const char* opt)
124 {
125 O_DEC(opt, "verbosity", verbosity)
126 else O_DEC(opt, "statistics-interval", stat_interval)
127 else O_YNO(opt, "statistics-cumulative", stat_interval)
128 else O_YNO(opt, "extended-statistics", stat_extended)
129 else O_DEC(opt, "num-threads", num_threads)
130 else O_IFC(opt, "interface", num_ifs, ifs)
131 else O_IFC(opt, "outgoing-interface", num_out_ifs, out_ifs)
132 else O_YNO(opt, "interface-automatic", if_automatic)
133 else O_DEC(opt, "port", port)
134 else O_DEC(opt, "outgoing-range", outgoing_num_ports)
135 else O_DEC(opt, "outgoing-num-tcp", outgoing_num_tcp)
136 else O_DEC(opt, "incoming-num-tcp", incoming_num_tcp)
137 else O_DEC(opt, "msg-buffer-size", msg_buffer_size)
138 else O_MEM(opt, "msg-cache-size", msg_cache_size)
139 else O_DEC(opt, "msg-cache-slabs", msg_cache_slabs)
140 else O_DEC(opt, "num-queries-per-thread", num_queries_per_thread)
141 else O_UNS(opt, "jostle-timeout", jostle_time)
142 else O_MEM(opt, "rrset-cache-size", rrset_cache_size)
143 else O_DEC(opt, "rrset-cache-slabs", rrset_cache_slabs)
144 else O_DEC(opt, "cache-max-ttl", max_ttl)
145 else O_DEC(opt, "infra-host-ttl", host_ttl)
146 else O_DEC(opt, "infra-lame-ttl", lame_ttl)
147 else O_DEC(opt, "infra-cache-slabs", infra_cache_slabs)
148 else O_MEM(opt, "infra-cache-numhosts", infra_cache_numhosts)
149 else O_MEM(opt, "infra-cache-lame-size", infra_cache_lame_size)
150 else O_YNO(opt, "do-ip4", do_ip4)
151 else O_YNO(opt, "do-ip6", do_ip6)
152 else O_YNO(opt, "do-udp", do_udp)
153 else O_YNO(opt, "do-tcp", do_tcp)
154 else O_YNO(opt, "do-daemonize", do_daemonize)
155 else O_STR(opt, "chroot", chrootdir)
156 else O_STR(opt, "username", username)
157 else O_STR(opt, "directory", directory)
158 else O_STR(opt, "logfile", logfile)
159 else O_STR(opt, "pidfile", pidfile)
160 else O_YNO(opt, "hide-identity", hide_identity)
161 else O_YNO(opt, "hide-version", hide_version)
162 else O_STR(opt, "identity", identity)
163 else O_STR(opt, "version", version)
164 else O_STR(opt, "target-fetch-policy", target_fetch_policy)
165 else O_YNO(opt, "harden-short-bufsize", harden_short_bufsize)
166 else O_YNO(opt, "harden-large-queries", harden_large_queries)
167 else O_YNO(opt, "harden-glue", harden_glue)
168 else O_YNO(opt, "harden-dnssec-stripped", harden_dnssec_stripped)
169 else O_YNO(opt, "harden-referral-path", harden_referral_path)
170 else O_YNO(opt, "use-caps-for-id", use_caps_bits_for_id)
171 else O_DEC(opt, "unwanted-reply-threshold", unwanted_threshold)
172 else O_YNO(opt, "do-not-query-localhost", donotquery_localhost)
173 else O_STR(opt, "module-config", module_conf)
174 else O_STR(opt, "dlv-anchor-file", dlv_anchor_file)
175 else O_DEC(opt, "val-bogus-ttl", bogus_ttl)
176 else O_YNO(opt, "val-clean-additional", val_clean_additional)
177 else O_YNO(opt, "val-permissive-mode", val_permissive_mode)
178 else O_STR(opt, "val-nsec3-keysize-iterations",val_nsec3_key_iterations)
179 else O_MEM(opt, "key-cache-size", key_cache_size)
180 else O_DEC(opt, "key-cache-slabs", key_cache_slabs)
181 else O_MEM(opt, "neg-cache-size", neg_cache_size)
182 else O_YNO(opt, "control-enable", remote_control_enable)
183 else O_DEC(opt, "control-port", control_port)
184 else O_STR(opt, "server-key-file", server_key_file)
185 else O_STR(opt, "server-cert-file", server_cert_file)
186 else O_STR(opt, "control-key-file", control_key_file)
187 else O_STR(opt, "control-cert-file", control_cert_file)
188 else O_LST(opt, "root-hints", root_hints)
189 else O_LS2(opt, "access-control", acls)
190 else O_LST(opt, "do-not-query-address", donotqueryaddrs)
191 else O_LST(opt, "private-address", private_address)
192 else O_LST(opt, "private-domain", private_domain)
193 else O_LST(opt, "trust-anchor-file", trust_anchor_file_list)
194 else O_LST(opt, "trust-anchor", trust_anchor_list)
195 else O_LST(opt, "trusted-keys-file", trusted_keys_file_list)
196 else O_LST(opt, "dlv-anchor", dlv_anchor_list)
197 else O_LST(opt, "control-interface", control_ifs)
198 else O_UNS(opt, "val-override-date", val_date_override)
199 /* not here:
200 * outgoing-permit, outgoing-avoid - have list of ports
201 * local-zone - zones and nodefault variables
202 * local-data - see below
203 * local-data-ptr - converted to local-data entries
204 * stub-zone, name, stub-addr, stub-host, stub-prime
205 * forward-zone, name, forward-addr, forward-host
206 */
207 else fatal_exit("cannot print option '%s'", opt);
75208 }
76209
77210 /** check if module works with config */
361494 free(cfg->chrootdir);
362495 cfg->chrootdir = NULL;
363496
364 if(strcmp(cfg->module_conf, "iterator") != 0 &&
365 strcmp(cfg->module_conf, "validator iterator") != 0) {
497 if(strcmp(cfg->module_conf, "iterator") != 0
498 && strcmp(cfg->module_conf, "validator iterator") != 0
499 #ifdef WITH_PYTHONMODULE
500 && strcmp(cfg->module_conf, "python iterator") != 0
501 && strcmp(cfg->module_conf, "python validator iterator") != 0
502 && strcmp(cfg->module_conf, "validator python iterator") != 0
503 #endif
504 ) {
366505 fatal_exit("module conf '%s' is not known to work",
367506 cfg->module_conf);
368507 }
390529 localzonechecks(cfg);
391530 }
392531
532 /** check forwards */
533 static void
534 check_fwd(struct config_file* cfg)
535 {
536 struct iter_forwards* fwd = forwards_create();
537 if(!fwd || !forwards_apply_cfg(fwd, cfg)) {
538 fatal_exit("Could not set forward zones");
539 }
540 forwards_delete(fwd);
541 }
542
393543 /** check config file */
394544 static void
395 checkconf(const char* cfgfile)
545 checkconf(const char* cfgfile, const char* opt)
396546 {
397547 struct config_file* cfg = config_create();
398548 if(!cfg)
405555 morechecks(cfg, cfgfile);
406556 check_mod(cfg, iter_get_funcblock());
407557 check_mod(cfg, val_get_funcblock());
558 #ifdef WITH_PYTHONMODULE
559 if(strstr(cfg->module_conf, "python"))
560 check_mod(cfg, pythonmod_get_funcblock());
561 #endif
562 check_fwd(cfg);
563 if(opt) print_option(cfg, opt);
564 else printf("unbound-checkconf: no errors in %s\n", cfgfile);
408565 config_delete(cfg);
409 printf("unbound-checkconf: no errors in %s\n", cfgfile);
410566 }
411567
412568 /** getopt global, in case header files fail to declare it. */
419575 {
420576 int c;
421577 const char* f;
578 const char* opt = NULL;
422579 log_ident_set("unbound-checkconf");
423580 log_init(NULL, 0, NULL);
424581 checklock_start();
425582 /* parse the options */
426 while( (c=getopt(argc, argv, "h")) != -1) {
583 while( (c=getopt(argc, argv, "ho:")) != -1) {
427584 switch(c) {
585 case 'o':
586 opt = optarg;
587 break;
428588 case '?':
429589 case 'h':
430590 default:
438598 if(argc == 1)
439599 f = argv[0];
440600 else f = CONFIGFILE;
441 checkconf(f);
601 checkconf(f, opt);
442602 checklock_stop();
443603 return 0;
444604 }
6060 printf(" start start server; runs unbound(8)\n");
6161 printf(" stop stops the server\n");
6262 printf(" reload reloads the server\n");
63 printf(" (this flushes data, stats, requestlist)\n");
6364 printf(" stats print statistics\n");
65 printf(" stats_noreset peek at statistics\n");
6466 printf(" status display status of server\n");
6567 printf(" verbosity [number] change logging detail\n");
6668 printf(" local_zone [name] [type] add new local zone\n");
7779 printf(" flush_type [name] [type] flush name, type from cache\n");
7880 printf(" flush_zone [name] flush everything at or under name\n");
7981 printf(" from rr and dnssec caches\n");
82 printf(" flush_stats flush statistics, make zero\n");
83 printf(" flush_requestlist drop queries that are worked on\n");
84 printf(" dump_requestlist show what is worked on\n");
85 printf(" forward [off | addr ...] without arg show forward setup\n");
86 printf(" or off to turn off root forwarding\n");
87 printf(" or give list of ip addresses\n");
8088 printf("Version %s\n", PACKAGE_VERSION);
8189 printf("BSD licensed, see LICENSE in source package for details.\n");
8290 printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
293301 ret = go_cmd(ssl, argc, argv);
294302
295303 SSL_free(ssl);
304 #ifndef USE_WINSOCK
296305 close(fd);
306 #else
307 closesocket(fd);
308 #endif
297309 SSL_CTX_free(ctx);
298310 config_delete(cfg);
299311 return ret;
6363 printf(" -y 'example.com DS 31560 5 1 1CFED8478...'\n");
6464 printf(" -f keyfile read trust anchors from file, with lines as -y.\n");
6565 printf(" -F keyfile read named.conf-style trust anchors.\n");
66 printf(" -C config use the specified unbound.conf\n");
66 printf(" -C config use the specified unbound.conf (none read by default)\n");
6767 printf(" -r read forwarder information from /etc/resolv.conf\n");
6868 printf(" breaks validation if the fwder does not do DNSSEC.\n");
6969 printf(" -v be more verbose, shows nodata and security.\n");
117117 return 0;
118118 }
119119
120 #ifdef UB_ON_WINDOWS
121 void
122 worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void*
123 ATTR_UNUSED(arg)) {
124 log_assert(0);
125 }
126
127 void
128 wsvc_cron_cb(void* ATTR_UNUSED(arg))
129 {
130 log_assert(0);
131 }
132 #endif /* UB_ON_WINDOWS */
133
120134 void
121135 worker_alloc_cleanup(void* ATTR_UNUSED(arg))
122136 {
4141
4242 #include "config.h"
4343 #include "libunbound/unbound.h"
44 #include "libunbound/context.h"
4445 #include "util/locks.h"
4546 #include "util/log.h"
4647
298299 if(i > 100) {
299300 lock_basic_lock(&async_ids[i-100].lock);
300301 r = ub_cancel(inf->ctx, async_ids[i-100].id);
301 async_ids[i-100].cancel=1;
302 if(r != UB_NOID)
303 async_ids[i-100].cancel=1;
302304 lock_basic_unlock(&async_ids[i-100].lock);
303 checkerr("ub_cancel", r);
305 if(r != UB_NOID)
306 checkerr("ub_cancel", r);
304307 }
305308 } else if(inf->thread_num > NUMTHR/2) {
306309 /* async */
366369 struct lookinfo* lookups;
367370 int i, r, cancel=0, blocking=0, ext=0;
368371
372 /* init log now because solaris thr_key_create() is not threadsafe */
373 log_init(0,0,0);
369374 /* lock debug start (if any) */
370375 checklock_start();
371376
466471 for(i=0; i<argc; i++) {
467472 fprintf(stderr, "cancel %s\n", argv[i]);
468473 r = ub_cancel(ctx, lookups[i].async_id);
469 checkerr("ub_cancel", r);
474 if(r != UB_NOID)
475 checkerr("ub_cancel", r);
470476 }
471477 num_wait = 0;
472478 }
541541 free(s);
542542 s = sn;
543543 }
544 #ifndef USE_WINSOCK
544545 close(p->client_s);
545546 if(p->server_s != -1)
546547 close(p->server_s);
548 #else
549 closesocket(p->client_s);
550 if(p->server_s != -1)
551 closesocket(p->server_s);
552 #endif
547553 free(p);
548554 }
549555
592598 #ifndef USE_WINSOCK
593599 if(errno != EINPROGRESS) {
594600 log_err("tcp connect: %s", strerror(errno));
601 close(p->server_s);
602 close(p->client_s);
595603 #else
596604 if(WSAGetLastError() != WSAEWOULDBLOCK &&
597605 WSAGetLastError() != WSAEINPROGRESS) {
598606 log_err("tcp connect: %s",
599607 wsa_strerror(WSAGetLastError()));
600 #endif
601 close(p->server_s);
602 close(p->client_s);
608 closesocket(p->server_s);
609 closesocket(p->client_s);
610 #endif
603611 free(p);
604612 return;
605613 }
752760 log_addr(1, "read tcp answer", &p->addr, p->addr_len);
753761 if(!tcp_relay_read(p->server_s, &p->answerlist,
754762 &p->answerlast, now, delay, pkt)) {
763 #ifndef USE_WINSOCK
755764 close(p->server_s);
765 #else
766 closesocket(p->server_s);
767 #endif
756768 FD_CLR(FD_SET_T p->server_s, worig);
757769 FD_CLR(FD_SET_T p->server_s, rorig);
758770 p->server_s = -1;
880892 "%u returned\n", i++, from, port, (int)p->numreuse+1,
881893 (unsigned)p->numwait, (unsigned)p->numsent,
882894 (unsigned)p->numreturn);
895 #ifndef USE_WINSOCK
883896 close(p->s);
897 #else
898 closesocket(p->s);
899 #endif
884900 free(p);
885901 p = np;
886902 }
10821098
10831099 /* cleanup */
10841100 verbose(1, "cleanup");
1101 #ifndef USE_WINSOCK
10851102 close(s);
10861103 close(listen_s);
1104 #else
1105 closesocket(s);
1106 closesocket(listen_s);
1107 #endif
10871108 ldns_buffer_free(pkt);
10881109 ring_delete(ring);
10891110 }
748748 free(outnet);
749749 }
750750
751 void
752 outside_network_quit_prepare(struct outside_network* ATTR_UNUSED(outnet))
753 {
754 }
755
751756 struct pending*
752757 pending_udp_query(struct outside_network* outnet, ldns_buffer* packet,
753758 struct sockaddr_storage* addr, socklen_t addrlen, int timeout,
252252 if(!info) return;
253253 if(info->io) {
254254 for(i=0; i<info->io_num; i++) {
255 #ifndef USE_WINSOCK
255256 close(info->io[i].fd);
257 #else
258 closesocket(info->io[i].fd);
259 #endif
256260 }
257261 free(info->io);
258262 }
9595
9696 #ifndef TESTCODE_REPLAY_H
9797 #define TESTCODE_REPLAY_H
98 #include "config.h"
9998 #include "util/netevent.h"
10099 #include "testcode/ldns-testpkts.h"
101100 struct replay_answer;
224224 recv_one(fd, udp, buf);
225225 }
226226
227 #ifndef USE_WINSOCK
227228 close(fd);
229 #else
230 closesocket(fd);
231 #endif
228232 ldns_buffer_free(buf);
229233 printf("orderly exit\n");
230234 }
226226 while( (c=getopt(argc, argv, "2ho:p:")) != -1) {
227227 switch(c) {
228228 case '2':
229 #ifdef HAVE_EVP_SHA256
229 #if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
230230 printf("SHA256 supported\n");
231231 exit(0);
232232 #else
318318 return 0;
319319 }
320320
321 void wsvc_command_option(const char* ATTR_UNUSED(wopt),
322 const char* ATTR_UNUSED(cfgfile), int ATTR_UNUSED(v),
323 int ATTR_UNUSED(c))
324 {
325 log_assert(0);
326 }
327
328 void wsvc_setup_worker(struct worker* ATTR_UNUSED(worker))
329 {
330 /* do nothing */
331 }
332
333 void wsvc_desetup_worker(struct worker* ATTR_UNUSED(worker))
334 {
335 /* do nothing */
336 }
337
338 #ifdef UB_ON_WINDOWS
339 void worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
340 void* ATTR_UNUSED(arg))
341 {
342 log_assert(0);
343 }
344
345 void wsvc_cron_cb(void* ATTR_UNUSED(arg))
346 {
347 log_assert(0);
348 }
349 #endif /* UB_ON_WINDOWS */
350
237237 (struct sockaddr_storage*)&b6, i, l6) == i);
238238 }
239239 }
240 /* test addr_is_ip4mapped */
241 if(1) {
242 struct sockaddr_storage a;
243 socklen_t l = (socklen_t)sizeof(a);
244 unit_assert(ipstrtoaddr("12.13.14.15", 53, &a, &l));
245 unit_assert(!addr_is_ip4mapped(&a, l));
246 unit_assert(ipstrtoaddr("fe80::217:31ff:fe91:df", 53, &a, &l));
247 unit_assert(!addr_is_ip4mapped(&a, l));
248 unit_assert(ipstrtoaddr("ffff::217:31ff:fe91:df", 53, &a, &l));
249 unit_assert(!addr_is_ip4mapped(&a, l));
250 unit_assert(ipstrtoaddr("::ffff:31ff:fe91:df", 53, &a, &l));
251 unit_assert(!addr_is_ip4mapped(&a, l));
252 unit_assert(ipstrtoaddr("::fffe:fe91:df", 53, &a, &l));
253 unit_assert(!addr_is_ip4mapped(&a, l));
254 unit_assert(ipstrtoaddr("::ffff:127.0.0.1", 53, &a, &l));
255 unit_assert(addr_is_ip4mapped(&a, l));
256 unit_assert(ipstrtoaddr("::ffff:127.0.0.2", 53, &a, &l));
257 unit_assert(addr_is_ip4mapped(&a, l));
258 unit_assert(ipstrtoaddr("::ffff:192.168.0.2", 53, &a, &l));
259 unit_assert(addr_is_ip4mapped(&a, l));
260 unit_assert(ipstrtoaddr("2::ffff:192.168.0.2", 53, &a, &l));
261 unit_assert(!addr_is_ip4mapped(&a, l));
262 }
240263 }
241264
242265 #include "util/config_file.h"
473473 verifytest_file("testdata/test_signatures.6", "20080416005004");
474474 verifytest_file("testdata/test_signatures.7", "20070829144150");
475475 verifytest_file("testdata/test_signatures.8", "20070829144150");
476 #ifdef HAVE_EVP_SHA256
476 #if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
477477 verifytest_file("testdata/test_signatures.9", "20070829144150");
478478 verifytest_file("testdata/test_signatures.11", "20070829144150");
479479 #endif
480 #ifdef HAVE_EVP_SHA512
480 #if defined(HAVE_EVP_SHA512) && defined(USE_SHA2)
481 /* Skip test. Algorithm number uncertainty
481482 verifytest_file("testdata/test_signatures.10", "20070829144150");
483 */
482484 #endif
483485 verifytest_file("testdata/test_signatures.12", "20090107100022");
486 verifytest_file("testdata/test_signatures.13", "20080414005004");
484487 dstest_file("testdata/test_ds_sig.1");
485488 nsectest();
486489 nsec3_hash_test("testdata/test_nsec3_hash.1");
Binary diff not shown
Binary diff not shown
0 example.com. 3600 IN DS 48886 9 1 eb70a0d5001a3da004b428f01bf15cb5aad22f73 ; xupol-bamyt-hobuc-pyzop-bacur-gupaz-bakoz-cylyr-hepyt-dorol-foxux
0 example.com. 3600 IN DNSKEY 256 3 9 AwEAAazmeO3BNv+xPYuFbQp8JN4XX+iKNuvJgD2QG5jRXI0IP5by+JGSob20OEmbPLqKcXWMRPICTyPBDaBh0tXA66DVlHV8rCtAT5Yqdrz2qw05SNYCGWJulscR6GM0e4gkO1FrBINr385IiMH3sJegBzm2HUbyb2I+xuFIfl7SgMuZ5fahHnhjDwsdgw+19OQlbYDRmNhMvtJemomIiGzPwrxEtKBlcUevcFPX7cPU7lpbcZwVP16xhLbtSNwMHvoCoRpJrAtdDGiSyAzTQef+jWuaUlFCPle6Qkghi51zmpBrPunqRCoYg7LIyJ9zS/KzPKX2zN2ASu9KJD3tDW9OSZM= ;{id = 48886 (zsk), size = 2048b}
0 Private-key-format: v1.2
1 Algorithm: 9 (RSASHA512)
2 Modulus: rOZ47cE2/7E9i4VtCnwk3hdf6Io268mAPZAbmNFcjQg/lvL4kZKhvbQ4SZs8uopxdYxE8gJPI8ENoGHS1cDroNWUdXysK0BPlip2vParDTlI1gIZYm6WxxHoYzR7iCQ7UWsEg2vfzkiIwfewl6AHObYdRvJvYj7G4Uh+XtKAy5nl9qEeeGMPCx2DD7X05CVtgNGY2Ey+0l6aiYiIbM/CvES0oGVxR69wU9ftw9TuWltxnBU/XrGEtu1I3Awe+gKhGkmsC10MaJLIDNNB5/6Na5pSUUI+V7pCSCGLnXOakGs+6epEKhiDssjIn3NL8rM8pfbM3YBK70okPe0Nb05Jkw==
3 PublicExponent: AQAB
4 PrivateExponent: FeWqcxIBUSi1TrI7ORS35pi3QNAgXIRMhX92v0fknMfqpcdny6fybAAjEM9kRYu7CtQU90FrnG+atjEtbnzcWqYyAx8i/udKLQ57szraNvaGTvQ9GsY+uj9+WvIOoxNTn+AZ1jsXQRzWlRo1dz6BK8Hwu0eA68Rfk7CGsKOgRCioONwz8m9/GTTxMsZ+VcLkenK/IyYOCnh47vrNkUGb5+3g9Bunkbymcjyhw79DLdMvRRYoqzvhAiGS8r+EpOtAA443iZ+RwfEae7U0VUJEPEEytLb3EZx2qjvWuXtN84tCvXpdum0M7y9dfDojH+I7ZvhiOIMmnWd20ldgjqqOQQ==
5 Prime1: 0xom8n5L5YrcHIHTAZtQK039Ozqay5vOz6QvqqEiXevAdYdDUQVuX3VSAWCScF9OxfPXHZhX8z4hNpjc8zDirVUDlWRf77Shp1kjdhBZvwwxOp28uuXvg6g3VtTirEp0iwCCt6Wy4HErAKRFFZ0sEq5nzp/fn2y71AAWezLk4Gs=
6 Prime2: 0axZNMdHG2ornNjoOJzQAgDDibmqBHgebkJg/f6IWI2X1ew044Qg+67t7VzvnkVe7UiVjLJYsnlVmXhIPA618hSIvPb2WH4QFNVBAW8Q9WeCSvczuTeyjg5BxZVNta4tSWrpm+oYLcwn0MDWJMCynQmT5C5pDjEQtlbQrutCZXk=
7 Exponent1: pQ8+wr6jw3BG2PddsFTrY2DQjv4syOUj2NFNAAKL55oNWxgPN4uimHsYSsFi3wB2jGszmQ1kP2ol+BWgNXrU0qi1a5sXNEstVrdo9cilE6+J0oZBanWdSHlAA+Hi9sokxAb7LnMeIUX7VL4c0mCZdGXv/uycooAXgRUsftn1gc8=
8 Exponent2: Zc1Ukree4sSt4D3AopwgsphEWH54+iqIO+imxyvqb3RwIEHLfBwPF6RbiT/yZ9ouuO7hDasaPa2DzjwEdoR9+sfVjEosWdL7Y+IW6edPSJe1P0i/KFLOswJhFNnlHS0wd9EdE8KZcsMJIeY/EyEsl+qqj8Oo5mcUQjPspsE7P6E=
9 Coefficient: SkqMe/RECHeiSYo+DBGMOdBiCKrxDc02W1lVCM9k9tD7lN6OA2KdhxTWGtfNI147kQkRnR8Q6Qv/ushy9S+dYScDXjqB3n1vpKaklvPdWOXGokJds6zgiviUKxtYuFiDoluPNEdHblk9sThkTBb2qpb17R9xUNIX4zRidkQweHQ=
+0
-1
testdata/Kexample.com.+010+18320.ds less more
0 example.com. 3600 IN DS 18320 10 1 c75d2cba6104e3962f93f326b1cbbee877e22f2d ; xucoh-torir-pamyb-gomon-kyrun-fased-kuses-rizuv-motov-dered-texyx
+0
-1
testdata/Kexample.com.+010+18320.key less more
0 example.com. 3600 IN DNSKEY 256 3 10 AwEAAb3HJP1WF0wWvk9VqqZ2+xTpURPSwyiZcNRlO/hAXJisMA4/ZN2Kf0aNGewVDa6IhT8ehww5FBvVJm3R1KW/hqO+H3WzvCBpVDv1JdDqZvHMGiqEd2lCfKz4+fxuJ+HeUJBZlTz6pm9Rlqevry5uB7sKpgddDe2fK9CFCr7M1BzX ;{id = 18320 (zsk), size = 1024b}
+0
-10
testdata/Kexample.com.+010+18320.private less more
0 Private-key-format: v1.2
1 Algorithm: 10 (RSASHA512)
2 Modulus: vcck/VYXTBa+T1Wqpnb7FOlRE9LDKJlw1GU7+EBcmKwwDj9k3Yp/Ro0Z7BUNroiFPx6HDDkUG9UmbdHUpb+Go74fdbO8IGlUO/Ul0Opm8cwaKoR3aUJ8rPj5/G4n4d5QkFmVPPqmb1GWp6+vLm4HuwqmB10N7Z8r0IUKvszUHNc=
3 PublicExponent: AQAB
4 PrivateExponent: i12zzFdsxHPvTlOa/qRhvvmYkPY2W5pTQacWYzjgxz2sDMqBSDBtR2JXpwfPBF09fRzuEAvauJXPotZ1U0NTm6erHSB7KaJN0GZRwNVty8MCoKjr3gDR1b82rEUexr3cTfq6+7ij8GZvhEY7vGNGKYyrj5t+wwZP9D/XB2okwAE=
5 Prime1: 6lwq8K9nQC2Sxu2Vhp4a/q0cCEAk57GWdegBJW5btVYz1v87mgvR3x/tAXVgQhpwUk3U9L6wSR1z8HhEfEbp+Q==
6 Prime2: z00jjSIdxRyE0XE3GKST0cZmFVc67Ov9OtV+tfFKbutR1ZokKqX4oEBf12rQDJgeBjCOoBAZOVwB8XLHlcNxTw==
7 Exponent1: yOgWT5quks/+wdYulua3EZhpLZF/kbgl2hH32ZTPvZaWfjrzZ022ruZ5kQSEbman34alhuJp0WQUXhNb8oYAUQ==
8 Exponent2: ewXvXDlr62diVx1WMjSxWOPh/zY2TRY7wOeke/tHTg4vEZGZdwnqQ8gQWLoV3/OCle/JJKqJHaZBrPWOBo3nNw==
9 Coefficient: sMfUpptJTxBdhqgUVbunh6xtTpZWQ+tyR2DeLom2enXAFqiMBbhjgFA7CptPpsQFqkghdRvnz1JG2QYKLuWbbw==
0 ; config options
1 ; The island of trust is at example.com (the DLV repository)
2 server:
3 dlv-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 domain-insecure: "example.net"
5 val-override-date: "20070916134226"
6 target-fetch-policy: "0 0 0 0 0"
7
8 stub-zone:
9 name: "."
10 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
11 CONFIG_END
12
13 SCENARIO_BEGIN Test validator with domain-insecure below a DLV
14 ; positive response for DLV.
15
16 ; K.ROOT-SERVERS.NET.
17 RANGE_BEGIN 0 100
18 ADDRESS 193.0.14.129
19 ENTRY_BEGIN
20 MATCH opcode qtype qname
21 ADJUST copy_id
22 REPLY QR NOERROR
23 SECTION QUESTION
24 . IN NS
25 SECTION ANSWER
26 . IN NS K.ROOT-SERVERS.NET.
27 SECTION ADDITIONAL
28 K.ROOT-SERVERS.NET. IN A 193.0.14.129
29 ENTRY_END
30
31 ENTRY_BEGIN
32 MATCH opcode subdomain
33 ADJUST copy_id copy_query
34 REPLY QR NOERROR
35 SECTION QUESTION
36 com. IN A
37 SECTION AUTHORITY
38 com. IN NS a.gtld-servers.net.
39 SECTION ADDITIONAL
40 a.gtld-servers.net. IN A 192.5.6.30
41 ENTRY_END
42
43 ENTRY_BEGIN
44 MATCH opcode subdomain
45 ADJUST copy_id copy_query
46 REPLY QR NOERROR
47 SECTION QUESTION
48 net. IN A
49 SECTION AUTHORITY
50 net. IN NS a.gtld-servers.net.
51 SECTION ADDITIONAL
52 a.gtld-servers.net. IN A 192.5.6.30
53 ENTRY_END
54 RANGE_END
55
56 ; a.gtld-servers.net.
57 RANGE_BEGIN 0 100
58 ADDRESS 192.5.6.30
59 ENTRY_BEGIN
60 MATCH opcode qtype qname
61 ADJUST copy_id
62 REPLY QR NOERROR
63 SECTION QUESTION
64 com. IN NS
65 SECTION ANSWER
66 com. IN NS a.gtld-servers.net.
67 SECTION ADDITIONAL
68 a.gtld-servers.net. IN A 192.5.6.30
69 ENTRY_END
70
71 ENTRY_BEGIN
72 MATCH opcode qtype qname
73 ADJUST copy_id
74 REPLY QR NOERROR
75 SECTION QUESTION
76 net. IN NS
77 SECTION ANSWER
78 net. IN NS a.gtld-servers.net.
79 SECTION ADDITIONAL
80 a.gtld-servers.net. IN A 192.5.6.30
81 ENTRY_END
82
83 ENTRY_BEGIN
84 MATCH opcode subdomain
85 ADJUST copy_id copy_query
86 REPLY QR NOERROR
87 SECTION QUESTION
88 example.com. IN A
89 SECTION AUTHORITY
90 example.com. IN NS ns.example.com.
91 SECTION ADDITIONAL
92 ns.example.com. IN A 1.2.3.4
93 ENTRY_END
94
95 ENTRY_BEGIN
96 MATCH opcode subdomain
97 ADJUST copy_id copy_query
98 REPLY QR NOERROR
99 SECTION QUESTION
100 example.net. IN A
101 SECTION AUTHORITY
102 example.net. IN NS ns.example.net.
103 SECTION ADDITIONAL
104 ns.example.net. IN A 1.2.3.5
105 ENTRY_END
106 RANGE_END
107
108 ; ns.example.com.
109 RANGE_BEGIN 0 100
110 ADDRESS 1.2.3.4
111 ENTRY_BEGIN
112 MATCH opcode qtype qname
113 ADJUST copy_id
114 REPLY QR NOERROR
115 SECTION QUESTION
116 example.com. IN NS
117 SECTION ANSWER
118 example.com. IN NS ns.example.com.
119 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
120 SECTION ADDITIONAL
121 ns.example.com. IN A 1.2.3.4
122 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
123 ENTRY_END
124
125 ; response to DNSKEY priming query
126 ENTRY_BEGIN
127 MATCH opcode qtype qname
128 ADJUST copy_id
129 REPLY QR NOERROR
130 SECTION QUESTION
131 example.com. IN DNSKEY
132 SECTION ANSWER
133 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
134 example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134802 20070829134802 2854 example.com. MCwCFG1yhRNtTEa3Eno2zhVVuy2EJX3wAhQeLyUp6+UXcpC5qGNu9tkrTEgPUg== ;{id = 2854}
135 SECTION AUTHORITY
136 example.com. IN NS ns.example.com.
137 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
138 SECTION ADDITIONAL
139 ns.example.com. IN A 1.2.3.4
140 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
141 ENTRY_END
142
143 ; DLV query
144 ENTRY_BEGIN
145 MATCH opcode qtype qname
146 ADJUST copy_id
147 REPLY QR NOERROR
148 SECTION QUESTION
149 example.net.example.com. IN DLV
150 SECTION ANSWER
151 example.net.example.com. 3600 IN DLV 30899 5 1 14188c885f20623ad1d3bec42798f3f951793e4c ; xehac-mofum-malyd-bomaf-pegit-fuzes-ganin-misiz-nigel-nozog-soxix
152 example.net.example.com. 3600 IN RRSIG DLV 3 4 3600 20070926134150 20070829134150 2854 example.com. ACK48Q/oKwh/SM9yRiKjZYuc+AtEZ2yCPNJ15kKCN8nsVcv7xigmNTY= ;{id = 2854}
153 SECTION AUTHORITY
154 example.com. IN NS ns.example.com.
155 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
156 SECTION ADDITIONAL
157 ns.example.com. IN A 1.2.3.4
158 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
159 ENTRY_END
160
161 ENTRY_BEGIN
162 MATCH opcode qtype qname
163 ADJUST copy_id
164 REPLY QR NOERROR
165 SECTION QUESTION
166 net.example.com. IN DLV
167 SECTION ANSWER
168 SECTION AUTHORITY
169 example.com. IN SOA open.nlnetlabs.nl. hostmaster.nlnetlabs.nl. 2008081300 28800 7200 604800 3600
170 example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. AKPJnPBqfJKxE4P2iVYkSRJno9HmiXJZtjdqE8oBeq9Lk9FytcMdcig= ;{id = 2854}
171 example.com IN NSEC example.net.example.com. SOA NS RRSIG NSEC
172 example.com. 3600 IN RRSIG NSEC 3 2 3600 20070926134150 20070829134150 2854 example.com. AIoUkJ04/7/kJFDLocoqksqt9UL2RHHwlRfXAMxGdBHcNO+GSpG47Uk= ;{id = 2854}
173 ENTRY_END
174
175 ENTRY_BEGIN
176 MATCH opcode qtype qname
177 ADJUST copy_id
178 REPLY QR NXDOMAIN
179 SECTION QUESTION
180 com.example.com. IN DLV
181 SECTION ANSWER
182 SECTION AUTHORITY
183 example.com. IN SOA open.nlnetlabs.nl. hostmaster.nlnetlabs.nl. 2008081300 28800 7200 604800 3600
184 example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. AKPJnPBqfJKxE4P2iVYkSRJno9HmiXJZtjdqE8oBeq9Lk9FytcMdcig= ;{id = 2854}
185 example.com IN NSEC example.net.example.com. SOA NS RRSIG NSEC
186 example.com. 3600 IN RRSIG NSEC 3 2 3600 20070926134150 20070829134150 2854 example.com. AIoUkJ04/7/kJFDLocoqksqt9UL2RHHwlRfXAMxGdBHcNO+GSpG47Uk= ;{id = 2854}
187 ENTRY_END
188
189 RANGE_END
190
191 ; ns.example.net.
192 RANGE_BEGIN 0 100
193 ADDRESS 1.2.3.5
194 ; DS RR is
195 ; example.net. 3600 IN DS 30899 5 1 14188c885f20623ad1d3bec42798f3f951793e4c ; xehac-mofum-malyd-bomaf-pegit-fuzes-ganin-misiz-nigel-nozog-soxix
196 ; DNSKEY prime query
197 ENTRY_BEGIN
198 MATCH opcode qtype qname
199 ADJUST copy_id
200 REPLY QR NOERROR
201 SECTION QUESTION
202 example.net. IN DNSKEY
203 SECTION ANSWER
204 example.net. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
205 example.net. 3600 IN RRSIG DNSKEY RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. hiFzlQ8VoYgCuvIsfVuxC3mfJDqsTh0yc6abs5xMx5uEcIjb0dndFQx7INOM+imlzveEN73Hqp4OLFpFhsWLlw== ;{id = 30899}
206 SECTION AUTHORITY
207 example.net. IN NS ns.example.net.
208 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
209 SECTION ADDITIONAL
210 ns.example.net. IN A 1.2.3.5
211 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
212 ENTRY_END
213
214 ; NS query
215 ENTRY_BEGIN
216 MATCH opcode qtype qname
217 ADJUST copy_id
218 REPLY QR NOERROR
219 SECTION QUESTION
220 example.net. IN NS
221 SECTION ANSWER
222 example.net. IN NS ns.example.net.
223 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
224 SECTION ADDITIONAL
225 ns.example.net. IN A 1.2.3.5
226 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
227 ENTRY_END
228
229 ; www.example.net query
230 ENTRY_BEGIN
231 MATCH opcode qtype qname
232 ADJUST copy_id
233 REPLY QR NOERROR
234 SECTION QUESTION
235 www.example.net. IN A
236 SECTION ANSWER
237 www.example.net. 3600 IN A 10.20.30.40
238 www.example.net. 3600 IN RRSIG A 5 3 3600 20070926135752 20070829135752 30899 example.net. ACvv4RQVC7TbI57ewqFImRaVoymktJ5Cxn/FaCodIENt82LVM92nivbP2WtwWCsQHWp7FkrMxTlQTJwyAeXFyg== ;{id = 30899}
239 SECTION AUTHORITY
240 example.net. IN NS ns.example.net.
241 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
242 SECTION ADDITIONAL
243 ns.example.net. IN A 1.2.3.5
244 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
245 ENTRY_END
246
247
248 RANGE_END
249
250 STEP 1 QUERY
251 ENTRY_BEGIN
252 REPLY RD DO
253 SECTION QUESTION
254 www.example.net. IN A
255 ENTRY_END
256
257 ; recursion happens here.
258 STEP 10 CHECK_ANSWER
259 ENTRY_BEGIN
260 MATCH all
261 REPLY QR RD RA NOERROR
262 SECTION QUESTION
263 www.example.net. IN A
264 SECTION ANSWER
265 www.example.net. 3600 IN A 10.20.30.40
266 www.example.net. 3600 IN RRSIG A 5 3 3600 20070926135752 20070829135752 30899 example.net. ACvv4RQVC7TbI57ewqFImRaVoymktJ5Cxn/FaCodIENt82LVM92nivbP2WtwWCsQHWp7FkrMxTlQTJwyAeXFyg== ;{id = 30899}
267 SECTION AUTHORITY
268 example.net. IN NS ns.example.net.
269 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
270 SECTION ADDITIONAL
271 ns.example.net. IN A 1.2.3.5
272 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
273 ENTRY_END
274
275 SCENARIO_END
0 ; config options
1 ; The island of trust is at example.com
2 server:
3 trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 domain-insecure: "sub.example.com"
5 val-override-date: "20070916134226"
6 target-fetch-policy: "0 0 0 0 0"
7
8 stub-zone:
9 name: "."
10 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
11 CONFIG_END
12
13 SCENARIO_BEGIN Test validator with domain-insecure below a DS
14
15 ; K.ROOT-SERVERS.NET.
16 RANGE_BEGIN 0 100
17 ADDRESS 193.0.14.129
18 ENTRY_BEGIN
19 MATCH opcode qtype qname
20 ADJUST copy_id
21 REPLY QR NOERROR
22 SECTION QUESTION
23 . IN NS
24 SECTION ANSWER
25 . IN NS K.ROOT-SERVERS.NET.
26 SECTION ADDITIONAL
27 K.ROOT-SERVERS.NET. IN A 193.0.14.129
28 ENTRY_END
29
30 ENTRY_BEGIN
31 MATCH opcode qtype qname
32 ADJUST copy_id
33 REPLY QR NOERROR
34 SECTION QUESTION
35 www.sub.example.com. IN A
36 SECTION AUTHORITY
37 com. IN NS a.gtld-servers.net.
38 SECTION ADDITIONAL
39 a.gtld-servers.net. IN A 192.5.6.30
40 ENTRY_END
41 RANGE_END
42
43 ; a.gtld-servers.net.
44 RANGE_BEGIN 0 100
45 ADDRESS 192.5.6.30
46 ENTRY_BEGIN
47 MATCH opcode qtype qname
48 ADJUST copy_id
49 REPLY QR NOERROR
50 SECTION QUESTION
51 com. IN NS
52 SECTION ANSWER
53 com. IN NS a.gtld-servers.net.
54 SECTION ADDITIONAL
55 a.gtld-servers.net. IN A 192.5.6.30
56 ENTRY_END
57
58 ENTRY_BEGIN
59 MATCH opcode qtype qname
60 ADJUST copy_id
61 REPLY QR NOERROR
62 SECTION QUESTION
63 www.sub.example.com. IN A
64 SECTION AUTHORITY
65 example.com. IN NS ns.example.com.
66 SECTION ADDITIONAL
67 ns.example.com. IN A 1.2.3.4
68 ENTRY_END
69 RANGE_END
70
71 ; ns.example.com.
72 RANGE_BEGIN 0 100
73 ADDRESS 1.2.3.4
74 ENTRY_BEGIN
75 MATCH opcode qtype qname
76 ADJUST copy_id
77 REPLY QR NOERROR
78 SECTION QUESTION
79 example.com. IN NS
80 SECTION ANSWER
81 example.com. IN NS ns.example.com.
82 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
83 SECTION ADDITIONAL
84 ns.example.com. IN A 1.2.3.4
85 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
86 ENTRY_END
87
88 ; response to DNSKEY priming query
89 ENTRY_BEGIN
90 MATCH opcode qtype qname
91 ADJUST copy_id
92 REPLY QR NOERROR
93 SECTION QUESTION
94 example.com. IN DNSKEY
95 SECTION ANSWER
96 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
97 example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
98 SECTION AUTHORITY
99 example.com. IN NS ns.example.com.
100 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
101 SECTION ADDITIONAL
102 ns.example.com. IN A 1.2.3.4
103 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
104 ENTRY_END
105
106 ; response for delegation to sub.example.com.
107 ENTRY_BEGIN
108 MATCH opcode qtype qname
109 ADJUST copy_id
110 REPLY QR NOERROR
111 SECTION QUESTION
112 www.sub.example.com. IN A
113 SECTION ANSWER
114 SECTION AUTHORITY
115 sub.example.com. IN NS ns.sub.example.com.
116 sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
117 sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
118 SECTION ADDITIONAL
119 ns.sub.example.com. IN A 1.2.3.6
120 ENTRY_END
121
122 ; response for delegation to sub.example.com.
123 ENTRY_BEGIN
124 MATCH opcode qtype qname
125 ADJUST copy_id
126 REPLY QR NOERROR
127 SECTION QUESTION
128 sub.example.com. IN DNSKEY
129 SECTION ANSWER
130 SECTION AUTHORITY
131 sub.example.com. IN NS ns.sub.example.com.
132 sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
133 sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
134 SECTION ADDITIONAL
135 ns.sub.example.com. IN A 1.2.3.6
136 ENTRY_END
137 RANGE_END
138
139 ; ns.sub.example.com.
140 RANGE_BEGIN 0 100
141 ADDRESS 1.2.3.6
142 ENTRY_BEGIN
143 MATCH opcode qtype qname
144 ADJUST copy_id
145 REPLY QR NOERROR
146 SECTION QUESTION
147 sub.example.com. IN NS
148 SECTION ANSWER
149 sub.example.com. IN NS ns.sub.example.com.
150 sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
151 SECTION ADDITIONAL
152 ns.sub.example.com. IN A 1.2.3.6
153 ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
154 ENTRY_END
155
156 ; response to DNSKEY priming query
157 ; sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
158 ENTRY_BEGIN
159 MATCH opcode qtype qname
160 ADJUST copy_id
161 REPLY QR NOERROR
162 SECTION QUESTION
163 sub.example.com. IN DNSKEY
164 SECTION ANSWER
165 sub.example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
166 sub.example.com. 3600 IN RRSIG DNSKEY 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. uNGp99iznjD7oOX02XnQbDnbg75UwBHRvZSKYUorTKvPUnCWMHKdRsQ+mf+Fx3GZ+Fz9BVjoCmQqpnfgXLEYqw== ;{id = 30899}
167 SECTION AUTHORITY
168 sub.example.com. IN NS ns.sub.example.com.
169 sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
170 SECTION ADDITIONAL
171 ns.sub.example.com. IN A 1.2.3.6
172 ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
173 ENTRY_END
174
175 ; response to query of interest
176 ENTRY_BEGIN
177 MATCH opcode qtype qname
178 ADJUST copy_id
179 REPLY QR NOERROR
180 SECTION QUESTION
181 www.sub.example.com. IN A
182 SECTION ANSWER
183 www.sub.example.com. IN A 11.11.11.11
184 www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
185 SECTION AUTHORITY
186 SECTION ADDITIONAL
187 ENTRY_END
188 RANGE_END
189
190 STEP 1 QUERY
191 ENTRY_BEGIN
192 REPLY RD DO
193 SECTION QUESTION
194 www.sub.example.com. IN A
195 ENTRY_END
196
197 ; recursion happens here.
198 STEP 10 CHECK_ANSWER
199 ENTRY_BEGIN
200 MATCH all
201 REPLY QR RD RA NOERROR
202 SECTION QUESTION
203 www.sub.example.com. IN A
204 SECTION ANSWER
205 www.sub.example.com. 3600 IN A 11.11.11.11
206 www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
207 SECTION AUTHORITY
208 SECTION ADDITIONAL
209 ENTRY_END
210
211 SCENARIO_END
0 ; config options
1 server:
2 target-fetch-policy: "0 0 0 0 0"
3
4 stub-zone:
5 name: "."
6 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
7 CONFIG_END
8
9 SCENARIO_BEGIN Test iterative resolve with cached cname for nameserver
10 ; example.com NS ns.example.com en ns2.example.com
11 ; ns.example.com CNAME ns.bla.nl
12 ; ns.bla.nl A ....
13 ; dan timeout van A record uit cache - refetch.
14 ; ns2.example.com timeed niet uit ; maar geeft altijd servfail.
15
16
17 ; K.ROOT-SERVERS.NET.
18 RANGE_BEGIN 0 100
19 ADDRESS 193.0.14.129
20 ENTRY_BEGIN
21 MATCH opcode qtype qname
22 ADJUST copy_id
23 REPLY QR NOERROR
24 SECTION QUESTION
25 . IN NS
26 SECTION ANSWER
27 . IN NS K.ROOT-SERVERS.NET.
28 SECTION ADDITIONAL
29 K.ROOT-SERVERS.NET. IN A 193.0.14.129
30 ENTRY_END
31
32 ENTRY_BEGIN
33 MATCH opcode qtype qname
34 ADJUST copy_id
35 REPLY QR NOERROR
36 SECTION QUESTION
37 a.gtld-servers.net. IN AAAA
38 SECTION ANSWER
39 SECTION ADDITIONAL
40 ENTRY_END
41
42 ENTRY_BEGIN
43 MATCH opcode subdomain
44 ADJUST copy_id copy_query
45 REPLY QR NOERROR
46 SECTION QUESTION
47 com. IN A
48 SECTION AUTHORITY
49 com. IN NS a.gtld-servers.net.
50 SECTION ADDITIONAL
51 a.gtld-servers.net. IN A 192.5.6.30
52 ENTRY_END
53
54 ENTRY_BEGIN
55 MATCH opcode subdomain
56 ADJUST copy_id copy_query
57 REPLY QR NOERROR
58 SECTION QUESTION
59 nl. IN A
60 SECTION AUTHORITY
61 nl. IN NS ns2.nic.nl.
62 SECTION ADDITIONAL
63 ns2.nic.nl. IN A 192.1.1.2
64 ENTRY_END
65 RANGE_END
66
67 ; a.gtld-servers.net. ".com"
68 RANGE_BEGIN 0 100
69 ADDRESS 192.5.6.30
70 ENTRY_BEGIN
71 MATCH opcode qtype qname
72 ADJUST copy_id
73 REPLY QR NOERROR
74 SECTION QUESTION
75 com. IN NS
76 SECTION ANSWER
77 com. IN NS a.gtld-servers.net.
78 SECTION ADDITIONAL
79 a.gtld-servers.net. IN A 192.5.6.30
80 ENTRY_END
81
82 ENTRY_BEGIN
83 MATCH opcode subdomain
84 ADJUST copy_id copy_query
85 REPLY QR NOERROR
86 SECTION QUESTION
87 example.com. IN A
88 SECTION AUTHORITY
89 example.com. IN NS ns.example.com.
90 example.com. IN NS ns2.example.com.
91 SECTION ADDITIONAL
92 ;;; but really a CNAME in child server
93 ns.example.com. 1 IN A 1.2.3.4
94 ns2.example.com. IN A 1.2.3.5
95 ns2.example.com. IN AAAA 2002::5
96 ENTRY_END
97
98 ; lame answers back to root for .nl (.com server not authoritative for .nl)
99 ENTRY_BEGIN
100 MATCH opcode subdomain
101 ADJUST copy_id copy_query
102 REPLY QR NOERROR
103 SECTION QUESTION
104 nl. IN A
105 SECTION AUTHORITY
106 . IN NS K.ROOT-SERVERS.NET.
107 SECTION ADDITIONAL
108 K.ROOT-SERVERS.NET. IN A 193.0.14.129
109 ENTRY_END
110
111 RANGE_END
112
113 ; ns2.nic.nl ".nl"
114 RANGE_BEGIN 0 100
115 ADDRESS 192.1.1.2
116
117 ENTRY_BEGIN
118 MATCH opcode subdomain
119 ADJUST copy_id copy_query
120 REPLY QR NOERROR
121 SECTION QUESTION
122 bla.nl. IN A
123 SECTION AUTHORITY
124 bla.nl. IN NS ns.bla.nl.
125 SECTION ADDITIONAL
126 ns.bla.nl. IN A 1.2.3.6
127 ENTRY_END
128
129 RANGE_END
130
131 ; ns.bla.nl "bla..nl"
132 RANGE_BEGIN 0 100
133 ADDRESS 1.2.3.6
134
135 ENTRY_BEGIN
136 MATCH opcode qtype qname
137 ADJUST copy_id copy_query
138 REPLY QR NOERROR
139 SECTION QUESTION
140 ns.bla.nl. IN A
141 SECTION ANSWER
142 ns.bla.nl. IN A 1.2.3.6
143 SECTION AUTHORITY
144 bla.nl. IN NS ns.bla.nl.
145 SECTION ADDITIONAL
146 ENTRY_END
147
148 ENTRY_BEGIN
149 MATCH opcode qtype qname
150 ADJUST copy_id copy_query
151 REPLY QR NOERROR
152 SECTION QUESTION
153 ns.bla.nl. IN AAAA
154 SECTION ANSWER
155 SECTION AUTHORITY
156 bla.nl. IN SOA bla.nl. bla.nl. 1 2 3 4 5
157 SECTION ADDITIONAL
158 ENTRY_END
159
160 ENTRY_BEGIN
161 MATCH opcode qtype qname
162 ADJUST copy_id copy_query
163 REPLY QR NOERROR
164 SECTION QUESTION
165 ns.bla.nl. IN MX
166 SECTION ANSWER
167 ns.bla.nl. IN MX 10 bla.nl.
168 ENTRY_END
169
170 ENTRY_BEGIN
171 MATCH opcode qtype qname
172 ADJUST copy_id
173 REPLY QR NOERROR
174 SECTION QUESTION
175 www.example.com. IN A
176 SECTION ANSWER
177 www.example.com. IN A 10.20.30.40
178 ENTRY_END
179 RANGE_END
180
181 ; ns.example.com "example.com"
182 RANGE_BEGIN 0 100
183 ADDRESS 1.2.3.4
184 ENTRY_BEGIN
185 MATCH opcode qname
186 ADJUST copy_id copy_query
187 REPLY QR NOERROR
188 SECTION QUESTION
189 ns.example.com. IN MX
190 SECTION ANSWER
191 ns.example.com IN CNAME ns.bla.nl.
192 ENTRY_END
193
194 ENTRY_BEGIN
195 MATCH opcode qtype qname
196 ADJUST copy_id
197 REPLY QR NOERROR
198 SECTION QUESTION
199 www.example.com. IN A
200 SECTION ANSWER
201 www.example.com. IN A 10.20.30.40
202 ENTRY_END
203 RANGE_END
204
205 ; ns2.example.com "example.com"
206 ; bad failing server
207 RANGE_BEGIN 0 100
208 ADDRESS 1.2.3.5
209 ENTRY_BEGIN
210 MATCH opcode
211 ADJUST copy_id copy_query
212 REPLY QR SERVFAIL
213 SECTION QUESTION
214 ns.example.com. IN MX
215 SECTION ANSWER
216 ENTRY_END
217 RANGE_END
218
219 ; ns2.example.com "example.com"
220 ; bad failing server
221 RANGE_BEGIN 0 100
222 ADDRESS 2002::5
223 ENTRY_BEGIN
224 MATCH opcode
225 ADJUST copy_id copy_query
226 REPLY QR SERVFAIL
227 SECTION QUESTION
228 ns.example.com. IN MX
229 SECTION ANSWER
230 ENTRY_END
231 RANGE_END
232
233 ; get cname in cache. use MX query
234 STEP 1 QUERY
235 ENTRY_BEGIN
236 REPLY RD
237 SECTION QUESTION
238 ns.example.com. IN MX
239 ENTRY_END
240
241 STEP 10 CHECK_ANSWER
242 ENTRY_BEGIN
243 MATCH all
244 REPLY QR RD RA NOERROR
245 SECTION QUESTION
246 ns.example.com. IN MX
247 SECTION ANSWER
248 ns.example.com. IN CNAME ns.bla.nl
249 ns.bla.nl. IN MX 10 bla.nl.
250 SECTION AUTHORITY
251 SECTION ADDITIONAL
252 ENTRY_END
253
254 ; get seconds to pass to timeout the A record
255 STEP 15 TIME_PASSES ELAPSE 5
256
257 ; get into trouble getting cname for nameserver.
258 STEP 20 QUERY
259 ENTRY_BEGIN
260 REPLY RD
261 SECTION QUESTION
262 www.example.com. IN A
263 ENTRY_END
264
265 STEP 30 CHECK_ANSWER
266 ENTRY_BEGIN
267 MATCH all
268 REPLY QR RD RA NOERROR
269 SECTION QUESTION
270 www.example.com. IN A
271 SECTION ANSWER
272 www.example.com. IN A 10.20.30.40
273 SECTION AUTHORITY
274 SECTION ADDITIONAL
275 ENTRY_END
276
277 ; there may still be pending ns.bla.nl AAAA queries ; get rid of them like this
278 STEP 40 QUERY
279 ENTRY_BEGIN
280 REPLY RD
281 SECTION QUESTION
282 ns.bla.nl. IN AAAA
283 ENTRY_END
284
285 STEP 50 CHECK_ANSWER
286 ENTRY_BEGIN
287 MATCH all
288 REPLY QR RD RA NOERROR
289 SECTION QUESTION
290 ns.bla.nl. IN AAAA
291 SECTION ANSWER
292 SECTION AUTHORITY
293 bla.nl. IN SOA bla.nl. bla.nl. 1 2 3 4 5
294 SECTION ADDITIONAL
295 ENTRY_END
296
297 SCENARIO_END
Binary diff not shown
Binary diff not shown
99 SECTION QUESTION
1010 sub.example.com. IN DNSKEY
1111 SECTION ANSWER
12 example.com. 3600 IN DNSKEY 256 3 10 AwEAAb3HJP1WF0wWvk9VqqZ2+xTpURPSwyiZcNRlO/hAXJisMA4/ZN2Kf0aNGewVDa6IhT8ehww5FBvVJm3R1KW/hqO+H3WzvCBpVDv1JdDqZvHMGiqEd2lCfKz4+fxuJ+HeUJBZlTz6pm9Rlqevry5uB7sKpgddDe2fK9CFCr7M1BzX ;{id = 18320 (zsk), size = 1024b}
12 example.com. 3600 IN DNSKEY 256 3 9 AwEAAazmeO3BNv+xPYuFbQp8JN4XX+iKNuvJgD2QG5jRXI0IP5by+JGSob20OEmbPLqKcXWMRPICTyPBDaBh0tXA66DVlHV8rCtAT5Yqdrz2qw05SNYCGWJulscR6GM0e4gkO1FrBINr385IiMH3sJegBzm2HUbyb2I+xuFIfl7SgMuZ5fahHnhjDwsdgw+19OQlbYDRmNhMvtJemomIiGzPwrxEtKBlcUevcFPX7cPU7lpbcZwVP16xhLbtSNwMHvoCoRpJrAtdDGiSyAzTQef+jWuaUlFCPle6Qkghi51zmpBrPunqRCoYg7LIyJ9zS/KzPKX2zN2ASu9KJD3tDW9OSZM= ;{id = 48886 (zsk), size = 2048b}
13
1314 ENTRY_END
1415
1516 ; entry to test
1819 www.example.com. IN A
1920 SECTION ANSWER
2021 www.example.com. 3600 IN A 192.0.2.66
21 www.example.com. 3600 IN RRSIG A 10 3 3600 20070926134150 20070829134150 18320 example.com. m0FS92Zg6oyJE7CEwa4o2hkV+U6M/Xvniem/vLo9pz4tsAv7xxlMgT0Q8Uxl+pugiHTMSJ78V6fG/Kv6FZgesxKu70mLHQo1SjAgozRHuNwUB6cD8yeOeX0WafbRW4IfvSs6uauc+/SRukBFhJMdiX/IXw3syUGfntm03jcpWoc= ;{id = 18320}
22 www.example.com. 3600 IN RRSIG A 9 3 3600 20070926134150 20070829134150 48886 example.com. Ys6CGNAxJ+0lG/EoDJqZOoZTlX8Aa1k124VjnSE2A9NTecZUX44TiKtJQtUu7cnUcURuNsqX5rulr/70Vx+ANeUot/ewtY6fX6qaGZVgIaNyyDw0Gu7oiAsjOE0bt5RS4VGvDpLSdxDlPV0Kbbc4fYSTsqiSe2idMokfD2bgPcFrIx2TcX/sF8Jyhn2MGiQsWryMWyvhRTZ1+dwQcPhkeslGFLF/SQpGx5BbW/BYQG026xb6ckL/F/Pu4Jf5sQTimTZXHi9iASeRNO34DM9bS0yDgc+nm3bEg8/pEGCdFuCt6dVv7JTFgnR9fPTbEbBHIi4ORw1oef11G2sRV/Ubvw== ;{id = 48886}
23
2224 ENTRY_END
2325
0 ; Signature test file
1
2 ; first entry is a DNSKEY answer, with the DNSKEY rrset used for verification.
3 ; later entries are verified with it.
4
5
6 ; DNSKEY is revoked.
7 ENTRY_BEGIN
8 SECTION QUESTION
9 example.com. IN DNSKEY
10 SECTION ANSWER
11 example.com. 3600 IN DNSKEY 384 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 31027 (zsk), size = 512b}
12 ENTRY_END
13
14 ; entry to test
15 ENTRY_BEGIN
16 SECTION QUESTION
17 secure.example.com. IN SOA
18 SECTION ANSWER
19 example.com. 43200 IN SOA home.kuroiwa.eng.br. hostmaster.cesar.sec3.br. 2008040903 86400 86400 8640000 600
20 example.com. 43200 IN RRSIG SOA 5 2 43200 20081010000000 20080410122550 31027 example.com. af7nqRak6cEeQLytqLHMIUKPsOECA4Cu/Zpm7vdnKSh2q2+/8ZwIxwHLyCEGdiu/mTYffZEHTZytJyzxnB0oxA== ;{id = 31027}
21 ENTRY_END
22
23
0 ; config options
1 server:
2 access-control: 127.0.0.1 allow_snoop
3 cache-max-ttl: 10
4
5 stub-zone:
6 name: "."
7 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
8 CONFIG_END
9
10 SCENARIO_BEGIN Test TTL max option for messages in the cache
11
12 ; K.ROOT-SERVERS.NET.
13 RANGE_BEGIN 0 100
14 ADDRESS 193.0.14.129
15 ENTRY_BEGIN
16 MATCH opcode qtype qname
17 ADJUST copy_id
18 REPLY QR NOERROR
19 SECTION QUESTION
20 . IN NS
21 SECTION ANSWER
22 . IN NS K.ROOT-SERVERS.NET.
23 SECTION ADDITIONAL
24 K.ROOT-SERVERS.NET. IN A 193.0.14.129
25 ENTRY_END
26
27 ENTRY_BEGIN
28 MATCH opcode subdomain
29 ADJUST copy_id copy_query
30 REPLY QR NOERROR
31 SECTION QUESTION
32 com. IN A
33 SECTION AUTHORITY
34 com. IN NS a.gtld-servers.net.
35 SECTION ADDITIONAL
36 a.gtld-servers.net. IN A 192.5.6.30
37 ENTRY_END
38
39 ENTRY_BEGIN
40 MATCH opcode qtype qname
41 ADJUST copy_id
42 REPLY QR AA NOERROR
43 SECTION QUESTION
44 a.gtld-servers.net. IN A
45 SECTION ANSWER
46 a.gtld-servers.net. IN A 192.5.6.30
47 ENTRY_END
48
49 ENTRY_BEGIN
50 MATCH opcode qtype qname
51 ADJUST copy_id
52 REPLY QR AA NOERROR
53 SECTION QUESTION
54 K.ROOT-SERVERS.NET. IN A
55 SECTION ANSWER
56 K.ROOT-SERVERS.NET. IN A 193.0.14.129
57 ENTRY_END
58
59 ENTRY_BEGIN
60 MATCH opcode qtype qname
61 ADJUST copy_id
62 REPLY QR AA NOERROR
63 SECTION QUESTION
64 a.gtld-servers.net. IN AAAA
65 SECTION AUTHORITY
66 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
67 ENTRY_END
68
69 ENTRY_BEGIN
70 MATCH opcode qtype qname
71 ADJUST copy_id
72 REPLY QR AA NOERROR
73 SECTION QUESTION
74 K.ROOT-SERVERS.NET. IN AAAA
75 SECTION AUTHORITY
76 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
77 ENTRY_END
78
79 RANGE_END
80
81 ; a.gtld-servers.net.
82 RANGE_BEGIN 0 100
83 ADDRESS 192.5.6.30
84 ENTRY_BEGIN
85 MATCH opcode qtype qname
86 ADJUST copy_id
87 REPLY QR NOERROR
88 SECTION QUESTION
89 com. IN NS
90 SECTION ANSWER
91 com. IN NS a.gtld-servers.net.
92 SECTION ADDITIONAL
93 a.gtld-servers.net. IN A 192.5.6.30
94 ENTRY_END
95
96 ENTRY_BEGIN
97 MATCH opcode subdomain
98 ADJUST copy_id copy_query
99 REPLY QR NOERROR
100 SECTION QUESTION
101 example.com. IN A
102 SECTION AUTHORITY
103 example.com. IN NS ns.example.com.
104 SECTION ADDITIONAL
105 ns.example.com. IN A 1.2.3.4
106 ENTRY_END
107 RANGE_END
108
109 ; ns.example.com.
110 RANGE_BEGIN 0 100
111 ADDRESS 1.2.3.4
112 ENTRY_BEGIN
113 MATCH opcode qtype qname
114 ADJUST copy_id
115 REPLY QR NOERROR
116 SECTION QUESTION
117 example.com. IN NS
118 SECTION ANSWER
119 example.com. IN NS ns.example.com.
120 SECTION ADDITIONAL
121 ns.example.com. IN A 1.2.3.4
122 ENTRY_END
123
124 ENTRY_BEGIN
125 MATCH opcode qtype qname
126 ADJUST copy_id
127 REPLY QR AA NOERROR
128 SECTION QUESTION
129 ns.example.com. IN A
130 SECTION ANSWER
131 ns.example.com. IN A 1.2.3.4
132 SECTION AUTHORITY
133 example.com. IN NS ns.example.com.
134 ENTRY_END
135
136 ENTRY_BEGIN
137 MATCH opcode qtype qname
138 ADJUST copy_id
139 REPLY QR NOERROR
140 SECTION QUESTION
141 www.example.com. IN A
142 SECTION ANSWER
143 www.example.com. 248 IN A 10.20.30.40
144 SECTION AUTHORITY
145 example.com. IN NS ns.example.com.
146 SECTION ADDITIONAL
147 ns.example.com. IN A 1.2.3.4
148 ENTRY_END
149
150 ENTRY_BEGIN
151 MATCH opcode qtype qname
152 ADJUST copy_id
153 REPLY QR AA NOERROR
154 SECTION QUESTION
155 ns.example.com. IN AAAA
156 SECTION AUTHORITY
157 example.com. 10 IN SOA . . 15 28800 7200 604800 10
158 ENTRY_END
159
160 RANGE_END
161
162 ; start by passing time ; so we are not at 0
163 STEP 1 TIME_PASSES ELAPSE 10
164
165 ; query for the record
166 STEP 8 QUERY
167 ENTRY_BEGIN
168 REPLY RD CD
169 SECTION QUESTION
170 www.example.com. IN A
171 ENTRY_END
172
173 STEP 10 CHECK_ANSWER
174 ENTRY_BEGIN
175 MATCH all ttl
176 REPLY QR RD RA CD
177 SECTION QUESTION
178 www.example.com. IN A
179 SECTION ANSWER
180 www.example.com. 248 IN A 10.20.30.40
181 SECTION AUTHORITY
182 example.com. IN NS ns.example.com.
183 SECTION ADDITIONAL
184 ns.example.com. IN A 1.2.3.4
185 ENTRY_END
186
187 ; wait
188 STEP 20 TIME_PASSES ELAPSE 17
189
190 ; do a lookup to check TTLs.
191 STEP 25 QUERY
192 ENTRY_BEGIN
193 REPLY
194 SECTION QUESTION
195 www.example.com. IN A
196 ENTRY_END
197
198 STEP 26 CHECK_ANSWER
199 ENTRY_BEGIN
200 MATCH all ttl
201 REPLY QR RA
202 SECTION QUESTION
203 www.example.com. IN A
204 SECTION ANSWER
205 . 3600 IN NS K.ROOT-SERVERS.NET.
206 SECTION AUTHORITY
207 SECTION ADDITIONAL
208 K.ROOT-SERVERS.NET. 3600 IN A 193.0.14.129
209 ENTRY_END
210
211 SCENARIO_END
0 ; config options
1 server:
2 access-control: 127.0.0.1 allow_snoop
3 cache-min-ttl: 10
4
5 stub-zone:
6 name: "."
7 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
8 CONFIG_END
9
10 SCENARIO_BEGIN Test TTL min option for messages in the cache
11
12 ; K.ROOT-SERVERS.NET.
13 RANGE_BEGIN 0 100
14 ADDRESS 193.0.14.129
15 ENTRY_BEGIN
16 MATCH opcode qtype qname
17 ADJUST copy_id
18 REPLY QR NOERROR
19 SECTION QUESTION
20 . IN NS
21 SECTION ANSWER
22 . IN NS K.ROOT-SERVERS.NET.
23 SECTION ADDITIONAL
24 K.ROOT-SERVERS.NET. IN A 193.0.14.129
25 ENTRY_END
26
27 ENTRY_BEGIN
28 MATCH opcode subdomain
29 ADJUST copy_id copy_query
30 REPLY QR NOERROR
31 SECTION QUESTION
32 com. IN A
33 SECTION AUTHORITY
34 com. IN NS a.gtld-servers.net.
35 SECTION ADDITIONAL
36 a.gtld-servers.net. IN A 192.5.6.30
37 ENTRY_END
38
39 ENTRY_BEGIN
40 MATCH opcode qtype qname
41 ADJUST copy_id
42 REPLY QR AA NOERROR
43 SECTION QUESTION
44 a.gtld-servers.net. IN A
45 SECTION ANSWER
46 a.gtld-servers.net. IN A 192.5.6.30
47 ENTRY_END
48
49 ENTRY_BEGIN
50 MATCH opcode qtype qname
51 ADJUST copy_id
52 REPLY QR AA NOERROR
53 SECTION QUESTION
54 K.ROOT-SERVERS.NET. IN A
55 SECTION ANSWER
56 K.ROOT-SERVERS.NET. IN A 193.0.14.129
57 ENTRY_END
58
59 ENTRY_BEGIN
60 MATCH opcode qtype qname
61 ADJUST copy_id
62 REPLY QR AA NOERROR
63 SECTION QUESTION
64 a.gtld-servers.net. IN AAAA
65 SECTION AUTHORITY
66 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
67 ENTRY_END
68
69 ENTRY_BEGIN
70 MATCH opcode qtype qname
71 ADJUST copy_id
72 REPLY QR AA NOERROR
73 SECTION QUESTION
74 K.ROOT-SERVERS.NET. IN AAAA
75 SECTION AUTHORITY
76 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
77 ENTRY_END
78
79 RANGE_END
80
81 ; a.gtld-servers.net.
82 RANGE_BEGIN 0 100
83 ADDRESS 192.5.6.30
84 ENTRY_BEGIN
85 MATCH opcode qtype qname
86 ADJUST copy_id
87 REPLY QR NOERROR
88 SECTION QUESTION
89 com. IN NS
90 SECTION ANSWER
91 com. IN NS a.gtld-servers.net.
92 SECTION ADDITIONAL
93 a.gtld-servers.net. IN A 192.5.6.30
94 ENTRY_END
95
96 ENTRY_BEGIN
97 MATCH opcode subdomain
98 ADJUST copy_id copy_query
99 REPLY QR NOERROR
100 SECTION QUESTION
101 example.com. IN A
102 SECTION AUTHORITY
103 example.com. IN NS ns.example.com.
104 SECTION ADDITIONAL
105 ns.example.com. IN A 1.2.3.4
106 ENTRY_END
107 RANGE_END
108
109 ; ns.example.com.
110 RANGE_BEGIN 0 100
111 ADDRESS 1.2.3.4
112 ENTRY_BEGIN
113 MATCH opcode qtype qname
114 ADJUST copy_id
115 REPLY QR NOERROR
116 SECTION QUESTION
117 example.com. IN NS
118 SECTION ANSWER
119 example.com. IN NS ns.example.com.
120 SECTION ADDITIONAL
121 ns.example.com. IN A 1.2.3.4
122 ENTRY_END
123
124 ENTRY_BEGIN
125 MATCH opcode qtype qname
126 ADJUST copy_id
127 REPLY QR AA NOERROR
128 SECTION QUESTION
129 ns.example.com. IN A
130 SECTION ANSWER
131 ns.example.com. IN A 1.2.3.4
132 SECTION AUTHORITY
133 example.com. IN NS ns.example.com.
134 ENTRY_END
135
136 ENTRY_BEGIN
137 MATCH opcode qtype qname
138 ADJUST copy_id
139 REPLY QR NOERROR
140 SECTION QUESTION
141 www.example.com. IN A
142 SECTION ANSWER
143 www.example.com. 5 IN A 10.20.30.40
144 SECTION AUTHORITY
145 example.com. IN NS ns.example.com.
146 SECTION ADDITIONAL
147 ns.example.com. IN A 1.2.3.4
148 ENTRY_END
149
150 ENTRY_BEGIN
151 MATCH opcode qtype qname
152 ADJUST copy_id
153 REPLY QR AA NOERROR
154 SECTION QUESTION
155 ns.example.com. IN AAAA
156 SECTION AUTHORITY
157 example.com. 10 IN SOA . . 15 28800 7200 604800 10
158 ENTRY_END
159
160 RANGE_END
161
162 ; start by passing time ; so we are not at 0
163 STEP 1 TIME_PASSES ELAPSE 10
164
165 ; query for the record
166 STEP 8 QUERY
167 ENTRY_BEGIN
168 REPLY RD CD
169 SECTION QUESTION
170 www.example.com. IN A
171 ENTRY_END
172
173 STEP 10 CHECK_ANSWER
174 ENTRY_BEGIN
175 MATCH all ttl
176 REPLY QR RD RA CD
177 SECTION QUESTION
178 www.example.com. IN A
179 SECTION ANSWER
180 www.example.com. 10 IN A 10.20.30.40
181 SECTION AUTHORITY
182 example.com. IN NS ns.example.com.
183 SECTION ADDITIONAL
184 ns.example.com. IN A 1.2.3.4
185 ENTRY_END
186
187 ; wait for 7 seconds
188 STEP 20 TIME_PASSES ELAPSE 7
189
190 ; do a lookup to check TTLs.
191 STEP 25 QUERY
192 ENTRY_BEGIN
193 REPLY
194 SECTION QUESTION
195 www.example.com. IN A
196 ENTRY_END
197
198 STEP 26 CHECK_ANSWER
199 ENTRY_BEGIN
200 MATCH all ttl
201 REPLY QR RA
202 SECTION QUESTION
203 www.example.com. IN A
204 SECTION ANSWER
205 www.example.com. 3 IN A 10.20.30.40
206 SECTION AUTHORITY
207 example.com. 3593 IN NS ns.example.com.
208 SECTION ADDITIONAL
209 ns.example.com. 3593 IN A 1.2.3.4
210 ENTRY_END
211
212 SCENARIO_END
0 ; config options
1 ; fetch all extra targets - we want to trigger a lookup in cache
2 server:
3 target-fetch-policy: "-1 -1 -1 -1 -1"
4 access-control: 127.0.0.1 allow_snoop
5
6 stub-zone:
7 name: "."
8 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
9 CONFIG_END
10
11 SCENARIO_BEGIN Test TTL countdown on messages in the cache
12
13 ; K.ROOT-SERVERS.NET.
14 RANGE_BEGIN 0 100
15 ADDRESS 193.0.14.129
16 ENTRY_BEGIN
17 MATCH opcode qtype qname
18 ADJUST copy_id
19 REPLY QR NOERROR
20 SECTION QUESTION
21 . IN NS
22 SECTION ANSWER
23 . IN NS K.ROOT-SERVERS.NET.
24 SECTION ADDITIONAL
25 K.ROOT-SERVERS.NET. IN A 193.0.14.129
26 ENTRY_END
27
28 ENTRY_BEGIN
29 MATCH opcode subdomain
30 ADJUST copy_id copy_query
31 REPLY QR NOERROR
32 SECTION QUESTION
33 com. IN A
34 SECTION AUTHORITY
35 com. IN NS a.gtld-servers.net.
36 SECTION ADDITIONAL
37 a.gtld-servers.net. IN A 192.5.6.30
38 ENTRY_END
39
40 ENTRY_BEGIN
41 MATCH opcode qtype qname
42 ADJUST copy_id
43 REPLY QR AA NOERROR
44 SECTION QUESTION
45 a.gtld-servers.net. IN A
46 SECTION ANSWER
47 a.gtld-servers.net. IN A 192.5.6.30
48 ENTRY_END
49
50 ENTRY_BEGIN
51 MATCH opcode qtype qname
52 ADJUST copy_id
53 REPLY QR AA NOERROR
54 SECTION QUESTION
55 K.ROOT-SERVERS.NET. IN A
56 SECTION ANSWER
57 K.ROOT-SERVERS.NET. IN A 193.0.14.129
58 ENTRY_END
59
60 ENTRY_BEGIN
61 MATCH opcode qtype qname
62 ADJUST copy_id
63 REPLY QR AA NOERROR
64 SECTION QUESTION
65 a.gtld-servers.net. IN AAAA
66 SECTION AUTHORITY
67 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
68 ENTRY_END
69
70 ENTRY_BEGIN
71 MATCH opcode qtype qname
72 ADJUST copy_id
73 REPLY QR AA NOERROR
74 SECTION QUESTION
75 K.ROOT-SERVERS.NET. IN AAAA
76 SECTION AUTHORITY
77 . 86400 IN SOA . . 20070304 28800 7200 604800 86400
78 ENTRY_END
79
80 RANGE_END
81
82 ; a.gtld-servers.net.
83 RANGE_BEGIN 0 100
84 ADDRESS 192.5.6.30
85 ENTRY_BEGIN
86 MATCH opcode qtype qname
87 ADJUST copy_id
88 REPLY QR NOERROR
89 SECTION QUESTION
90 com. IN NS
91 SECTION ANSWER
92 com. IN NS a.gtld-servers.net.
93 SECTION ADDITIONAL
94 a.gtld-servers.net. IN A 192.5.6.30
95 ENTRY_END
96
97 ENTRY_BEGIN
98 MATCH opcode subdomain
99 ADJUST copy_id copy_query
100 REPLY QR NOERROR
101 SECTION QUESTION
102 example.com. IN A
103 SECTION AUTHORITY
104 example.com. IN NS ns.example.com.
105 SECTION ADDITIONAL
106 ns.example.com. IN A 1.2.3.4
107 ENTRY_END
108
109 ENTRY_BEGIN
110 MATCH opcode subdomain
111 ADJUST copy_id copy_query
112 REPLY QR NOERROR
113 SECTION QUESTION
114 foo.com. IN A
115 SECTION AUTHORITY
116 foo.com. IN NS ns.foo.com.
117 ;foo.com. IN NS nx1.example.com.
118 SECTION ADDITIONAL
119 ns.foo.com. IN A 1.2.5.6
120 ENTRY_END
121 RANGE_END
122
123 ; ns.foo.com
124 RANGE_BEGIN 0 100
125 ADDRESS 1.2.5.6
126
127 ENTRY_BEGIN
128 MATCH opcode qtype qname
129 ADJUST copy_id
130 REPLY QR AA NOERROR
131 SECTION QUESTION
132 foo.com. IN NS
133 SECTION ANSWER
134 foo.com. IN NS ns.foo.com.
135 ;foo.com. IN NS nx1.example.com.
136 SECTION ADDITIONAL
137 ns.foo.com. IN A 1.2.5.6
138 ENTRY_END
139
140 ENTRY_BEGIN
141 MATCH opcode qtype qname
142 ADJUST copy_id
143 REPLY QR AA NOERROR
144 SECTION QUESTION
145 www.foo.com. IN A
146 SECTION ANSWER
147 ;www.foo.com. IN A 1.2.5.6
148 www.foo.com. IN CNAME nx1.example.com.
149 ENTRY_END
150
151 ENTRY_BEGIN
152 MATCH opcode qtype qname
153 ADJUST copy_id
154 REPLY QR AA NOERROR
155 SECTION QUESTION
156 ns.foo.com. IN A
157 SECTION ANSWER
158 ns.foo.com. IN A 1.2.5.6
159 ENTRY_END
160
161 ENTRY_BEGIN
162 MATCH opcode qtype qname
163 ADJUST copy_id
164 REPLY QR AA NOERROR
165 SECTION QUESTION
166 ns.foo.com. IN AAAA
167 SECTION AUTHORITY
168 foo.com. IN SOA . . 1 2 3 4 3600
169 ENTRY_END
170 RANGE_END
171
172 ; ns.example.com. --- serial=15
173 RANGE_BEGIN 0 20
174 ADDRESS 1.2.3.4
175 ENTRY_BEGIN
176 MATCH opcode qtype qname
177 ADJUST copy_id
178 REPLY QR NOERROR
179 SECTION QUESTION
180 example.com. IN NS
181 SECTION ANSWER
182 example.com. IN NS ns.example.com.
183 SECTION ADDITIONAL
184 ns.example.com. IN A 1.2.3.4
185 ENTRY_END
186
187 ENTRY_BEGIN
188 MATCH opcode qtype qname
189 ADJUST copy_id
190 REPLY QR AA NOERROR
191 SECTION QUESTION
192 ns.example.com. IN A
193 SECTION ANSWER
194 ns.example.com. IN A 1.2.3.4
195 SECTION AUTHORITY
196 example.com. IN NS ns.example.com.
197 ENTRY_END
198
199 ENTRY_BEGIN
200 MATCH opcode qtype qname
201 ADJUST copy_id
202 REPLY QR NOERROR
203 SECTION QUESTION
204 www.example.com. IN A
205 SECTION ANSWER
206 www.example.com. IN A 10.20.30.40
207 SECTION AUTHORITY
208 example.com. IN NS ns.example.com.
209 SECTION ADDITIONAL
210 ns.example.com. IN A 1.2.3.4
211 ENTRY_END
212
213 ENTRY_BEGIN
214 MATCH opcode qtype qname
215 ADJUST copy_id
216 REPLY QR AA NOERROR
217 SECTION QUESTION
218 ns.example.com. IN AAAA
219 SECTION AUTHORITY
220 example.com. 10 IN SOA . . 15 28800 7200 604800 10
221 ENTRY_END
222
223 ENTRY_BEGIN
224 MATCH opcode qtype qname
225 ADJUST copy_id
226 REPLY QR AA NXDOMAIN
227 SECTION QUESTION
228 nx1.example.com. IN A
229 SECTION ANSWER
230 SECTION AUTHORITY
231 example.com. 10 IN SOA . . 15 28800 7200 604800 10
232 SECTION ADDITIONAL
233 ENTRY_END
234
235 ENTRY_BEGIN
236 MATCH opcode qtype qname
237 ADJUST copy_id
238 REPLY QR AA NXDOMAIN
239 SECTION QUESTION
240 nx2.example.com. IN A
241 SECTION ANSWER
242 SECTION AUTHORITY
243 example.com. 10 IN SOA . . 15 28800 7200 604800 10
244 SECTION ADDITIONAL
245 ENTRY_END
246
247 RANGE_END
248
249 ; ns.example.com. --- serial=17
250 RANGE_BEGIN 20 100
251 ADDRESS 1.2.3.4
252 ENTRY_BEGIN
253 MATCH opcode qtype qname
254 ADJUST copy_id
255 REPLY QR NOERROR
256 SECTION QUESTION
257 example.com. IN NS
258 SECTION ANSWER
259 example.com. IN NS ns.example.com.
260 SECTION ADDITIONAL
261 ns.example.com. IN A 1.2.3.4
262 ENTRY_END
263
264 ENTRY_BEGIN
265 MATCH opcode qtype qname
266 ADJUST copy_id
267 REPLY QR AA NOERROR
268 SECTION QUESTION
269 ns.example.com. IN A
270 SECTION ANSWER
271 ns.example.com. IN A 1.2.3.4
272 SECTION AUTHORITY
273 example.com. IN NS ns.example.com.
274 ENTRY_END
275
276 ENTRY_BEGIN
277 MATCH opcode qtype qname
278 ADJUST copy_id
279 REPLY QR NOERROR
280 SECTION QUESTION
281 www.example.com. IN A
282 SECTION ANSWER
283 www.example.com. IN A 10.20.30.40
284 SECTION AUTHORITY
285 example.com. IN NS ns.example.com.
286 SECTION ADDITIONAL
287 ns.example.com. IN A 1.2.3.4
288 ENTRY_END
289
290 ENTRY_BEGIN
291 MATCH opcode qtype qname
292 ADJUST copy_id
293 REPLY QR AA NOERROR
294 SECTION QUESTION
295 ns.example.com. IN AAAA
296 SECTION AUTHORITY
297 example.com. 10 IN SOA . . 17 28800 7200 604800 10
298 ENTRY_END
299
300 ENTRY_BEGIN
301 MATCH opcode qtype qname
302 ADJUST copy_id
303 REPLY QR AA NXDOMAIN
304 SECTION QUESTION
305 nx1.example.com. IN A
306 SECTION ANSWER
307 SECTION AUTHORITY
308 example.com. 10 IN SOA . . 17 28800 7200 604800 10
309 SECTION ADDITIONAL
310 ENTRY_END
311
312 ENTRY_BEGIN
313 MATCH opcode qtype qname
314 ADJUST copy_id
315 REPLY QR AA NXDOMAIN
316 SECTION QUESTION
317 nx2.example.com. IN A
318 SECTION ANSWER
319 SECTION AUTHORITY
320 example.com. 10 IN SOA . . 17 28800 7200 604800 10
321 SECTION ADDITIONAL
322 ENTRY_END
323
324 RANGE_END
325
326 ; start by passing time ; so we are not at 0
327 STEP 1 TIME_PASSES ELAPSE 10
328
329 ; query for NXDOMAIN
330 STEP 8 QUERY
331 ENTRY_BEGIN
332 REPLY RD CD
333 SECTION QUESTION
334 nx1.example.com. IN A
335 ENTRY_END
336
337 STEP 10 CHECK_ANSWER
338 ENTRY_BEGIN
339 MATCH all ttl
340 REPLY QR RD RA NXDOMAIN CD
341 SECTION QUESTION
342 nx1.example.com. IN A
343 SECTION ANSWER
344 SECTION AUTHORITY
345 example.com. 10 IN SOA . . 15 28800 7200 604800 10
346 SECTION ADDITIONAL
347 ENTRY_END
348
349 ; wait for 5 seconds
350 STEP 20 TIME_PASSES ELAPSE 5
351
352 ; do a lookup for nx1.example.com just to check TTLs...
353 STEP 25 QUERY
354 ENTRY_BEGIN
355 REPLY RD CD
356 SECTION QUESTION
357 nx1.example.com. IN A
358 ENTRY_END
359 STEP 26 CHECK_ANSWER
360 ENTRY_BEGIN
361 MATCH all ttl
362 REPLY QR RD RA NXDOMAIN CD
363 SECTION QUESTION
364 nx1.example.com. IN A
365 SECTION ANSWER
366 SECTION AUTHORITY
367 example.com. 5 IN SOA . . 15 28800 7200 604800 10
368 SECTION ADDITIONAL
369 ENTRY_END
370
371 ; cause a lookup that refreshes the TTL on the SOA record
372 STEP 30 QUERY
373 ENTRY_BEGIN
374 REPLY RD
375 SECTION QUESTION
376 nx2.example.com. IN A
377 ENTRY_END
378 STEP 31 CHECK_ANSWER
379 ENTRY_BEGIN
380 MATCH all ttl
381 REPLY QR RD RA NXDOMAIN
382 SECTION QUESTION
383 nx2.example.com. IN A
384 SECTION ANSWER
385 SECTION AUTHORITY
386 example.com. 10 IN SOA . . 17 28800 7200 604800 10
387 SECTION ADDITIONAL
388 ENTRY_END
389
390 ; do a lookup for nx1.example.com to check TTLs updated
391 STEP 35 QUERY
392 ENTRY_BEGIN
393 REPLY RD CD
394 SECTION QUESTION
395 nx1.example.com. IN A
396 ENTRY_END
397 STEP 36 CHECK_ANSWER
398 ENTRY_BEGIN
399 MATCH all ttl
400 REPLY QR RD RA NXDOMAIN CD
401 SECTION QUESTION
402 nx1.example.com. IN A
403 SECTION ANSWER
404 SECTION AUTHORITY
405 example.com. 10 IN SOA . . 17 28800 7200 604800 10
406 SECTION ADDITIONAL
407 ENTRY_END
408
409 ; cause a lookup for nx1.example.com bypassing the cache.
410 ; with bug; this causes msg ttl for nx1 to be time(NOW)+ttl.
411 ; so 15+5 = 20
412 ; visiable in debug log as "msg ttl is %d"
413 STEP 40 QUERY
414 ENTRY_BEGIN
415 REPLY RD
416 SECTION QUESTION
417 www.foo.com. IN A
418 ENTRY_END
419 STEP 41 CHECK_ANSWER
420 ENTRY_BEGIN
421 MATCH all ttl
422 REPLY QR RD RA NOERROR
423 SECTION QUESTION
424 www.foo.com. IN A
425 SECTION ANSWER
426 ;www.foo.com IN A 1.2.5.6
427 www.foo.com IN CNAME nx1.example.com.
428 SECTION AUTHORITY
429 example.com. 10 IN SOA . . 17 28800 7200 604800 10
430 ENTRY_END
431
432 ; now cause lookup from cache by not passing CD flag
433 ; (validator has a look, and stores after iterator cache lookup).
434 STEP 45 QUERY
435 ENTRY_BEGIN
436 REPLY RD
437 SECTION QUESTION
438 nx1.example.com. IN A
439 ENTRY_END
440 STEP 46 CHECK_ANSWER
441 ENTRY_BEGIN
442 MATCH all ttl
443 REPLY QR RD RA NXDOMAIN
444 SECTION QUESTION
445 nx1.example.com. IN A
446 SECTION ANSWER
447 SECTION AUTHORITY
448 example.com. 10 IN SOA . . 17 28800 7200 604800 10
449 SECTION ADDITIONAL
450 ENTRY_END
451
452 ; the message should timeout in 5 seconds, wait 7
453 STEP 50 TIME_PASSES ELAPSE 7
454
455 ; it is still there? (nonRD query)
456 STEP 55 QUERY
457 ENTRY_BEGIN
458 REPLY
459 SECTION QUESTION
460 nx1.example.com. IN A
461 ENTRY_END
462
463 ; this answer is the bug - NXDOMAIN too long in the cache.
464 ;STEP 56 CHECK_ANSWER
465 ;ENTRY_BEGIN
466 ;MATCH all ttl
467 ;REPLY QR RA NXDOMAIN
468 ;SECTION QUESTION
469 ;nx1.example.com. IN A
470 ;SECTION ANSWER
471 ;SECTION AUTHORITY
472 ;example.com. 3 IN SOA . . 17 28800 7200 604800 10
473 ;SECTION ADDITIONAL
474 ;ENTRY_END
475
476 ; Now the correct answer: no such cached query.
477 STEP 56 CHECK_ANSWER
478 ENTRY_BEGIN
479 MATCH all
480 REPLY QR RA NOERROR
481 SECTION QUESTION
482 nx1.example.com. IN A
483 SECTION ANSWER
484 SECTION AUTHORITY
485 example.com. IN NS ns.example.com.
486 SECTION ADDITIONAL
487 ns.example.com. IN A 1.2.3.4
488 ENTRY_END
489
490 SCENARIO_END
0 ; config options
1 ; The island of trust is at example.com
2 server:
3 trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 val-override-date: "20070916134226"
5 target-fetch-policy: "0 0 0 0 0"
6
7 stub-zone:
8 name: "."
9 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
10 CONFIG_END
11
12 SCENARIO_BEGIN Test validator with qtype RRSIG response
13
14 ; K.ROOT-SERVERS.NET.
15 RANGE_BEGIN 0 100
16 ADDRESS 193.0.14.129
17 ENTRY_BEGIN
18 MATCH opcode qtype qname
19 ADJUST copy_id
20 REPLY QR NOERROR
21 SECTION QUESTION
22 . IN NS
23 SECTION ANSWER
24 . IN NS K.ROOT-SERVERS.NET.
25 SECTION ADDITIONAL
26 K.ROOT-SERVERS.NET. IN A 193.0.14.129
27 ENTRY_END
28
29 ENTRY_BEGIN
30 MATCH opcode subdomain
31 ADJUST copy_id copy_query
32 REPLY QR NOERROR
33 SECTION QUESTION
34 example.com. IN A
35 SECTION AUTHORITY
36 com. IN NS a.gtld-servers.net.
37 SECTION ADDITIONAL
38 a.gtld-servers.net. IN A 192.5.6.30
39 ENTRY_END
40 RANGE_END
41
42 ; a.gtld-servers.net.
43 RANGE_BEGIN 0 100
44 ADDRESS 192.5.6.30
45 ENTRY_BEGIN
46 MATCH opcode qtype qname
47 ADJUST copy_id
48 REPLY QR NOERROR
49 SECTION QUESTION
50 com. IN NS
51 SECTION ANSWER
52 com. IN NS a.gtld-servers.net.
53 SECTION ADDITIONAL
54 a.gtld-servers.net. IN A 192.5.6.30
55 ENTRY_END
56
57 ENTRY_BEGIN
58 MATCH opcode subdomain
59 ADJUST copy_id copy_query
60 REPLY QR NOERROR
61 SECTION QUESTION
62 example.com. IN A
63 SECTION AUTHORITY
64 example.com. IN NS ns.example.com.
65 SECTION ADDITIONAL
66 ns.example.com. IN A 1.2.3.4
67 ENTRY_END
68 RANGE_END
69
70 ; ns.example.com.
71 RANGE_BEGIN 0 100
72 ADDRESS 1.2.3.4
73 ENTRY_BEGIN
74 MATCH opcode qtype qname
75 ADJUST copy_id
76 REPLY QR NOERROR
77 SECTION QUESTION
78 example.com. IN NS
79 SECTION ANSWER
80 example.com. IN NS ns.example.com.
81 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
82 SECTION ADDITIONAL
83 ns.example.com. IN A 1.2.3.4
84 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
85 ENTRY_END
86
87 ; response to DNSKEY priming query
88 ENTRY_BEGIN
89 MATCH opcode qtype qname
90 ADJUST copy_id
91 REPLY QR NOERROR
92 SECTION QUESTION
93 example.com. IN DNSKEY
94 SECTION ANSWER
95 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
96 example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134802 20070829134802 2854 example.com. MCwCFG1yhRNtTEa3Eno2zhVVuy2EJX3wAhQeLyUp6+UXcpC5qGNu9tkrTEgPUg== ;{id = 2854}
97 SECTION AUTHORITY
98 example.com. IN NS ns.example.com.
99 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
100 SECTION ADDITIONAL
101 ns.example.com. IN A 1.2.3.4
102 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
103 ENTRY_END
104
105 ; response to query for A
106 ENTRY_BEGIN
107 MATCH opcode qtype qname
108 ADJUST copy_id
109 REPLY QR NOERROR
110 SECTION QUESTION
111 www.example.com. IN A
112 SECTION ANSWER
113 www.example.com. IN A 10.20.30.40
114 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
115 SECTION AUTHORITY
116 example.com. IN NS ns.example.com.
117 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
118 SECTION ADDITIONAL
119 ns.example.com. IN A 1.2.3.4
120 www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
121 ENTRY_END
122
123 ; RRSIG query
124 ENTRY_BEGIN
125 MATCH opcode qtype qname
126 ADJUST copy_id
127 REPLY QR NOERROR
128 SECTION QUESTION
129 www.example.com. IN RRSIG
130 SECTION ANSWER
131 ;www.example.com. IN A 10.20.30.40
132 www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
133 SECTION AUTHORITY
134 example.com. IN NS ns.example.com.
135 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
136 SECTION ADDITIONAL
137 ns.example.com. IN A 1.2.3.4
138 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
139 ENTRY_END
140 RANGE_END
141
142 STEP 1 QUERY
143 ENTRY_BEGIN
144 REPLY RD DO
145 SECTION QUESTION
146 www.example.com. IN RRSIG
147 ENTRY_END
148
149 ; recursion happens here.
150 STEP 10 CHECK_ANSWER
151 ENTRY_BEGIN
152 MATCH all
153 REPLY QR RD RA NOERROR
154 SECTION QUESTION
155 www.example.com. IN RRSIG
156 SECTION ANSWER
157 www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
158 SECTION AUTHORITY
159 example.com. IN NS ns.example.com.
160 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
161 SECTION ADDITIONAL
162 ns.example.com. IN A 1.2.3.4
163 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
164 ENTRY_END
165
166 SCENARIO_END
0 ; config options
1 ; The island of trust is at example.com
2 server:
3 trust-anchor: "example.com. 3600 IN DS 2854 208 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 val-override-date: "20070916134226"
5 target-fetch-policy: "0 0 0 0 0"
6
7 stub-zone:
8 name: "."
9 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
10 CONFIG_END
11
12 SCENARIO_BEGIN Test validator with unsupported algorithm trust anchor
13
14 ; K.ROOT-SERVERS.NET.
15 RANGE_BEGIN 0 100
16 ADDRESS 193.0.14.129
17 ENTRY_BEGIN
18 MATCH opcode qtype qname
19 ADJUST copy_id
20 REPLY QR NOERROR
21 SECTION QUESTION
22 . IN NS
23 SECTION ANSWER
24 . IN NS K.ROOT-SERVERS.NET.
25 SECTION ADDITIONAL
26 K.ROOT-SERVERS.NET. IN A 193.0.14.129
27 ENTRY_END
28
29 ENTRY_BEGIN
30 MATCH opcode qtype qname
31 ADJUST copy_id
32 REPLY QR NOERROR
33 SECTION QUESTION
34 www.example.com. IN A
35 SECTION AUTHORITY
36 com. IN NS a.gtld-servers.net.
37 SECTION ADDITIONAL
38 a.gtld-servers.net. IN A 192.5.6.30
39 ENTRY_END
40 RANGE_END
41
42 ; a.gtld-servers.net.
43 RANGE_BEGIN 0 100
44 ADDRESS 192.5.6.30
45 ENTRY_BEGIN
46 MATCH opcode qtype qname
47 ADJUST copy_id
48 REPLY QR NOERROR
49 SECTION QUESTION
50 com. IN NS
51 SECTION ANSWER
52 com. IN NS a.gtld-servers.net.
53 SECTION ADDITIONAL
54 a.gtld-servers.net. IN A 192.5.6.30
55 ENTRY_END
56
57 ENTRY_BEGIN
58 MATCH opcode qtype qname
59 ADJUST copy_id
60 REPLY QR NOERROR
61 SECTION QUESTION
62 www.example.com. IN A
63 SECTION AUTHORITY
64 example.com. IN NS ns.example.com.
65 SECTION ADDITIONAL
66 ns.example.com. IN A 1.2.3.4
67 ENTRY_END
68 RANGE_END
69
70 ; ns.example.com.
71 RANGE_BEGIN 0 100
72 ADDRESS 1.2.3.4
73 ENTRY_BEGIN
74 MATCH opcode qtype qname
75 ADJUST copy_id
76 REPLY QR NOERROR
77 SECTION QUESTION
78 example.com. IN NS
79 SECTION ANSWER
80 example.com. IN NS ns.example.com.
81 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
82 SECTION ADDITIONAL
83 ns.example.com. IN A 1.2.3.4
84 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
85 ENTRY_END
86
87 ; response to DNSKEY priming query
88 ENTRY_BEGIN
89 MATCH opcode qtype qname
90 ADJUST copy_id
91 REPLY QR NOERROR
92 SECTION QUESTION
93 example.com. IN DNSKEY
94 SECTION ANSWER
95 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
96 example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134802 20070829134802 2854 example.com. MCwCFG1yhRNtTEa3Eno2zhVVuy2EJX3wAhQeLyUp6+UXcpC5qGNu9tkrTEgPUg== ;{id = 2854}
97 SECTION AUTHORITY
98 example.com. IN NS ns.example.com.
99 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
100 SECTION ADDITIONAL
101 ns.example.com. IN A 1.2.3.4
102 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
103 ENTRY_END
104
105 ; response to query of interest
106 ENTRY_BEGIN
107 MATCH opcode qtype qname
108 ADJUST copy_id
109 REPLY QR NOERROR
110 SECTION QUESTION
111 www.example.com. IN A
112 SECTION ANSWER
113 www.example.com. IN A 10.20.30.40
114 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
115 SECTION AUTHORITY
116 example.com. IN NS ns.example.com.
117 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
118 SECTION ADDITIONAL
119 ns.example.com. IN A 1.2.3.4
120 www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
121 ENTRY_END
122 RANGE_END
123
124 STEP 1 QUERY
125 ENTRY_BEGIN
126 REPLY RD DO
127 SECTION QUESTION
128 www.example.com. IN A
129 ENTRY_END
130
131 ; recursion happens here.
132 STEP 10 CHECK_ANSWER
133 ENTRY_BEGIN
134 MATCH all
135 REPLY QR RD RA NOERROR
136 SECTION QUESTION
137 www.example.com. IN A
138 SECTION ANSWER
139 www.example.com. IN A 10.20.30.40
140 www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
141 SECTION AUTHORITY
142 example.com. IN NS ns.example.com.
143 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
144 SECTION ADDITIONAL
145 ns.example.com. IN A 1.2.3.4
146 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
147 ENTRY_END
148
149 SCENARIO_END
0 ; config options
1 ; The island of trust is at example.com (the DLV repository)
2 server:
3 dlv-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 val-override-date: "20070916134226"
5 target-fetch-policy: "0 0 0 0 0"
6
7 stub-zone:
8 name: "."
9 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
10 CONFIG_END
11
12 SCENARIO_BEGIN Test validator with unknown algorithm DLV anchor
13 ; positive response for DLV.
14 ; but only has unknown algos
15 ; have to treat zone as insecure
16
17 ; K.ROOT-SERVERS.NET.
18 RANGE_BEGIN 0 100
19 ADDRESS 193.0.14.129
20 ENTRY_BEGIN
21 MATCH opcode qtype qname
22 ADJUST copy_id
23 REPLY QR NOERROR
24 SECTION QUESTION
25 . IN NS
26 SECTION ANSWER
27 . IN NS K.ROOT-SERVERS.NET.
28 SECTION ADDITIONAL
29 K.ROOT-SERVERS.NET. IN A 193.0.14.129
30 ENTRY_END
31
32 ENTRY_BEGIN
33 MATCH opcode subdomain
34 ADJUST copy_id copy_query
35 REPLY QR NOERROR
36 SECTION QUESTION
37 com. IN A
38 SECTION AUTHORITY
39 com. IN NS a.gtld-servers.net.
40 SECTION ADDITIONAL
41 a.gtld-servers.net. IN A 192.5.6.30
42 ENTRY_END
43
44 ENTRY_BEGIN
45 MATCH opcode subdomain
46 ADJUST copy_id copy_query
47 REPLY QR NOERROR
48 SECTION QUESTION
49 net. IN A
50 SECTION AUTHORITY
51 net. IN NS a.gtld-servers.net.
52 SECTION ADDITIONAL
53 a.gtld-servers.net. IN A 192.5.6.30
54 ENTRY_END
55 RANGE_END
56
57 ; a.gtld-servers.net.
58 RANGE_BEGIN 0 100
59 ADDRESS 192.5.6.30
60 ENTRY_BEGIN
61 MATCH opcode qtype qname
62 ADJUST copy_id
63 REPLY QR NOERROR
64 SECTION QUESTION
65 com. IN NS
66 SECTION ANSWER
67 com. IN NS a.gtld-servers.net.
68 SECTION ADDITIONAL
69 a.gtld-servers.net. IN A 192.5.6.30
70 ENTRY_END
71
72 ENTRY_BEGIN
73 MATCH opcode qtype qname
74 ADJUST copy_id
75 REPLY QR NOERROR
76 SECTION QUESTION
77 net. IN NS
78 SECTION ANSWER
79 net. IN NS a.gtld-servers.net.
80 SECTION ADDITIONAL
81 a.gtld-servers.net. IN A 192.5.6.30
82 ENTRY_END
83
84 ENTRY_BEGIN
85 MATCH opcode subdomain
86 ADJUST copy_id copy_query
87 REPLY QR NOERROR
88 SECTION QUESTION
89 example.com. IN A
90 SECTION AUTHORITY
91 example.com. IN NS ns.example.com.
92 SECTION ADDITIONAL
93 ns.example.com. IN A 1.2.3.4
94 ENTRY_END
95
96 ENTRY_BEGIN
97 MATCH opcode subdomain
98 ADJUST copy_id copy_query
99 REPLY QR NOERROR
100 SECTION QUESTION
101 example.net. IN A
102 SECTION AUTHORITY
103 example.net. IN NS ns.example.net.
104 SECTION ADDITIONAL
105 ns.example.net. IN A 1.2.3.5
106 ENTRY_END
107 RANGE_END
108
109 ; ns.example.com.
110 RANGE_BEGIN 0 100
111 ADDRESS 1.2.3.4
112 ENTRY_BEGIN
113 MATCH opcode qtype qname
114 ADJUST copy_id
115 REPLY QR NOERROR
116 SECTION QUESTION
117 example.com. IN NS
118 SECTION ANSWER
119 example.com. IN NS ns.example.com.
120 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
121 SECTION ADDITIONAL
122 ns.example.com. IN A 1.2.3.4
123 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
124 ENTRY_END
125
126 ; response to DNSKEY priming query
127 ENTRY_BEGIN
128 MATCH opcode qtype qname
129 ADJUST copy_id
130 REPLY QR NOERROR
131 SECTION QUESTION
132 example.com. IN DNSKEY
133 SECTION ANSWER
134 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
135 example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134802 20070829134802 2854 example.com. MCwCFG1yhRNtTEa3Eno2zhVVuy2EJX3wAhQeLyUp6+UXcpC5qGNu9tkrTEgPUg== ;{id = 2854}
136 SECTION AUTHORITY
137 example.com. IN NS ns.example.com.
138 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
139 SECTION ADDITIONAL
140 ns.example.com. IN A 1.2.3.4
141 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
142 ENTRY_END
143
144 ; DLV query
145 ENTRY_BEGIN
146 MATCH opcode qtype qname
147 ADJUST copy_id
148 REPLY QR NOERROR
149 SECTION QUESTION
150 example.net.example.com. IN DLV
151 SECTION ANSWER
152 ; algo 208 is unknown
153 example.net.example.com. 3600 IN DLV 30899 208 1 14188c885f20623ad1d3bec42798f3f951793e4c ; xehac-mofum-malyd-bomaf-pegit-fuzes-ganin-misiz-nigel-nozog-soxix
154 example.net.example.com. 3600 IN RRSIG DLV 3 4 3600 20070926134150 20070829134150 2854 example.com. AFBU1dN/KstcLfQQzy7ZKvPq+2hQg7D6QynqgwI3f8envPQGj782/NA= ;{id = 2854}
155 ;example.net.example.com. 3600 IN DLV 30899 5 1 14188c885f20623ad1d3bec42798f3f951793e4c ; xehac-mofum-malyd-bomaf-pegit-fuzes-ganin-misiz-nigel-nozog-soxix
156 ;example.net.example.com. 3600 IN RRSIG DLV 3 4 3600 20070926134150 20070829134150 2854 example.com. ACK48Q/oKwh/SM9yRiKjZYuc+AtEZ2yCPNJ15kKCN8nsVcv7xigmNTY= ;{id = 2854}
157 SECTION AUTHORITY
158 example.com. IN NS ns.example.com.
159 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
160 SECTION ADDITIONAL
161 ns.example.com. IN A 1.2.3.4
162 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
163 ENTRY_END
164
165 ENTRY_BEGIN
166 MATCH opcode qtype qname
167 ADJUST copy_id
168 REPLY QR NOERROR
169 SECTION QUESTION
170 net.example.com. IN DLV
171 SECTION ANSWER
172 SECTION AUTHORITY
173 example.com. IN SOA open.nlnetlabs.nl. hostmaster.nlnetlabs.nl. 2008081300 28800 7200 604800 3600
174 example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. AKPJnPBqfJKxE4P2iVYkSRJno9HmiXJZtjdqE8oBeq9Lk9FytcMdcig= ;{id = 2854}
175 example.com IN NSEC example.net.example.com. SOA NS RRSIG NSEC
176 example.com. 3600 IN RRSIG NSEC 3 2 3600 20070926134150 20070829134150 2854 example.com. AIoUkJ04/7/kJFDLocoqksqt9UL2RHHwlRfXAMxGdBHcNO+GSpG47Uk= ;{id = 2854}
177 ENTRY_END
178
179 ENTRY_BEGIN
180 MATCH opcode qtype qname
181 ADJUST copy_id
182 REPLY QR NXDOMAIN
183 SECTION QUESTION
184 com.example.com. IN DLV
185 SECTION ANSWER
186 SECTION AUTHORITY
187 example.com. IN SOA open.nlnetlabs.nl. hostmaster.nlnetlabs.nl. 2008081300 28800 7200 604800 3600
188 example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. AKPJnPBqfJKxE4P2iVYkSRJno9HmiXJZtjdqE8oBeq9Lk9FytcMdcig= ;{id = 2854}
189 example.com IN NSEC example.net.example.com. SOA NS RRSIG NSEC
190 example.com. 3600 IN RRSIG NSEC 3 2 3600 20070926134150 20070829134150 2854 example.com. AIoUkJ04/7/kJFDLocoqksqt9UL2RHHwlRfXAMxGdBHcNO+GSpG47Uk= ;{id = 2854}
191 ENTRY_END
192
193 RANGE_END
194
195 ; ns.example.net.
196 RANGE_BEGIN 0 100
197 ADDRESS 1.2.3.5
198 ; DS RR is
199 ; example.net. 3600 IN DS 30899 5 1 14188c885f20623ad1d3bec42798f3f951793e4c ; xehac-mofum-malyd-bomaf-pegit-fuzes-ganin-misiz-nigel-nozog-soxix
200 ; DNSKEY prime query
201 ENTRY_BEGIN
202 MATCH opcode qtype qname
203 ADJUST copy_id
204 REPLY QR NOERROR
205 SECTION QUESTION
206 example.net. IN DNSKEY
207 SECTION ANSWER
208 example.net. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
209 example.net. 3600 IN RRSIG DNSKEY RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. hiFzlQ8VoYgCuvIsfVuxC3mfJDqsTh0yc6abs5xMx5uEcIjb0dndFQx7INOM+imlzveEN73Hqp4OLFpFhsWLlw== ;{id = 30899}
210 SECTION AUTHORITY
211 example.net. IN NS ns.example.net.
212 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
213 SECTION ADDITIONAL
214 ns.example.net. IN A 1.2.3.5
215 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
216 ENTRY_END
217
218 ; NS query
219 ENTRY_BEGIN
220 MATCH opcode qtype qname
221 ADJUST copy_id
222 REPLY QR NOERROR
223 SECTION QUESTION
224 example.net. IN NS
225 SECTION ANSWER
226 example.net. IN NS ns.example.net.
227 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
228 SECTION ADDITIONAL
229 ns.example.net. IN A 1.2.3.5
230 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
231 ENTRY_END
232
233 ; www.example.net query
234 ENTRY_BEGIN
235 MATCH opcode qtype qname
236 ADJUST copy_id
237 REPLY QR NOERROR
238 SECTION QUESTION
239 www.example.net. IN A
240 SECTION ANSWER
241 www.example.net. 3600 IN A 10.20.30.40
242 www.example.net. 3600 IN RRSIG A 5 3 3600 20070926135752 20070829135752 30899 example.net. ACvv4RQVC7TbI57ewqFImRaVoymktJ5Cxn/FaCodIENt82LVM92nivbP2WtwWCsQHWp7FkrMxTlQTJwyAeXFyg== ;{id = 30899}
243 SECTION AUTHORITY
244 example.net. IN NS ns.example.net.
245 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
246 SECTION ADDITIONAL
247 ns.example.net. IN A 1.2.3.5
248 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
249 ENTRY_END
250
251
252 RANGE_END
253
254 STEP 1 QUERY
255 ENTRY_BEGIN
256 REPLY RD DO
257 SECTION QUESTION
258 www.example.net. IN A
259 ENTRY_END
260
261 ; recursion happens here.
262 STEP 10 CHECK_ANSWER
263 ENTRY_BEGIN
264 MATCH all
265 REPLY QR RD RA NOERROR
266 SECTION QUESTION
267 www.example.net. IN A
268 SECTION ANSWER
269 www.example.net. 3600 IN A 10.20.30.40
270 www.example.net. 3600 IN RRSIG A 5 3 3600 20070926135752 20070829135752 30899 example.net. ACvv4RQVC7TbI57ewqFImRaVoymktJ5Cxn/FaCodIENt82LVM92nivbP2WtwWCsQHWp7FkrMxTlQTJwyAeXFyg== ;{id = 30899}
271 SECTION AUTHORITY
272 example.net. IN NS ns.example.net.
273 example.net. 3600 IN RRSIG NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
274 SECTION ADDITIONAL
275 ns.example.net. IN A 1.2.3.5
276 ns.example.net. 3600 IN RRSIG A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
277 ENTRY_END
278
279 SCENARIO_END
0 ; config options
1 ; The island of trust is at example.com
2 server:
3 trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
4 val-override-date: "20070916134226"
5 target-fetch-policy: "0 0 0 0 0"
6
7 stub-zone:
8 name: "."
9 stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
10 CONFIG_END
11
12 SCENARIO_BEGIN Test validator with unknown algorithm delegation
13 ; DS has unknown algo only.
14 ; so subzone has to be treated as unsigned.
15
16 ; K.ROOT-SERVERS.NET.
17 RANGE_BEGIN 0 100
18 ADDRESS 193.0.14.129
19 ENTRY_BEGIN
20 MATCH opcode qtype qname
21 ADJUST copy_id
22 REPLY QR NOERROR
23 SECTION QUESTION
24 . IN NS
25 SECTION ANSWER
26 . IN NS K.ROOT-SERVERS.NET.
27 SECTION ADDITIONAL
28 K.ROOT-SERVERS.NET. IN A 193.0.14.129
29 ENTRY_END
30
31 ENTRY_BEGIN
32 MATCH opcode qtype qname
33 ADJUST copy_id
34 REPLY QR NOERROR
35 SECTION QUESTION
36 www.sub.example.com. IN A
37 SECTION AUTHORITY
38 com. IN NS a.gtld-servers.net.
39 SECTION ADDITIONAL
40 a.gtld-servers.net. IN A 192.5.6.30
41 ENTRY_END
42 RANGE_END
43
44 ; a.gtld-servers.net.
45 RANGE_BEGIN 0 100
46 ADDRESS 192.5.6.30
47 ENTRY_BEGIN
48 MATCH opcode qtype qname
49 ADJUST copy_id
50 REPLY QR NOERROR
51 SECTION QUESTION
52 com. IN NS
53 SECTION ANSWER
54 com. IN NS a.gtld-servers.net.
55 SECTION ADDITIONAL
56 a.gtld-servers.net. IN A 192.5.6.30
57 ENTRY_END
58
59 ENTRY_BEGIN
60 MATCH opcode qtype qname
61 ADJUST copy_id
62 REPLY QR NOERROR
63 SECTION QUESTION
64 www.sub.example.com. IN A
65 SECTION AUTHORITY
66 example.com. IN NS ns.example.com.
67 SECTION ADDITIONAL
68 ns.example.com. IN A 1.2.3.4
69 ENTRY_END
70 RANGE_END
71
72 ; ns.example.com.
73 RANGE_BEGIN 0 100
74 ADDRESS 1.2.3.4
75 ENTRY_BEGIN
76 MATCH opcode qtype qname
77 ADJUST copy_id
78 REPLY QR NOERROR
79 SECTION QUESTION
80 example.com. IN NS
81 SECTION ANSWER
82 example.com. IN NS ns.example.com.
83 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
84 SECTION ADDITIONAL
85 ns.example.com. IN A 1.2.3.4
86 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
87 ENTRY_END
88
89 ; response to DNSKEY priming query
90 ENTRY_BEGIN
91 MATCH opcode qtype qname
92 ADJUST copy_id
93 REPLY QR NOERROR
94 SECTION QUESTION
95 example.com. IN DNSKEY
96 SECTION ANSWER
97 example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
98 example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
99 SECTION AUTHORITY
100 example.com. IN NS ns.example.com.
101 example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
102 SECTION ADDITIONAL
103 ns.example.com. IN A 1.2.3.4
104 ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
105 ENTRY_END
106
107 ; response for delegation to sub.example.com.
108 ENTRY_BEGIN
109 MATCH opcode qtype subdomain
110 ADJUST copy_id copy_query
111 REPLY QR NOERROR
112 SECTION QUESTION
113 sub.example.com. IN A
114 SECTION ANSWER
115 SECTION AUTHORITY
116 sub.example.com. IN NS ns.sub.example.com.
117 ; algorithm 208 is unknown.
118 sub.example.com. 3600 IN DS 30899 208 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
119 sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. AEMPMNVJAygL0TyRUU+MVgP4FA7jSIpVj6628IdLe7eY3OwWp3hUTnU= ;{id = 2854}
120 ;sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
121 ;sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
122 SECTION ADDITIONAL
123 ns.sub.example.com. IN A 1.2.3.6
124 ENTRY_END
125 RANGE_END
126
127 ; ns.sub.example.com.
128 RANGE_BEGIN 0 100
129 ADDRESS 1.2.3.6
130 ENTRY_BEGIN
131 MATCH opcode qtype qname
132 ADJUST copy_id
133 REPLY QR NOERROR
134 SECTION QUESTION
135 sub.example.com. IN NS
136 SECTION ANSWER
137 sub.example.com. IN NS ns.sub.example.com.
138 sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
139 SECTION ADDITIONAL
140 ns.sub.example.com. IN A 1.2.3.6
141 ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
142 ENTRY_END
143
144 ; response to DNSKEY priming query
145 ; sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
146 ENTRY_BEGIN
147 MATCH opcode qtype qname
148 ADJUST copy_id
149 REPLY QR NOERROR
150 SECTION QUESTION
151 sub.example.com. IN DNSKEY
152 SECTION ANSWER
153 sub.example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
154 sub.example.com. 3600 IN RRSIG DNSKEY 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. uNGp99iznjD7oOX02XnQbDnbg75UwBHRvZSKYUorTKvPUnCWMHKdRsQ+mf+Fx3GZ+Fz9BVjoCmQqpnfgXLEYqw== ;{id = 30899}
155 SECTION AUTHORITY
156 sub.example.com. IN NS ns.sub.example.com.
157 sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
158 SECTION ADDITIONAL
159 ns.sub.example.com. IN A 1.2.3.6
160 ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
161 ENTRY_END
162
163 ; response to query of interest
164 ENTRY_BEGIN
165 MATCH opcode qtype qname
166 ADJUST copy_id
167 REPLY QR NOERROR
168 SECTION QUESTION
169 www.sub.example.com. IN A
170 SECTION ANSWER
171 www.sub.example.com. IN A 11.11.11.11
172 www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
173 SECTION AUTHORITY
174 SECTION ADDITIONAL
175 ENTRY_END
176 RANGE_END
177
178 STEP 1 QUERY
179 ENTRY_BEGIN
180 REPLY RD DO
181 SECTION QUESTION
182 www.sub.example.com. IN A
183 ENTRY_END
184
185 ; recursion happens here.
186 STEP 10 CHECK_ANSWER
187 ENTRY_BEGIN
188 MATCH all
189 REPLY QR RD RA NOERROR
190 SECTION QUESTION
191 www.sub.example.com. IN A
192 SECTION ANSWER
193 www.sub.example.com. 3600 IN A 11.11.11.11
194 www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
195 SECTION AUTHORITY
196 SECTION ADDITIONAL
197 ENTRY_END
198
199 SCENARIO_END
4545 #include "util/config_file.h"
4646 #include "util/configparser.h"
4747 #include "util/net_help.h"
48 #include "util/data/msgparse.h"
4849 /** global config during parsing */
4950 struct config_parser_state* cfg_parser = 0;
5051 /** lex in file */
8283 cfg->do_udp = 1;
8384 cfg->do_tcp = 1;
8485 cfg->use_syslog = 1;
86 cfg->log_time_ascii = 0;
8587 #ifndef USE_WINSOCK
8688 cfg->outgoing_num_ports = 256;
87 #else
88 cfg->outgoing_num_ports = 16; /* windows is limited in num fds */
89 #endif
9089 cfg->outgoing_num_tcp = 10;
9190 cfg->incoming_num_tcp = 10;
91 #else
92 cfg->outgoing_num_ports = 48; /* windows is limited in num fds */
93 cfg->outgoing_num_tcp = 2; /* leaves 64-52=12 for: 4if,1stop,thread4 */
94 cfg->incoming_num_tcp = 2;
95 #endif
9296 cfg->msg_buffer_size = 65552; /* 64 k + a small margin */
9397 cfg->msg_cache_size = 4 * 1024 * 1024;
9498 cfg->msg_cache_slabs = 4;
99103 cfg->host_ttl = 900;
100104 cfg->lame_ttl = 900;
101105 cfg->bogus_ttl = 60;
106 cfg->min_ttl = 0;
102107 cfg->max_ttl = 3600 * 24;
103108 cfg->infra_cache_slabs = 4;
104109 cfg->infra_cache_numhosts = 10000;
144149 cfg->trusted_keys_file_list = NULL;
145150 cfg->dlv_anchor_file = NULL;
146151 cfg->dlv_anchor_list = NULL;
152 cfg->domain_insecure = NULL;
147153 cfg->val_date_override = 0;
154 cfg->val_sig_skew_min = 3600; /* at least daylight savings trouble */
155 cfg->val_sig_skew_max = 86400; /* at most timezone settings trouble */
148156 cfg->val_clean_additional = 1;
149157 cfg->val_permissive_mode = 0;
150158 cfg->key_cache_size = 4 * 1024 * 1024;
153161 cfg->local_zones = NULL;
154162 cfg->local_zones_nodefault = NULL;
155163 cfg->local_data = NULL;
156
164 cfg->python_script = NULL;
157165 cfg->remote_control_enable = 0;
158166 cfg->control_ifs = NULL;
159167 cfg->control_port = 953;
348356 } else if(strcmp(opt, "dlv-anchor:") == 0) {
349357 return cfg_strlist_insert(&cfg->dlv_anchor_list,
350358 strdup(val));
359 } else if(strcmp(opt, "domain-insecure:") == 0) {
360 return cfg_strlist_insert(&cfg->domain_insecure, strdup(val));
351361 } else if(strcmp(opt, "val-override-date:") == 0) {
352362 if(strcmp(val, "") == 0 || strcmp(val, "0") == 0) {
353363 cfg->val_date_override = 0;
379389 return cfg_parse_memsize(val, &cfg->neg_cache_size);
380390 } else if(strcmp(opt, "local-data:") == 0) {
381391 return cfg_strlist_insert(&cfg->local_data, strdup(val));
392 } else if(strcmp(opt, "local-zone:") == 0) {
393 return cfg_parse_local_zone(cfg, val);
382394 } else if(strcmp(opt, "control-enable:") == 0) {
383395 IS_YES_OR_NO;
384396 cfg->remote_control_enable = (strcmp(val, "yes") == 0);
402414 } else if(strcmp(opt, "module-config:") == 0) {
403415 free(cfg->module_conf);
404416 return (cfg->module_conf = strdup(val)) != NULL;
417 } else if(strcmp(opt, "python-script:") == 0) {
418 free(cfg->python_script);
419 return (cfg->python_script = strdup(val)) != NULL;
405420 } else {
406421 /* unknown or unsupported (from the library interface) */
407422 return 0;
522537 config_delstrlist(cfg->trust_anchor_file_list);
523538 config_delstrlist(cfg->trusted_keys_file_list);
524539 config_delstrlist(cfg->trust_anchor_list);
540 config_delstrlist(cfg->domain_insecure);
525541 free(cfg->dlv_anchor_file);
526542 config_delstrlist(cfg->dlv_anchor_list);
527543 config_deldblstrlist(cfg->acls);
797813 return 1;
798814 }
799815
800 /** the MAX_TTL global */
801 extern uint32_t MAX_TTL;
802
803816 void
804817 config_apply(struct config_file* config)
805818 {
806819 MAX_TTL = (uint32_t)config->max_ttl;
820 MIN_TTL = (uint32_t)config->min_ttl;
821 log_set_time_asc(config->log_time_ascii);
807822 }
808823
809824 /**
832847 slashit = 1;
833848 }
834849 /* chdir */
850 #ifdef UB_ON_WINDOWS
851 if(fname[0] != 0 && fname[1] == ':') {
852 /* full path, no chdir */
853 } else
854 #endif
835855 if(fname[0] == '/' || !use_chdir) {
836856 /* full path, no chdir */
837857 } else if(cfg->directory && cfg->directory[0]) {
875895 strncpy(buf, cfg->chrootdir, len);
876896 slashit = 1;
877897 }
898 #ifdef UB_ON_WINDOWS
899 if(fname[0] != 0 && fname[1] == ':') {
900 /* full path, no chdir */
901 } else
902 #endif
878903 /* chdir */
879904 if(fname[0] == '/' || !use_chdir) {
880905 /* full path, no chdir */
900925 }
901926
902927 /** return next space character in string */
903 static char* next_space_pos(char* str)
928 static char* next_space_pos(const char* str)
904929 {
905930 char* sp = strchr(str, ' ');
906931 char* tab = strchr(str, '\t');
912937 }
913938
914939 /** return last space character in string */
915 static char* last_space_pos(char* str)
940 static char* last_space_pos(const char* str)
916941 {
917942 char* sp = strrchr(str, ' ');
918943 char* tab = strrchr(str, '\t');
921946 if(!sp) return tab;
922947 if(!tab) return sp;
923948 return (sp>tab)?sp:tab;
949 }
950
951 int
952 cfg_parse_local_zone(struct config_file* cfg, const char* val)
953 {
954 const char *type, *name_end, *name;
955 char buf[256];
956
957 /* parse it as: [zone_name] [between stuff] [zone_type] */
958 name = val;
959 while(*name && isspace(*name))
960 name++;
961 if(!*name) {
962 log_err("syntax error: too short: %s", val);
963 return 0;
964 }
965 name_end = next_space_pos(name);
966 if(!name_end || !*name_end) {
967 log_err("syntax error: expected zone type: %s", val);
968 return 0;
969 }
970 if (name_end - name > 255) {
971 log_err("syntax error: bad zone name: %s", val);
972 return 0;
973 }
974 strncpy(buf, name, (size_t)(name_end-name));
975 buf[name_end-name] = '\0';
976
977 type = last_space_pos(name_end);
978 while(type && *type && isspace(*type))
979 type++;
980 if(!type || !*type) {
981 log_err("syntax error: expected zone type: %s", val);
982 return 0;
983 }
984
985 if(strcmp(type, "nodefault")==0) {
986 return cfg_strlist_insert(&cfg->local_zones_nodefault,
987 strdup(name));
988 } else {
989 return cfg_str2list_insert(&cfg->local_zones, strdup(buf),
990 strdup(type));
991 }
924992 }
925993
926994 char* cfg_ptr_reverse(char* str)
170170
171171 /** should log messages be sent to syslogd */
172172 int use_syslog;
173 /** log timestamp in ascii UTC */
174 int log_time_ascii;
173175
174176 /** do not report identity (id.server, hostname.bind) */
175177 int hide_identity;
193195 char* dlv_anchor_file;
194196 /** DLV anchor inline */
195197 struct config_strlist* dlv_anchor_list;
198 /** insecure domain list */
199 struct config_strlist* domain_insecure;
196200
197201 /** the number of seconds maximal TTL used for RRsets and messages */
198202 int max_ttl;
203 /** the number of seconds minimum TTL used for RRsets and messages */
204 int min_ttl;
199205 /** if not 0, this value is the validation date for RRSIGs */
200206 int32_t val_date_override;
207 /** the minimum for signature clock skew */
208 int32_t val_sig_skew_min;
209 /** the maximum for signature clock skew */
210 int32_t val_sig_skew_max;
201211 /** this value sets the number of seconds before revalidating bogus */
202212 int bogus_ttl;
203213 /** should validator clean additional section for secure msgs */
236246 /** certificate file for unbound-control */
237247 char* control_cert_file;
238248
249 /** Python script file */
250 char* python_script;
251
239252 /** daemonize, i.e. fork into the background. */
240253 int do_daemonize;
241254 };
390403 int cfg_parse_memsize(const char* str, size_t* res);
391404
392405 /**
406 * Parse local-zone directive into two strings and register it in the config.
407 * @param cfg: to put it in.
408 * @param val: argument strings to local-zone, "example.com nodefault".
409 * @return: false on failure
410 */
411 int cfg_parse_local_zone(struct config_file* cfg, const char* val);
412
413 /**
393414 * Mark "number" or "low-high" as available or not in ports array.
394415 * @param str: string in input
395416 * @param allow: give true if this range is permitted.
360360 *yy_cp = '\0'; \
361361 (yy_c_buf_p) = yy_cp;
362362
363 #define YY_NUM_RULES 111
364 #define YY_END_OF_BUFFER 112
363 #define YY_NUM_RULES 120
364 #define YY_END_OF_BUFFER 121
365365 /* This struct is not used in this scanner,
366366 but its presence is necessary. */
367367 struct yy_trans_info
369369 flex_int32_t yy_verify;
370370 flex_int32_t yy_nxt;
371371 };
372 static yyconst flex_int16_t yy_accept[1025] =
372 static yyconst flex_int16_t yy_accept[1111] =
373373 { 0,
374 1, 1, 95, 95, 99, 99, 103, 103, 107, 107,
375 112, 110, 1, 93, 94, 2, 98, 110, 110, 110,
376 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
377 110, 110, 110, 110, 110, 110, 111, 95, 96, 111,
378 97, 111, 99, 100, 101, 111, 106, 103, 104, 105,
379 111, 107, 108, 109, 111, 110, 0, 1, 2, 2,
380 2, 2, 110, 110, 110, 110, 110, 110, 110, 110,
381 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
382 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
383 110, 110, 110, 110, 110, 110, 110, 110, 95, 0,
384
385 99, 0, 106, 0, 103, 107, 0, 110, 110, 110,
386 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
387 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
388 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
389 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
390 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
391 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
392 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
393 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
394 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
395
396 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
397 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
398 110, 50, 110, 110, 110, 110, 110, 6, 110, 110,
399 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
400 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
401 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
402 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
403 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
404 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
405 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
406
407 110, 110, 110, 110, 110, 110, 110, 110, 20, 110,
408 110, 110, 110, 12, 13, 110, 15, 14, 110, 110,
409 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
410 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
411 110, 110, 110, 110, 110, 110, 110, 110, 3, 110,
412 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
413 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
414 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
415 110, 110, 110, 110, 110, 102, 110, 110, 110, 110,
416 110, 110, 110, 110, 110, 23, 110, 110, 110, 110,
417
418 110, 110, 110, 24, 110, 110, 110, 110, 110, 110,
419 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
420 110, 110, 110, 110, 110, 110, 110, 110, 63, 110,
421 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
422 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
423 110, 62, 110, 110, 110, 110, 110, 110, 110, 110,
424 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
425 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
426 110, 110, 110, 110, 110, 110, 21, 110, 110, 110,
427 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
428
429 22, 110, 110, 110, 110, 110, 110, 110, 110, 110,
430 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
431 17, 110, 110, 110, 110, 110, 110, 110, 110, 110,
432 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
433 110, 110, 110, 51, 52, 110, 49, 110, 110, 110,
434 110, 110, 110, 110, 110, 110, 110, 110, 5, 110,
435 110, 110, 110, 110, 110, 110, 110, 65, 110, 110,
436 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
437 110, 110, 110, 110, 110, 110, 110, 110, 110, 80,
438 79, 110, 110, 110, 110, 110, 110, 110, 110, 110,
439
440 110, 110, 110, 110, 25, 110, 110, 110, 110, 53,
441 110, 110, 110, 110, 110, 78, 110, 110, 110, 110,
442 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
443 110, 110, 110, 110, 110, 110, 42, 110, 110, 110,
444 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
445 110, 110, 110, 110, 110, 110, 110, 4, 110, 110,
446 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
447 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
448 110, 110, 110, 110, 110, 110, 88, 110, 16, 110,
449 110, 55, 56, 54, 110, 110, 110, 110, 110, 61,
450
451 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
452 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
453 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
454 110, 69, 110, 110, 110, 110, 110, 110, 110, 110,
455 110, 31, 110, 110, 110, 110, 110, 110, 110, 110,
456 110, 110, 110, 110, 60, 110, 110, 110, 110, 110,
457 110, 110, 110, 110, 110, 110, 64, 110, 110, 110,
458 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
459 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
460 71, 110, 110, 110, 110, 59, 110, 86, 110, 110,
461
462 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
463 110, 110, 32, 33, 110, 38, 74, 110, 81, 110,
464 27, 110, 76, 110, 110, 110, 110, 110, 7, 110,
465 48, 85, 110, 110, 110, 110, 110, 110, 110, 110,
466 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
467 66, 110, 110, 110, 110, 110, 110, 110, 110, 110,
468 110, 110, 110, 75, 26, 28, 110, 110, 110, 110,
469 110, 47, 110, 110, 110, 89, 110, 110, 110, 110,
470 110, 110, 45, 110, 110, 110, 110, 110, 110, 91,
471 110, 110, 110, 110, 110, 110, 110, 11, 110, 110,
472
473 110, 110, 110, 110, 10, 110, 110, 29, 110, 90,
474 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
475 92, 87, 110, 110, 110, 110, 110, 110, 110, 110,
476 110, 34, 110, 110, 110, 110, 110, 30, 110, 110,
477 110, 67, 68, 110, 110, 110, 70, 110, 110, 110,
478 110, 110, 110, 110, 110, 110, 110, 110, 110, 18,
479 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
480 110, 84, 110, 110, 110, 110, 110, 110, 19, 110,
481 9, 110, 110, 82, 39, 110, 110, 110, 73, 57,
482 110, 110, 41, 44, 40, 110, 35, 110, 8, 110,
483
484 110, 72, 110, 110, 110, 36, 110, 83, 110, 110,
485 58, 43, 37, 110, 110, 110, 110, 46, 110, 110,
486 110, 110, 77, 0
374 1, 1, 102, 102, 106, 106, 110, 110, 114, 114,
375 1, 1, 121, 118, 1, 100, 100, 119, 118, 118,
376 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
377 118, 118, 118, 118, 118, 118, 118, 118, 119, 102,
378 103, 103, 104, 119, 106, 107, 107, 108, 119, 113,
379 110, 111, 111, 112, 119, 114, 115, 115, 116, 119,
380 117, 101, 117, 105, 117, 119, 118, 0, 1, 0,
381 118, 0, 2, 0, 118, 118, 118, 118, 118, 118,
382 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
383 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
384
385 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
386 118, 102, 0, 106, 0, 113, 0, 110, 114, 0,
387 117, 0, 117, 0, 117, 118, 118, 118, 118, 118,
388 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
389 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
390 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
391 118, 118, 118, 118, 118, 118, 118, 117, 118, 118,
392 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
393 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
394 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
395
396 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
397 118, 118, 118, 118, 118, 118, 118, 118, 117, 118,
398 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
399 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
400 118, 118, 118, 118, 118, 118, 118, 118, 51, 118,
401 118, 118, 118, 118, 6, 118, 118, 118, 118, 118,
402 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
403 118, 118, 118, 118, 118, 118, 118, 117, 118, 118,
404 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
405 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
406
407 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
408 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
409 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
410 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
411 117, 118, 118, 20, 118, 118, 118, 118, 12, 13,
412 118, 15, 14, 118, 118, 118, 118, 118, 118, 118,
413 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
414 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
415 118, 118, 98, 118, 118, 118, 118, 3, 118, 118,
416 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
417
418 118, 118, 118, 118, 118, 118, 118, 118, 117, 118,
419 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
420 118, 118, 118, 118, 118, 118, 118, 118, 109, 118,
421 118, 118, 118, 118, 118, 118, 118, 118, 118, 23,
422 118, 118, 118, 118, 118, 118, 118, 24, 118, 118,
423 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
424 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
425 118, 118, 118, 118, 64, 109, 118, 118, 118, 118,
426 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
427 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
428
429 63, 118, 118, 118, 118, 118, 118, 118, 118, 118,
430 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
431 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
432 118, 118, 118, 118, 118, 118, 118, 21, 118, 118,
433 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
434 118, 118, 118, 22, 118, 118, 118, 118, 118, 118,
435 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
436 118, 118, 118, 118, 17, 118, 118, 118, 118, 118,
437 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
438 118, 118, 118, 118, 118, 118, 118, 118, 118, 52,
439
440 53, 118, 50, 118, 118, 118, 118, 118, 118, 118,
441 118, 118, 118, 118, 118, 5, 118, 118, 118, 118,
442 118, 118, 118, 118, 118, 66, 118, 118, 118, 118,
443 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
444 118, 118, 118, 118, 118, 118, 118, 118, 84, 83,
445 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
446 118, 118, 118, 118, 118, 25, 118, 118, 118, 118,
447 54, 118, 118, 118, 118, 118, 81, 118, 118, 118,
448 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
449 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
450
451 43, 118, 118, 118, 118, 118, 118, 118, 118, 118,
452 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
453 118, 118, 4, 118, 118, 118, 118, 118, 118, 118,
454 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
455 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
456 118, 118, 118, 118, 92, 118, 16, 118, 118, 118,
457 56, 57, 55, 118, 118, 118, 118, 118, 62, 118,
458 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
459 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
460 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
461
462 118, 118, 70, 118, 118, 118, 118, 118, 118, 118,
463 118, 118, 118, 31, 32, 118, 118, 118, 118, 118,
464 118, 118, 118, 118, 118, 118, 118, 118, 61, 118,
465 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
466 118, 65, 118, 118, 118, 118, 118, 118, 118, 118,
467 118, 118, 118, 97, 118, 118, 118, 118, 118, 118,
468 118, 118, 118, 118, 118, 118, 74, 118, 118, 118,
469 118, 118, 60, 118, 90, 118, 118, 118, 118, 118,
470 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
471 33, 34, 118, 39, 77, 118, 85, 82, 118, 27,
472
473 118, 79, 118, 118, 118, 118, 118, 7, 118, 49,
474 89, 118, 118, 118, 118, 118, 118, 118, 118, 118,
475 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
476 118, 67, 118, 118, 99, 118, 118, 118, 118, 118,
477 118, 118, 118, 118, 118, 78, 26, 28, 118, 118,
478 118, 118, 118, 48, 118, 118, 118, 93, 118, 118,
479 118, 118, 118, 118, 46, 118, 118, 118, 118, 118,
480 118, 118, 118, 95, 118, 118, 118, 118, 118, 118,
481 118, 11, 118, 118, 118, 118, 118, 118, 10, 118,
482 118, 29, 118, 94, 118, 118, 118, 118, 118, 118,
483
484 118, 118, 118, 118, 73, 72, 96, 91, 118, 118,
485 118, 118, 118, 118, 118, 118, 118, 35, 118, 118,
486 118, 118, 118, 30, 118, 118, 118, 68, 69, 118,
487 118, 118, 71, 118, 118, 118, 118, 118, 118, 118,
488 118, 118, 118, 118, 118, 18, 118, 118, 118, 118,
489 118, 118, 118, 118, 118, 118, 118, 88, 118, 118,
490 118, 118, 118, 118, 19, 118, 9, 118, 118, 86,
491 40, 118, 118, 118, 76, 58, 118, 118, 42, 45,
492 41, 118, 36, 118, 8, 118, 118, 75, 118, 118,
493 118, 37, 118, 87, 118, 118, 59, 44, 38, 118,
494
495 118, 118, 118, 47, 118, 118, 118, 118, 80, 0
487496 } ;
488497
489498 static yyconst flex_int32_t yy_ec[256] =
520529
521530 static yyconst flex_int32_t yy_meta[66] =
522531 { 0,
523 1, 2, 3, 4, 5, 1, 6, 1, 1, 1,
524 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
532 1, 2, 3, 3, 4, 1, 5, 1, 1, 1,
533 1, 6, 1, 1, 1, 1, 1, 1, 1, 1,
525534 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
526535 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
527536 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
529538 1, 1, 1, 1, 1
530539 } ;
531540
532 static yyconst flex_int16_t yy_base[1036] =
541 static yyconst flex_int16_t yy_base[1125] =
533542 { 0,
534543 0, 0, 63, 66, 69, 71, 77, 83, 88, 91,
535 2242, 2197, 95, 2969, 2969, 102, 2969, 84, 98, 107,
536 76, 90, 111, 117, 108, 125, 109, 126, 154, 80,
537 147, 158, 164, 160, 152, 194, 214, 2168, 2969, 2969,
538 2969, 116, 2161, 2969, 2969, 96, 2135, 2168, 2969, 2969,
539 220, 2126, 2969, 2969, 224, 2069, 235, 170, 0, 239,
540 0, 0, 167, 211, 206, 209, 217, 215, 75, 220,
541 225, 227, 242, 244, 254, 229, 228, 256, 261, 251,
542 255, 270, 266, 269, 287, 276, 290, 285, 292, 281,
543 284, 309, 295, 311, 297, 318, 316, 315, 2046, 226,
544
545 2040, 185, 1936, 356, 1968, 1920, 360, 334, 327, 329,
546 338, 336, 212, 382, 362, 347, 368, 373, 363, 395,
547 361, 387, 381, 384, 397, 406, 394, 420, 421, 424,
548 431, 425, 411, 416, 413, 430, 429, 441, 428, 434,
549 458, 457, 447, 468, 471, 474, 463, 456, 473, 479,
550 470, 477, 485, 498, 487, 493, 507, 513, 497, 518,
551 522, 526, 509, 512, 515, 530, 505, 535, 538, 536,
552 534, 539, 569, 552, 556, 560, 549, 558, 573, 581,
553 568, 585, 570, 579, 583, 593, 596, 594, 589, 599,
554 608, 648, 598, 625, 612, 597, 626, 617, 627, 628,
555
556 633, 658, 652, 654, 655, 676, 649, 669, 678, 657,
557 682, 679, 609, 689, 696, 691, 641, 690, 699, 703,
558 707, 1912, 710, 712, 713, 716, 720, 1836, 722, 731,
559 737, 748, 723, 727, 754, 747, 760, 751, 756, 752,
560 775, 773, 774, 766, 768, 791, 787, 784, 795, 792,
561 808, 797, 801, 807, 812, 820, 821, 831, 829, 830,
562 833, 836, 835, 837, 839, 822, 845, 832, 867, 853,
563 849, 858, 874, 877, 857, 880, 884, 888, 885, 865,
564 881, 893, 894, 897, 907, 920, 932, 909, 915, 918,
565 912, 922, 935, 939, 934, 936, 928, 950, 945, 946,
566
567 943, 947, 949, 960, 973, 970, 980, 985, 1833, 992,
568 971, 987, 975, 1826, 1788, 974, 1750, 1692, 999, 996,
569 1027, 988, 1006, 1000, 994, 1001, 1028, 1017, 1035, 1037,
570 1021, 1030, 1042, 1056, 1047, 1050, 1054, 1067, 1068, 1061,
571 1073, 1077, 1082, 1010, 1083, 1085, 1088, 1090, 1653, 1087,
572 1103, 1100, 1109, 1094, 1116, 1110, 1129, 1127, 1113, 1121,
573 1134, 1117, 1140, 1144, 1135, 1137, 1143, 1142, 1157, 1128,
574 1197, 1151, 1167, 1169, 1164, 1161, 1210, 1178, 1177, 1194,
575 1188, 1190, 1187, 1204, 1207, 1612, 1230, 1229, 1220, 1228,
576 1237, 1234, 1244, 1226, 1238, 1610, 1233, 1253, 1257, 1267,
577
578 1265, 1250, 1271, 1603, 1282, 1266, 1268, 1284, 1285, 1291,
579 1294, 1289, 1299, 1293, 1295, 1298, 1301, 1318, 1309, 1336,
580 1320, 1337, 1321, 1324, 140, 1323, 1330, 1317, 1601, 1344,
581 1347, 1348, 1345, 1346, 1349, 1355, 1352, 1365, 1368, 1373,
582 1369, 1380, 1374, 1375, 1372, 1382, 1394, 1387, 1398, 1399,
583 1397, 1500, 1408, 1415, 1407, 1424, 1432, 1418, 1440, 1436,
584 1433, 1430, 1425, 1445, 1451, 1448, 1457, 1465, 1458, 1467,
585 1459, 1449, 1469, 1472, 1466, 1478, 1487, 1498, 1502, 1503,
586 1492, 1505, 1506, 1504, 1509, 1514, 1475, 1520, 1524, 1527,
587 1517, 1516, 1528, 1525, 1530, 1519, 1555, 1538, 1534, 1542,
588
589 1442, 1567, 1544, 1548, 1553, 1564, 1557, 1565, 1562, 1569,
590 1571, 1583, 1572, 1593, 1589, 1586, 1606, 1613, 1616, 1617,
591 1439, 1609, 1600, 1625, 1622, 1620, 1627, 1605, 1623, 1629,
592 1636, 1643, 1637, 1644, 1634, 1656, 1652, 1646, 1667, 1663,
593 1654, 1676, 1680, 1428, 1421, 1677, 1381, 1675, 1673, 1664,
594 1691, 1682, 1698, 1679, 1707, 1700, 1706, 1693, 1371, 1695,
595 1694, 1709, 1715, 1723, 1734, 1725, 1726, 1367, 1738, 1721,
596 1730, 1733, 1727, 1744, 1757, 1763, 1759, 1748, 1760, 1761,
597 1755, 1770, 1771, 1765, 1774, 1778, 1787, 1791, 1752, 1334,
598 1328, 1795, 1790, 1807, 1797, 1815, 1813, 1805, 1810, 1817,
599
600 1814, 1820, 1844, 1821, 1322, 1824, 1853, 1848, 1855, 1275,
601 1849, 1841, 1842, 1840, 1852, 1264, 1867, 1869, 1872, 1884,
602 1865, 1863, 1881, 1899, 1886, 1885, 1896, 1906, 1900, 1907,
603 1914, 1895, 1917, 1918, 1919, 1921, 1255, 1925, 1910, 1935,
604 1913, 1932, 1939, 1942, 1923, 1933, 1937, 1946, 1945, 1948,
605 1958, 1970, 1959, 1963, 1973, 1965, 1966, 1227, 1994, 1983,
606 1976, 1980, 1997, 2003, 1993, 1992, 2000, 2004, 2001, 2018,
607 2019, 2041, 2021, 2024, 2029, 2030, 2039, 2025, 2038, 2031,
608 2035, 2044, 2048, 2055, 2058, 2052, 1217, 2066, 1203, 2071,
609 2067, 1170, 1160, 1159, 2059, 2073, 2088, 2082, 2092, 1154,
610
611 2075, 2096, 2080, 2094, 2100, 2102, 2093, 2098, 2099, 2111,
612 2116, 2130, 2110, 2127, 2140, 2139, 2141, 2129, 2128, 2153,
613 2145, 2133, 2137, 2158, 2172, 2156, 2164, 2169, 2166, 2171,
614 2183, 1148, 2188, 2175, 2192, 2190, 2195, 2193, 2202, 2213,
615 2205, 1146, 2198, 2223, 2225, 2224, 2230, 2233, 2227, 2219,
616 2222, 2234, 2231, 2245, 1102, 2244, 2246, 2254, 2274, 2256,
617 2276, 2264, 2278, 2279, 2261, 2284, 1070, 2282, 2285, 2270,
618 2290, 2281, 2286, 2293, 2294, 2298, 2305, 2300, 2315, 2302,
619 2317, 2319, 2325, 2312, 2329, 2320, 2327, 2332, 2342, 2339,
620 1065, 2344, 2340, 2347, 2354, 1064, 2353, 1063, 2369, 2368,
621
622 2377, 2374, 2376, 2362, 2363, 2380, 2357, 2381, 2370, 2388,
623 2390, 2392, 1058, 1023, 2401, 1022, 1015, 2411, 977, 2416,
624 972, 2418, 924, 2426, 2422, 2408, 2405, 2425, 908, 2431,
625 876, 869, 2428, 2432, 2435, 2436, 2429, 2419, 2453, 2454,
626 2457, 2450, 2444, 2463, 2421, 2455, 2460, 2471, 2474, 2478,
627 862, 2467, 2482, 2477, 2489, 2490, 2495, 2496, 2491, 2492,
628 2499, 2501, 2504, 847, 828, 824, 2505, 2518, 2527, 2522,
629 2512, 739, 2529, 2517, 2533, 734, 2539, 2528, 2534, 2541,
630 2548, 2551, 726, 2547, 2560, 2564, 2556, 2558, 2572, 693,
631 2574, 2570, 2573, 2575, 2581, 2587, 2585, 685, 2586, 2591,
632
633 2593, 2595, 2599, 2611, 621, 2614, 2606, 616, 2624, 606,
634 2608, 2626, 2622, 2629, 2630, 2618, 2633, 2643, 2640, 2638,
635 600, 542, 2639, 2651, 2645, 2646, 2656, 2648, 2650, 2670,
636 2660, 491, 2678, 2666, 2644, 2686, 2673, 452, 2683, 2687,
637 2669, 444, 414, 2693, 2700, 2695, 404, 2697, 2696, 2703,
638 2712, 2716, 2714, 2726, 2730, 2710, 2719, 2740, 2739, 366,
639 2747, 2728, 2727, 2750, 2751, 2737, 2746, 2752, 2768, 2769,
640 2761, 360, 2765, 2781, 2782, 2784, 2785, 2786, 357, 2788,
641 356, 2787, 2793, 355, 354, 2783, 2794, 2795, 349, 348,
642 2799, 2797, 346, 342, 337, 2802, 304, 2826, 288, 2804,
643
644 2808, 282, 2814, 2806, 2834, 278, 2836, 234, 2825, 2838,
645 193, 174, 127, 2840, 2822, 2843, 2845, 115, 2833, 2841,
646 2857, 2847, 59, 2969, 2915, 2921, 2927, 2933, 88, 2939,
647 2945, 2951, 76, 2956, 2962
544 129, 135, 442, 402, 95, 3209, 3209, 3209, 116, 109,
545 132, 122, 90, 50, 141, 149, 130, 143, 139, 164,
546 177, 125, 193, 209, 196, 185, 180, 232, 257, 379,
547 3209, 3209, 3209, 94, 370, 3209, 3209, 3209, 96, 362,
548 388, 3209, 3209, 3209, 107, 300, 3209, 3209, 3209, 102,
549 279, 3209, 275, 3209, 205, 263, 217, 279, 111, 249,
550 285, 240, 3209, 206, 212, 259, 255, 267, 265, 173,
551 221, 264, 269, 270, 286, 293, 301, 276, 274, 302,
552 312, 311, 306, 317, 310, 315, 326, 322, 332, 327,
553
554 339, 343, 336, 338, 359, 346, 348, 349, 366, 365,
555 363, 169, 192, 166, 140, 165, 410, 199, 128, 195,
556 124, 419, 425, 122, 392, 396, 386, 409, 406, 405,
557 429, 453, 433, 422, 408, 357, 436, 428, 460, 420,
558 439, 423, 449, 458, 482, 456, 452, 476, 468, 486,
559 483, 485, 478, 470, 499, 496, 494, 501, 500, 504,
560 518, 509, 510, 531, 534, 539, 538, 536, 523, 541,
561 545, 526, 551, 561, 563, 558, 555, 573, 579, 568,
562 566, 585, 587, 598, 582, 578, 595, 610, 597, 604,
563 593, 605, 601, 609, 622, 637, 627, 630, 635, 626,
564
565 638, 646, 649, 636, 660, 662, 661, 664, 663, 674,
566 666, 665, 670, 656, 686, 726, 679, 695, 682, 691,
567 699, 696, 690, 719, 706, 730, 750, 724, 709, 738,
568 746, 755, 743, 749, 769, 765, 771, 770, 723, 777,
569 753, 788, 768, 784, 782, 795, 786, 798, 3209, 802,
570 787, 804, 810, 805, 3209, 813, 809, 836, 816, 832,
571 820, 826, 848, 834, 852, 835, 865, 842, 869, 858,
572 859, 861, 868, 872, 878, 883, 888, 885, 882, 893,
573 908, 899, 898, 915, 909, 919, 921, 927, 924, 928,
574 931, 929, 933, 935, 939, 936, 912, 942, 930, 964,
575
576 951, 954, 950, 961, 962, 968, 986, 977, 981, 982,
577 988, 978, 992, 1002, 1011, 990, 1001, 1009, 995, 1030,
578 1004, 1017, 1012, 1014, 1020, 1041, 1039, 1038, 1044, 1034,
579 1033, 1043, 1046, 1058, 1059, 1067, 1057, 1071, 1065, 1068,
580 1076, 1084, 1088, 3209, 1092, 1086, 1085, 1091, 3209, 3209,
581 1083, 3209, 3209, 1098, 1113, 1125, 1149, 1118, 1110, 1105,
582 1122, 1131, 1135, 1124, 1142, 1144, 1152, 1146, 1158, 1133,
583 1173, 1164, 1174, 1176, 1179, 1181, 1166, 1185, 1191, 1192,
584 1200, 1183, 3209, 1194, 1193, 1212, 1219, 3209, 1206, 1224,
585 1204, 1217, 1218, 1229, 1227, 1240, 1233, 1239, 1236, 1238,
586
587 1250, 1246, 1249, 1251, 1259, 1265, 1260, 1281, 1282, 1268,
588 1264, 1270, 1313, 1275, 1278, 1276, 1285, 1287, 1298, 1331,
589 1307, 1292, 1325, 1333, 1315, 1327, 1317, 1335, 3209, 1334,
590 1343, 1328, 1351, 1362, 1360, 1366, 1352, 1361, 1380, 3209,
591 1368, 1376, 1377, 1385, 1388, 1391, 1384, 3209, 1412, 1398,
592 1399, 1400, 1402, 1417, 1418, 1403, 1419, 1411, 1408, 1429,
593 1446, 1433, 1441, 1457, 1458, 1440, 1442, 1443, 1445, 266,
594 1447, 1466, 1461, 1456, 3209, 76, 1463, 1470, 1491, 1471,
595 1482, 1485, 1489, 1486, 1495, 1487, 1497, 1510, 1492, 1498,
596 1516, 1512, 1514, 1521, 1509, 1528, 1525, 1534, 1533, 1536,
597
598 3209, 1537, 1542, 1539, 1557, 1574, 1552, 1572, 1570, 1576,
599 1582, 1561, 1567, 1586, 1591, 1588, 1592, 1608, 1600, 1601,
600 1587, 1607, 1606, 1603, 1618, 1612, 1623, 1629, 1640, 1641,
601 1647, 1634, 1649, 1650, 1644, 1652, 1653, 3209, 1645, 1663,
602 1669, 1661, 1656, 1667, 1666, 1671, 1672, 1680, 1668, 1702,
603 1681, 1679, 1693, 3209, 1714, 1689, 1694, 1717, 1705, 1719,
604 1690, 1710, 1707, 1728, 1736, 1730, 1727, 1731, 1732, 1744,
605 1751, 1752, 1768, 1760, 3209, 1764, 1754, 1780, 1766, 1758,
606 1776, 1772, 1767, 1770, 1771, 1783, 1787, 1784, 1791, 1807,
607 1811, 1799, 1810, 1800, 1821, 1817, 1803, 1828, 1829, 3209,
608
609 3209, 1831, 3209, 1833, 1825, 1816, 1846, 1830, 1853, 1834,
610 1858, 1855, 1860, 1843, 1869, 3209, 1857, 1856, 1868, 1870,
611 1877, 1887, 1873, 1878, 1893, 3209, 1889, 1882, 1905, 1909,
612 1895, 1891, 1918, 1919, 1912, 1922, 1915, 1921, 1932, 1916,
613 1931, 1935, 1936, 1945, 1926, 1940, 1957, 1948, 3209, 3209,
614 1958, 1967, 1951, 1968, 1972, 1990, 1973, 1978, 1974, 1984,
615 1992, 1991, 1988, 1994, 1995, 3209, 2016, 2024, 2017, 2025,
616 3209, 2018, 2012, 2008, 2015, 2014, 3209, 2029, 2042, 2033,
617 2043, 2053, 2040, 2051, 2052, 2056, 2075, 2060, 2059, 2076,
618 2047, 2079, 2081, 2089, 2071, 2074, 2084, 2096, 2097, 2102,
619
620 3209, 2104, 2095, 2111, 2085, 2114, 2121, 2106, 2107, 2108,
621 2116, 2123, 2130, 2138, 2122, 2137, 2151, 2150, 2134, 2152,
622 2141, 2154, 3209, 2157, 2155, 2168, 2165, 2169, 2166, 2171,
623 2185, 2184, 2198, 2181, 2186, 2192, 2209, 2214, 2213, 2208,
624 2225, 2210, 2212, 2199, 2227, 2223, 2232, 2217, 2238, 2242,
625 2240, 2243, 2247, 2249, 3209, 2250, 3209, 2254, 2260, 2252,
626 3209, 3209, 3209, 2236, 2267, 2263, 2269, 2268, 3209, 2272,
627 2282, 2276, 2274, 2288, 2290, 2289, 2287, 2301, 2310, 2303,
628 2299, 2318, 2296, 2315, 2323, 2327, 2331, 2326, 2335, 2342,
629 2338, 2337, 2346, 2340, 2339, 2363, 2352, 2362, 2364, 2365,
630
631 2341, 2370, 3209, 2380, 2368, 2387, 2381, 2389, 2390, 2401,
632 2395, 2397, 2394, 3209, 3209, 2402, 2406, 2414, 2407, 2413,
633 2422, 2416, 2425, 2420, 2429, 2423, 2442, 2434, 3209, 2432,
634 2438, 2447, 2462, 2464, 2467, 2457, 2468, 2472, 2458, 2473,
635 2476, 3209, 2474, 2480, 2469, 2483, 2475, 2486, 2495, 2507,
636 2505, 2490, 2511, 3209, 2512, 2500, 2513, 2504, 2519, 2521,
637 2525, 2518, 2520, 2528, 2522, 2540, 3209, 2534, 2549, 2561,
638 2532, 2564, 3209, 2551, 3209, 2567, 2569, 2566, 2568, 2576,
639 2575, 2557, 2560, 2578, 2586, 2592, 2593, 2603, 2604, 2613,
640 3209, 3209, 2610, 3209, 3209, 2614, 3209, 3209, 2616, 3209,
641
642 2617, 3209, 2622, 2620, 2607, 2602, 2627, 3209, 2626, 3209,
643 3209, 2628, 2643, 2641, 2652, 2644, 2639, 2649, 2650, 2651,
644 2638, 2664, 2660, 2648, 2666, 2654, 2668, 2683, 2675, 2677,
645 2698, 3209, 2681, 2702, 3209, 2691, 2687, 2688, 2695, 2693,
646 2716, 2721, 2708, 2709, 2714, 3209, 3209, 3209, 2717, 2739,
647 2731, 2725, 2727, 3209, 2746, 2730, 2747, 3209, 2750, 2738,
648 2744, 2754, 2757, 2748, 3209, 2755, 2758, 2774, 2773, 2768,
649 2791, 2792, 2793, 3209, 2789, 2784, 2795, 2790, 2800, 2801,
650 2803, 3209, 2786, 2814, 2804, 2815, 2826, 2830, 3209, 2828,
651 2825, 3209, 2840, 3209, 2823, 2844, 2846, 2847, 2848, 2836,
652
653 2842, 2850, 2858, 2855, 3209, 3209, 3209, 3209, 2860, 2870,
654 2861, 2868, 2885, 2869, 2865, 2892, 2873, 3209, 2895, 2876,
655 2899, 2900, 2905, 3209, 2906, 2896, 2909, 3209, 3209, 2897,
656 2912, 2921, 3209, 2932, 2919, 2928, 2944, 2929, 2931, 2939,
657 2946, 2926, 2935, 2949, 2955, 3209, 2963, 2948, 2958, 2967,
658 2969, 2964, 2972, 2966, 2988, 2989, 2973, 3209, 2993, 2997,
659 3001, 3002, 2999, 3003, 3209, 3005, 3209, 3008, 3007, 3209,
660 3209, 3009, 3014, 3013, 3209, 3209, 3022, 3019, 3209, 3209,
661 3209, 3021, 3209, 3033, 3209, 3027, 3028, 3209, 3020, 3051,
662 3052, 3209, 3053, 3209, 3044, 3057, 3209, 3209, 3209, 3055,
663
664 3041, 3062, 3054, 3209, 3060, 3077, 3047, 3067, 3209, 3209,
665 3130, 3136, 3142, 3148, 3154, 82, 3160, 3166, 3172, 3178,
666 3184, 3190, 3196, 3202
648667 } ;
649668
650 static yyconst flex_int16_t yy_def[1036] =
669 static yyconst flex_int16_t yy_def[1125] =
651670 { 0,
652 1024, 1, 1025, 1025, 1026, 1026, 1027, 1027, 1028, 1028,
653 1024, 1029, 1024, 1024, 1024, 1030, 1024, 1029, 1029, 1029,
654 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
655 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1031, 1024, 1024,
656 1024, 1031, 1032, 1024, 1024, 1032, 1033, 1024, 1024, 1024,
657 1033, 1034, 1024, 1024, 1034, 1029, 1029, 1024, 1035, 1030,
658 1035, 1030, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
659 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
660 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
661 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1031, 1031,
662
663 1032, 1032, 1033, 1033, 1024, 1034, 1034, 1029, 1029, 1029,
664 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
665 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
666 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
667 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
668 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
669 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
670 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
671 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
672 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
673
674 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
675 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
676 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
677 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
678 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
679 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
680 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
681 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
682 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
683 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
684
685 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
686 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
687 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
688 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
689 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
690 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
691 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
692 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
693 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
694 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
695
696 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
697 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
698 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
699 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
700 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
701 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
702 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
703 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
704 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
705 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
706
707 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
708 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
709 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
710 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
711 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
712 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
713 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
714 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
715 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
716 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
717
718 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
719 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
720 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
721 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
722 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
723 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
724 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
725 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
726 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
727 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
728
729 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
730 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
731 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
732 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
733 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
734 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
735 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
736 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
737 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
738 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
739
740 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
741 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
742 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
743 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
744 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
745 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
746 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
747 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
748 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
749 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
750
751 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
752 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
753 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
754 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
755 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
756 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
757 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
758 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
759 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
760 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
761
762 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
763 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
764 1029, 1029, 1029, 0, 1024, 1024, 1024, 1024, 1024, 1024,
765 1024, 1024, 1024, 1024, 1024
671 1110, 1, 1111, 1111, 1112, 1112, 1113, 1113, 1114, 1114,
672 1115, 1115, 1110, 1116, 1110, 1110, 1110, 1110, 1117, 1116,
673 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
674 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1118,
675 1110, 1110, 1110, 1118, 1119, 1110, 1110, 1110, 1119, 1120,
676 1110, 1110, 1110, 1110, 1120, 1121, 1110, 1110, 1110, 1121,
677 1122, 1110, 1123, 1110, 1122, 1122, 1116, 1116, 1110, 1124,
678 1117, 1124, 1110, 1117, 1116, 1116, 1116, 1116, 1116, 1116,
679 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
680 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
681
682 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
683 1116, 1118, 1118, 1119, 1119, 1120, 1120, 1110, 1121, 1121,
684 1122, 1122, 1123, 1123, 1122, 1116, 1116, 1116, 1116, 1116,
685 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
686 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
687 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
688 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1122, 1116, 1116,
689 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
690 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
691 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
692
693 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
694 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1122, 1116,
695 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
696 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
697 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116,
698 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116,
699 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
700 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1122, 1116, 1116,
701 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
702 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
703
704 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
705 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
706 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
707 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
708 1122, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1110, 1110,
709 1116, 1110, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
710 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
711 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
712 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1110, 1116, 1116,
713 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
714
715 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1122, 1116,
716 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
717 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116,
718 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110,
719 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116,
720 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
721 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
722 1116, 1116, 1116, 1116, 1110, 1122, 1116, 1116, 1116, 1116,
723 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
724 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
725
726 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
727 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
728 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
729 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116,
730 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
731 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116,
732 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
733 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116,
734 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
735 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110,
736
737 1110, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
738 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116,
739 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116,
740 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
741 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1110,
742 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
743 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116,
744 1110, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116,
745 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
746 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
747
748 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
749 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
750 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
751 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
752 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
753 1116, 1116, 1116, 1116, 1110, 1116, 1110, 1116, 1116, 1116,
754 1110, 1110, 1110, 1116, 1116, 1116, 1116, 1116, 1110, 1116,
755 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
756 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
757 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
758
759 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
760 1116, 1116, 1116, 1110, 1110, 1116, 1116, 1116, 1116, 1116,
761 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116,
762 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
763 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
764 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116,
765 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116,
766 1116, 1116, 1110, 1116, 1110, 1116, 1116, 1116, 1116, 1116,
767 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
768 1110, 1110, 1116, 1110, 1110, 1116, 1110, 1110, 1116, 1110,
769
770 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1110,
771 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
772 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
773 1116, 1110, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116,
774 1116, 1116, 1116, 1116, 1116, 1110, 1110, 1110, 1116, 1116,
775 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1110, 1116, 1116,
776 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116,
777 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116,
778 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116,
779 1116, 1110, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116,
780
781 1116, 1116, 1116, 1116, 1110, 1110, 1110, 1110, 1116, 1116,
782 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116,
783 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1110, 1110, 1116,
784 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
785 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116,
786 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1110, 1116, 1116,
787 1116, 1116, 1116, 1116, 1110, 1116, 1110, 1116, 1116, 1110,
788 1110, 1116, 1116, 1116, 1110, 1110, 1116, 1116, 1110, 1110,
789 1110, 1116, 1110, 1116, 1110, 1116, 1116, 1110, 1116, 1116,
790 1116, 1110, 1116, 1110, 1116, 1116, 1110, 1110, 1110, 1116,
791
792 1116, 1116, 1116, 1110, 1116, 1116, 1116, 1116, 1110, 0,
793 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
794 1110, 1110, 1110, 1110
766795 } ;
767796
768 static yyconst flex_int16_t yy_nxt[3035] =
797 static yyconst flex_int16_t yy_nxt[3275] =
769798 { 0,
770 12, 13, 14, 14, 15, 16, 17, 12, 12, 12,
771 12, 12, 18, 12, 19, 20, 21, 22, 12, 23,
772 24, 25, 26, 27, 28, 29, 30, 31, 12, 32,
773 33, 34, 35, 36, 12, 12, 12, 12, 37, 18,
774 12, 19, 20, 21, 22, 12, 23, 24, 25, 26,
775 27, 28, 29, 30, 31, 12, 32, 33, 34, 35,
776 36, 12, 12, 12, 12, 39, 40, 41, 39, 40,
777 41, 44, 40, 44, 40, 45, 103, 45, 48, 49,
778 49, 50, 114, 40, 48, 49, 49, 50, 56, 40,
779 53, 53, 54, 53, 53, 54, 58, 57, 63, 101,
780
781 59, 42, 101, 61, 42, 61, 61, 46, 61, 46,
782 64, 70, 84, 57, 57, 51, 71, 65, 57, 99,
783 99, 51, 57, 72, 66, 63, 55, 67, 57, 55,
784 68, 73, 74, 69, 76, 78, 57, 64, 70, 84,
785 62, 77, 75, 71, 65, 57, 57, 57, 490, 57,
786 72, 66, 79, 57, 67, 57, 80, 68, 73, 74,
787 69, 76, 78, 57, 57, 57, 81, 85, 77, 75,
788 82, 58, 93, 86, 88, 59, 87, 95, 57, 79,
789 91, 108, 96, 80, 89, 57, 83, 90, 101, 94,
790 57, 101, 57, 81, 85, 92, 57, 82, 57, 93,
791
792 86, 88, 57, 87, 95, 57, 97, 91, 108, 96,
793 98, 89, 57, 83, 90, 56, 94, 56, 56, 153,
794 56, 103, 92, 103, 103, 109, 103, 106, 106, 99,
795 99, 57, 57, 97, 111, 110, 56, 98, 56, 56,
796 61, 56, 61, 61, 57, 61, 112, 57, 113, 57,
797 57, 115, 109, 57, 116, 57, 117, 118, 57, 123,
798 119, 111, 110, 57, 124, 57, 57, 57, 120, 128,
799 125, 121, 57, 112, 126, 113, 127, 62, 115, 129,
800 57, 116, 57, 117, 118, 122, 123, 119, 130, 57,
801 131, 124, 57, 57, 57, 120, 128, 125, 121, 57,
802
803 132, 126, 133, 127, 57, 134, 129, 57, 57, 136,
804 135, 138, 122, 139, 57, 130, 57, 131, 137, 57,
805 57, 140, 57, 57, 142, 57, 57, 132, 57, 133,
806 57, 144, 134, 57, 145, 57, 136, 135, 138, 146,
807 139, 141, 57, 143, 147, 137, 149, 57, 140, 57,
808 148, 142, 152, 57, 57, 150, 57, 103, 144, 103,
809 103, 145, 103, 106, 106, 57, 146, 57, 141, 151,
810 143, 147, 57, 149, 57, 57, 57, 148, 159, 152,
811 57, 160, 150, 161, 57, 57, 57, 57, 163, 162,
812 166, 169, 57, 57, 57, 57, 151, 154, 57, 57,
813
814 57, 57, 155, 167, 57, 159, 57, 156, 160, 170,
815 161, 57, 168, 157, 158, 163, 162, 166, 164, 57,
816 57, 165, 57, 171, 154, 57, 172, 173, 178, 155,
817 167, 175, 57, 57, 156, 57, 170, 174, 176, 168,
818 157, 158, 57, 177, 57, 164, 180, 179, 165, 57,
819 171, 57, 57, 172, 57, 178, 181, 183, 57, 57,
820 182, 184, 57, 57, 174, 185, 57, 57, 57, 57,
821 177, 186, 57, 180, 179, 187, 193, 188, 190, 57,
822 189, 192, 57, 181, 183, 57, 195, 182, 184, 196,
823 57, 199, 185, 194, 57, 57, 57, 200, 186, 198,
824
825 191, 57, 187, 193, 188, 197, 57, 189, 57, 57,
826 201, 57, 57, 195, 202, 57, 196, 57, 199, 203,
827 194, 204, 206, 57, 200, 57, 198, 191, 205, 57,
828 207, 57, 197, 209, 214, 57, 57, 201, 208, 212,
829 210, 202, 213, 57, 211, 57, 203, 57, 204, 206,
830 57, 57, 216, 57, 218, 205, 57, 207, 215, 217,
831 57, 214, 219, 222, 57, 208, 212, 210, 57, 213,
832 223, 211, 57, 57, 57, 226, 57, 57, 227, 216,
833 57, 218, 220, 221, 228, 215, 217, 57, 224, 219,
834 57, 225, 231, 229, 57, 233, 57, 223, 57, 230,
835
836 235, 232, 226, 234, 250, 227, 57, 57, 57, 220,
837 221, 57, 236, 239, 238, 224, 269, 57, 225, 57,
838 229, 57, 233, 57, 247, 237, 230, 57, 232, 240,
839 234, 57, 57, 241, 57, 57, 57, 57, 57, 236,
840 239, 238, 249, 252, 57, 248, 57, 57, 273, 255,
841 57, 247, 237, 254, 57, 57, 240, 251, 253, 57,
842 241, 242, 243, 57, 57, 57, 57, 256, 257, 249,
843 252, 57, 248, 244, 245, 246, 255, 266, 262, 57,
844 254, 259, 260, 258, 251, 253, 57, 57, 242, 243,
845 57, 261, 57, 57, 263, 57, 57, 267, 264, 268,
846
847 244, 245, 246, 272, 266, 262, 270, 57, 259, 260,
848 258, 265, 271, 274, 57, 275, 57, 57, 261, 277,
849 57, 263, 278, 57, 267, 264, 268, 57, 57, 57,
850 272, 57, 280, 270, 57, 276, 281, 57, 265, 271,
851 274, 57, 275, 282, 279, 57, 277, 284, 57, 278,
852 57, 57, 287, 283, 57, 286, 285, 288, 57, 280,
853 57, 57, 276, 281, 57, 57, 289, 294, 297, 57,
854 282, 279, 57, 290, 284, 57, 295, 57, 293, 287,
855 283, 291, 296, 285, 288, 57, 57, 299, 298, 57,
856 57, 292, 57, 289, 57, 297, 302, 301, 57, 300,
857
858 290, 303, 307, 295, 57, 293, 57, 304, 291, 296,
859 306, 57, 57, 57, 299, 298, 308, 305, 292, 309,
860 310, 312, 57, 302, 301, 57, 300, 311, 303, 57,
861 57, 314, 315, 57, 304, 57, 313, 306, 316, 57,
862 317, 318, 321, 308, 305, 57, 57, 310, 312, 319,
863 57, 320, 322, 324, 311, 323, 331, 326, 57, 57,
864 57, 325, 57, 313, 336, 330, 57, 57, 57, 57,
865 57, 57, 332, 57, 57, 57, 319, 57, 320, 322,
866 324, 327, 323, 57, 326, 57, 328, 57, 325, 333,
867 329, 57, 330, 335, 341, 57, 57, 337, 338, 332,
868
869 57, 340, 339, 57, 345, 57, 342, 57, 327, 343,
870 344, 334, 57, 328, 57, 57, 333, 329, 57, 57,
871 335, 341, 57, 57, 337, 338, 57, 346, 340, 339,
872 351, 57, 57, 342, 347, 57, 343, 344, 334, 348,
873 350, 353, 355, 349, 352, 57, 57, 57, 354, 357,
874 57, 356, 358, 57, 346, 359, 57, 351, 57, 363,
875 57, 347, 57, 364, 362, 365, 57, 350, 353, 361,
876 57, 352, 57, 57, 57, 354, 357, 57, 356, 358,
877 360, 57, 359, 57, 57, 57, 363, 57, 57, 366,
878 364, 362, 365, 367, 369, 368, 361, 370, 57, 371,
879
880 372, 374, 375, 377, 383, 386, 373, 360, 57, 57,
881 57, 57, 57, 57, 376, 57, 366, 405, 57, 387,
882 367, 369, 368, 57, 370, 57, 57, 372, 374, 375,
883 57, 383, 57, 373, 57, 384, 385, 57, 57, 57,
884 388, 376, 378, 389, 57, 379, 387, 390, 57, 393,
885 380, 391, 392, 57, 394, 57, 381, 382, 396, 57,
886 57, 57, 384, 385, 397, 57, 57, 388, 57, 378,
887 389, 398, 379, 57, 390, 57, 393, 380, 391, 392,
888 57, 394, 395, 381, 382, 57, 399, 400, 57, 402,
889 401, 397, 57, 404, 57, 403, 57, 406, 398, 57,
890
891 408, 57, 57, 57, 409, 57, 57, 411, 57, 395,
892 407, 57, 410, 399, 400, 57, 402, 401, 412, 415,
893 57, 57, 403, 57, 406, 57, 57, 408, 57, 414,
894 413, 409, 57, 416, 411, 417, 418, 407, 57, 410,
895 57, 57, 419, 420, 421, 412, 415, 57, 57, 423,
896 422, 57, 424, 429, 57, 57, 414, 413, 425, 57,
897 416, 427, 417, 431, 426, 57, 57, 57, 441, 419,
898 420, 421, 57, 57, 428, 57, 423, 422, 57, 424,
899 57, 57, 57, 430, 57, 425, 57, 437, 427, 57,
900 431, 426, 57, 438, 439, 57, 440, 57, 57, 57,
901
902 446, 428, 57, 445, 448, 57, 447, 57, 57, 449,
903 430, 432, 450, 433, 437, 57, 57, 434, 452, 435,
904 438, 439, 442, 440, 436, 57, 57, 446, 57, 443,
905 445, 448, 57, 447, 451, 57, 449, 453, 432, 450,
906 433, 57, 57, 454, 434, 57, 435, 444, 57, 442,
907 455, 436, 456, 457, 458, 57, 443, 460, 57, 462,
908 459, 451, 467, 461, 57, 57, 57, 57, 57, 463,
909 454, 57, 57, 464, 444, 57, 57, 455, 468, 456,
910 457, 458, 57, 465, 460, 466, 462, 459, 57, 467,
911 461, 57, 471, 57, 469, 57, 463, 470, 473, 472,
912
913 464, 474, 57, 57, 57, 57, 57, 475, 476, 57,
914 465, 480, 466, 57, 481, 482, 484, 479, 477, 471,
915 57, 469, 57, 57, 470, 473, 472, 57, 474, 57,
916 478, 57, 57, 57, 475, 476, 57, 57, 480, 57,
917 483, 481, 482, 485, 479, 477, 486, 57, 487, 489,
918 492, 488, 491, 493, 495, 57, 57, 478, 57, 57,
919 57, 57, 57, 501, 496, 499, 57, 483, 57, 494,
920 497, 498, 57, 486, 57, 57, 489, 492, 488, 491,
921 493, 500, 57, 57, 57, 57, 57, 57, 503, 504,
922 57, 496, 499, 57, 502, 506, 494, 497, 498, 505,
923
924 507, 508, 509, 57, 512, 57, 57, 57, 500, 57,
925 57, 57, 57, 57, 510, 503, 504, 515, 57, 57,
926 57, 502, 506, 511, 513, 57, 505, 507, 508, 509,
927 514, 512, 57, 516, 517, 57, 57, 57, 518, 520,
928 519, 510, 522, 521, 515, 57, 57, 523, 524, 525,
929 511, 513, 528, 57, 527, 526, 57, 514, 529, 57,
930 516, 517, 57, 57, 530, 518, 57, 519, 57, 522,
931 57, 57, 531, 536, 57, 524, 525, 57, 57, 539,
932 57, 527, 526, 57, 538, 532, 57, 57, 540, 57,
933 533, 530, 534, 537, 535, 57, 57, 57, 544, 531,
934
935 536, 541, 542, 57, 57, 57, 539, 57, 543, 545,
936 57, 538, 532, 57, 547, 540, 57, 533, 546, 534,
937 537, 535, 550, 548, 549, 57, 552, 554, 541, 542,
938 57, 555, 553, 551, 556, 543, 57, 557, 57, 559,
939 57, 57, 57, 57, 57, 546, 558, 57, 562, 550,
940 548, 549, 57, 552, 57, 57, 560, 57, 57, 553,
941 551, 561, 57, 57, 557, 57, 57, 563, 57, 564,
942 565, 566, 57, 558, 567, 562, 57, 570, 568, 572,
943 57, 569, 57, 560, 571, 576, 57, 573, 561, 577,
944 574, 57, 575, 57, 563, 57, 564, 565, 566, 578,
945
946 57, 579, 57, 57, 570, 57, 572, 57, 569, 57,
947 57, 571, 576, 580, 573, 581, 577, 574, 582, 575,
948 584, 57, 583, 585, 57, 587, 578, 57, 579, 586,
949 588, 57, 589, 591, 593, 594, 590, 592, 57, 57,
950 580, 57, 581, 57, 57, 582, 601, 57, 57, 583,
951 57, 57, 587, 595, 57, 57, 586, 588, 57, 596,
952 57, 57, 594, 57, 592, 57, 597, 57, 598, 599,
953 600, 602, 57, 601, 57, 57, 603, 604, 605, 606,
954 595, 57, 57, 608, 57, 607, 596, 609, 610, 611,
955 57, 57, 57, 597, 57, 598, 599, 600, 602, 612,
956
957 613, 57, 57, 603, 604, 57, 606, 614, 615, 616,
958 617, 57, 607, 57, 57, 57, 611, 57, 57, 618,
959 57, 620, 619, 621, 622, 623, 612, 613, 625, 57,
960 57, 57, 57, 57, 614, 615, 57, 617, 57, 626,
961 624, 627, 632, 629, 57, 57, 618, 57, 620, 619,
962 621, 622, 623, 57, 630, 625, 628, 631, 634, 57,
963 635, 57, 633, 57, 57, 57, 626, 624, 57, 632,
964 629, 57, 57, 636, 637, 638, 57, 639, 644, 651,
965 642, 630, 57, 628, 631, 634, 57, 635, 57, 633,
966 57, 640, 641, 57, 643, 57, 645, 57, 57, 57,
967
968 636, 57, 638, 57, 639, 646, 651, 642, 57, 57,
969 647, 649, 57, 648, 650, 652, 57, 656, 640, 641,
970 653, 643, 657, 645, 658, 57, 57, 654, 57, 57,
971 655, 666, 646, 57, 660, 57, 659, 647, 649, 662,
972 648, 650, 652, 57, 656, 57, 661, 653, 57, 663,
973 665, 57, 57, 57, 654, 57, 664, 655, 57, 57,
974 667, 660, 57, 659, 57, 668, 662, 674, 671, 669,
975 672, 57, 673, 661, 57, 670, 663, 665, 57, 57,
976 57, 675, 57, 664, 677, 680, 57, 57, 678, 681,
977 57, 57, 668, 57, 674, 671, 669, 672, 676, 673,
978
979 679, 57, 670, 57, 682, 57, 683, 57, 675, 684,
980 57, 677, 680, 686, 685, 678, 681, 687, 689, 57,
981 688, 690, 57, 57, 57, 676, 691, 679, 692, 693,
982 694, 682, 696, 57, 57, 695, 684, 57, 57, 697,
983 686, 685, 698, 700, 57, 57, 701, 688, 57, 699,
984 57, 57, 57, 691, 705, 57, 57, 57, 107, 57,
985 710, 57, 695, 57, 706, 702, 697, 703, 707, 105,
986 57, 57, 704, 57, 104, 57, 699, 57, 708, 713,
987 57, 705, 709, 57, 57, 715, 57, 710, 712, 711,
988 719, 706, 702, 717, 703, 707, 57, 57, 721, 704,
989
990 714, 57, 716, 57, 57, 708, 713, 720, 57, 709,
991 718, 57, 715, 722, 57, 712, 711, 726, 57, 724,
992 717, 57, 725, 723, 727, 721, 730, 714, 733, 716,
993 57, 57, 57, 728, 720, 57, 735, 718, 57, 57,
994 722, 57, 57, 729, 726, 739, 724, 734, 731, 725,
995 723, 727, 732, 736, 737, 742, 57, 57, 741, 57,
996 728, 738, 57, 57, 740, 743, 751, 57, 57, 57,
997 729, 744, 746, 57, 734, 745, 57, 57, 102, 57,
998 736, 737, 57, 748, 100, 741, 57, 750, 738, 747,
999 57, 740, 743, 57, 749, 754, 57, 57, 744, 746,
1000
1001 753, 752, 745, 755, 57, 57, 756, 57, 757, 57,
1002 748, 57, 758, 57, 750, 764, 747, 759, 57, 762,
1003 57, 749, 754, 760, 765, 761, 57, 753, 752, 763,
1004 57, 57, 57, 756, 57, 757, 57, 57, 57, 758,
1005 57, 767, 764, 769, 759, 766, 762, 768, 57, 57,
1006 760, 765, 761, 770, 57, 771, 763, 772, 773, 774,
1007 775, 776, 778, 777, 107, 57, 57, 57, 57, 105,
1008 769, 57, 766, 104, 768, 57, 782, 57, 57, 57,
1009 770, 779, 771, 57, 772, 773, 774, 783, 776, 778,
1010 777, 57, 780, 784, 57, 781, 57, 785, 786, 102,
1011
1012 787, 791, 57, 782, 57, 788, 100, 57, 779, 57,
1013 57, 789, 790, 57, 783, 792, 796, 794, 797, 780,
1014 784, 57, 781, 793, 785, 786, 57, 787, 57, 795,
1015 57, 57, 788, 57, 798, 57, 57, 799, 789, 790,
1016 57, 1024, 792, 57, 794, 797, 801, 800, 802, 804,
1017 793, 57, 805, 803, 807, 1024, 795, 57, 809, 1024,
1018 57, 57, 57, 57, 799, 57, 806, 813, 57, 57,
1019 810, 57, 57, 801, 800, 802, 804, 808, 811, 805,
1020 803, 807, 57, 57, 57, 809, 812, 814, 815, 816,
1021 817, 818, 57, 806, 57, 819, 821, 810, 820, 57,
1022
1023 822, 823, 57, 825, 808, 811, 827, 826, 57, 829,
1024 824, 831, 57, 812, 57, 815, 57, 57, 818, 57,
1025 57, 828, 57, 57, 57, 820, 832, 822, 57, 834,
1026 825, 57, 57, 827, 826, 830, 57, 824, 57, 833,
1027 57, 836, 835, 57, 837, 838, 839, 840, 828, 842,
1028 57, 1024, 841, 57, 843, 57, 834, 57, 57, 846,
1029 845, 847, 830, 57, 857, 57, 833, 57, 836, 835,
1030 57, 837, 838, 839, 840, 844, 848, 57, 57, 841,
1031 57, 843, 57, 849, 850, 57, 846, 845, 851, 852,
1032 853, 57, 57, 854, 855, 57, 856, 859, 858, 1024,
1033
1034 57, 57, 844, 848, 860, 862, 57, 57, 57, 861,
1035 849, 850, 57, 863, 57, 57, 852, 853, 57, 57,
1036 854, 855, 864, 856, 859, 858, 57, 865, 57, 866,
1037 57, 860, 862, 867, 868, 869, 861, 1024, 870, 57,
1038 863, 871, 872, 57, 873, 874, 57, 876, 878, 57,
1039 1024, 875, 877, 1024, 57, 883, 57, 57, 885, 57,
1040 57, 868, 869, 57, 57, 870, 57, 57, 871, 57,
1041 57, 873, 874, 57, 57, 878, 879, 880, 875, 877,
1042 881, 882, 57, 884, 887, 885, 886, 888, 57, 890,
1043 889, 57, 57, 57, 892, 57, 891, 893, 57, 899,
1044
1045 1024, 57, 898, 879, 880, 57, 1024, 881, 882, 57,
1046 884, 887, 57, 886, 888, 57, 57, 889, 894, 895,
1047 57, 892, 896, 891, 893, 900, 897, 57, 57, 57,
1048 57, 901, 904, 57, 57, 902, 903, 57, 905, 57,
1049 908, 907, 57, 57, 910, 894, 895, 909, 906, 896,
1050 57, 911, 900, 897, 913, 57, 57, 914, 901, 904,
1051 57, 912, 902, 903, 915, 57, 57, 57, 907, 921,
1052 916, 57, 57, 917, 909, 906, 918, 57, 911, 57,
1053 919, 913, 920, 922, 914, 57, 57, 925, 912, 57,
1054 923, 915, 1024, 924, 57, 926, 57, 916, 57, 928,
1055
1056 917, 927, 57, 918, 932, 929, 1024, 919, 57, 920,
1057 57, 57, 57, 57, 925, 933, 930, 923, 934, 57,
1058 924, 931, 926, 57, 57, 57, 928, 935, 927, 57,
1059 937, 57, 929, 57, 936, 938, 941, 57, 940, 939,
1060 942, 943, 933, 930, 57, 934, 57, 944, 931, 57,
1061 946, 947, 57, 948, 935, 960, 57, 937, 945, 1024,
1062 57, 936, 57, 941, 57, 940, 939, 57, 57, 949,
1063 950, 57, 953, 952, 944, 951, 57, 57, 57, 954,
1064 948, 57, 57, 57, 57, 945, 57, 955, 57, 57,
1065 956, 957, 958, 962, 57, 959, 949, 950, 57, 953,
1066
1067 952, 961, 951, 963, 57, 965, 954, 57, 57, 966,
1068 964, 57, 967, 969, 955, 968, 57, 956, 957, 958,
1069 962, 57, 959, 972, 57, 57, 970, 1024, 961, 971,
1070 963, 57, 965, 57, 57, 57, 966, 964, 57, 967,
1071 969, 57, 968, 973, 974, 975, 976, 977, 57, 978,
1072 57, 979, 57, 970, 57, 980, 971, 57, 981, 982,
1073 983, 984, 985, 1024, 57, 57, 57, 986, 57, 987,
1074 973, 974, 975, 976, 977, 57, 978, 57, 57, 989,
1075 990, 992, 980, 988, 57, 57, 982, 983, 57, 57,
1076 57, 991, 993, 994, 986, 995, 987, 997, 999, 57,
1077
1078 998, 996, 1001, 57, 1024, 1002, 57, 57, 992, 1000,
1079 988, 1003, 1005, 1006, 1024, 1008, 1024, 1011, 991, 57,
1080 57, 57, 57, 57, 57, 57, 57, 998, 996, 1001,
1081 1004, 57, 57, 57, 1009, 57, 1000, 57, 1003, 1005,
1082 57, 1007, 57, 1010, 57, 1012, 57, 1013, 1014, 1024,
1083 1015, 1024, 57, 1017, 1018, 1016, 1024, 1004, 1023, 1020,
1084 57, 1009, 1024, 57, 57, 1019, 1021, 1024, 1007, 1024,
1085 1010, 57, 57, 1024, 57, 1014, 57, 1015, 57, 57,
1086 1017, 57, 1016, 57, 1024, 57, 1020, 1022, 1024, 1024,
1087 1024, 1024, 1019, 1021, 1024, 57, 1024, 1024, 1024, 1024,
1088
1089 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1090 1024, 1024, 1024, 1024, 1022, 38, 38, 38, 38, 38,
1091 38, 43, 43, 43, 43, 43, 43, 47, 47, 47,
1092 47, 47, 47, 52, 52, 52, 52, 52, 52, 60,
1093 60, 1024, 60, 60, 60, 99, 99, 1024, 1024, 1024,
1094 99, 101, 101, 1024, 1024, 101, 106, 106, 1024, 1024,
1095 1024, 106, 61, 61, 1024, 61, 61, 61, 11, 1024,
1096 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1097 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1098 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1099
1100 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1101 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1102 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1103 1024, 1024, 1024, 1024
799 14, 15, 16, 17, 18, 19, 18, 14, 14, 14,
800 14, 18, 20, 14, 21, 22, 23, 24, 14, 25,
801 26, 27, 28, 29, 30, 31, 32, 33, 14, 34,
802 35, 36, 37, 38, 14, 14, 14, 14, 39, 20,
803 14, 21, 22, 23, 24, 14, 25, 26, 27, 28,
804 29, 30, 31, 32, 33, 14, 34, 35, 36, 37,
805 38, 14, 14, 14, 14, 41, 42, 43, 41, 42,
806 43, 46, 47, 46, 47, 48, 83, 48, 51, 52,
807 53, 54, 67, 18, 51, 52, 53, 54, 68, 18,
808 57, 58, 59, 57, 58, 59, 69, 112, 112, 114,
809
810 70, 44, 114, 83, 44, 119, 119, 49, 116, 49,
811 116, 116, 69, 116, 122, 55, 70, 72, 73, 72,
812 72, 55, 72, 75, 73, 82, 60, 72, 68, 60,
813 15, 16, 17, 62, 63, 64, 15, 16, 17, 62,
814 63, 64, 79, 114, 76, 80, 114, 68, 81, 65,
815 75, 77, 82, 84, 74, 65, 88, 96, 78, 89,
816 68, 85, 122, 68, 86, 90, 120, 66, 68, 79,
817 68, 76, 80, 66, 87, 81, 65, 68, 77, 68,
818 84, 68, 65, 88, 96, 78, 89, 68, 85, 93,
819 91, 86, 90, 94, 92, 112, 112, 106, 119, 119,
820
821 118, 87, 68, 117, 115, 108, 131, 113, 73, 95,
822 109, 68, 104, 97, 107, 68, 93, 91, 68, 98,
823 94, 92, 99, 68, 106, 101, 126, 105, 132, 100,
824 125, 68, 108, 131, 68, 102, 95, 109, 103, 104,
825 97, 107, 73, 122, 110, 133, 98, 68, 111, 99,
826 68, 73, 101, 126, 105, 68, 100, 125, 67, 68,
827 67, 67, 102, 67, 121, 103, 121, 121, 67, 121,
828 68, 110, 133, 127, 541, 111, 72, 73, 72, 72,
829 67, 72, 67, 67, 128, 67, 72, 73, 72, 72,
830 67, 72, 129, 68, 130, 134, 72, 68, 135, 136,
831
832 127, 137, 68, 68, 68, 68, 142, 68, 68, 138,
833 143, 128, 68, 124, 68, 139, 144, 122, 140, 129,
834 145, 130, 134, 74, 68, 135, 136, 146, 137, 147,
835 148, 68, 141, 142, 150, 149, 138, 143, 120, 68,
836 68, 152, 139, 144, 68, 140, 151, 145, 68, 68,
837 68, 153, 154, 68, 146, 68, 147, 148, 155, 141,
838 68, 150, 149, 156, 68, 68, 158, 159, 152, 157,
839 68, 160, 183, 151, 68, 162, 68, 68, 153, 154,
840 163, 68, 165, 164, 68, 155, 68, 68, 166, 118,
841 156, 161, 167, 158, 159, 68, 157, 68, 160, 183,
842
843 117, 68, 162, 68, 68, 170, 168, 163, 115, 165,
844 164, 116, 169, 116, 116, 166, 116, 113, 161, 167,
845 121, 173, 121, 121, 68, 121, 72, 73, 72, 72,
846 122, 72, 170, 168, 68, 171, 174, 172, 181, 169,
847 68, 1110, 182, 68, 68, 180, 68, 68, 173, 188,
848 1110, 1110, 184, 185, 190, 189, 191, 1110, 68, 196,
849 68, 68, 171, 124, 172, 181, 68, 68, 175, 182,
850 192, 68, 180, 176, 68, 198, 188, 68, 177, 184,
851 185, 190, 189, 186, 178, 179, 187, 68, 195, 193,
852 68, 68, 197, 199, 68, 175, 68, 192, 68, 194,
853
854 176, 200, 201, 203, 1110, 177, 68, 1110, 68, 202,
855 186, 178, 179, 187, 68, 195, 68, 207, 204, 197,
856 68, 68, 205, 68, 68, 206, 194, 211, 200, 201,
857 203, 210, 68, 208, 68, 209, 202, 68, 68, 68,
858 212, 214, 68, 213, 207, 204, 216, 68, 68, 205,
859 1110, 217, 206, 220, 211, 223, 68, 221, 210, 219,
860 208, 68, 209, 215, 68, 224, 1110, 212, 218, 68,
861 213, 222, 68, 225, 122, 226, 68, 68, 217, 68,
862 220, 228, 223, 68, 221, 227, 219, 229, 231, 68,
863 215, 232, 224, 68, 230, 218, 68, 233, 222, 68,
864
865 225, 68, 226, 234, 68, 235, 68, 242, 228, 1110,
866 237, 68, 227, 236, 229, 231, 68, 68, 232, 238,
867 68, 230, 239, 68, 233, 68, 240, 241, 243, 245,
868 234, 68, 244, 68, 242, 68, 68, 237, 249, 68,
869 236, 1110, 68, 68, 250, 246, 238, 68, 68, 239,
870 247, 248, 253, 240, 241, 243, 245, 255, 254, 244,
871 68, 256, 257, 251, 68, 68, 252, 1110, 68, 259,
872 267, 250, 246, 68, 68, 68, 68, 247, 248, 253,
873 261, 263, 264, 262, 68, 254, 268, 68, 256, 257,
874 251, 258, 260, 252, 68, 266, 265, 267, 68, 68,
875
876 68, 68, 68, 68, 68, 276, 280, 261, 68, 264,
877 262, 269, 68, 268, 278, 277, 282, 68, 258, 260,
878 122, 279, 266, 265, 68, 1110, 1110, 281, 68, 68,
879 300, 284, 276, 68, 68, 1110, 289, 68, 269, 270,
880 271, 278, 277, 282, 68, 1110, 285, 68, 279, 1110,
881 283, 272, 273, 274, 281, 288, 275, 68, 284, 286,
882 287, 68, 68, 289, 68, 290, 270, 271, 68, 302,
883 292, 291, 293, 285, 294, 304, 68, 283, 272, 273,
884 274, 68, 288, 275, 68, 297, 298, 68, 68, 295,
885 299, 68, 290, 68, 301, 1110, 302, 292, 291, 293,
886
887 303, 294, 296, 68, 305, 306, 68, 68, 68, 68,
888 309, 307, 297, 298, 310, 68, 295, 299, 308, 311,
889 68, 301, 68, 312, 68, 68, 68, 303, 314, 296,
890 313, 305, 306, 68, 316, 318, 68, 309, 307, 319,
891 68, 310, 68, 68, 315, 308, 311, 68, 68, 320,
892 312, 68, 317, 1110, 68, 314, 321, 313, 68, 327,
893 322, 316, 318, 1110, 68, 326, 329, 323, 328, 1110,
894 68, 315, 68, 68, 68, 324, 320, 330, 331, 317,
895 68, 332, 334, 321, 333, 325, 68, 322, 337, 342,
896 68, 335, 326, 329, 323, 328, 68, 68, 338, 68,
897
898 341, 336, 324, 68, 330, 331, 68, 68, 332, 334,
899 68, 333, 325, 339, 340, 337, 68, 343, 335, 344,
900 68, 68, 345, 122, 346, 338, 68, 341, 336, 347,
901 349, 68, 350, 348, 351, 352, 68, 68, 354, 353,
902 339, 340, 357, 360, 343, 355, 68, 68, 356, 345,
903 68, 346, 359, 68, 358, 362, 347, 68, 361, 68,
904 348, 367, 68, 366, 368, 68, 68, 68, 68, 68,
905 360, 68, 355, 68, 68, 356, 369, 68, 363, 359,
906 68, 358, 362, 364, 372, 361, 371, 365, 68, 68,
907 366, 368, 68, 373, 374, 375, 376, 382, 370, 68,
908
909 68, 383, 68, 369, 377, 363, 68, 378, 384, 386,
910 364, 372, 1110, 371, 365, 68, 68, 379, 380, 68,
911 68, 374, 375, 376, 68, 370, 68, 381, 68, 385,
912 68, 377, 390, 68, 378, 389, 386, 387, 391, 68,
913 68, 388, 68, 392, 379, 380, 393, 68, 394, 68,
914 68, 395, 68, 396, 381, 68, 385, 1110, 68, 390,
915 397, 398, 389, 399, 401, 391, 1110, 400, 68, 1110,
916 392, 68, 68, 393, 402, 403, 68, 68, 395, 68,
917 396, 68, 68, 404, 68, 407, 405, 397, 398, 406,
918 399, 401, 409, 408, 400, 68, 68, 68, 410, 413,
919
920 411, 402, 403, 68, 415, 68, 68, 1110, 412, 68,
921 404, 417, 407, 405, 122, 414, 406, 416, 418, 409,
922 408, 68, 68, 68, 68, 410, 68, 411, 419, 68,
923 68, 415, 420, 429, 426, 412, 68, 1110, 417, 427,
924 1110, 428, 414, 68, 416, 418, 1110, 431, 68, 430,
925 432, 68, 1110, 1110, 433, 419, 68, 1110, 434, 438,
926 68, 426, 68, 68, 421, 436, 427, 422, 428, 68,
927 437, 68, 423, 68, 431, 440, 430, 432, 424, 425,
928 68, 433, 68, 435, 68, 434, 438, 68, 441, 439,
929 68, 421, 436, 442, 422, 445, 68, 437, 443, 423,
930
931 444, 446, 68, 448, 68, 424, 425, 449, 451, 447,
932 435, 68, 68, 450, 68, 441, 439, 68, 452, 68,
933 442, 68, 445, 68, 453, 443, 456, 444, 446, 68,
934 68, 68, 68, 454, 458, 451, 447, 459, 68, 457,
935 450, 455, 68, 460, 68, 452, 461, 463, 464, 1110,
936 68, 453, 462, 456, 467, 68, 68, 68, 469, 466,
937 454, 458, 68, 470, 459, 68, 457, 68, 455, 465,
938 460, 68, 473, 461, 68, 464, 68, 68, 68, 462,
939 471, 467, 468, 472, 68, 469, 466, 68, 68, 68,
940 470, 474, 475, 476, 477, 479, 465, 68, 68, 478,
941
942 1110, 487, 68, 68, 486, 490, 68, 471, 68, 468,
943 472, 485, 489, 68, 68, 495, 68, 488, 474, 68,
944 122, 477, 479, 68, 1110, 68, 478, 480, 487, 481,
945 68, 486, 494, 482, 498, 483, 68, 496, 485, 489,
946 484, 502, 495, 491, 488, 68, 501, 500, 1110, 497,
947 492, 68, 499, 68, 480, 68, 481, 503, 504, 494,
948 482, 498, 483, 68, 496, 68, 68, 484, 493, 68,
949 491, 68, 68, 68, 500, 505, 497, 492, 506, 499,
950 507, 68, 508, 509, 503, 504, 510, 511, 1110, 68,
951 68, 518, 513, 514, 512, 493, 1110, 1110, 68, 68,
952
953 68, 515, 505, 517, 68, 506, 68, 507, 516, 508,
954 509, 1110, 521, 510, 68, 68, 524, 527, 68, 513,
955 514, 512, 68, 68, 519, 522, 68, 520, 515, 68,
956 517, 523, 530, 525, 526, 516, 68, 68, 68, 521,
957 68, 68, 529, 524, 527, 531, 68, 533, 528, 68,
958 68, 519, 522, 538, 520, 68, 68, 68, 523, 530,
959 525, 526, 532, 534, 535, 536, 537, 68, 1110, 529,
960 540, 68, 531, 539, 533, 528, 542, 547, 68, 68,
961 68, 68, 1110, 68, 68, 68, 543, 549, 546, 532,
962 534, 544, 545, 537, 68, 68, 68, 540, 548, 68,
963
964 539, 68, 1110, 542, 68, 552, 554, 550, 68, 68,
965 551, 1110, 553, 543, 549, 546, 555, 556, 544, 545,
966 68, 1110, 558, 68, 68, 68, 557, 68, 559, 68,
967 68, 560, 552, 68, 550, 68, 68, 551, 561, 553,
968 562, 564, 566, 555, 556, 1110, 1110, 68, 68, 558,
969 68, 563, 68, 557, 68, 559, 569, 565, 560, 68,
970 567, 571, 570, 68, 568, 561, 68, 562, 564, 566,
971 572, 68, 68, 573, 68, 68, 576, 68, 563, 577,
972 68, 574, 578, 569, 565, 575, 581, 567, 571, 570,
973 68, 568, 579, 583, 580, 68, 582, 572, 584, 68,
974
975 573, 1110, 1110, 576, 585, 68, 1110, 586, 68, 578,
976 68, 1110, 68, 581, 68, 591, 593, 1110, 1110, 579,
977 68, 580, 596, 582, 68, 68, 68, 592, 587, 68,
978 68, 585, 594, 588, 586, 589, 595, 590, 68, 68,
979 600, 68, 591, 593, 68, 68, 68, 597, 598, 596,
980 68, 601, 610, 599, 592, 587, 68, 602, 603, 594,
981 588, 68, 589, 595, 590, 604, 606, 68, 605, 608,
982 611, 609, 68, 607, 597, 598, 612, 616, 68, 68,
983 599, 613, 68, 68, 602, 68, 614, 68, 68, 615,
984 68, 68, 604, 606, 68, 605, 608, 620, 609, 68,
985
986 607, 68, 617, 618, 68, 68, 68, 68, 613, 68,
987 68, 619, 622, 614, 621, 623, 615, 68, 68, 68,
988 632, 625, 624, 628, 620, 626, 627, 68, 68, 617,
989 618, 68, 68, 629, 631, 633, 630, 634, 619, 622,
990 68, 621, 623, 68, 635, 68, 637, 632, 68, 624,
991 628, 639, 68, 627, 636, 68, 638, 68, 640, 643,
992 629, 631, 633, 630, 634, 68, 68, 642, 68, 68,
993 68, 635, 645, 637, 68, 644, 641, 650, 639, 653,
994 646, 636, 68, 638, 647, 640, 1110, 648, 651, 68,
995 68, 649, 68, 652, 642, 1110, 68, 654, 68, 645,
996
997 655, 656, 68, 641, 68, 68, 68, 646, 68, 68,
998 68, 647, 658, 657, 68, 651, 659, 660, 68, 661,
999 652, 68, 68, 663, 654, 68, 662, 655, 656, 68,
1000 664, 665, 666, 667, 668, 669, 670, 68, 68, 658,
1001 657, 68, 671, 659, 660, 68, 661, 672, 68, 68,
1002 663, 673, 674, 662, 68, 68, 676, 664, 665, 68,
1003 667, 668, 675, 68, 677, 678, 68, 68, 68, 68,
1004 679, 68, 68, 682, 672, 681, 1110, 680, 673, 674,
1005 690, 68, 1110, 676, 68, 683, 684, 685, 1110, 675,
1006 688, 68, 678, 68, 68, 68, 68, 679, 68, 686,
1007
1008 682, 687, 681, 689, 680, 693, 68, 68, 68, 691,
1009 692, 68, 683, 684, 685, 68, 68, 688, 694, 695,
1010 68, 696, 698, 701, 697, 68, 686, 68, 687, 68,
1011 689, 68, 693, 68, 699, 700, 691, 692, 702, 1110,
1012 1110, 706, 708, 68, 703, 694, 695, 68, 696, 698,
1013 68, 697, 704, 68, 68, 707, 68, 68, 711, 68,
1014 68, 699, 700, 705, 68, 702, 712, 709, 706, 68,
1015 68, 703, 716, 68, 68, 715, 710, 713, 68, 704,
1016 714, 718, 707, 68, 723, 711, 68, 717, 719, 68,
1017 705, 720, 721, 712, 709, 68, 68, 722, 725, 716,
1018
1019 729, 1110, 715, 710, 713, 68, 68, 714, 718, 724,
1020 68, 68, 68, 726, 717, 719, 68, 727, 720, 721,
1021 728, 730, 68, 732, 731, 725, 68, 729, 68, 68,
1022 68, 733, 68, 68, 734, 1110, 724, 737, 739, 735,
1023 726, 738, 740, 741, 727, 736, 68, 728, 730, 744,
1024 68, 731, 68, 68, 68, 68, 68, 743, 755, 745,
1025 742, 734, 68, 68, 737, 739, 735, 68, 738, 740,
1026 741, 68, 736, 746, 747, 749, 744, 748, 68, 750,
1027 68, 68, 751, 752, 743, 68, 745, 742, 753, 68,
1028 68, 68, 757, 754, 68, 761, 758, 68, 68, 756,
1029
1030 746, 747, 749, 759, 748, 760, 750, 762, 763, 68,
1031 752, 765, 68, 68, 68, 753, 764, 68, 767, 68,
1032 754, 768, 68, 68, 766, 769, 756, 68, 770, 771,
1033 759, 772, 760, 68, 68, 68, 773, 1110, 774, 775,
1034 68, 1110, 68, 764, 68, 68, 68, 776, 768, 68,
1035 779, 766, 68, 780, 68, 777, 771, 781, 772, 68,
1036 68, 68, 789, 773, 785, 774, 775, 778, 68, 782,
1037 783, 784, 68, 788, 776, 68, 68, 779, 786, 68,
1038 780, 787, 777, 791, 781, 792, 793, 1110, 68, 68,
1039 68, 785, 68, 68, 778, 68, 782, 783, 784, 790,
1040
1041 788, 798, 794, 68, 68, 786, 68, 68, 787, 68,
1042 791, 795, 792, 793, 796, 797, 801, 800, 799, 68,
1043 804, 802, 68, 68, 68, 803, 790, 808, 798, 794,
1044 68, 805, 806, 807, 810, 809, 68, 68, 795, 812,
1045 813, 796, 797, 825, 800, 799, 68, 68, 68, 814,
1046 68, 68, 68, 815, 808, 68, 811, 816, 805, 817,
1047 807, 68, 809, 68, 818, 68, 821, 813, 1110, 819,
1048 68, 1110, 824, 820, 68, 827, 68, 822, 68, 829,
1049 68, 68, 828, 811, 816, 68, 817, 68, 68, 823,
1050 68, 818, 68, 821, 831, 826, 819, 833, 68, 824,
1051
1052 820, 68, 827, 830, 822, 68, 68, 68, 832, 828,
1053 68, 834, 68, 835, 68, 836, 823, 838, 837, 841,
1054 68, 831, 826, 839, 833, 68, 68, 68, 68, 842,
1055 830, 844, 840, 843, 68, 832, 845, 68, 834, 68,
1056 835, 68, 836, 846, 838, 837, 841, 847, 68, 850,
1057 839, 854, 1110, 68, 851, 848, 68, 1110, 844, 840,
1058 843, 68, 855, 845, 68, 68, 849, 852, 862, 68,
1059 846, 853, 858, 68, 847, 68, 68, 68, 68, 68,
1060 68, 851, 848, 856, 68, 859, 857, 863, 860, 855,
1061 68, 1110, 867, 849, 852, 862, 861, 864, 853, 858,
1062
1063 68, 68, 68, 68, 865, 873, 68, 866, 68, 868,
1064 856, 871, 859, 857, 863, 860, 870, 875, 68, 68,
1065 869, 872, 874, 861, 864, 68, 876, 68, 68, 878,
1066 877, 865, 68, 68, 866, 68, 868, 879, 871, 68,
1067 68, 881, 880, 870, 68, 68, 887, 869, 872, 874,
1068 882, 68, 68, 876, 68, 884, 878, 877, 68, 883,
1069 68, 68, 888, 68, 879, 885, 886, 68, 881, 880,
1070 68, 889, 68, 887, 890, 891, 68, 882, 892, 894,
1071 68, 893, 884, 895, 897, 68, 883, 898, 896, 888,
1072 899, 900, 885, 886, 902, 68, 68, 1110, 889, 901,
1073
1074 68, 890, 68, 904, 903, 68, 68, 68, 893, 905,
1075 68, 68, 68, 68, 68, 896, 908, 899, 68, 906,
1076 909, 68, 910, 911, 68, 913, 901, 914, 68, 921,
1077 904, 903, 1110, 68, 907, 915, 905, 912, 68, 926,
1078 919, 917, 68, 68, 918, 68, 906, 909, 920, 68,
1079 68, 68, 913, 916, 914, 922, 68, 68, 68, 68,
1080 68, 907, 915, 68, 912, 923, 68, 919, 917, 924,
1081 68, 918, 68, 925, 929, 920, 927, 932, 68, 1110,
1082 916, 930, 922, 933, 928, 931, 935, 68, 936, 68,
1083 934, 937, 923, 939, 938, 68, 924, 1110, 68, 68,
1084
1085 925, 929, 68, 927, 68, 68, 68, 68, 930, 940,
1086 933, 928, 931, 68, 68, 936, 68, 934, 937, 942,
1087 941, 938, 945, 943, 68, 946, 944, 947, 948, 949,
1088 68, 68, 950, 1110, 951, 952, 940, 954, 1110, 1110,
1089 68, 68, 68, 953, 955, 68, 942, 941, 68, 945,
1090 943, 68, 68, 944, 68, 68, 956, 957, 68, 950,
1091 68, 951, 952, 958, 68, 68, 68, 959, 960, 964,
1092 953, 955, 961, 962, 963, 965, 68, 68, 969, 68,
1093 966, 68, 68, 956, 957, 967, 68, 68, 68, 68,
1094 68, 972, 68, 973, 959, 960, 964, 968, 68, 961,
1095
1096 962, 963, 68, 970, 68, 969, 68, 966, 971, 974,
1097 975, 977, 967, 68, 976, 68, 978, 979, 972, 68,
1098 973, 68, 980, 981, 968, 68, 68, 982, 983, 68,
1099 970, 68, 1110, 68, 984, 971, 68, 975, 977, 985,
1100 68, 976, 989, 978, 979, 986, 68, 68, 987, 980,
1101 981, 990, 68, 988, 68, 68, 991, 992, 994, 68,
1102 993, 984, 995, 68, 997, 68, 985, 1000, 68, 68,
1103 998, 996, 986, 999, 1002, 987, 68, 68, 990, 1005,
1104 988, 1001, 68, 991, 68, 68, 68, 993, 68, 995,
1105 1003, 997, 68, 68, 1000, 68, 68, 998, 996, 1004,
1106
1107 999, 1002, 1006, 1007, 1008, 1009, 68, 1010, 1001, 1011,
1108 1012, 68, 68, 1014, 1110, 1018, 1016, 1003, 1110, 1110,
1109 1013, 1110, 68, 1015, 68, 1110, 1004, 68, 68, 68,
1110 68, 68, 1009, 68, 1010, 1019, 1011, 1012, 68, 68,
1111 1014, 68, 68, 1016, 1017, 1020, 1021, 1013, 1022, 1023,
1112 1015, 1024, 68, 68, 1025, 1110, 1026, 1032, 1028, 1029,
1113 1027, 68, 1019, 68, 68, 1030, 68, 1031, 68, 1033,
1114 1034, 1017, 1020, 1021, 68, 1022, 1023, 1110, 68, 1110,
1115 68, 1025, 68, 1026, 68, 68, 68, 1027, 68, 1036,
1116 1035, 1037, 1030, 68, 1031, 1038, 68, 1034, 68, 68,
1117
1118 1040, 1039, 1041, 68, 1043, 1045, 68, 68, 68, 1044,
1119 1046, 68, 1042, 1052, 68, 1047, 1036, 1035, 1037, 1050,
1120 1110, 1110, 1038, 68, 1053, 1048, 1049, 1040, 1039, 1041,
1121 68, 1043, 1045, 68, 68, 68, 1044, 68, 68, 1042,
1122 1052, 1054, 1047, 68, 68, 1051, 1050, 68, 1055, 1056,
1123 68, 1053, 1048, 1049, 1057, 1058, 1059, 68, 1061, 68,
1124 1065, 1060, 1062, 1063, 68, 1064, 68, 68, 1054, 68,
1125 68, 1066, 1051, 68, 1067, 1055, 1056, 68, 1070, 1068,
1126 1071, 1057, 68, 1059, 68, 1061, 68, 68, 1060, 1062,
1127 1063, 1069, 1064, 68, 1072, 1073, 68, 1074, 1066, 1075,
1128
1129 1076, 68, 68, 1077, 68, 68, 1068, 68, 1079, 1078,
1130 68, 68, 1080, 1081, 1083, 1082, 1110, 1084, 1069, 1085,
1131 1110, 1072, 1073, 1086, 1074, 1088, 68, 68, 1087, 1089,
1132 1077, 68, 1092, 1110, 1091, 68, 1078, 68, 1094, 68,
1133 68, 68, 1082, 68, 1084, 68, 68, 68, 1093, 1096,
1134 1086, 68, 68, 1090, 1095, 1087, 1089, 68, 68, 68,
1135 68, 1091, 1097, 1098, 1099, 68, 68, 1100, 1110, 1101,
1136 1102, 68, 1103, 1104, 1105, 1093, 1096, 1108, 1109, 68,
1137 1090, 1095, 68, 1110, 1110, 68, 1106, 1110, 1110, 68,
1138 68, 68, 68, 68, 1100, 68, 1101, 1102, 68, 1103,
1139
1140 68, 1105, 1107, 1110, 1108, 68, 1110, 1110, 1110, 1110,
1141 1110, 1110, 1110, 1106, 1110, 68, 1110, 1110, 1110, 1110,
1142 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1107,
1143 40, 40, 40, 40, 40, 40, 45, 45, 45, 45,
1144 45, 45, 50, 50, 50, 50, 50, 50, 56, 56,
1145 56, 56, 56, 56, 61, 61, 61, 61, 61, 61,
1146 71, 71, 71, 71, 71, 71, 112, 112, 1110, 1110,
1147 112, 112, 114, 114, 1110, 114, 1110, 114, 116, 1110,
1148 1110, 1110, 1110, 116, 119, 119, 1110, 1110, 119, 119,
1149 121, 1110, 1110, 1110, 1110, 121, 123, 123, 123, 123,
1150
1151 123, 123, 72, 72, 72, 72, 72, 72, 13, 1110,
1152 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1153 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1154 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1155 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1156 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1157 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1158 1110, 1110, 1110, 1110
11041159 } ;
11051160
1106 static yyconst flex_int16_t yy_chk[3035] =
1161 static yyconst flex_int16_t yy_chk[3275] =
11071162 { 0,
11081163 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11091164 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11121167 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11131168 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11141169 1, 1, 1, 1, 1, 3, 3, 3, 4, 4,
1115 4, 5, 5, 6, 6, 5, 1033, 6, 7, 7,
1116 7, 7, 69, 7, 8, 8, 8, 8, 1029, 8,
1117 9, 9, 9, 10, 10, 10, 13, 1023, 18, 46,
1118
1119 13, 3, 46, 16, 4, 16, 16, 5, 16, 6,
1120 19, 21, 30, 69, 21, 7, 22, 19, 30, 42,
1121 42, 8, 18, 23, 19, 18, 9, 20, 22, 10,
1122 20, 23, 24, 20, 25, 27, 19, 19, 21, 30,
1123 16, 26, 24, 22, 19, 20, 25, 27, 425, 23,
1124 23, 19, 28, 1018, 20, 24, 28, 20, 23, 24,
1125 20, 25, 27, 26, 28, 1013, 29, 31, 26, 24,
1126 29, 58, 34, 31, 32, 58, 31, 35, 425, 28,
1127 33, 63, 35, 28, 32, 31, 29, 32, 102, 34,
1128 35, 102, 29, 29, 31, 33, 32, 29, 34, 34,
1129
1130 31, 32, 33, 31, 35, 63, 36, 33, 63, 35,
1131 36, 32, 1012, 29, 32, 37, 34, 37, 37, 113,
1132 37, 51, 33, 51, 51, 64, 51, 55, 55, 100,
1133 100, 1011, 36, 36, 66, 65, 57, 36, 57, 57,
1134 60, 57, 60, 60, 65, 60, 67, 66, 68, 64,
1135 113, 70, 64, 68, 71, 67, 72, 73, 70, 76,
1136 74, 66, 65, 71, 77, 72, 77, 76, 75, 80,
1137 78, 75, 1008, 67, 78, 68, 79, 60, 70, 81,
1138 73, 71, 74, 72, 73, 75, 76, 74, 82, 80,
1139 83, 77, 75, 81, 78, 75, 80, 78, 75, 79,
1140
1141 84, 78, 85, 79, 83, 86, 81, 84, 82, 88,
1142 87, 90, 75, 91, 86, 82, 1006, 83, 89, 90,
1143 1002, 92, 91, 88, 93, 85, 999, 84, 87, 85,
1144 89, 95, 86, 93, 96, 95, 88, 87, 90, 97,
1145 91, 92, 997, 94, 98, 89, 109, 92, 92, 94,
1146 108, 93, 112, 98, 97, 110, 96, 104, 95, 104,
1147 104, 96, 104, 107, 107, 109, 97, 110, 92, 111,
1148 94, 98, 108, 109, 112, 995, 111, 108, 115, 112,
1149 994, 116, 110, 117, 993, 116, 990, 989, 119, 118,
1150 121, 124, 985, 984, 981, 979, 111, 114, 972, 121,
1151
1152 115, 119, 114, 122, 960, 115, 117, 114, 116, 125,
1153 117, 118, 123, 114, 114, 119, 118, 121, 120, 123,
1154 114, 120, 124, 126, 114, 122, 127, 128, 133, 114,
1155 122, 130, 127, 120, 114, 125, 125, 129, 131, 123,
1156 114, 114, 947, 132, 126, 120, 135, 134, 120, 133,
1157 126, 135, 943, 127, 134, 133, 136, 138, 128, 129,
1158 137, 139, 130, 132, 129, 140, 139, 137, 136, 131,
1159 132, 141, 140, 135, 134, 142, 147, 143, 145, 138,
1160 144, 146, 942, 136, 138, 143, 148, 137, 139, 149,
1161 938, 152, 140, 147, 148, 142, 141, 153, 141, 151,
1162
1163 145, 147, 142, 147, 143, 150, 144, 144, 151, 145,
1164 154, 149, 146, 148, 155, 152, 149, 150, 152, 156,
1165 147, 157, 159, 153, 153, 155, 151, 145, 158, 932,
1166 160, 156, 150, 162, 167, 159, 154, 154, 161, 165,
1167 163, 155, 166, 167, 164, 157, 156, 163, 157, 159,
1168 164, 158, 169, 165, 171, 158, 160, 160, 168, 170,
1169 161, 167, 172, 174, 162, 161, 165, 163, 166, 166,
1170 175, 164, 171, 168, 170, 177, 169, 172, 178, 169,
1171 922, 171, 173, 173, 179, 168, 170, 177, 176, 172,
1172 174, 176, 182, 180, 175, 184, 178, 175, 176, 181,
1173
1174 186, 183, 177, 185, 196, 178, 181, 173, 183, 173,
1175 173, 179, 187, 190, 189, 176, 213, 184, 176, 180,
1176 180, 185, 184, 182, 193, 188, 181, 189, 183, 190,
1177 185, 186, 188, 191, 187, 196, 193, 190, 921, 187,
1178 190, 189, 195, 198, 910, 194, 191, 213, 217, 201,
1179 195, 193, 188, 200, 908, 198, 190, 197, 199, 905,
1180 191, 192, 192, 194, 197, 199, 200, 202, 202, 195,
1181 198, 201, 194, 192, 192, 192, 201, 210, 207, 217,
1182 200, 204, 205, 203, 197, 199, 192, 207, 192, 192,
1183 203, 206, 204, 205, 208, 210, 202, 211, 209, 212,
1184
1185 192, 192, 192, 216, 210, 207, 214, 208, 204, 205,
1186 203, 209, 215, 218, 206, 219, 209, 212, 206, 221,
1187 211, 208, 223, 898, 211, 209, 212, 214, 218, 216,
1188 216, 890, 225, 214, 215, 220, 226, 219, 209, 215,
1189 218, 220, 219, 227, 224, 221, 221, 230, 223, 223,
1190 224, 225, 233, 229, 226, 232, 231, 234, 227, 225,
1191 229, 233, 220, 226, 883, 234, 235, 237, 239, 230,
1192 227, 224, 876, 235, 230, 231, 237, 872, 236, 233,
1193 229, 235, 238, 231, 234, 236, 232, 241, 240, 238,
1194 240, 235, 235, 235, 239, 239, 244, 243, 237, 242,
1195
1196 235, 245, 249, 237, 244, 236, 245, 246, 235, 238,
1197 248, 242, 243, 241, 241, 240, 250, 247, 235, 251,
1198 252, 254, 248, 244, 243, 247, 242, 253, 245, 246,
1199 250, 256, 257, 249, 246, 252, 255, 248, 258, 253,
1200 259, 260, 263, 250, 247, 254, 251, 252, 254, 261,
1201 255, 262, 264, 266, 253, 265, 271, 268, 256, 257,
1202 266, 267, 866, 255, 275, 270, 865, 259, 260, 258,
1203 268, 261, 272, 263, 262, 264, 261, 265, 262, 264,
1204 266, 269, 265, 267, 268, 864, 269, 271, 267, 273,
1205 269, 270, 270, 274, 280, 275, 272, 276, 277, 272,
1206
1207 851, 279, 278, 280, 284, 269, 281, 832, 269, 282,
1208 283, 273, 273, 269, 831, 274, 273, 269, 276, 281,
1209 274, 280, 277, 279, 276, 277, 278, 285, 279, 278,
1210 289, 282, 283, 281, 286, 284, 282, 283, 273, 287,
1211 288, 291, 293, 287, 290, 285, 829, 288, 292, 295,
1212 291, 294, 296, 289, 285, 297, 290, 289, 286, 301,
1213 292, 286, 823, 302, 300, 303, 297, 288, 291, 299,
1214 287, 290, 295, 293, 296, 292, 295, 294, 294, 296,
1215 298, 301, 297, 299, 300, 302, 301, 303, 298, 304,
1216 302, 300, 303, 305, 307, 306, 299, 308, 304, 310,
1217
1218 311, 313, 316, 320, 322, 325, 312, 298, 306, 311,
1219 821, 305, 316, 313, 319, 819, 304, 344, 307, 326,
1220 305, 307, 306, 308, 308, 312, 322, 311, 313, 316,
1221 310, 322, 325, 312, 320, 323, 324, 319, 324, 326,
1222 327, 319, 321, 328, 323, 321, 326, 329, 344, 332,
1223 321, 330, 331, 817, 333, 328, 321, 321, 335, 331,
1224 816, 814, 323, 324, 336, 321, 327, 327, 332, 321,
1225 328, 337, 321, 329, 329, 330, 332, 321, 330, 331,
1226 333, 333, 334, 321, 321, 335, 338, 339, 336, 341,
1227 340, 336, 337, 343, 334, 342, 813, 345, 337, 340,
1228
1229 347, 798, 796, 791, 348, 338, 339, 350, 767, 334,
1230 346, 341, 348, 338, 339, 342, 341, 340, 351, 354,
1231 343, 345, 342, 346, 345, 350, 347, 347, 348, 353,
1232 352, 348, 354, 355, 350, 356, 357, 346, 352, 348,
1233 755, 351, 358, 359, 360, 351, 354, 353, 356, 362,
1234 361, 359, 363, 368, 355, 362, 353, 352, 364, 360,
1235 355, 366, 356, 370, 365, 358, 370, 357, 376, 358,
1236 359, 360, 361, 365, 367, 366, 362, 361, 363, 363,
1237 368, 367, 364, 369, 742, 364, 732, 372, 366, 372,
1238 370, 365, 700, 373, 374, 369, 375, 694, 693, 376,
1239
1240 379, 367, 375, 378, 381, 373, 380, 374, 692, 382,
1241 369, 371, 383, 371, 372, 379, 378, 371, 385, 371,
1242 373, 374, 377, 375, 371, 383, 381, 379, 382, 377,
1243 378, 381, 380, 380, 384, 371, 382, 387, 371, 383,
1244 371, 689, 384, 388, 371, 385, 371, 377, 377, 377,
1245 389, 371, 390, 391, 392, 687, 377, 394, 389, 397,
1246 393, 384, 402, 395, 394, 658, 390, 388, 387, 398,
1247 388, 397, 392, 399, 377, 391, 395, 389, 403, 390,
1248 391, 392, 393, 400, 394, 401, 397, 393, 402, 402,
1249 395, 398, 406, 637, 405, 399, 398, 405, 408, 407,
1250
1251 399, 409, 616, 401, 406, 400, 407, 410, 411, 403,
1252 400, 415, 401, 610, 416, 417, 419, 414, 412, 406,
1253 405, 405, 408, 409, 405, 408, 407, 412, 409, 410,
1254 413, 414, 411, 415, 410, 411, 416, 413, 415, 417,
1255 418, 416, 417, 420, 414, 412, 421, 419, 422, 424,
1256 427, 423, 426, 428, 431, 428, 418, 413, 421, 423,
1257 605, 426, 424, 437, 432, 435, 591, 418, 427, 430,
1258 433, 434, 590, 421, 420, 422, 424, 427, 423, 426,
1259 428, 436, 430, 433, 434, 431, 432, 435, 439, 440,
1260 437, 432, 435, 436, 438, 442, 430, 433, 434, 441,
1261
1262 443, 444, 445, 438, 448, 568, 439, 441, 436, 559,
1263 445, 440, 443, 444, 446, 439, 440, 451, 442, 547,
1264 446, 438, 442, 447, 449, 448, 441, 443, 444, 445,
1265 450, 448, 447, 453, 454, 451, 449, 450, 455, 457,
1266 456, 446, 458, 457, 451, 455, 453, 459, 460, 461,
1267 447, 449, 464, 454, 463, 462, 458, 450, 465, 545,
1268 453, 454, 456, 463, 466, 455, 544, 456, 462, 458,
1269 457, 461, 467, 469, 460, 460, 461, 521, 459, 472,
1270 501, 463, 462, 464, 471, 468, 466, 472, 473, 465,
1271 468, 466, 468, 470, 468, 467, 469, 471, 477, 467,
1272
1273 469, 474, 475, 468, 475, 470, 472, 473, 476, 478,
1274 474, 471, 468, 487, 480, 473, 476, 468, 479, 468,
1275 470, 468, 483, 481, 482, 477, 485, 488, 474, 475,
1276 481, 489, 486, 484, 490, 476, 478, 491, 452, 493,
1277 479, 480, 484, 482, 483, 479, 492, 485, 496, 483,
1278 481, 482, 486, 485, 492, 491, 494, 496, 488, 486,
1279 484, 495, 489, 494, 491, 490, 493, 497, 495, 498,
1280 499, 500, 499, 492, 502, 496, 498, 504, 502, 506,
1281 500, 503, 503, 494, 505, 510, 504, 507, 495, 511,
1282 508, 505, 509, 497, 497, 507, 498, 499, 500, 512,
1283
1284 509, 513, 506, 508, 504, 502, 506, 510, 503, 511,
1285 513, 505, 510, 514, 507, 515, 511, 508, 516, 509,
1286 518, 512, 517, 519, 516, 522, 512, 515, 513, 520,
1287 523, 514, 524, 525, 527, 528, 524, 526, 523, 429,
1288 514, 404, 515, 528, 517, 516, 535, 522, 396, 517,
1289 386, 518, 522, 529, 519, 520, 520, 523, 526, 530,
1290 525, 529, 528, 524, 526, 527, 531, 530, 532, 533,
1291 534, 536, 535, 535, 531, 533, 537, 538, 539, 540,
1292 529, 532, 534, 542, 538, 541, 530, 543, 546, 548,
1293 537, 349, 541, 531, 536, 532, 533, 534, 536, 549,
1294
1295 550, 540, 550, 537, 538, 539, 540, 551, 552, 553,
1296 554, 549, 541, 548, 542, 546, 548, 554, 543, 555,
1297 552, 557, 556, 558, 560, 561, 549, 550, 563, 551,
1298 318, 558, 561, 560, 551, 552, 553, 554, 556, 564,
1299 562, 565, 571, 567, 557, 555, 555, 562, 557, 556,
1300 558, 560, 561, 563, 569, 563, 566, 570, 573, 570,
1301 574, 564, 572, 566, 567, 573, 564, 562, 571, 571,
1302 567, 572, 565, 575, 576, 577, 569, 578, 583, 589,
1303 581, 569, 574, 566, 570, 573, 578, 574, 317, 572,
1304 589, 579, 580, 581, 582, 575, 584, 577, 579, 580,
1305
1306 575, 576, 577, 584, 578, 585, 589, 581, 582, 583,
1307 586, 588, 585, 587, 588, 592, 586, 595, 579, 580,
1308 593, 582, 596, 584, 597, 587, 315, 594, 593, 588,
1309 594, 606, 585, 592, 599, 595, 598, 586, 588, 601,
1310 587, 588, 592, 598, 595, 594, 600, 593, 599, 602,
1311 604, 597, 601, 596, 594, 600, 603, 594, 602, 604,
1312 607, 599, 606, 598, 314, 608, 601, 614, 611, 609,
1313 612, 309, 613, 600, 228, 609, 602, 604, 614, 612,
1314 613, 615, 603, 603, 618, 621, 608, 611, 619, 622,
1315 615, 607, 608, 609, 614, 611, 609, 612, 617, 613,
1316
1317 620, 622, 609, 621, 623, 617, 624, 618, 615, 625,
1318 619, 618, 621, 627, 626, 619, 622, 628, 630, 623,
1319 629, 631, 620, 626, 625, 617, 632, 620, 633, 634,
1320 635, 623, 638, 632, 627, 636, 625, 624, 629, 639,
1321 627, 626, 640, 642, 628, 630, 643, 629, 639, 641,
1322 222, 641, 631, 632, 645, 633, 634, 635, 106, 636,
1323 650, 645, 636, 638, 646, 644, 639, 644, 647, 105,
1324 642, 646, 644, 640, 103, 647, 641, 643, 648, 653,
1325 644, 645, 649, 649, 648, 655, 650, 650, 652, 651,
1326 660, 646, 644, 657, 644, 647, 651, 653, 662, 644,
1327
1328 654, 654, 656, 656, 657, 648, 653, 661, 652, 649,
1329 659, 655, 655, 663, 661, 652, 651, 667, 662, 665,
1330 657, 660, 666, 664, 668, 662, 671, 654, 673, 656,
1331 666, 665, 659, 669, 661, 663, 675, 659, 667, 669,
1332 663, 664, 668, 670, 667, 679, 665, 674, 672, 666,
1333 664, 668, 672, 676, 677, 682, 670, 671, 681, 673,
1334 669, 678, 674, 678, 680, 683, 695, 675, 676, 680,
1335 670, 684, 686, 681, 674, 685, 679, 677, 101, 672,
1336 676, 677, 682, 690, 99, 681, 683, 691, 678, 688,
1337 686, 680, 683, 684, 690, 698, 685, 695, 684, 686,
1338
1339 697, 696, 685, 699, 688, 691, 701, 56, 702, 690,
1340 690, 696, 703, 701, 691, 709, 688, 704, 703, 707,
1341 698, 690, 698, 705, 710, 706, 697, 697, 696, 708,
1342 699, 707, 704, 701, 702, 702, 708, 709, 705, 703,
1343 706, 712, 709, 714, 704, 711, 707, 713, 713, 710,
1344 705, 710, 706, 715, 711, 716, 708, 717, 718, 719,
1345 720, 721, 723, 722, 52, 714, 719, 718, 712, 48,
1346 714, 722, 711, 47, 713, 723, 726, 716, 715, 717,
1347 715, 724, 716, 721, 717, 718, 719, 727, 721, 723,
1348 722, 720, 725, 728, 726, 725, 724, 729, 730, 43,
1349
1350 731, 736, 727, 726, 729, 733, 38, 728, 724, 730,
1351 725, 734, 735, 734, 727, 737, 741, 739, 743, 725,
1352 728, 731, 725, 738, 729, 730, 733, 731, 736, 740,
1353 735, 738, 733, 737, 744, 12, 743, 745, 734, 735,
1354 739, 11, 737, 741, 739, 743, 747, 746, 748, 750,
1355 738, 740, 751, 749, 753, 0, 740, 750, 756, 0,
1356 751, 744, 746, 745, 745, 749, 752, 760, 747, 753,
1357 757, 748, 752, 747, 746, 748, 750, 754, 758, 751,
1358 749, 753, 756, 754, 757, 756, 759, 761, 762, 763,
1359 764, 765, 758, 752, 760, 766, 769, 757, 768, 765,
1360
1361 770, 771, 762, 773, 754, 758, 775, 774, 770, 776,
1362 772, 778, 759, 759, 761, 762, 763, 764, 765, 772,
1363 768, 775, 766, 769, 773, 768, 779, 770, 771, 781,
1364 773, 774, 775, 775, 774, 777, 776, 772, 778, 780,
1365 780, 783, 782, 777, 784, 785, 786, 787, 775, 789,
1366 784, 0, 788, 779, 790, 781, 781, 782, 786, 794,
1367 793, 795, 777, 783, 807, 787, 780, 785, 783, 782,
1368 788, 784, 785, 786, 787, 792, 797, 790, 793, 788,
1369 789, 790, 792, 799, 800, 794, 794, 793, 801, 802,
1370 803, 797, 795, 804, 805, 807, 806, 809, 808, 0,
1371
1372 804, 805, 792, 797, 810, 812, 800, 799, 809, 811,
1373 799, 800, 802, 815, 803, 801, 802, 803, 806, 808,
1374 804, 805, 818, 806, 809, 808, 810, 820, 811, 822,
1375 812, 810, 812, 824, 825, 826, 811, 0, 827, 815,
1376 815, 828, 830, 827, 833, 834, 826, 836, 838, 818,
1377 0, 835, 837, 0, 820, 843, 822, 838, 845, 845,
1378 825, 825, 826, 828, 824, 827, 833, 837, 828, 830,
1379 834, 833, 834, 835, 836, 838, 839, 840, 835, 837,
1380 841, 842, 843, 844, 847, 845, 846, 848, 842, 850,
1381 849, 839, 840, 846, 853, 841, 852, 854, 847, 860,
1382
1383 0, 844, 859, 839, 840, 852, 0, 841, 842, 848,
1384 844, 847, 849, 846, 848, 854, 850, 849, 855, 856,
1385 853, 853, 857, 852, 854, 861, 858, 855, 856, 859,
1386 860, 862, 868, 857, 858, 863, 867, 861, 869, 862,
1387 873, 871, 863, 867, 875, 855, 856, 874, 870, 857,
1388 871, 877, 861, 858, 879, 874, 868, 880, 862, 868,
1389 870, 878, 863, 867, 881, 869, 878, 873, 871, 888,
1390 882, 875, 879, 884, 874, 870, 885, 877, 877, 880,
1391 886, 879, 887, 889, 880, 884, 881, 893, 878, 882,
1392 891, 881, 0, 892, 887, 894, 888, 882, 885, 896,
1393
1394 884, 895, 886, 885, 901, 897, 0, 886, 892, 887,
1395 889, 893, 891, 894, 893, 902, 899, 891, 903, 895,
1396 892, 900, 894, 897, 899, 896, 896, 904, 895, 900,
1397 907, 901, 897, 902, 906, 909, 913, 903, 912, 911,
1398 914, 915, 902, 899, 907, 903, 911, 916, 900, 904,
1399 918, 919, 906, 920, 904, 935, 916, 907, 917, 0,
1400 913, 906, 909, 913, 912, 912, 911, 914, 915, 923,
1401 924, 917, 927, 926, 916, 925, 920, 923, 919, 928,
1402 920, 918, 935, 925, 926, 917, 928, 929, 929, 924,
1403 930, 931, 933, 937, 927, 934, 923, 924, 931, 927,
1404
1405 926, 936, 925, 939, 934, 941, 928, 941, 930, 944,
1406 940, 937, 945, 948, 929, 946, 933, 930, 931, 933,
1407 937, 939, 934, 951, 936, 940, 949, 0, 936, 950,
1408 939, 944, 941, 946, 949, 948, 944, 940, 945, 945,
1409 948, 950, 946, 952, 953, 954, 955, 956, 956, 957,
1410 951, 958, 953, 949, 952, 959, 950, 957, 961, 962,
1411 963, 964, 965, 0, 954, 963, 962, 966, 955, 967,
1412 952, 953, 954, 955, 956, 966, 957, 959, 958, 969,
1413 970, 973, 959, 968, 967, 961, 962, 963, 964, 965,
1414 968, 971, 974, 975, 966, 976, 967, 978, 982, 971,
1415
1416 980, 977, 986, 973, 0, 987, 969, 970, 973, 983,
1417 968, 988, 992, 996, 0, 1000, 0, 1004, 971, 974,
1418 975, 986, 976, 977, 978, 982, 980, 980, 977, 986,
1419 991, 983, 987, 988, 1001, 992, 983, 991, 988, 992,
1420 996, 998, 1000, 1003, 1004, 1005, 1001, 1007, 1009, 0,
1421 1010, 0, 1003, 1015, 1016, 1014, 0, 991, 1022, 1019,
1422 1015, 1001, 0, 1009, 998, 1017, 1020, 0, 998, 0,
1423 1003, 1019, 1005, 0, 1007, 1009, 1010, 1010, 1014, 1020,
1424 1015, 1016, 1014, 1017, 0, 1022, 1019, 1021, 0, 0,
1425 0, 0, 1017, 1020, 0, 1021, 0, 0, 0, 0,
1426
1427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1428 0, 0, 0, 0, 1021, 1025, 1025, 1025, 1025, 1025,
1429 1025, 1026, 1026, 1026, 1026, 1026, 1026, 1027, 1027, 1027,
1430 1027, 1027, 1027, 1028, 1028, 1028, 1028, 1028, 1028, 1030,
1431 1030, 0, 1030, 1030, 1030, 1031, 1031, 0, 0, 0,
1432 1031, 1032, 1032, 0, 0, 1032, 1034, 1034, 0, 0,
1433 0, 1034, 1035, 1035, 0, 1035, 1035, 1035, 1024, 1024,
1434 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1435 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1436 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1437
1438 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1439 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1440 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
1441 1024, 1024, 1024, 1024
1170 4, 5, 5, 6, 6, 5, 24, 6, 7, 7,
1171 7, 7, 1116, 7, 8, 8, 8, 8, 24, 8,
1172 9, 9, 9, 10, 10, 10, 15, 44, 44, 49,
1173
1174 15, 3, 49, 24, 4, 60, 60, 5, 55, 6,
1175 55, 55, 69, 55, 476, 7, 69, 19, 19, 19,
1176 19, 8, 19, 20, 124, 23, 9, 19, 23, 10,
1177 11, 11, 11, 11, 11, 11, 12, 12, 12, 12,
1178 12, 12, 22, 115, 21, 22, 115, 20, 22, 11,
1179 20, 21, 23, 25, 19, 12, 27, 32, 21, 28,
1180 22, 25, 121, 32, 26, 29, 119, 11, 27, 22,
1181 21, 21, 22, 12, 26, 22, 11, 29, 21, 25,
1182 25, 28, 12, 27, 32, 21, 28, 26, 25, 31,
1183 30, 26, 29, 31, 30, 113, 113, 36, 120, 120,
1184
1185 118, 26, 30, 116, 114, 37, 80, 112, 74, 31,
1186 37, 80, 35, 33, 36, 31, 31, 30, 37, 33,
1187 31, 30, 33, 36, 36, 34, 75, 35, 81, 33,
1188 65, 33, 37, 80, 35, 34, 31, 37, 34, 35,
1189 33, 36, 72, 65, 38, 81, 33, 34, 38, 33,
1190 75, 70, 34, 75, 35, 67, 33, 65, 39, 81,
1191 39, 39, 34, 39, 66, 34, 66, 66, 39, 66,
1192 38, 38, 81, 76, 470, 38, 63, 63, 63, 63,
1193 68, 63, 68, 68, 77, 68, 71, 71, 71, 71,
1194 68, 71, 78, 77, 79, 82, 71, 76, 83, 84,
1195
1196 76, 85, 82, 79, 470, 78, 88, 83, 84, 86,
1197 89, 77, 89, 63, 88, 87, 90, 61, 87, 78,
1198 90, 79, 82, 71, 85, 83, 84, 91, 85, 92,
1199 93, 86, 87, 88, 95, 94, 86, 89, 56, 87,
1200 90, 97, 87, 90, 93, 87, 96, 90, 95, 92,
1201 91, 98, 99, 96, 91, 94, 92, 93, 100, 87,
1202 98, 95, 94, 101, 97, 100, 103, 104, 97, 102,
1203 99, 105, 136, 96, 103, 106, 104, 101, 98, 99,
1204 107, 102, 109, 108, 106, 100, 107, 108, 110, 51,
1205 101, 105, 111, 103, 104, 136, 102, 105, 105, 136,
1206
1207 50, 111, 106, 110, 109, 127, 125, 107, 45, 109,
1208 108, 117, 126, 117, 117, 110, 117, 40, 105, 111,
1209 122, 130, 122, 122, 127, 122, 123, 123, 123, 123,
1210 125, 123, 127, 125, 126, 128, 131, 129, 134, 126,
1211 14, 13, 135, 130, 129, 133, 135, 128, 130, 140,
1212 0, 0, 137, 138, 142, 141, 143, 0, 140, 147,
1213 134, 142, 128, 123, 129, 134, 138, 131, 132, 135,
1214 144, 133, 133, 132, 137, 149, 140, 141, 132, 137,
1215 138, 142, 141, 139, 132, 132, 139, 143, 146, 145,
1216 147, 132, 148, 150, 146, 132, 144, 144, 139, 145,
1217
1218 132, 151, 152, 154, 0, 132, 149, 0, 154, 153,
1219 139, 132, 132, 139, 148, 146, 153, 158, 155, 148,
1220 145, 151, 156, 152, 150, 157, 145, 162, 151, 152,
1221 154, 161, 157, 159, 156, 160, 153, 155, 159, 158,
1222 163, 165, 160, 164, 158, 155, 166, 162, 163, 156,
1223 0, 167, 157, 169, 162, 172, 161, 170, 161, 168,
1224 159, 169, 160, 165, 172, 173, 0, 163, 167, 164,
1225 164, 171, 165, 174, 168, 175, 167, 166, 167, 170,
1226 169, 177, 172, 171, 170, 176, 168, 178, 180, 173,
1227 165, 181, 173, 177, 179, 167, 176, 182, 171, 174,
1228
1229 174, 175, 175, 183, 181, 184, 180, 191, 177, 0,
1230 186, 178, 176, 185, 178, 180, 186, 179, 181, 187,
1231 185, 179, 188, 182, 182, 183, 189, 190, 192, 194,
1232 183, 191, 193, 187, 191, 189, 184, 186, 197, 193,
1233 185, 0, 190, 192, 198, 195, 187, 194, 188, 188,
1234 196, 196, 200, 189, 190, 192, 194, 202, 201, 193,
1235 195, 203, 204, 199, 200, 197, 199, 0, 198, 206,
1236 214, 198, 195, 199, 204, 196, 201, 196, 196, 200,
1237 208, 210, 211, 209, 202, 201, 214, 203, 203, 204,
1238 199, 205, 207, 199, 214, 213, 212, 214, 205, 207,
1239
1240 206, 209, 208, 212, 211, 217, 221, 208, 213, 211,
1241 209, 215, 210, 214, 219, 218, 223, 217, 205, 207,
1242 219, 220, 213, 212, 215, 0, 0, 222, 223, 220,
1243 239, 225, 217, 218, 222, 0, 229, 221, 215, 216,
1244 216, 219, 218, 223, 225, 0, 226, 229, 220, 0,
1245 224, 216, 216, 216, 222, 228, 216, 224, 225, 227,
1246 227, 239, 228, 229, 216, 230, 216, 216, 226, 241,
1247 232, 231, 233, 226, 234, 243, 230, 224, 216, 216,
1248 216, 233, 228, 216, 231, 236, 237, 234, 227, 235,
1249 238, 241, 230, 232, 240, 0, 241, 232, 231, 233,
1250
1251 242, 234, 235, 236, 244, 245, 243, 235, 238, 237,
1252 248, 246, 236, 237, 250, 240, 235, 238, 247, 251,
1253 245, 240, 244, 252, 247, 251, 242, 242, 254, 235,
1254 253, 244, 245, 246, 257, 259, 248, 248, 246, 260,
1255 250, 250, 252, 254, 256, 247, 251, 257, 253, 261,
1256 252, 256, 258, 0, 259, 254, 262, 253, 261, 265,
1257 263, 257, 259, 0, 262, 264, 266, 263, 265, 0,
1258 260, 256, 264, 266, 258, 263, 261, 267, 268, 258,
1259 268, 269, 271, 262, 270, 263, 263, 263, 274, 279,
1260 265, 272, 264, 266, 263, 265, 270, 271, 275, 272,
1261
1262 278, 273, 263, 267, 267, 268, 273, 269, 269, 271,
1263 274, 270, 263, 276, 277, 274, 275, 280, 272, 281,
1264 279, 276, 282, 278, 283, 275, 277, 278, 273, 284,
1265 286, 280, 287, 285, 288, 289, 283, 282, 291, 290,
1266 276, 277, 294, 297, 280, 292, 281, 285, 293, 282,
1267 297, 283, 296, 284, 295, 299, 284, 286, 298, 287,
1268 285, 302, 289, 301, 303, 288, 290, 292, 299, 291,
1269 297, 293, 292, 294, 296, 293, 304, 295, 300, 296,
1270 298, 295, 299, 300, 306, 298, 305, 300, 303, 301,
1271 301, 303, 302, 307, 308, 309, 310, 316, 304, 304,
1272
1273 305, 316, 300, 304, 311, 300, 306, 312, 317, 319,
1274 300, 306, 0, 305, 300, 308, 312, 313, 314, 309,
1275 310, 308, 309, 310, 307, 304, 311, 315, 316, 318,
1276 313, 311, 322, 319, 312, 321, 319, 320, 323, 317,
1277 314, 320, 321, 324, 313, 314, 325, 318, 326, 315,
1278 323, 327, 324, 328, 315, 322, 318, 0, 325, 322,
1279 329, 330, 321, 331, 333, 323, 0, 332, 320, 0,
1280 324, 331, 330, 325, 334, 335, 328, 327, 327, 326,
1281 328, 332, 329, 336, 333, 339, 337, 329, 330, 338,
1282 331, 333, 341, 340, 332, 337, 334, 335, 342, 345,
1283
1284 343, 334, 335, 339, 347, 336, 340, 0, 343, 338,
1285 336, 351, 339, 337, 341, 346, 338, 348, 354, 341,
1286 340, 351, 342, 347, 346, 342, 343, 343, 355, 348,
1287 345, 347, 356, 361, 358, 343, 354, 0, 351, 359,
1288 0, 360, 346, 360, 348, 354, 0, 363, 359, 362,
1289 364, 355, 0, 0, 365, 355, 358, 0, 366, 370,
1290 361, 358, 364, 356, 357, 368, 359, 357, 360, 362,
1291 369, 370, 357, 363, 363, 372, 362, 364, 357, 357,
1292 365, 365, 366, 367, 368, 366, 370, 357, 373, 371,
1293 367, 357, 368, 374, 357, 377, 369, 369, 375, 357,
1294
1295 376, 378, 372, 380, 377, 357, 357, 381, 384, 379,
1296 367, 371, 373, 382, 374, 373, 371, 375, 385, 376,
1297 374, 382, 377, 378, 386, 375, 389, 376, 378, 379,
1298 380, 385, 384, 387, 391, 384, 379, 392, 381, 390,
1299 382, 387, 391, 393, 389, 385, 394, 396, 397, 0,
1300 386, 386, 395, 389, 400, 392, 393, 387, 402, 399,
1301 387, 391, 390, 403, 392, 395, 390, 394, 387, 398,
1302 393, 397, 406, 394, 399, 397, 400, 398, 396, 395,
1303 404, 400, 401, 405, 402, 402, 399, 403, 401, 404,
1304 403, 407, 408, 409, 410, 412, 398, 405, 407, 411,
1305
1306 0, 416, 411, 406, 415, 419, 410, 404, 412, 401,
1307 405, 414, 418, 414, 416, 422, 415, 417, 407, 408,
1308 409, 410, 412, 417, 0, 418, 411, 413, 416, 413,
1309 422, 415, 421, 413, 425, 413, 419, 423, 414, 418,
1310 413, 430, 422, 420, 417, 421, 428, 427, 0, 424,
1311 420, 413, 426, 425, 413, 427, 413, 431, 432, 421,
1312 413, 425, 413, 423, 423, 426, 432, 413, 420, 420,
1313 420, 424, 430, 428, 427, 433, 424, 420, 434, 426,
1314 435, 431, 436, 437, 431, 432, 438, 439, 0, 433,
1315 437, 447, 442, 443, 441, 420, 0, 0, 435, 438,
1316
1317 434, 444, 433, 446, 436, 434, 441, 435, 445, 436,
1318 437, 0, 450, 438, 442, 443, 453, 456, 439, 442,
1319 443, 441, 447, 444, 449, 451, 445, 449, 444, 446,
1320 446, 452, 459, 454, 455, 445, 450, 451, 452, 450,
1321 453, 456, 458, 453, 456, 460, 459, 462, 457, 458,
1322 449, 449, 451, 467, 449, 454, 455, 457, 452, 459,
1323 454, 455, 461, 463, 464, 465, 466, 460, 0, 458,
1324 469, 462, 460, 468, 462, 457, 471, 478, 466, 463,
1325 467, 468, 0, 469, 461, 471, 472, 480, 477, 461,
1326 463, 473, 474, 466, 474, 464, 465, 469, 479, 473,
1327
1328 468, 477, 0, 471, 472, 483, 485, 481, 478, 480,
1329 482, 0, 484, 472, 480, 477, 486, 487, 473, 474,
1330 481, 0, 489, 482, 484, 486, 488, 483, 490, 479,
1331 489, 491, 483, 485, 481, 487, 490, 482, 492, 484,
1332 493, 495, 497, 486, 487, 0, 0, 495, 488, 489,
1333 492, 494, 493, 488, 491, 490, 500, 496, 491, 494,
1334 498, 503, 502, 497, 499, 492, 496, 493, 495, 497,
1335 504, 499, 498, 505, 500, 502, 507, 504, 494, 508,
1336 503, 506, 509, 500, 496, 506, 512, 498, 503, 502,
1337 507, 499, 510, 514, 511, 505, 513, 504, 515, 512,
1338
1339 505, 0, 0, 507, 516, 513, 0, 517, 509, 509,
1340 508, 0, 506, 512, 510, 519, 521, 0, 0, 510,
1341 511, 511, 524, 513, 514, 521, 516, 520, 518, 515,
1342 517, 516, 522, 518, 517, 518, 523, 518, 519, 520,
1343 528, 524, 519, 521, 523, 522, 518, 525, 526, 524,
1344 526, 529, 539, 527, 520, 518, 525, 530, 531, 522,
1345 518, 527, 518, 523, 518, 532, 534, 528, 533, 536,
1346 540, 537, 532, 535, 525, 526, 541, 545, 529, 530,
1347 527, 542, 535, 539, 530, 531, 543, 533, 534, 544,
1348 536, 537, 532, 534, 543, 533, 536, 549, 537, 542,
1349
1350 535, 540, 546, 547, 545, 544, 549, 541, 542, 546,
1351 547, 548, 551, 543, 550, 552, 544, 552, 548, 551,
1352 561, 555, 553, 557, 549, 555, 556, 556, 561, 546,
1353 547, 553, 557, 558, 560, 562, 559, 563, 548, 551,
1354 550, 550, 552, 559, 564, 563, 566, 561, 562, 553,
1355 557, 568, 555, 556, 565, 558, 567, 560, 569, 572,
1356 558, 560, 562, 559, 563, 567, 564, 571, 566, 568,
1357 569, 564, 574, 566, 565, 573, 570, 579, 568, 582,
1358 576, 565, 570, 567, 577, 569, 0, 578, 580, 571,
1359 572, 578, 577, 581, 571, 0, 580, 583, 574, 574,
1360
1361 584, 585, 576, 570, 579, 583, 573, 576, 584, 585,
1362 582, 577, 587, 586, 581, 580, 588, 589, 578, 590,
1363 581, 586, 588, 592, 583, 587, 591, 584, 585, 589,
1364 593, 594, 595, 596, 597, 598, 599, 592, 594, 587,
1365 586, 597, 602, 588, 589, 590, 590, 604, 593, 591,
1366 592, 605, 606, 591, 606, 596, 608, 593, 594, 595,
1367 596, 597, 607, 605, 609, 610, 598, 599, 608, 602,
1368 611, 604, 610, 614, 604, 613, 0, 612, 605, 606,
1369 623, 614, 0, 608, 607, 615, 617, 618, 0, 607,
1370 621, 609, 610, 612, 618, 617, 611, 611, 613, 619,
1371
1372 614, 620, 613, 622, 612, 627, 619, 615, 620, 624,
1373 625, 623, 615, 617, 618, 621, 624, 621, 628, 629,
1374 628, 630, 632, 635, 631, 622, 619, 627, 620, 632,
1375 622, 625, 627, 631, 633, 634, 624, 625, 636, 0,
1376 0, 640, 642, 629, 637, 628, 629, 630, 630, 632,
1377 635, 631, 638, 637, 640, 641, 633, 634, 645, 638,
1378 636, 633, 634, 639, 645, 636, 646, 643, 640, 641,
1379 639, 637, 651, 642, 643, 648, 644, 647, 646, 638,
1380 647, 653, 641, 644, 657, 645, 648, 652, 654, 653,
1381 639, 654, 655, 646, 643, 647, 651, 656, 659, 651,
1382
1383 663, 0, 648, 644, 647, 652, 654, 647, 653, 658,
1384 655, 657, 659, 660, 652, 654, 658, 661, 654, 655,
1385 662, 664, 660, 667, 665, 659, 663, 663, 656, 662,
1386 661, 668, 664, 665, 669, 0, 658, 672, 674, 670,
1387 660, 673, 675, 676, 661, 670, 674, 662, 664, 680,
1388 673, 665, 676, 675, 667, 669, 672, 679, 691, 681,
1389 678, 669, 668, 670, 672, 674, 670, 678, 673, 675,
1390 676, 680, 670, 682, 683, 685, 680, 684, 683, 686,
1391 679, 681, 687, 688, 679, 691, 681, 678, 689, 684,
1392 685, 682, 693, 690, 686, 697, 694, 689, 688, 692,
1393
1394 682, 683, 685, 695, 684, 696, 686, 698, 699, 695,
1395 688, 702, 696, 687, 690, 689, 700, 692, 704, 693,
1396 690, 705, 697, 705, 703, 706, 692, 694, 707, 708,
1397 695, 708, 696, 703, 698, 699, 708, 0, 709, 710,
1398 700, 0, 702, 700, 708, 709, 710, 711, 705, 704,
1399 714, 703, 706, 715, 711, 712, 708, 716, 708, 707,
1400 715, 712, 725, 708, 720, 709, 710, 713, 713, 717,
1401 718, 719, 719, 724, 711, 716, 714, 714, 721, 721,
1402 715, 722, 712, 727, 716, 728, 729, 0, 718, 717,
1403 720, 720, 722, 725, 713, 724, 717, 718, 719, 726,
1404
1405 724, 734, 730, 727, 729, 721, 726, 728, 722, 730,
1406 727, 731, 728, 729, 732, 733, 737, 736, 735, 734,
1407 739, 738, 732, 731, 735, 738, 726, 743, 734, 730,
1408 736, 740, 741, 742, 745, 744, 733, 744, 731, 747,
1409 748, 732, 733, 764, 736, 735, 740, 737, 742, 749,
1410 743, 739, 738, 750, 743, 748, 746, 751, 740, 752,
1411 742, 746, 744, 741, 753, 745, 758, 748, 0, 754,
1412 747, 0, 760, 756, 764, 766, 749, 758, 751, 768,
1413 750, 752, 767, 746, 751, 753, 752, 754, 756, 759,
1414 760, 753, 758, 758, 771, 765, 754, 773, 759, 760,
1415
1416 756, 766, 766, 770, 758, 765, 768, 767, 772, 767,
1417 770, 774, 773, 775, 772, 776, 759, 778, 777, 781,
1418 771, 771, 765, 779, 773, 777, 774, 776, 775, 782,
1419 770, 784, 780, 783, 783, 772, 785, 781, 774, 778,
1420 775, 780, 776, 786, 778, 777, 781, 787, 779, 790,
1421 779, 794, 0, 784, 791, 788, 782, 0, 784, 780,
1422 783, 785, 795, 785, 788, 786, 789, 792, 801, 787,
1423 786, 793, 797, 789, 787, 792, 791, 795, 794, 801,
1424 790, 791, 788, 796, 793, 798, 796, 802, 799, 795,
1425 797, 0, 807, 789, 792, 801, 800, 804, 793, 797,
1426
1427 798, 796, 799, 800, 805, 813, 805, 806, 802, 808,
1428 796, 811, 798, 796, 802, 799, 810, 817, 804, 807,
1429 809, 812, 816, 800, 804, 806, 818, 808, 809, 820,
1430 819, 805, 813, 811, 806, 812, 808, 821, 811, 810,
1431 816, 823, 822, 810, 817, 819, 830, 809, 812, 816,
1432 824, 820, 818, 818, 822, 826, 820, 819, 824, 825,
1433 821, 826, 831, 823, 821, 827, 828, 825, 823, 822,
1434 830, 832, 828, 830, 833, 834, 831, 824, 835, 837,
1435 827, 836, 826, 838, 840, 832, 825, 841, 839, 831,
1436 843, 844, 827, 828, 846, 836, 839, 0, 832, 845,
1437
1438 833, 833, 834, 848, 847, 835, 837, 845, 836, 849,
1439 838, 840, 843, 847, 841, 839, 851, 843, 844, 850,
1440 852, 846, 853, 855, 848, 857, 845, 858, 852, 865,
1441 848, 847, 0, 849, 850, 859, 849, 856, 856, 871,
1442 863, 861, 858, 851, 862, 850, 850, 852, 864, 853,
1443 855, 857, 857, 860, 858, 866, 862, 859, 863, 860,
1444 865, 850, 859, 861, 856, 868, 864, 863, 861, 869,
1445 871, 862, 868, 870, 874, 864, 872, 878, 866, 0,
1446 860, 876, 866, 879, 872, 877, 881, 869, 882, 874,
1447 880, 883, 868, 885, 884, 882, 869, 0, 883, 870,
1448
1449 870, 874, 872, 872, 878, 876, 879, 877, 876, 886,
1450 879, 872, 877, 881, 880, 882, 884, 880, 883, 888,
1451 887, 884, 893, 889, 885, 896, 890, 899, 901, 903,
1452 886, 887, 904, 0, 905, 906, 886, 909, 0, 0,
1453 906, 888, 889, 907, 912, 905, 888, 887, 893, 893,
1454 889, 890, 896, 890, 899, 901, 913, 914, 904, 904,
1455 903, 905, 906, 915, 909, 907, 912, 916, 917, 921,
1456 907, 912, 918, 919, 920, 922, 921, 917, 926, 914,
1457 923, 913, 916, 913, 914, 924, 924, 918, 919, 920,
1458 915, 929, 926, 930, 916, 917, 921, 925, 923, 918,
1459
1460 919, 920, 922, 927, 925, 926, 927, 923, 928, 931,
1461 933, 936, 924, 929, 934, 930, 937, 938, 929, 933,
1462 930, 928, 939, 940, 925, 937, 938, 941, 942, 936,
1463 927, 940, 0, 939, 943, 928, 931, 933, 936, 944,
1464 934, 934, 951, 937, 938, 945, 943, 944, 949, 939,
1465 940, 952, 945, 950, 941, 949, 953, 955, 957, 942,
1466 956, 943, 959, 952, 961, 953, 944, 964, 956, 951,
1467 962, 960, 945, 963, 967, 949, 960, 950, 952, 970,
1468 950, 966, 961, 953, 955, 957, 964, 956, 959, 959,
1469 968, 961, 962, 966, 964, 963, 967, 962, 960, 969,
1470
1471 963, 967, 971, 972, 973, 975, 970, 976, 966, 977,
1472 978, 969, 968, 980, 0, 985, 983, 968, 0, 0,
1473 979, 0, 976, 981, 983, 0, 969, 975, 978, 971,
1474 972, 973, 975, 977, 976, 986, 977, 978, 979, 980,
1475 980, 981, 985, 983, 984, 987, 988, 979, 990, 991,
1476 981, 993, 984, 986, 995, 0, 996, 1002, 998, 999,
1477 997, 995, 986, 991, 987, 1000, 990, 1001, 988, 1003,
1478 1004, 984, 987, 988, 1000, 990, 991, 0, 993, 0,
1479 1001, 995, 996, 996, 997, 998, 999, 997, 1002, 1010,
1480 1009, 1011, 1000, 1004, 1001, 1012, 1003, 1004, 1009, 1011,
1481
1482 1014, 1013, 1015, 1015, 1017, 1020, 1012, 1014, 1010, 1019,
1483 1021, 1017, 1016, 1030, 1020, 1022, 1010, 1009, 1011, 1026,
1484 0, 0, 1012, 1013, 1031, 1023, 1025, 1014, 1013, 1015,
1485 1016, 1017, 1020, 1019, 1026, 1030, 1019, 1021, 1022, 1016,
1486 1030, 1032, 1022, 1023, 1025, 1027, 1026, 1027, 1034, 1035,
1487 1031, 1031, 1023, 1025, 1036, 1037, 1038, 1035, 1040, 1032,
1488 1044, 1039, 1041, 1042, 1042, 1043, 1036, 1038, 1032, 1039,
1489 1034, 1045, 1027, 1043, 1047, 1034, 1035, 1040, 1050, 1048,
1490 1051, 1036, 1037, 1038, 1041, 1040, 1048, 1044, 1039, 1041,
1491 1042, 1049, 1043, 1045, 1052, 1053, 1049, 1054, 1045, 1055,
1492
1493 1056, 1047, 1052, 1057, 1054, 1050, 1048, 1051, 1060, 1059,
1494 1053, 1057, 1061, 1062, 1064, 1063, 0, 1066, 1049, 1068,
1495 0, 1052, 1053, 1069, 1054, 1073, 1055, 1056, 1072, 1074,
1496 1057, 1059, 1082, 0, 1078, 1060, 1059, 1063, 1086, 1061,
1497 1062, 1064, 1063, 1066, 1066, 1069, 1068, 1072, 1084, 1089,
1498 1069, 1074, 1073, 1077, 1087, 1072, 1074, 1078, 1089, 1082,
1499 1077, 1078, 1090, 1091, 1093, 1086, 1087, 1095, 0, 1096,
1500 1100, 1084, 1101, 1102, 1103, 1084, 1089, 1107, 1108, 1101,
1501 1077, 1087, 1095, 0, 0, 1107, 1105, 0, 0, 1090,
1502 1091, 1093, 1103, 1100, 1095, 1096, 1096, 1100, 1105, 1101,
1503
1504 1102, 1103, 1106, 0, 1107, 1108, 0, 0, 0, 0,
1505 0, 0, 0, 1105, 0, 1106, 0, 0, 0, 0,
1506 0, 0, 0, 0, 0, 0, 0, 0, 0, 1106,
1507 1111, 1111, 1111, 1111, 1111, 1111, 1112, 1112, 1112, 1112,
1508 1112, 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114,
1509 1114, 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115,
1510 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118, 0, 0,
1511 1118, 1118, 1119, 1119, 0, 1119, 0, 1119, 1120, 0,
1512 0, 0, 0, 1120, 1121, 1121, 0, 0, 1121, 1121,
1513 1122, 0, 0, 0, 0, 1122, 1123, 1123, 1123, 1123,
1514
1515 1123, 1123, 1124, 1124, 1124, 1124, 1124, 1124, 1110, 1110,
1516 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1517 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1518 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1519 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1520 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1521 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1522 1110, 1110, 1110, 1110
14421523 } ;
14431524
14441525 static yy_state_type yy_last_accepting_state;
14851566 #define LEXOUT(s)
14861567 #endif
14871568
1488 #define YDOUT LEXOUT(("v(%s )", yytext))
1569 /** avoid warning in about fwrite return value */
1570 #define ECHO ub_c_error_msg("syntax error at text: %s", yytext)
1571
1572 /** A parser variable, this is a statement in the config file which is
1573 * of the form variable: value1 value2 ... nargs is the number of values. */
1574 #define YDVAR(nargs, var) \
1575 num_args=(nargs); \
1576 LEXOUT(("v(%s%d) ", yytext, num_args)); \
1577 if(num_args > 0) { BEGIN(val); } \
1578 return (var);
14891579
14901580 struct inc_state {
14911581 char* filename;
14941584 static struct inc_state parse_stack[MAXINCLUDES];
14951585 static YY_BUFFER_STATE include_stack[MAXINCLUDES];
14961586 static int config_include_stack_ptr = 0;
1587 static int inc_prev = 0;
1588 static int num_args = 0;
14971589
14981590 static void config_start_include(const char* filename)
14991591 {
15461638 #endif
15471639
15481640 #define YY_NO_INPUT 1
1549 #line 92 "util/configlexer.lex"
1641 #line 103 "util/configlexer.lex"
15501642 #ifndef YY_NO_UNPUT
15511643 #define YY_NO_UNPUT 1
15521644 #endif
15541646 #define YY_NO_INPUT 1
15551647 #endif
15561648
1557 #line 1558 "<stdout>"
1649 #line 1650 "<stdout>"
15581650
15591651 #define INITIAL 0
15601652 #define quotedstring 1
15611653 #define singlequotedstr 2
15621654 #define include 3
15631655 #define include_quoted 4
1656 #define val 5
15641657
15651658 #ifndef YY_NO_UNISTD_H
15661659 /* Special case for "unistd.h", since it is non-ANSI. We include it way
17381831 register char *yy_cp, *yy_bp;
17391832 register int yy_act;
17401833
1741 #line 111 "util/configlexer.lex"
1742
1743 #line 1744 "<stdout>"
1834 #line 123 "util/configlexer.lex"
1835
1836 #line 1837 "<stdout>"
17441837
17451838 if ( !(yy_init) )
17461839 {
17991892 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
18001893 {
18011894 yy_current_state = (int) yy_def[yy_current_state];
1802 if ( yy_current_state >= 1025 )
1895 if ( yy_current_state >= 1111 )
18031896 yy_c = yy_meta[(unsigned int) yy_c];
18041897 }
18051898 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
18061899 ++yy_cp;
18071900 }
1808 while ( yy_base[yy_current_state] != 2969 );
1901 while ( yy_base[yy_current_state] != 3209 );
18091902
18101903 yy_find_action:
18111904 yy_act = yy_accept[yy_current_state];
18311924
18321925 case 1:
18331926 YY_RULE_SETUP
1834 #line 112 "util/configlexer.lex"
1835 { LEXOUT(("SP ")); /* ignore */ }
1927 #line 124 "util/configlexer.lex"
1928 {
1929 LEXOUT(("SP ")); /* ignore */ }
18361930 YY_BREAK
18371931 case 2:
1838 YY_RULE_SETUP
1839 #line 113 "util/configlexer.lex"
1840 { LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
1932 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1933 (yy_c_buf_p) = yy_cp -= 1;
1934 YY_DO_BEFORE_ACTION; /* set up yytext again */
1935 YY_RULE_SETUP
1936 #line 126 "util/configlexer.lex"
1937 {
1938 LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
18411939 YY_BREAK
18421940 case 3:
18431941 YY_RULE_SETUP
1844 #line 114 "util/configlexer.lex"
1845 { YDOUT; return VAR_SERVER;}
1942 #line 128 "util/configlexer.lex"
1943 { YDVAR(0, VAR_SERVER) }
18461944 YY_BREAK
18471945 case 4:
18481946 YY_RULE_SETUP
1849 #line 115 "util/configlexer.lex"
1850 { YDOUT; return VAR_NUM_THREADS;}
1947 #line 129 "util/configlexer.lex"
1948 { YDVAR(1, VAR_NUM_THREADS) }
18511949 YY_BREAK
18521950 case 5:
18531951 YY_RULE_SETUP
1854 #line 116 "util/configlexer.lex"
1855 { YDOUT; return VAR_VERBOSITY;}
1952 #line 130 "util/configlexer.lex"
1953 { YDVAR(1, VAR_VERBOSITY) }
18561954 YY_BREAK
18571955 case 6:
18581956 YY_RULE_SETUP
1859 #line 117 "util/configlexer.lex"
1860 { YDOUT; return VAR_PORT;}
1957 #line 131 "util/configlexer.lex"
1958 { YDVAR(1, VAR_PORT) }
18611959 YY_BREAK
18621960 case 7:
18631961 YY_RULE_SETUP
1864 #line 118 "util/configlexer.lex"
1865 { YDOUT; return VAR_OUTGOING_RANGE;}
1962 #line 132 "util/configlexer.lex"
1963 { YDVAR(1, VAR_OUTGOING_RANGE) }
18661964 YY_BREAK
18671965 case 8:
18681966 YY_RULE_SETUP
1869 #line 119 "util/configlexer.lex"
1870 { YDOUT; return VAR_OUTGOING_PORT_PERMIT;}
1967 #line 133 "util/configlexer.lex"
1968 { YDVAR(1, VAR_OUTGOING_PORT_PERMIT) }
18711969 YY_BREAK
18721970 case 9:
18731971 YY_RULE_SETUP
1874 #line 120 "util/configlexer.lex"
1875 { YDOUT; return VAR_OUTGOING_PORT_AVOID;}
1972 #line 134 "util/configlexer.lex"
1973 { YDVAR(1, VAR_OUTGOING_PORT_AVOID) }
18761974 YY_BREAK
18771975 case 10:
18781976 YY_RULE_SETUP
1879 #line 121 "util/configlexer.lex"
1880 { YDOUT; return VAR_OUTGOING_NUM_TCP;}
1977 #line 135 "util/configlexer.lex"
1978 { YDVAR(1, VAR_OUTGOING_NUM_TCP) }
18811979 YY_BREAK
18821980 case 11:
18831981 YY_RULE_SETUP
1884 #line 122 "util/configlexer.lex"
1885 { YDOUT; return VAR_INCOMING_NUM_TCP;}
1982 #line 136 "util/configlexer.lex"
1983 { YDVAR(1, VAR_INCOMING_NUM_TCP) }
18861984 YY_BREAK
18871985 case 12:
18881986 YY_RULE_SETUP
1889 #line 123 "util/configlexer.lex"
1890 { YDOUT; return VAR_DO_IP4;}
1987 #line 137 "util/configlexer.lex"
1988 { YDVAR(1, VAR_DO_IP4) }
18911989 YY_BREAK
18921990 case 13:
18931991 YY_RULE_SETUP
1894 #line 124 "util/configlexer.lex"
1895 { YDOUT; return VAR_DO_IP6;}
1992 #line 138 "util/configlexer.lex"
1993 { YDVAR(1, VAR_DO_IP6) }
18961994 YY_BREAK
18971995 case 14:
18981996 YY_RULE_SETUP
1899 #line 125 "util/configlexer.lex"
1900 { YDOUT; return VAR_DO_UDP;}
1997 #line 139 "util/configlexer.lex"
1998 { YDVAR(1, VAR_DO_UDP) }
19011999 YY_BREAK
19022000 case 15:
19032001 YY_RULE_SETUP
1904 #line 126 "util/configlexer.lex"
1905 { YDOUT; return VAR_DO_TCP;}
2002 #line 140 "util/configlexer.lex"
2003 { YDVAR(1, VAR_DO_TCP) }
19062004 YY_BREAK
19072005 case 16:
19082006 YY_RULE_SETUP
1909 #line 127 "util/configlexer.lex"
1910 { YDOUT; return VAR_DO_DAEMONIZE;}
2007 #line 141 "util/configlexer.lex"
2008 { YDVAR(1, VAR_DO_DAEMONIZE) }
19112009 YY_BREAK
19122010 case 17:
19132011 YY_RULE_SETUP
1914 #line 128 "util/configlexer.lex"
1915 { YDOUT; return VAR_INTERFACE;}
2012 #line 142 "util/configlexer.lex"
2013 { YDVAR(1, VAR_INTERFACE) }
19162014 YY_BREAK
19172015 case 18:
19182016 YY_RULE_SETUP
1919 #line 129 "util/configlexer.lex"
1920 { YDOUT; return VAR_OUTGOING_INTERFACE;}
2017 #line 143 "util/configlexer.lex"
2018 { YDVAR(1, VAR_OUTGOING_INTERFACE) }
19212019 YY_BREAK
19222020 case 19:
19232021 YY_RULE_SETUP
1924 #line 130 "util/configlexer.lex"
1925 { YDOUT; return VAR_INTERFACE_AUTOMATIC;}
2022 #line 144 "util/configlexer.lex"
2023 { YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
19262024 YY_BREAK
19272025 case 20:
19282026 YY_RULE_SETUP
1929 #line 131 "util/configlexer.lex"
1930 { YDOUT; return VAR_CHROOT;}
2027 #line 145 "util/configlexer.lex"
2028 { YDVAR(1, VAR_CHROOT) }
19312029 YY_BREAK
19322030 case 21:
19332031 YY_RULE_SETUP
1934 #line 132 "util/configlexer.lex"
1935 { YDOUT; return VAR_USERNAME;}
2032 #line 146 "util/configlexer.lex"
2033 { YDVAR(1, VAR_USERNAME) }
19362034 YY_BREAK
19372035 case 22:
19382036 YY_RULE_SETUP
1939 #line 133 "util/configlexer.lex"
1940 { YDOUT; return VAR_DIRECTORY;}
2037 #line 147 "util/configlexer.lex"
2038 { YDVAR(1, VAR_DIRECTORY) }
19412039 YY_BREAK
19422040 case 23:
19432041 YY_RULE_SETUP
1944 #line 134 "util/configlexer.lex"
1945 { YDOUT; return VAR_LOGFILE;}
2042 #line 148 "util/configlexer.lex"
2043 { YDVAR(1, VAR_LOGFILE) }
19462044 YY_BREAK
19472045 case 24:
19482046 YY_RULE_SETUP
1949 #line 135 "util/configlexer.lex"
1950 { YDOUT; return VAR_PIDFILE;}
2047 #line 149 "util/configlexer.lex"
2048 { YDVAR(1, VAR_PIDFILE) }
19512049 YY_BREAK
19522050 case 25:
19532051 YY_RULE_SETUP
1954 #line 136 "util/configlexer.lex"
1955 { YDOUT; return VAR_ROOT_HINTS;}
2052 #line 150 "util/configlexer.lex"
2053 { YDVAR(1, VAR_ROOT_HINTS) }
19562054 YY_BREAK
19572055 case 26:
19582056 YY_RULE_SETUP
1959 #line 137 "util/configlexer.lex"
1960 { YDOUT; return VAR_MSG_BUFFER_SIZE;}
2057 #line 151 "util/configlexer.lex"
2058 { YDVAR(1, VAR_MSG_BUFFER_SIZE) }
19612059 YY_BREAK
19622060 case 27:
19632061 YY_RULE_SETUP
1964 #line 138 "util/configlexer.lex"
1965 { YDOUT; return VAR_MSG_CACHE_SIZE;}
2062 #line 152 "util/configlexer.lex"
2063 { YDVAR(1, VAR_MSG_CACHE_SIZE) }
19662064 YY_BREAK
19672065 case 28:
19682066 YY_RULE_SETUP
1969 #line 139 "util/configlexer.lex"
1970 { YDOUT; return VAR_MSG_CACHE_SLABS;}
2067 #line 153 "util/configlexer.lex"
2068 { YDVAR(1, VAR_MSG_CACHE_SLABS) }
19712069 YY_BREAK
19722070 case 29:
19732071 YY_RULE_SETUP
1974 #line 140 "util/configlexer.lex"
1975 { YDOUT; return VAR_RRSET_CACHE_SIZE;}
2072 #line 154 "util/configlexer.lex"
2073 { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
19762074 YY_BREAK
19772075 case 30:
19782076 YY_RULE_SETUP
1979 #line 141 "util/configlexer.lex"
1980 { YDOUT; return VAR_RRSET_CACHE_SLABS;}
2077 #line 155 "util/configlexer.lex"
2078 { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
19812079 YY_BREAK
19822080 case 31:
19832081 YY_RULE_SETUP
1984 #line 142 "util/configlexer.lex"
1985 { YDOUT; return VAR_CACHE_MAX_TTL;}
2082 #line 156 "util/configlexer.lex"
2083 { YDVAR(1, VAR_CACHE_MAX_TTL) }
19862084 YY_BREAK
19872085 case 32:
19882086 YY_RULE_SETUP
1989 #line 143 "util/configlexer.lex"
1990 { YDOUT; return VAR_INFRA_HOST_TTL;}
2087 #line 157 "util/configlexer.lex"
2088 { YDVAR(1, VAR_CACHE_MIN_TTL) }
19912089 YY_BREAK
19922090 case 33:
19932091 YY_RULE_SETUP
1994 #line 144 "util/configlexer.lex"
1995 { YDOUT; return VAR_INFRA_LAME_TTL;}
2092 #line 158 "util/configlexer.lex"
2093 { YDVAR(1, VAR_INFRA_HOST_TTL) }
19962094 YY_BREAK
19972095 case 34:
19982096 YY_RULE_SETUP
1999 #line 145 "util/configlexer.lex"
2000 { YDOUT; return VAR_INFRA_CACHE_SLABS;}
2097 #line 159 "util/configlexer.lex"
2098 { YDVAR(1, VAR_INFRA_LAME_TTL) }
20012099 YY_BREAK
20022100 case 35:
20032101 YY_RULE_SETUP
2004 #line 146 "util/configlexer.lex"
2005 { YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;}
2102 #line 160 "util/configlexer.lex"
2103 { YDVAR(1, VAR_INFRA_CACHE_SLABS) }
20062104 YY_BREAK
20072105 case 36:
20082106 YY_RULE_SETUP
2009 #line 147 "util/configlexer.lex"
2010 { YDOUT; return VAR_INFRA_CACHE_LAME_SIZE;}
2107 #line 161 "util/configlexer.lex"
2108 { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
20112109 YY_BREAK
20122110 case 37:
20132111 YY_RULE_SETUP
2014 #line 148 "util/configlexer.lex"
2015 { YDOUT; return VAR_NUM_QUERIES_PER_THREAD;}
2112 #line 162 "util/configlexer.lex"
2113 { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
20162114 YY_BREAK
20172115 case 38:
20182116 YY_RULE_SETUP
2019 #line 149 "util/configlexer.lex"
2020 { YDOUT; return VAR_JOSTLE_TIMEOUT;}
2117 #line 163 "util/configlexer.lex"
2118 { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
20212119 YY_BREAK
20222120 case 39:
20232121 YY_RULE_SETUP
2024 #line 150 "util/configlexer.lex"
2025 { YDOUT; return VAR_TARGET_FETCH_POLICY;}
2122 #line 164 "util/configlexer.lex"
2123 { YDVAR(1, VAR_JOSTLE_TIMEOUT) }
20262124 YY_BREAK
20272125 case 40:
20282126 YY_RULE_SETUP
2029 #line 151 "util/configlexer.lex"
2030 { YDOUT; return VAR_HARDEN_SHORT_BUFSIZE;}
2127 #line 165 "util/configlexer.lex"
2128 { YDVAR(1, VAR_TARGET_FETCH_POLICY) }
20312129 YY_BREAK
20322130 case 41:
20332131 YY_RULE_SETUP
2034 #line 152 "util/configlexer.lex"
2035 { YDOUT; return VAR_HARDEN_LARGE_QUERIES;}
2132 #line 166 "util/configlexer.lex"
2133 { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
20362134 YY_BREAK
20372135 case 42:
20382136 YY_RULE_SETUP
2039 #line 153 "util/configlexer.lex"
2040 { YDOUT; return VAR_HARDEN_GLUE;}
2137 #line 167 "util/configlexer.lex"
2138 { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
20412139 YY_BREAK
20422140 case 43:
20432141 YY_RULE_SETUP
2044 #line 154 "util/configlexer.lex"
2045 { YDOUT; return VAR_HARDEN_DNNSEC_STRIPPED;}
2142 #line 168 "util/configlexer.lex"
2143 { YDVAR(1, VAR_HARDEN_GLUE) }
20462144 YY_BREAK
20472145 case 44:
20482146 YY_RULE_SETUP
2049 #line 155 "util/configlexer.lex"
2050 { YDOUT; return VAR_HARDEN_REFERRAL_PATH;}
2147 #line 169 "util/configlexer.lex"
2148 { YDVAR(1, VAR_HARDEN_DNNSEC_STRIPPED) }
20512149 YY_BREAK
20522150 case 45:
20532151 YY_RULE_SETUP
2054 #line 156 "util/configlexer.lex"
2055 { YDOUT; return VAR_USE_CAPS_FOR_ID;}
2152 #line 170 "util/configlexer.lex"
2153 { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
20562154 YY_BREAK
20572155 case 46:
20582156 YY_RULE_SETUP
2059 #line 157 "util/configlexer.lex"
2060 { YDOUT; return VAR_UNWANTED_REPLY_THRESHOLD;}
2157 #line 171 "util/configlexer.lex"
2158 { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
20612159 YY_BREAK
20622160 case 47:
20632161 YY_RULE_SETUP
2064 #line 158 "util/configlexer.lex"
2065 { YDOUT; return VAR_PRIVATE_ADDRESS;}
2162 #line 172 "util/configlexer.lex"
2163 { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
20662164 YY_BREAK
20672165 case 48:
20682166 YY_RULE_SETUP
2069 #line 159 "util/configlexer.lex"
2070 { YDOUT; return VAR_PRIVATE_DOMAIN;}
2167 #line 173 "util/configlexer.lex"
2168 { YDVAR(1, VAR_PRIVATE_ADDRESS) }
20712169 YY_BREAK
20722170 case 49:
20732171 YY_RULE_SETUP
2074 #line 160 "util/configlexer.lex"
2075 { YDOUT; return VAR_STUB_ZONE;}
2172 #line 174 "util/configlexer.lex"
2173 { YDVAR(1, VAR_PRIVATE_DOMAIN) }
20762174 YY_BREAK
20772175 case 50:
20782176 YY_RULE_SETUP
2079 #line 161 "util/configlexer.lex"
2080 { YDOUT; return VAR_NAME;}
2177 #line 175 "util/configlexer.lex"
2178 { YDVAR(0, VAR_STUB_ZONE) }
20812179 YY_BREAK
20822180 case 51:
20832181 YY_RULE_SETUP
2084 #line 162 "util/configlexer.lex"
2085 { YDOUT; return VAR_STUB_ADDR;}
2182 #line 176 "util/configlexer.lex"
2183 { YDVAR(1, VAR_NAME) }
20862184 YY_BREAK
20872185 case 52:
20882186 YY_RULE_SETUP
2089 #line 163 "util/configlexer.lex"
2090 { YDOUT; return VAR_STUB_HOST;}
2187 #line 177 "util/configlexer.lex"
2188 { YDVAR(1, VAR_STUB_ADDR) }
20912189 YY_BREAK
20922190 case 53:
20932191 YY_RULE_SETUP
2094 #line 164 "util/configlexer.lex"
2095 { YDOUT; return VAR_STUB_PRIME;}
2192 #line 178 "util/configlexer.lex"
2193 { YDVAR(1, VAR_STUB_HOST) }
20962194 YY_BREAK
20972195 case 54:
20982196 YY_RULE_SETUP
2099 #line 165 "util/configlexer.lex"
2100 { YDOUT; return VAR_FORWARD_ZONE;}
2197 #line 179 "util/configlexer.lex"
2198 { YDVAR(1, VAR_STUB_PRIME) }
21012199 YY_BREAK
21022200 case 55:
21032201 YY_RULE_SETUP
2104 #line 166 "util/configlexer.lex"
2105 { YDOUT; return VAR_FORWARD_ADDR;}
2202 #line 180 "util/configlexer.lex"
2203 { YDVAR(0, VAR_FORWARD_ZONE) }
21062204 YY_BREAK
21072205 case 56:
21082206 YY_RULE_SETUP
2109 #line 167 "util/configlexer.lex"
2110 { YDOUT; return VAR_FORWARD_HOST;}
2207 #line 181 "util/configlexer.lex"
2208 { YDVAR(1, VAR_FORWARD_ADDR) }
21112209 YY_BREAK
21122210 case 57:
21132211 YY_RULE_SETUP
2114 #line 168 "util/configlexer.lex"
2115 { YDOUT; return VAR_DO_NOT_QUERY_ADDRESS;}
2212 #line 182 "util/configlexer.lex"
2213 { YDVAR(1, VAR_FORWARD_HOST) }
21162214 YY_BREAK
21172215 case 58:
21182216 YY_RULE_SETUP
2119 #line 169 "util/configlexer.lex"
2120 { YDOUT; return VAR_DO_NOT_QUERY_LOCALHOST;}
2217 #line 183 "util/configlexer.lex"
2218 { YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
21212219 YY_BREAK
21222220 case 59:
21232221 YY_RULE_SETUP
2124 #line 170 "util/configlexer.lex"
2125 { YDOUT; return VAR_ACCESS_CONTROL;}
2222 #line 184 "util/configlexer.lex"
2223 { YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
21262224 YY_BREAK
21272225 case 60:
21282226 YY_RULE_SETUP
2129 #line 171 "util/configlexer.lex"
2130 { YDOUT; return VAR_HIDE_IDENTITY;}
2227 #line 185 "util/configlexer.lex"
2228 { YDVAR(2, VAR_ACCESS_CONTROL) }
21312229 YY_BREAK
21322230 case 61:
21332231 YY_RULE_SETUP
2134 #line 172 "util/configlexer.lex"
2135 { YDOUT; return VAR_HIDE_VERSION;}
2232 #line 186 "util/configlexer.lex"
2233 { YDVAR(1, VAR_HIDE_IDENTITY) }
21362234 YY_BREAK
21372235 case 62:
21382236 YY_RULE_SETUP
2139 #line 173 "util/configlexer.lex"
2140 { YDOUT; return VAR_IDENTITY;}
2237 #line 187 "util/configlexer.lex"
2238 { YDVAR(1, VAR_HIDE_VERSION) }
21412239 YY_BREAK
21422240 case 63:
21432241 YY_RULE_SETUP
2144 #line 174 "util/configlexer.lex"
2145 { YDOUT; return VAR_VERSION;}
2242 #line 188 "util/configlexer.lex"
2243 { YDVAR(1, VAR_IDENTITY) }
21462244 YY_BREAK
21472245 case 64:
21482246 YY_RULE_SETUP
2149 #line 175 "util/configlexer.lex"
2150 { YDOUT; return VAR_MODULE_CONF;}
2247 #line 189 "util/configlexer.lex"
2248 { YDVAR(1, VAR_VERSION) }
21512249 YY_BREAK
21522250 case 65:
21532251 YY_RULE_SETUP
2154 #line 176 "util/configlexer.lex"
2155 { YDOUT; return VAR_DLV_ANCHOR;}
2252 #line 190 "util/configlexer.lex"
2253 { YDVAR(1, VAR_MODULE_CONF) }
21562254 YY_BREAK
21572255 case 66:
21582256 YY_RULE_SETUP
2159 #line 177 "util/configlexer.lex"
2160 { YDOUT; return VAR_DLV_ANCHOR_FILE;}
2257 #line 191 "util/configlexer.lex"
2258 { YDVAR(1, VAR_DLV_ANCHOR) }
21612259 YY_BREAK
21622260 case 67:
21632261 YY_RULE_SETUP
2164 #line 178 "util/configlexer.lex"
2165 { YDOUT; return VAR_TRUST_ANCHOR_FILE;}
2262 #line 192 "util/configlexer.lex"
2263 { YDVAR(1, VAR_DLV_ANCHOR_FILE) }
21662264 YY_BREAK
21672265 case 68:
21682266 YY_RULE_SETUP
2169 #line 179 "util/configlexer.lex"
2170 { YDOUT; return VAR_TRUSTED_KEYS_FILE;}
2267 #line 193 "util/configlexer.lex"
2268 { YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
21712269 YY_BREAK
21722270 case 69:
21732271 YY_RULE_SETUP
2174 #line 180 "util/configlexer.lex"
2175 { YDOUT; return VAR_TRUST_ANCHOR;}
2272 #line 194 "util/configlexer.lex"
2273 { YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
21762274 YY_BREAK
21772275 case 70:
21782276 YY_RULE_SETUP
2179 #line 181 "util/configlexer.lex"
2180 { YDOUT; return VAR_VAL_OVERRIDE_DATE;}
2277 #line 195 "util/configlexer.lex"
2278 { YDVAR(1, VAR_TRUST_ANCHOR) }
21812279 YY_BREAK
21822280 case 71:
21832281 YY_RULE_SETUP
2184 #line 182 "util/configlexer.lex"
2185 { YDOUT; return VAR_BOGUS_TTL;}
2282 #line 196 "util/configlexer.lex"
2283 { YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
21862284 YY_BREAK
21872285 case 72:
21882286 YY_RULE_SETUP
2189 #line 183 "util/configlexer.lex"
2190 { YDOUT; return VAR_VAL_CLEAN_ADDITIONAL;}
2287 #line 197 "util/configlexer.lex"
2288 { YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
21912289 YY_BREAK
21922290 case 73:
21932291 YY_RULE_SETUP
2194 #line 184 "util/configlexer.lex"
2195 { YDOUT; return VAR_VAL_PERMISSIVE_MODE;}
2292 #line 198 "util/configlexer.lex"
2293 { YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
21962294 YY_BREAK
21972295 case 74:
21982296 YY_RULE_SETUP
2199 #line 185 "util/configlexer.lex"
2200 { YDOUT; return VAR_KEY_CACHE_SIZE;}
2297 #line 199 "util/configlexer.lex"
2298 { YDVAR(1, VAR_BOGUS_TTL) }
22012299 YY_BREAK
22022300 case 75:
22032301 YY_RULE_SETUP
2204 #line 186 "util/configlexer.lex"
2205 { YDOUT; return VAR_KEY_CACHE_SLABS;}
2302 #line 200 "util/configlexer.lex"
2303 { YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
22062304 YY_BREAK
22072305 case 76:
22082306 YY_RULE_SETUP
2209 #line 187 "util/configlexer.lex"
2210 { YDOUT; return VAR_NEG_CACHE_SIZE;}
2307 #line 201 "util/configlexer.lex"
2308 { YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
22112309 YY_BREAK
22122310 case 77:
22132311 YY_RULE_SETUP
2214 #line 188 "util/configlexer.lex"
2215 { YDOUT; return VAR_VAL_NSEC3_KEYSIZE_ITERATIONS;}
2312 #line 202 "util/configlexer.lex"
2313 { YDVAR(1, VAR_KEY_CACHE_SIZE) }
22162314 YY_BREAK
22172315 case 78:
22182316 YY_RULE_SETUP
2219 #line 189 "util/configlexer.lex"
2220 { YDOUT; return VAR_USE_SYSLOG;}
2317 #line 203 "util/configlexer.lex"
2318 { YDVAR(1, VAR_KEY_CACHE_SLABS) }
22212319 YY_BREAK
22222320 case 79:
22232321 YY_RULE_SETUP
2224 #line 190 "util/configlexer.lex"
2225 { YDOUT; return VAR_LOCAL_ZONE;}
2322 #line 204 "util/configlexer.lex"
2323 { YDVAR(1, VAR_NEG_CACHE_SIZE) }
22262324 YY_BREAK
22272325 case 80:
22282326 YY_RULE_SETUP
2229 #line 191 "util/configlexer.lex"
2230 { YDOUT; return VAR_LOCAL_DATA;}
2327 #line 205 "util/configlexer.lex"
2328 {
2329 YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
22312330 YY_BREAK
22322331 case 81:
22332332 YY_RULE_SETUP
2234 #line 192 "util/configlexer.lex"
2235 { YDOUT; return VAR_LOCAL_DATA_PTR;}
2333 #line 207 "util/configlexer.lex"
2334 { YDVAR(1, VAR_USE_SYSLOG) }
22362335 YY_BREAK
22372336 case 82:
22382337 YY_RULE_SETUP
2239 #line 193 "util/configlexer.lex"
2240 { YDOUT; return VAR_STATISTICS_INTERVAL;}
2338 #line 208 "util/configlexer.lex"
2339 { YDVAR(1, VAR_LOG_TIME_ASCII) }
22412340 YY_BREAK
22422341 case 83:
22432342 YY_RULE_SETUP
2244 #line 194 "util/configlexer.lex"
2245 { YDOUT; return VAR_STATISTICS_CUMULATIVE;}
2343 #line 209 "util/configlexer.lex"
2344 { YDVAR(2, VAR_LOCAL_ZONE) }
22462345 YY_BREAK
22472346 case 84:
22482347 YY_RULE_SETUP
2249 #line 195 "util/configlexer.lex"
2250 { YDOUT; return VAR_EXTENDED_STATISTICS;}
2348 #line 210 "util/configlexer.lex"
2349 { YDVAR(1, VAR_LOCAL_DATA) }
22512350 YY_BREAK
22522351 case 85:
22532352 YY_RULE_SETUP
2254 #line 196 "util/configlexer.lex"
2255 { YDOUT; return VAR_REMOTE_CONTROL; }
2353 #line 211 "util/configlexer.lex"
2354 { YDVAR(1, VAR_LOCAL_DATA_PTR) }
22562355 YY_BREAK
22572356 case 86:
22582357 YY_RULE_SETUP
2259 #line 197 "util/configlexer.lex"
2260 { YDOUT; return VAR_CONTROL_ENABLE; }
2358 #line 212 "util/configlexer.lex"
2359 { YDVAR(1, VAR_STATISTICS_INTERVAL) }
22612360 YY_BREAK
22622361 case 87:
22632362 YY_RULE_SETUP
2264 #line 198 "util/configlexer.lex"
2265 { YDOUT; return VAR_CONTROL_INTERFACE; }
2363 #line 213 "util/configlexer.lex"
2364 { YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
22662365 YY_BREAK
22672366 case 88:
22682367 YY_RULE_SETUP
2269 #line 199 "util/configlexer.lex"
2270 { YDOUT; return VAR_CONTROL_PORT; }
2368 #line 214 "util/configlexer.lex"
2369 { YDVAR(1, VAR_EXTENDED_STATISTICS) }
22712370 YY_BREAK
22722371 case 89:
22732372 YY_RULE_SETUP
2274 #line 200 "util/configlexer.lex"
2275 { YDOUT; return VAR_SERVER_KEY_FILE; }
2373 #line 215 "util/configlexer.lex"
2374 { YDVAR(0, VAR_REMOTE_CONTROL) }
22762375 YY_BREAK
22772376 case 90:
22782377 YY_RULE_SETUP
2279 #line 201 "util/configlexer.lex"
2280 { YDOUT; return VAR_SERVER_CERT_FILE; }
2378 #line 216 "util/configlexer.lex"
2379 { YDVAR(1, VAR_CONTROL_ENABLE) }
22812380 YY_BREAK
22822381 case 91:
22832382 YY_RULE_SETUP
2284 #line 202 "util/configlexer.lex"
2285 { YDOUT; return VAR_CONTROL_KEY_FILE; }
2383 #line 217 "util/configlexer.lex"
2384 { YDVAR(1, VAR_CONTROL_INTERFACE) }
22862385 YY_BREAK
22872386 case 92:
22882387 YY_RULE_SETUP
2289 #line 203 "util/configlexer.lex"
2290 { YDOUT; return VAR_CONTROL_CERT_FILE; }
2388 #line 218 "util/configlexer.lex"
2389 { YDVAR(1, VAR_CONTROL_PORT) }
22912390 YY_BREAK
22922391 case 93:
2293 /* rule 93 can match eol */
2294 YY_RULE_SETUP
2295 #line 204 "util/configlexer.lex"
2296 { LEXOUT(("NL\n")); cfg_parser->line++;}
2392 YY_RULE_SETUP
2393 #line 219 "util/configlexer.lex"
2394 { YDVAR(1, VAR_SERVER_KEY_FILE) }
2395 YY_BREAK
2396 case 94:
2397 YY_RULE_SETUP
2398 #line 220 "util/configlexer.lex"
2399 { YDVAR(1, VAR_SERVER_CERT_FILE) }
2400 YY_BREAK
2401 case 95:
2402 YY_RULE_SETUP
2403 #line 221 "util/configlexer.lex"
2404 { YDVAR(1, VAR_CONTROL_KEY_FILE) }
2405 YY_BREAK
2406 case 96:
2407 YY_RULE_SETUP
2408 #line 222 "util/configlexer.lex"
2409 { YDVAR(1, VAR_CONTROL_CERT_FILE) }
2410 YY_BREAK
2411 case 97:
2412 YY_RULE_SETUP
2413 #line 223 "util/configlexer.lex"
2414 { YDVAR(1, VAR_PYTHON_SCRIPT) }
2415 YY_BREAK
2416 case 98:
2417 YY_RULE_SETUP
2418 #line 224 "util/configlexer.lex"
2419 { YDVAR(0, VAR_PYTHON) }
2420 YY_BREAK
2421 case 99:
2422 YY_RULE_SETUP
2423 #line 225 "util/configlexer.lex"
2424 { YDVAR(1, VAR_DOMAIN_INSECURE) }
2425 YY_BREAK
2426 case 100:
2427 /* rule 100 can match eol */
2428 YY_RULE_SETUP
2429 #line 226 "util/configlexer.lex"
2430 { LEXOUT(("NL\n")); cfg_parser->line++; }
22972431 YY_BREAK
22982432 /* Quoted strings. Strip leading and ending quotes */
2299 case 94:
2300 YY_RULE_SETUP
2301 #line 207 "util/configlexer.lex"
2433 case 101:
2434 YY_RULE_SETUP
2435 #line 229 "util/configlexer.lex"
23022436 { BEGIN(quotedstring); LEXOUT(("QS ")); }
23032437 YY_BREAK
23042438 case YY_STATE_EOF(quotedstring):
2305 #line 208 "util/configlexer.lex"
2439 #line 230 "util/configlexer.lex"
23062440 {
23072441 yyerror("EOF inside quoted string");
2308 BEGIN(INITIAL);
2309 }
2310 YY_BREAK
2311 case 95:
2312 YY_RULE_SETUP
2313 #line 212 "util/configlexer.lex"
2442 if(--num_args == 0) { BEGIN(INITIAL); }
2443 else { BEGIN(val); }
2444 }
2445 YY_BREAK
2446 case 102:
2447 YY_RULE_SETUP
2448 #line 235 "util/configlexer.lex"
23142449 { LEXOUT(("STR(%s) ", yytext)); yymore(); }
23152450 YY_BREAK
2316 case 96:
2317 /* rule 96 can match eol */
2318 YY_RULE_SETUP
2319 #line 213 "util/configlexer.lex"
2320 { cfg_parser->line++; yymore(); }
2321 YY_BREAK
2322 case 97:
2323 YY_RULE_SETUP
2324 #line 214 "util/configlexer.lex"
2451 case 103:
2452 /* rule 103 can match eol */
2453 YY_RULE_SETUP
2454 #line 236 "util/configlexer.lex"
2455 { yyerror("newline inside quoted string, no end \"");
2456 cfg_parser->line++; BEGIN(INITIAL); }
2457 YY_BREAK
2458 case 104:
2459 YY_RULE_SETUP
2460 #line 238 "util/configlexer.lex"
23252461 {
23262462 LEXOUT(("QE "));
2327 BEGIN(INITIAL);
2463 if(--num_args == 0) { BEGIN(INITIAL); }
2464 else { BEGIN(val); }
23282465 yytext[yyleng - 1] = '\0';
23292466 yylval.str = strdup(yytext);
23302467 if(!yylval.str)
23312468 yyerror("out of memory");
2332 return STRING;
2469 return STRING_ARG;
23332470 }
23342471 YY_BREAK
23352472 /* Single Quoted strings. Strip leading and ending quotes */
2336 case 98:
2337 YY_RULE_SETUP
2338 #line 225 "util/configlexer.lex"
2473 case 105:
2474 YY_RULE_SETUP
2475 #line 250 "util/configlexer.lex"
23392476 { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
23402477 YY_BREAK
23412478 case YY_STATE_EOF(singlequotedstr):
2342 #line 226 "util/configlexer.lex"
2479 #line 251 "util/configlexer.lex"
23432480 {
23442481 yyerror("EOF inside quoted string");
2345 BEGIN(INITIAL);
2346 }
2347 YY_BREAK
2348 case 99:
2349 YY_RULE_SETUP
2350 #line 230 "util/configlexer.lex"
2482 if(--num_args == 0) { BEGIN(INITIAL); }
2483 else { BEGIN(val); }
2484 }
2485 YY_BREAK
2486 case 106:
2487 YY_RULE_SETUP
2488 #line 256 "util/configlexer.lex"
23512489 { LEXOUT(("STR(%s) ", yytext)); yymore(); }
23522490 YY_BREAK
2353 case 100:
2354 /* rule 100 can match eol */
2355 YY_RULE_SETUP
2356 #line 231 "util/configlexer.lex"
2357 { cfg_parser->line++; yymore(); }
2358 YY_BREAK
2359 case 101:
2360 YY_RULE_SETUP
2361 #line 232 "util/configlexer.lex"
2491 case 107:
2492 /* rule 107 can match eol */
2493 YY_RULE_SETUP
2494 #line 257 "util/configlexer.lex"
2495 { yyerror("newline inside quoted string, no end '");
2496 cfg_parser->line++; BEGIN(INITIAL); }
2497 YY_BREAK
2498 case 108:
2499 YY_RULE_SETUP
2500 #line 259 "util/configlexer.lex"
23622501 {
23632502 LEXOUT(("SQE "));
2364 BEGIN(INITIAL);
2503 if(--num_args == 0) { BEGIN(INITIAL); }
2504 else { BEGIN(val); }
23652505 yytext[yyleng - 1] = '\0';
23662506 yylval.str = strdup(yytext);
23672507 if(!yylval.str)
23682508 yyerror("out of memory");
2369 return STRING;
2509 return STRING_ARG;
23702510 }
23712511 YY_BREAK
23722512 /* include: directive */
2373 case 102:
2374 YY_RULE_SETUP
2375 #line 243 "util/configlexer.lex"
2376 { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
2513 case 109:
2514 YY_RULE_SETUP
2515 #line 271 "util/configlexer.lex"
2516 {
2517 LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); }
23772518 YY_BREAK
23782519 case YY_STATE_EOF(include):
2379 #line 244 "util/configlexer.lex"
2520 #line 273 "util/configlexer.lex"
23802521 {
23812522 yyerror("EOF inside include directive");
2382 BEGIN(INITIAL);
2383 }
2384 YY_BREAK
2385 case 103:
2386 YY_RULE_SETUP
2387 #line 248 "util/configlexer.lex"
2523 BEGIN(inc_prev);
2524 }
2525 YY_BREAK
2526 case 110:
2527 YY_RULE_SETUP
2528 #line 277 "util/configlexer.lex"
23882529 { LEXOUT(("ISP ")); /* ignore */ }
23892530 YY_BREAK
2390 case 104:
2391 /* rule 104 can match eol */
2392 YY_RULE_SETUP
2393 #line 249 "util/configlexer.lex"
2531 case 111:
2532 /* rule 111 can match eol */
2533 YY_RULE_SETUP
2534 #line 278 "util/configlexer.lex"
23942535 { LEXOUT(("NL\n")); cfg_parser->line++;}
23952536 YY_BREAK
2396 case 105:
2397 YY_RULE_SETUP
2398 #line 250 "util/configlexer.lex"
2537 case 112:
2538 YY_RULE_SETUP
2539 #line 279 "util/configlexer.lex"
23992540 { LEXOUT(("IQS ")); BEGIN(include_quoted); }
24002541 YY_BREAK
2401 case 106:
2402 YY_RULE_SETUP
2403 #line 251 "util/configlexer.lex"
2542 case 113:
2543 YY_RULE_SETUP
2544 #line 280 "util/configlexer.lex"
24042545 {
24052546 LEXOUT(("Iunquotedstr(%s) ", yytext));
24062547 config_start_include(yytext);
2407 BEGIN(INITIAL);
2548 BEGIN(inc_prev);
24082549 }
24092550 YY_BREAK
24102551 case YY_STATE_EOF(include_quoted):
2411 #line 256 "util/configlexer.lex"
2552 #line 285 "util/configlexer.lex"
24122553 {
24132554 yyerror("EOF inside quoted string");
2414 BEGIN(INITIAL);
2415 }
2416 YY_BREAK
2417 case 107:
2418 YY_RULE_SETUP
2419 #line 260 "util/configlexer.lex"
2555 BEGIN(inc_prev);
2556 }
2557 YY_BREAK
2558 case 114:
2559 YY_RULE_SETUP
2560 #line 289 "util/configlexer.lex"
24202561 { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
24212562 YY_BREAK
2422 case 108:
2423 /* rule 108 can match eol */
2424 YY_RULE_SETUP
2425 #line 261 "util/configlexer.lex"
2426 { cfg_parser->line++; yymore(); }
2427 YY_BREAK
2428 case 109:
2429 YY_RULE_SETUP
2430 #line 262 "util/configlexer.lex"
2563 case 115:
2564 /* rule 115 can match eol */
2565 YY_RULE_SETUP
2566 #line 290 "util/configlexer.lex"
2567 { yyerror("newline before \" in include name");
2568 cfg_parser->line++; BEGIN(inc_prev); }
2569 YY_BREAK
2570 case 116:
2571 YY_RULE_SETUP
2572 #line 292 "util/configlexer.lex"
24312573 {
24322574 LEXOUT(("IQE "));
24332575 yytext[yyleng - 1] = '\0';
24342576 config_start_include(yytext);
2435 BEGIN(INITIAL);
2577 BEGIN(inc_prev);
24362578 }
24372579 YY_BREAK
24382580 case YY_STATE_EOF(INITIAL):
2439 #line 268 "util/configlexer.lex"
2581 case YY_STATE_EOF(val):
2582 #line 298 "util/configlexer.lex"
24402583 {
24412584 yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
24422585 if (config_include_stack_ptr == 0) {
24472590 }
24482591 }
24492592 YY_BREAK
2450 case 110:
2451 YY_RULE_SETUP
2452 #line 278 "util/configlexer.lex"
2593 case 117:
2594 YY_RULE_SETUP
2595 #line 308 "util/configlexer.lex"
24532596 { LEXOUT(("unquotedstr(%s) ", yytext));
2454 yylval.str = strdup(yytext); return STRING; }
2455 YY_BREAK
2456 case 111:
2457 YY_RULE_SETUP
2458 #line 281 "util/configlexer.lex"
2597 if(--num_args == 0) { BEGIN(INITIAL); }
2598 yylval.str = strdup(yytext); return STRING_ARG; }
2599 YY_BREAK
2600 case 118:
2601 YY_RULE_SETUP
2602 #line 312 "util/configlexer.lex"
2603 {
2604 ub_c_error_msg("unknown keyword '%s'", yytext);
2605 }
2606 YY_BREAK
2607 case 119:
2608 YY_RULE_SETUP
2609 #line 316 "util/configlexer.lex"
2610 {
2611 ub_c_error_msg("stray '%s'", yytext);
2612 }
2613 YY_BREAK
2614 case 120:
2615 YY_RULE_SETUP
2616 #line 320 "util/configlexer.lex"
24592617 ECHO;
24602618 YY_BREAK
2461 #line 2462 "<stdout>"
2619 #line 2620 "<stdout>"
24622620
24632621 case YY_END_OF_BUFFER:
24642622 {
27482906 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
27492907 {
27502908 yy_current_state = (int) yy_def[yy_current_state];
2751 if ( yy_current_state >= 1025 )
2909 if ( yy_current_state >= 1111 )
27522910 yy_c = yy_meta[(unsigned int) yy_c];
27532911 }
27542912 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
27762934 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
27772935 {
27782936 yy_current_state = (int) yy_def[yy_current_state];
2779 if ( yy_current_state >= 1025 )
2937 if ( yy_current_state >= 1111 )
27802938 yy_c = yy_meta[(unsigned int) yy_c];
27812939 }
27822940 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2783 yy_is_jam = (yy_current_state == 1024);
2941 yy_is_jam = (yy_current_state == 1110);
27842942
27852943 return yy_is_jam ? 0 : yy_current_state;
27862944 }
34173575
34183576 #define YYTABLES_NAME "yytables"
34193577
3420 #line 281 "util/configlexer.lex"
3421
3422
3423
3578 #line 320 "util/configlexer.lex"
3579
3580
3581
2424 #define LEXOUT(s)
2525 #endif
2626
27 #define YDOUT LEXOUT(("v(%s )", yytext))
27 /** avoid warning in about fwrite return value */
28 #define ECHO ub_c_error_msg("syntax error at text: %s", yytext)
29
30 /** A parser variable, this is a statement in the config file which is
31 * of the form variable: value1 value2 ... nargs is the number of values. */
32 #define YDVAR(nargs, var) \
33 num_args=(nargs); \
34 LEXOUT(("v(%s%d) ", yytext, num_args)); \
35 if(num_args > 0) { BEGIN(val); } \
36 return (var);
2837
2938 struct inc_state {
3039 char* filename;
3342 static struct inc_state parse_stack[MAXINCLUDES];
3443 static YY_BUFFER_STATE include_stack[MAXINCLUDES];
3544 static int config_include_stack_ptr = 0;
45 static int inc_prev = 0;
46 static int num_args = 0;
3647
3748 static void config_start_include(const char* filename)
3849 {
99110 SPACE [ \t]
100111 LETTER [a-zA-Z]
101112 UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\.
113 UNQUOTEDLETTER_NOCOLON [^\:\'\"\n\r \t\\]|\\.
102114 NEWLINE [\r\n]
103115 COMMENT \#
104116 COLON \:
105117 DQANY [^\"\n\r\\]|\\.
106118 SQANY [^\'\n\r\\]|\\.
107119
108 %x quotedstring singlequotedstr include include_quoted
120 %x quotedstring singlequotedstr include include_quoted val
109121
110122 %%
111 {SPACE}* { LEXOUT(("SP ")); /* ignore */ }
112 {SPACE}*{COMMENT}.* { LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
113 server{COLON} { YDOUT; return VAR_SERVER;}
114 num-threads{COLON} { YDOUT; return VAR_NUM_THREADS;}
115 verbosity{COLON} { YDOUT; return VAR_VERBOSITY;}
116 port{COLON} { YDOUT; return VAR_PORT;}
117 outgoing-range{COLON} { YDOUT; return VAR_OUTGOING_RANGE;}
118 outgoing-port-permit{COLON} { YDOUT; return VAR_OUTGOING_PORT_PERMIT;}
119 outgoing-port-avoid{COLON} { YDOUT; return VAR_OUTGOING_PORT_AVOID;}
120 outgoing-num-tcp{COLON} { YDOUT; return VAR_OUTGOING_NUM_TCP;}
121 incoming-num-tcp{COLON} { YDOUT; return VAR_INCOMING_NUM_TCP;}
122 do-ip4{COLON} { YDOUT; return VAR_DO_IP4;}
123 do-ip6{COLON} { YDOUT; return VAR_DO_IP6;}
124 do-udp{COLON} { YDOUT; return VAR_DO_UDP;}
125 do-tcp{COLON} { YDOUT; return VAR_DO_TCP;}
126 do-daemonize{COLON} { YDOUT; return VAR_DO_DAEMONIZE;}
127 interface{COLON} { YDOUT; return VAR_INTERFACE;}
128 outgoing-interface{COLON} { YDOUT; return VAR_OUTGOING_INTERFACE;}
129 interface-automatic{COLON} { YDOUT; return VAR_INTERFACE_AUTOMATIC;}
130 chroot{COLON} { YDOUT; return VAR_CHROOT;}
131 username{COLON} { YDOUT; return VAR_USERNAME;}
132 directory{COLON} { YDOUT; return VAR_DIRECTORY;}
133 logfile{COLON} { YDOUT; return VAR_LOGFILE;}
134 pidfile{COLON} { YDOUT; return VAR_PIDFILE;}
135 root-hints{COLON} { YDOUT; return VAR_ROOT_HINTS;}
136 msg-buffer-size{COLON} { YDOUT; return VAR_MSG_BUFFER_SIZE;}
137 msg-cache-size{COLON} { YDOUT; return VAR_MSG_CACHE_SIZE;}
138 msg-cache-slabs{COLON} { YDOUT; return VAR_MSG_CACHE_SLABS;}
139 rrset-cache-size{COLON} { YDOUT; return VAR_RRSET_CACHE_SIZE;}
140 rrset-cache-slabs{COLON} { YDOUT; return VAR_RRSET_CACHE_SLABS;}
141 cache-max-ttl{COLON} { YDOUT; return VAR_CACHE_MAX_TTL;}
142 infra-host-ttl{COLON} { YDOUT; return VAR_INFRA_HOST_TTL;}
143 infra-lame-ttl{COLON} { YDOUT; return VAR_INFRA_LAME_TTL;}
144 infra-cache-slabs{COLON} { YDOUT; return VAR_INFRA_CACHE_SLABS;}
145 infra-cache-numhosts{COLON} { YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;}
146 infra-cache-lame-size{COLON} { YDOUT; return VAR_INFRA_CACHE_LAME_SIZE;}
147 num-queries-per-thread{COLON} { YDOUT; return VAR_NUM_QUERIES_PER_THREAD;}
148 jostle-timeout{COLON} { YDOUT; return VAR_JOSTLE_TIMEOUT;}
149 target-fetch-policy{COLON} { YDOUT; return VAR_TARGET_FETCH_POLICY;}
150 harden-short-bufsize{COLON} { YDOUT; return VAR_HARDEN_SHORT_BUFSIZE;}
151 harden-large-queries{COLON} { YDOUT; return VAR_HARDEN_LARGE_QUERIES;}
152 harden-glue{COLON} { YDOUT; return VAR_HARDEN_GLUE;}
153 harden-dnssec-stripped{COLON} { YDOUT; return VAR_HARDEN_DNNSEC_STRIPPED;}
154 harden-referral-path{COLON} { YDOUT; return VAR_HARDEN_REFERRAL_PATH;}
155 use-caps-for-id{COLON} { YDOUT; return VAR_USE_CAPS_FOR_ID;}
156 unwanted-reply-threshold{COLON} { YDOUT; return VAR_UNWANTED_REPLY_THRESHOLD;}
157 private-address{COLON} { YDOUT; return VAR_PRIVATE_ADDRESS;}
158 private-domain{COLON} { YDOUT; return VAR_PRIVATE_DOMAIN;}
159 stub-zone{COLON} { YDOUT; return VAR_STUB_ZONE;}
160 name{COLON} { YDOUT; return VAR_NAME;}
161 stub-addr{COLON} { YDOUT; return VAR_STUB_ADDR;}
162 stub-host{COLON} { YDOUT; return VAR_STUB_HOST;}
163 stub-prime{COLON} { YDOUT; return VAR_STUB_PRIME;}
164 forward-zone{COLON} { YDOUT; return VAR_FORWARD_ZONE;}
165 forward-addr{COLON} { YDOUT; return VAR_FORWARD_ADDR;}
166 forward-host{COLON} { YDOUT; return VAR_FORWARD_HOST;}
167 do-not-query-address{COLON} { YDOUT; return VAR_DO_NOT_QUERY_ADDRESS;}
168 do-not-query-localhost{COLON} { YDOUT; return VAR_DO_NOT_QUERY_LOCALHOST;}
169 access-control{COLON} { YDOUT; return VAR_ACCESS_CONTROL;}
170 hide-identity{COLON} { YDOUT; return VAR_HIDE_IDENTITY;}
171 hide-version{COLON} { YDOUT; return VAR_HIDE_VERSION;}
172 identity{COLON} { YDOUT; return VAR_IDENTITY;}
173 version{COLON} { YDOUT; return VAR_VERSION;}
174 module-config{COLON} { YDOUT; return VAR_MODULE_CONF;}
175 dlv-anchor{COLON} { YDOUT; return VAR_DLV_ANCHOR;}
176 dlv-anchor-file{COLON} { YDOUT; return VAR_DLV_ANCHOR_FILE;}
177 trust-anchor-file{COLON} { YDOUT; return VAR_TRUST_ANCHOR_FILE;}
178 trusted-keys-file{COLON} { YDOUT; return VAR_TRUSTED_KEYS_FILE;}
179 trust-anchor{COLON} { YDOUT; return VAR_TRUST_ANCHOR;}
180 val-override-date{COLON} { YDOUT; return VAR_VAL_OVERRIDE_DATE;}
181 val-bogus-ttl{COLON} { YDOUT; return VAR_BOGUS_TTL;}
182 val-clean-additional{COLON} { YDOUT; return VAR_VAL_CLEAN_ADDITIONAL;}
183 val-permissive-mode{COLON} { YDOUT; return VAR_VAL_PERMISSIVE_MODE;}
184 key-cache-size{COLON} { YDOUT; return VAR_KEY_CACHE_SIZE;}
185 key-cache-slabs{COLON} { YDOUT; return VAR_KEY_CACHE_SLABS;}
186 neg-cache-size{COLON} { YDOUT; return VAR_NEG_CACHE_SIZE;}
187 val-nsec3-keysize-iterations{COLON} { YDOUT; return VAR_VAL_NSEC3_KEYSIZE_ITERATIONS;}
188 use-syslog{COLON} { YDOUT; return VAR_USE_SYSLOG;}
189 local-zone{COLON} { YDOUT; return VAR_LOCAL_ZONE;}
190 local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;}
191 local-data-ptr{COLON} { YDOUT; return VAR_LOCAL_DATA_PTR;}
192 statistics-interval{COLON} { YDOUT; return VAR_STATISTICS_INTERVAL;}
193 statistics-cumulative{COLON} { YDOUT; return VAR_STATISTICS_CUMULATIVE;}
194 extended-statistics{COLON} { YDOUT; return VAR_EXTENDED_STATISTICS;}
195 remote-control{COLON} { YDOUT; return VAR_REMOTE_CONTROL; }
196 control-enable{COLON} { YDOUT; return VAR_CONTROL_ENABLE; }
197 control-interface{COLON} { YDOUT; return VAR_CONTROL_INTERFACE; }
198 control-port{COLON} { YDOUT; return VAR_CONTROL_PORT; }
199 server-key-file{COLON} { YDOUT; return VAR_SERVER_KEY_FILE; }
200 server-cert-file{COLON} { YDOUT; return VAR_SERVER_CERT_FILE; }
201 control-key-file{COLON} { YDOUT; return VAR_CONTROL_KEY_FILE; }
202 control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; }
203 {NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
123 <INITIAL,val>{SPACE}* {
124 LEXOUT(("SP ")); /* ignore */ }
125 <INITIAL,val>{SPACE}*{COMMENT}.*$ {
126 LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
127 server{COLON} { YDVAR(0, VAR_SERVER) }
128 num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) }
129 verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) }
130 port{COLON} { YDVAR(1, VAR_PORT) }
131 outgoing-range{COLON} { YDVAR(1, VAR_OUTGOING_RANGE) }
132 outgoing-port-permit{COLON} { YDVAR(1, VAR_OUTGOING_PORT_PERMIT) }
133 outgoing-port-avoid{COLON} { YDVAR(1, VAR_OUTGOING_PORT_AVOID) }
134 outgoing-num-tcp{COLON} { YDVAR(1, VAR_OUTGOING_NUM_TCP) }
135 incoming-num-tcp{COLON} { YDVAR(1, VAR_INCOMING_NUM_TCP) }
136 do-ip4{COLON} { YDVAR(1, VAR_DO_IP4) }
137 do-ip6{COLON} { YDVAR(1, VAR_DO_IP6) }
138 do-udp{COLON} { YDVAR(1, VAR_DO_UDP) }
139 do-tcp{COLON} { YDVAR(1, VAR_DO_TCP) }
140 do-daemonize{COLON} { YDVAR(1, VAR_DO_DAEMONIZE) }
141 interface{COLON} { YDVAR(1, VAR_INTERFACE) }
142 outgoing-interface{COLON} { YDVAR(1, VAR_OUTGOING_INTERFACE) }
143 interface-automatic{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
144 chroot{COLON} { YDVAR(1, VAR_CHROOT) }
145 username{COLON} { YDVAR(1, VAR_USERNAME) }
146 directory{COLON} { YDVAR(1, VAR_DIRECTORY) }
147 logfile{COLON} { YDVAR(1, VAR_LOGFILE) }
148 pidfile{COLON} { YDVAR(1, VAR_PIDFILE) }
149 root-hints{COLON} { YDVAR(1, VAR_ROOT_HINTS) }
150 msg-buffer-size{COLON} { YDVAR(1, VAR_MSG_BUFFER_SIZE) }
151 msg-cache-size{COLON} { YDVAR(1, VAR_MSG_CACHE_SIZE) }
152 msg-cache-slabs{COLON} { YDVAR(1, VAR_MSG_CACHE_SLABS) }
153 rrset-cache-size{COLON} { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
154 rrset-cache-slabs{COLON} { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
155 cache-max-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_TTL) }
156 cache-min-ttl{COLON} { YDVAR(1, VAR_CACHE_MIN_TTL) }
157 infra-host-ttl{COLON} { YDVAR(1, VAR_INFRA_HOST_TTL) }
158 infra-lame-ttl{COLON} { YDVAR(1, VAR_INFRA_LAME_TTL) }
159 infra-cache-slabs{COLON} { YDVAR(1, VAR_INFRA_CACHE_SLABS) }
160 infra-cache-numhosts{COLON} { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
161 infra-cache-lame-size{COLON} { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
162 num-queries-per-thread{COLON} { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
163 jostle-timeout{COLON} { YDVAR(1, VAR_JOSTLE_TIMEOUT) }
164 target-fetch-policy{COLON} { YDVAR(1, VAR_TARGET_FETCH_POLICY) }
165 harden-short-bufsize{COLON} { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
166 harden-large-queries{COLON} { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
167 harden-glue{COLON} { YDVAR(1, VAR_HARDEN_GLUE) }
168 harden-dnssec-stripped{COLON} { YDVAR(1, VAR_HARDEN_DNNSEC_STRIPPED) }
169 harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
170 use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
171 unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
172 private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) }
173 private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) }
174 stub-zone{COLON} { YDVAR(0, VAR_STUB_ZONE) }
175 name{COLON} { YDVAR(1, VAR_NAME) }
176 stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) }
177 stub-host{COLON} { YDVAR(1, VAR_STUB_HOST) }
178 stub-prime{COLON} { YDVAR(1, VAR_STUB_PRIME) }
179 forward-zone{COLON} { YDVAR(0, VAR_FORWARD_ZONE) }
180 forward-addr{COLON} { YDVAR(1, VAR_FORWARD_ADDR) }
181 forward-host{COLON} { YDVAR(1, VAR_FORWARD_HOST) }
182 do-not-query-address{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
183 do-not-query-localhost{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
184 access-control{COLON} { YDVAR(2, VAR_ACCESS_CONTROL) }
185 hide-identity{COLON} { YDVAR(1, VAR_HIDE_IDENTITY) }
186 hide-version{COLON} { YDVAR(1, VAR_HIDE_VERSION) }
187 identity{COLON} { YDVAR(1, VAR_IDENTITY) }
188 version{COLON} { YDVAR(1, VAR_VERSION) }
189 module-config{COLON} { YDVAR(1, VAR_MODULE_CONF) }
190 dlv-anchor{COLON} { YDVAR(1, VAR_DLV_ANCHOR) }
191 dlv-anchor-file{COLON} { YDVAR(1, VAR_DLV_ANCHOR_FILE) }
192 trust-anchor-file{COLON} { YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
193 trusted-keys-file{COLON} { YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
194 trust-anchor{COLON} { YDVAR(1, VAR_TRUST_ANCHOR) }
195 val-override-date{COLON} { YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
196 val-sig-skew-min{COLON} { YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
197 val-sig-skew-max{COLON} { YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
198 val-bogus-ttl{COLON} { YDVAR(1, VAR_BOGUS_TTL) }
199 val-clean-additional{COLON} { YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
200 val-permissive-mode{COLON} { YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
201 key-cache-size{COLON} { YDVAR(1, VAR_KEY_CACHE_SIZE) }
202 key-cache-slabs{COLON} { YDVAR(1, VAR_KEY_CACHE_SLABS) }
203 neg-cache-size{COLON} { YDVAR(1, VAR_NEG_CACHE_SIZE) }
204 val-nsec3-keysize-iterations{COLON} {
205 YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
206 use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
207 log-time-ascii{COLON} { YDVAR(1, VAR_LOG_TIME_ASCII) }
208 local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
209 local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
210 local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
211 statistics-interval{COLON} { YDVAR(1, VAR_STATISTICS_INTERVAL) }
212 statistics-cumulative{COLON} { YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
213 extended-statistics{COLON} { YDVAR(1, VAR_EXTENDED_STATISTICS) }
214 remote-control{COLON} { YDVAR(0, VAR_REMOTE_CONTROL) }
215 control-enable{COLON} { YDVAR(1, VAR_CONTROL_ENABLE) }
216 control-interface{COLON} { YDVAR(1, VAR_CONTROL_INTERFACE) }
217 control-port{COLON} { YDVAR(1, VAR_CONTROL_PORT) }
218 server-key-file{COLON} { YDVAR(1, VAR_SERVER_KEY_FILE) }
219 server-cert-file{COLON} { YDVAR(1, VAR_SERVER_CERT_FILE) }
220 control-key-file{COLON} { YDVAR(1, VAR_CONTROL_KEY_FILE) }
221 control-cert-file{COLON} { YDVAR(1, VAR_CONTROL_CERT_FILE) }
222 python-script{COLON} { YDVAR(1, VAR_PYTHON_SCRIPT) }
223 python{COLON} { YDVAR(0, VAR_PYTHON) }
224 domain-insecure{COLON} { YDVAR(1, VAR_DOMAIN_INSECURE) }
225 <INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
204226
205227 /* Quoted strings. Strip leading and ending quotes */
206 \" { BEGIN(quotedstring); LEXOUT(("QS ")); }
228 <val>\" { BEGIN(quotedstring); LEXOUT(("QS ")); }
207229 <quotedstring><<EOF>> {
208230 yyerror("EOF inside quoted string");
209 BEGIN(INITIAL);
231 if(--num_args == 0) { BEGIN(INITIAL); }
232 else { BEGIN(val); }
210233 }
211234 <quotedstring>{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
212 <quotedstring>\n { cfg_parser->line++; yymore(); }
235 <quotedstring>{NEWLINE} { yyerror("newline inside quoted string, no end \"");
236 cfg_parser->line++; BEGIN(INITIAL); }
213237 <quotedstring>\" {
214238 LEXOUT(("QE "));
215 BEGIN(INITIAL);
239 if(--num_args == 0) { BEGIN(INITIAL); }
240 else { BEGIN(val); }
216241 yytext[yyleng - 1] = '\0';
217242 yylval.str = strdup(yytext);
218243 if(!yylval.str)
219244 yyerror("out of memory");
220 return STRING;
245 return STRING_ARG;
221246 }
222247
223248 /* Single Quoted strings. Strip leading and ending quotes */
224 \' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
249 <val>\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
225250 <singlequotedstr><<EOF>> {
226251 yyerror("EOF inside quoted string");
227 BEGIN(INITIAL);
252 if(--num_args == 0) { BEGIN(INITIAL); }
253 else { BEGIN(val); }
228254 }
229255 <singlequotedstr>{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
230 <singlequotedstr>\n { cfg_parser->line++; yymore(); }
256 <singlequotedstr>{NEWLINE} { yyerror("newline inside quoted string, no end '");
257 cfg_parser->line++; BEGIN(INITIAL); }
231258 <singlequotedstr>\' {
232259 LEXOUT(("SQE "));
233 BEGIN(INITIAL);
260 if(--num_args == 0) { BEGIN(INITIAL); }
261 else { BEGIN(val); }
234262 yytext[yyleng - 1] = '\0';
235263 yylval.str = strdup(yytext);
236264 if(!yylval.str)
237265 yyerror("out of memory");
238 return STRING;
266 return STRING_ARG;
239267 }
240268
241269 /* include: directive */
242 include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
270 <INITIAL,val>include{COLON} {
271 LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); }
243272 <include><<EOF>> {
244273 yyerror("EOF inside include directive");
245 BEGIN(INITIAL);
274 BEGIN(inc_prev);
246275 }
247276 <include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ }
248277 <include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
250279 <include>{UNQUOTEDLETTER}* {
251280 LEXOUT(("Iunquotedstr(%s) ", yytext));
252281 config_start_include(yytext);
253 BEGIN(INITIAL);
282 BEGIN(inc_prev);
254283 }
255284 <include_quoted><<EOF>> {
256285 yyerror("EOF inside quoted string");
257 BEGIN(INITIAL);
286 BEGIN(inc_prev);
258287 }
259288 <include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
260 <include_quoted>{NEWLINE} { cfg_parser->line++; yymore(); }
289 <include_quoted>{NEWLINE} { yyerror("newline before \" in include name");
290 cfg_parser->line++; BEGIN(inc_prev); }
261291 <include_quoted>\" {
262292 LEXOUT(("IQE "));
263293 yytext[yyleng - 1] = '\0';
264294 config_start_include(yytext);
265 BEGIN(INITIAL);
266 }
267 <INITIAL><<EOF>> {
295 BEGIN(inc_prev);
296 }
297 <INITIAL,val><<EOF>> {
268298 yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
269299 if (config_include_stack_ptr == 0) {
270300 yyterminate();
274304 }
275305 }
276306
277 {UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext));
278 yylval.str = strdup(yytext); return STRING; }
307 <val>{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext));
308 if(--num_args == 0) { BEGIN(INITIAL); }
309 yylval.str = strdup(yytext); return STRING_ARG; }
310
311 {UNQUOTEDLETTER_NOCOLON}* {
312 ub_c_error_msg("unknown keyword '%s'", yytext);
313 }
314
315 <*>. {
316 ub_c_error_msg("stray '%s'", yytext);
317 }
279318
280319 %%
7272 COLON = 262,
7373 ANY = 263,
7474 ZONESTR = 264,
75 STRING = 265,
75 STRING_ARG = 265,
7676 VAR_SERVER = 266,
7777 VAR_VERBOSITY = 267,
7878 VAR_NUM_THREADS = 268,
162162 VAR_LOCAL_DATA_PTR = 352,
163163 VAR_JOSTLE_TIMEOUT = 353,
164164 VAR_STUB_PRIME = 354,
165 VAR_UNWANTED_REPLY_THRESHOLD = 355
165 VAR_UNWANTED_REPLY_THRESHOLD = 355,
166 VAR_LOG_TIME_ASCII = 356,
167 VAR_DOMAIN_INSECURE = 357,
168 VAR_PYTHON = 358,
169 VAR_PYTHON_SCRIPT = 359,
170 VAR_VAL_SIG_SKEW_MIN = 360,
171 VAR_VAL_SIG_SKEW_MAX = 361,
172 VAR_CACHE_MIN_TTL = 362
166173 };
167174 #endif
168175 /* Tokens. */
173180 #define COLON 262
174181 #define ANY 263
175182 #define ZONESTR 264
176 #define STRING 265
183 #define STRING_ARG 265
177184 #define VAR_SERVER 266
178185 #define VAR_VERBOSITY 267
179186 #define VAR_NUM_THREADS 268
264271 #define VAR_JOSTLE_TIMEOUT 353
265272 #define VAR_STUB_PRIME 354
266273 #define VAR_UNWANTED_REPLY_THRESHOLD 355
274 #define VAR_LOG_TIME_ASCII 356
275 #define VAR_DOMAIN_INSECURE 357
276 #define VAR_PYTHON 358
277 #define VAR_PYTHON_SCRIPT 359
278 #define VAR_VAL_SIG_SKEW_MIN 360
279 #define VAR_VAL_SIG_SKEW_MAX 361
280 #define VAR_CACHE_MIN_TTL 362
267281
268282
269283
322336 char* str;
323337 }
324338 /* Line 187 of yacc.c. */
325 #line 327 "util/configparser.c"
339 #line 341 "util/configparser.c"
326340 YYSTYPE;
327341 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
328342 # define YYSTYPE_IS_DECLARED 1
335349
336350
337351 /* Line 216 of yacc.c. */
338 #line 340 "util/configparser.c"
352 #line 354 "util/configparser.c"
339353
340354 #ifdef short
341355 # undef short
550564 /* YYFINAL -- State number of the termination state. */
551565 #define YYFINAL 2
552566 /* YYLAST -- Last index in YYTABLE. */
553 #define YYLAST 180
567 #define YYLAST 199
554568
555569 /* YYNTOKENS -- Number of terminals. */
556 #define YYNTOKENS 101
570 #define YYNTOKENS 108
557571 /* YYNNTS -- Number of nonterminals. */
558 #define YYNNTS 102
572 #define YYNNTS 111
559573 /* YYNRULES -- Number of rules. */
560 #define YYNRULES 193
574 #define YYNRULES 209
561575 /* YYNRULES -- Number of states. */
562 #define YYNSTATES 283
576 #define YYNSTATES 305
563577
564578 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
565579 #define YYUNDEFTOK 2
566 #define YYMAXUTOK 355
580 #define YYMAXUTOK 362
567581
568582 #define YYTRANSLATE(YYX) \
569583 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
606620 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
607621 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
608622 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
609 95, 96, 97, 98, 99, 100
623 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
624 105, 106, 107
610625 };
611626
612627 #if YYDEBUG
614629 YYRHS. */
615630 static const yytype_uint16 yyprhs[] =
616631 {
617 0, 0, 3, 4, 7, 10, 13, 16, 19, 21,
618 24, 25, 27, 29, 31, 33, 35, 37, 39, 41,
619 43, 45, 47, 49, 51, 53, 55, 57, 59, 61,
620 63, 65, 67, 69, 71, 73, 75, 77, 79, 81,
621 83, 85, 87, 89, 91, 93, 95, 97, 99, 101,
622 103, 105, 107, 109, 111, 113, 115, 117, 119, 121,
623 123, 125, 127, 129, 131, 133, 135, 137, 139, 141,
624 143, 145, 147, 149, 151, 153, 155, 157, 159, 161,
625 163, 165, 167, 169, 171, 173, 176, 177, 179, 181,
626 183, 185, 187, 190, 191, 193, 195, 197, 200, 203,
627 206, 209, 212, 215, 218, 221, 224, 227, 230, 233,
628 236, 239, 242, 245, 248, 251, 254, 257, 260, 263,
629 266, 269, 272, 275, 278, 281, 284, 287, 290, 293,
630 296, 299, 302, 305, 308, 311, 314, 317, 320, 323,
631 326, 329, 332, 335, 338, 341, 344, 347, 350, 353,
632 356, 359, 362, 365, 368, 371, 374, 378, 381, 384,
633 387, 390, 393, 396, 399, 402, 405, 408, 412, 415,
634 418, 421, 424, 427, 430, 433, 436, 439, 441, 444,
635 445, 447, 449, 451, 453, 455, 457, 459, 462, 465,
636 468, 471, 474, 477
632 0, 0, 3, 4, 7, 10, 13, 16, 19, 22,
633 24, 27, 28, 30, 32, 34, 36, 38, 40, 42,
634 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
635 64, 66, 68, 70, 72, 74, 76, 78, 80, 82,
636 84, 86, 88, 90, 92, 94, 96, 98, 100, 102,
637 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
638 124, 126, 128, 130, 132, 134, 136, 138, 140, 142,
639 144, 146, 148, 150, 152, 154, 156, 158, 160, 162,
640 164, 166, 168, 170, 172, 174, 176, 178, 180, 182,
641 184, 186, 189, 190, 192, 194, 196, 198, 200, 203,
642 204, 206, 208, 210, 213, 216, 219, 222, 225, 228,
643 231, 234, 237, 240, 243, 246, 249, 252, 255, 258,
644 261, 264, 267, 270, 273, 276, 279, 282, 285, 288,
645 291, 294, 297, 300, 303, 306, 309, 312, 315, 318,
646 321, 324, 327, 330, 333, 336, 339, 342, 345, 348,
647 351, 354, 357, 360, 363, 366, 369, 372, 375, 378,
648 381, 384, 387, 390, 393, 397, 400, 403, 406, 409,
649 412, 415, 418, 421, 424, 427, 430, 433, 436, 440,
650 443, 446, 449, 452, 455, 458, 461, 464, 467, 469,
651 472, 473, 475, 477, 479, 481, 483, 485, 487, 490,
652 493, 496, 499, 502, 505, 508, 510, 513, 514, 516
637653 };
638654
639655 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
640656 static const yytype_int16 yyrhs[] =
641657 {
642 102, 0, -1, -1, 102, 103, -1, 104, 105, -1,
643 107, 108, -1, 110, 111, -1, 193, 194, -1, 11,
644 -1, 105, 106, -1, -1, 113, -1, 114, -1, 118,
645 -1, 121, -1, 127, -1, 128, -1, 129, -1, 130,
646 -1, 119, -1, 133, -1, 134, -1, 135, -1, 136,
647 -1, 137, -1, 149, -1, 150, -1, 151, -1, 153,
648 -1, 154, -1, 124, -1, 155, -1, 156, -1, 159,
649 -1, 157, -1, 158, -1, 160, -1, 161, -1, 162,
650 -1, 170, -1, 144, -1, 145, -1, 146, -1, 147,
651 -1, 163, -1, 173, -1, 141, -1, 143, -1, 174,
652 -1, 176, -1, 177, -1, 178, -1, 125, -1, 148,
653 -1, 180, -1, 181, -1, 142, -1, 179, -1, 132,
654 -1, 120, -1, 138, -1, 171, -1, 175, -1, 164,
655 -1, 172, -1, 183, -1, 184, -1, 126, -1, 115,
656 -1, 131, -1, 166, -1, 116, -1, 122, -1, 123,
657 -1, 139, -1, 140, -1, 182, -1, 165, -1, 167,
658 -1, 168, -1, 117, -1, 185, -1, 152, -1, 169,
659 -1, 38, -1, 108, 109, -1, -1, 186, -1, 187,
660 -1, 188, -1, 189, -1, 44, -1, 111, 112, -1,
661 -1, 190, -1, 191, -1, 192, -1, 13, 10, -1,
662 12, 10, -1, 76, 10, -1, 79, 10, -1, 96,
663 10, -1, 14, 10, -1, 16, 10, -1, 67, 10,
664 -1, 15, 10, -1, 80, 10, -1, 81, 10, -1,
665 31, 10, -1, 60, 10, -1, 75, 10, -1, 17,
666 10, -1, 18, 10, -1, 19, 10, -1, 20, 10,
667 -1, 77, 10, -1, 66, 10, -1, 21, 10, -1,
668 22, 10, -1, 23, 10, -1, 24, 10, -1, 25,
669 10, -1, 68, 10, -1, 82, 10, -1, 83, 10,
670 -1, 54, 10, -1, 64, 10, -1, 55, 10, -1,
671 48, 10, -1, 49, 10, -1, 50, 10, -1, 51,
672 10, -1, 61, 10, -1, 26, 10, -1, 27, 10,
673 -1, 28, 10, -1, 98, 10, -1, 29, 10, -1,
674 30, 10, -1, 32, 10, -1, 33, 10, -1, 35,
675 10, -1, 36, 10, -1, 34, 10, -1, 41, 10,
676 -1, 42, 10, -1, 43, 10, -1, 52, 10, -1,
677 71, 10, -1, 85, 10, -1, 78, 10, -1, 86,
678 10, -1, 87, 10, -1, 100, 10, -1, 47, 10,
679 -1, 69, 10, -1, 72, 10, 10, -1, 53, 10,
680 -1, 56, 10, -1, 70, 10, -1, 57, 10, -1,
681 58, 10, -1, 59, 10, -1, 65, 10, -1, 62,
682 10, -1, 63, 10, -1, 84, 10, -1, 73, 10,
683 10, -1, 74, 10, -1, 97, 10, -1, 37, 10,
684 -1, 39, 10, -1, 40, 10, -1, 99, 10, -1,
685 37, 10, -1, 45, 10, -1, 46, 10, -1, 88,
686 -1, 194, 195, -1, -1, 196, -1, 198, -1, 197,
687 -1, 199, -1, 200, -1, 201, -1, 202, -1, 89,
688 10, -1, 91, 10, -1, 90, 10, -1, 92, 10,
689 -1, 93, 10, -1, 94, 10, -1, 95, 10, -1
658 109, 0, -1, -1, 109, 110, -1, 111, 112, -1,
659 114, 115, -1, 117, 118, -1, 215, 216, -1, 205,
660 206, -1, 11, -1, 112, 113, -1, -1, 120, -1,
661 121, -1, 125, -1, 128, -1, 134, -1, 135, -1,
662 136, -1, 137, -1, 126, -1, 141, -1, 142, -1,
663 143, -1, 144, -1, 145, -1, 158, -1, 159, -1,
664 160, -1, 162, -1, 163, -1, 131, -1, 164, -1,
665 165, -1, 168, -1, 166, -1, 167, -1, 169, -1,
666 170, -1, 171, -1, 179, -1, 153, -1, 154, -1,
667 155, -1, 156, -1, 172, -1, 182, -1, 149, -1,
668 151, -1, 183, -1, 188, -1, 189, -1, 190, -1,
669 132, -1, 157, -1, 192, -1, 193, -1, 150, -1,
670 191, -1, 139, -1, 127, -1, 146, -1, 180, -1,
671 186, -1, 173, -1, 181, -1, 195, -1, 196, -1,
672 133, -1, 122, -1, 138, -1, 175, -1, 123, -1,
673 129, -1, 130, -1, 147, -1, 148, -1, 194, -1,
674 174, -1, 176, -1, 177, -1, 124, -1, 197, -1,
675 161, -1, 178, -1, 140, -1, 152, -1, 184, -1,
676 185, -1, 187, -1, 38, -1, 115, 116, -1, -1,
677 198, -1, 199, -1, 200, -1, 201, -1, 44, -1,
678 118, 119, -1, -1, 202, -1, 203, -1, 204, -1,
679 13, 10, -1, 12, 10, -1, 76, 10, -1, 79,
680 10, -1, 96, 10, -1, 14, 10, -1, 16, 10,
681 -1, 67, 10, -1, 15, 10, -1, 80, 10, -1,
682 81, 10, -1, 31, 10, -1, 60, 10, -1, 75,
683 10, -1, 17, 10, -1, 18, 10, -1, 19, 10,
684 -1, 20, 10, -1, 77, 10, -1, 66, 10, -1,
685 101, 10, -1, 21, 10, -1, 22, 10, -1, 23,
686 10, -1, 24, 10, -1, 25, 10, -1, 68, 10,
687 -1, 82, 10, -1, 83, 10, -1, 54, 10, -1,
688 64, 10, -1, 55, 10, -1, 102, 10, -1, 48,
689 10, -1, 49, 10, -1, 50, 10, -1, 51, 10,
690 -1, 61, 10, -1, 26, 10, -1, 27, 10, -1,
691 28, 10, -1, 98, 10, -1, 29, 10, -1, 30,
692 10, -1, 32, 10, -1, 33, 10, -1, 35, 10,
693 -1, 36, 10, -1, 34, 10, -1, 41, 10, -1,
694 42, 10, -1, 43, 10, -1, 52, 10, -1, 71,
695 10, -1, 85, 10, -1, 78, 10, -1, 86, 10,
696 -1, 87, 10, -1, 100, 10, -1, 47, 10, -1,
697 69, 10, -1, 72, 10, 10, -1, 53, 10, -1,
698 56, 10, -1, 105, 10, -1, 106, 10, -1, 70,
699 10, -1, 107, 10, -1, 57, 10, -1, 58, 10,
700 -1, 59, 10, -1, 65, 10, -1, 62, 10, -1,
701 63, 10, -1, 84, 10, -1, 73, 10, 10, -1,
702 74, 10, -1, 97, 10, -1, 37, 10, -1, 39,
703 10, -1, 40, 10, -1, 99, 10, -1, 37, 10,
704 -1, 45, 10, -1, 46, 10, -1, 88, -1, 206,
705 207, -1, -1, 208, -1, 210, -1, 209, -1, 211,
706 -1, 212, -1, 213, -1, 214, -1, 89, 10, -1,
707 91, 10, -1, 90, 10, -1, 92, 10, -1, 93,
708 10, -1, 94, 10, -1, 95, 10, -1, 103, -1,
709 216, 217, -1, -1, 218, -1, 104, 10, -1
690710 };
691711
692712 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
693713 static const yytype_uint16 yyrline[] =
694714 {
695 0, 102, 102, 102, 103, 103, 104, 104, 108, 113,
696 114, 115, 115, 115, 116, 116, 117, 117, 117, 118,
697 118, 118, 119, 119, 119, 120, 120, 121, 121, 122,
698 122, 123, 123, 124, 124, 125, 125, 126, 126, 127,
699 127, 128, 128, 128, 129, 129, 129, 130, 130, 130,
700 131, 131, 132, 132, 133, 133, 134, 134, 135, 135,
701 135, 136, 136, 137, 137, 138, 138, 138, 139, 139,
702 140, 140, 141, 141, 142, 142, 142, 143, 143, 144,
703 144, 145, 145, 146, 148, 160, 161, 162, 162, 162,
704 162, 164, 176, 177, 178, 178, 178, 180, 189, 198,
705 209, 218, 227, 236, 249, 264, 273, 282, 291, 300,
706 309, 318, 327, 336, 345, 354, 363, 377, 384, 391,
707 398, 406, 413, 420, 427, 434, 442, 450, 457, 466,
708 475, 482, 489, 500, 508, 521, 530, 539, 547, 560,
709 569, 578, 587, 596, 609, 616, 626, 636, 646, 656,
710 666, 676, 683, 690, 699, 706, 716, 730, 737, 755,
711 764, 773, 783, 793, 800, 808, 821, 829, 849, 856,
712 871, 878, 885, 892, 902, 909, 916, 923, 928, 929,
713 930, 930, 930, 931, 931, 931, 932, 934, 944, 953,
714 960, 967, 974, 981
715 0, 104, 104, 104, 105, 105, 106, 106, 107, 111,
716 116, 117, 118, 118, 118, 119, 119, 120, 120, 120,
717 121, 121, 121, 122, 122, 122, 123, 123, 124, 124,
718 125, 125, 126, 126, 127, 127, 128, 128, 129, 129,
719 130, 130, 131, 131, 131, 132, 132, 132, 133, 133,
720 133, 134, 134, 135, 135, 136, 136, 137, 137, 138,
721 138, 138, 139, 139, 140, 140, 141, 141, 141, 142,
722 142, 143, 143, 144, 144, 145, 145, 145, 146, 146,
723 147, 147, 148, 148, 149, 149, 150, 150, 151, 151,
724 153, 165, 166, 167, 167, 167, 167, 169, 181, 182,
725 183, 183, 183, 185, 194, 203, 214, 223, 232, 241,
726 254, 269, 278, 287, 296, 305, 314, 323, 332, 341,
727 350, 359, 368, 382, 391, 398, 405, 412, 420, 427,
728 434, 441, 448, 456, 464, 471, 478, 487, 496, 503,
729 510, 521, 529, 542, 551, 560, 568, 581, 590, 599,
730 608, 617, 630, 637, 647, 657, 667, 677, 687, 697,
731 704, 711, 720, 727, 737, 751, 758, 776, 789, 802,
732 811, 820, 829, 839, 849, 856, 864, 877, 885, 905,
733 912, 927, 934, 941, 948, 958, 965, 972, 979, 984,
734 985, 986, 986, 986, 987, 987, 987, 988, 990, 1000,
735 1009, 1016, 1023, 1030, 1037, 1044, 1049, 1050, 1051, 1053
715736 };
716737 #endif
717738
721742 static const char *const yytname[] =
722743 {
723744 "$end", "error", "$undefined", "SPACE", "LETTER", "NEWLINE", "COMMENT",
724 "COLON", "ANY", "ZONESTR", "STRING", "VAR_SERVER", "VAR_VERBOSITY",
745 "COLON", "ANY", "ZONESTR", "STRING_ARG", "VAR_SERVER", "VAR_VERBOSITY",
725746 "VAR_NUM_THREADS", "VAR_PORT", "VAR_OUTGOING_RANGE", "VAR_INTERFACE",
726747 "VAR_DO_IP4", "VAR_DO_IP6", "VAR_DO_UDP", "VAR_DO_TCP", "VAR_CHROOT",
727748 "VAR_USERNAME", "VAR_DIRECTORY", "VAR_LOGFILE", "VAR_PIDFILE",
751772 "VAR_CONTROL_INTERFACE", "VAR_CONTROL_PORT", "VAR_SERVER_KEY_FILE",
752773 "VAR_SERVER_CERT_FILE", "VAR_CONTROL_KEY_FILE", "VAR_CONTROL_CERT_FILE",
753774 "VAR_EXTENDED_STATISTICS", "VAR_LOCAL_DATA_PTR", "VAR_JOSTLE_TIMEOUT",
754 "VAR_STUB_PRIME", "VAR_UNWANTED_REPLY_THRESHOLD", "$accept",
755 "toplevelvars", "toplevelvar", "serverstart", "contents_server",
756 "content_server", "stubstart", "contents_stub", "content_stub",
757 "forwardstart", "contents_forward", "content_forward",
775 "VAR_STUB_PRIME", "VAR_UNWANTED_REPLY_THRESHOLD", "VAR_LOG_TIME_ASCII",
776 "VAR_DOMAIN_INSECURE", "VAR_PYTHON", "VAR_PYTHON_SCRIPT",
777 "VAR_VAL_SIG_SKEW_MIN", "VAR_VAL_SIG_SKEW_MAX", "VAR_CACHE_MIN_TTL",
778 "$accept", "toplevelvars", "toplevelvar", "serverstart",
779 "contents_server", "content_server", "stubstart", "contents_stub",
780 "content_stub", "forwardstart", "contents_forward", "content_forward",
758781 "server_num_threads", "server_verbosity", "server_statistics_interval",
759782 "server_statistics_cumulative", "server_extended_statistics",
760783 "server_port", "server_interface", "server_outgoing_interface",
762785 "server_outgoing_port_avoid", "server_outgoing_num_tcp",
763786 "server_incoming_num_tcp", "server_interface_automatic", "server_do_ip4",
764787 "server_do_ip6", "server_do_udp", "server_do_tcp", "server_do_daemonize",
765 "server_use_syslog", "server_chroot", "server_username",
766 "server_directory", "server_logfile", "server_pidfile",
767 "server_root_hints", "server_dlv_anchor_file", "server_dlv_anchor",
768 "server_trust_anchor_file", "server_trusted_keys_file",
769 "server_trust_anchor", "server_hide_identity", "server_hide_version",
788 "server_use_syslog", "server_log_time_ascii", "server_chroot",
789 "server_username", "server_directory", "server_logfile",
790 "server_pidfile", "server_root_hints", "server_dlv_anchor_file",
791 "server_dlv_anchor", "server_trust_anchor_file",
792 "server_trusted_keys_file", "server_trust_anchor",
793 "server_domain_insecure", "server_hide_identity", "server_hide_version",
770794 "server_identity", "server_version", "server_msg_buffer_size",
771795 "server_msg_cache_size", "server_msg_cache_slabs",
772796 "server_num_queries_per_thread", "server_jostle_timeout",
780804 "server_private_address", "server_private_domain",
781805 "server_unwanted_reply_threshold", "server_do_not_query_address",
782806 "server_do_not_query_localhost", "server_access_control",
783 "server_module_conf", "server_val_override_date", "server_cache_max_ttl",
784 "server_bogus_ttl", "server_val_clean_additional",
785 "server_val_permissive_mode", "server_val_nsec3_keysize_iterations",
786 "server_key_cache_size", "server_key_cache_slabs",
787 "server_neg_cache_size", "server_local_zone", "server_local_data",
788 "server_local_data_ptr", "stub_name", "stub_host", "stub_addr",
789 "stub_prime", "forward_name", "forward_host", "forward_addr", "rcstart",
790 "contents_rc", "content_rc", "rc_control_enable", "rc_control_port",
791 "rc_control_interface", "rc_server_key_file", "rc_server_cert_file",
792 "rc_control_key_file", "rc_control_cert_file", 0
807 "server_module_conf", "server_val_override_date",
808 "server_val_sig_skew_min", "server_val_sig_skew_max",
809 "server_cache_max_ttl", "server_cache_min_ttl", "server_bogus_ttl",
810 "server_val_clean_additional", "server_val_permissive_mode",
811 "server_val_nsec3_keysize_iterations", "server_key_cache_size",
812 "server_key_cache_slabs", "server_neg_cache_size", "server_local_zone",
813 "server_local_data", "server_local_data_ptr", "stub_name", "stub_host",
814 "stub_addr", "stub_prime", "forward_name", "forward_host",
815 "forward_addr", "rcstart", "contents_rc", "content_rc",
816 "rc_control_enable", "rc_control_port", "rc_control_interface",
817 "rc_server_key_file", "rc_server_cert_file", "rc_control_key_file",
818 "rc_control_cert_file", "pythonstart", "contents_py", "content_py",
819 "py_script", 0
793820 };
794821 #endif
795822
808835 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
809836 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
810837 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
811 355
838 355, 356, 357, 358, 359, 360, 361, 362
812839 };
813840 # endif
814841
815842 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
816843 static const yytype_uint8 yyr1[] =
817844 {
818 0, 101, 102, 102, 103, 103, 103, 103, 104, 105,
819 105, 106, 106, 106, 106, 106, 106, 106, 106, 106,
820 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
821 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
822 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
823 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
824 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
825 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
826 106, 106, 106, 106, 107, 108, 108, 109, 109, 109,
827 109, 110, 111, 111, 112, 112, 112, 113, 114, 115,
845 0, 108, 109, 109, 110, 110, 110, 110, 110, 111,
846 112, 112, 113, 113, 113, 113, 113, 113, 113, 113,
847 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
848 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
849 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
850 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
851 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
852 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
853 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
854 114, 115, 115, 116, 116, 116, 116, 117, 118, 118,
855 119, 119, 119, 120, 121, 122, 123, 124, 125, 126,
856 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
857 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
858 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
859 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
860 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
861 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
862 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
863 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
864 206, 207, 207, 207, 207, 207, 207, 207, 208, 209,
865 210, 211, 212, 213, 214, 215, 216, 216, 217, 218
866 };
867
868 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
869 static const yytype_uint8 yyr2[] =
870 {
871 0, 2, 0, 2, 2, 2, 2, 2, 2, 1,
872 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
873 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
874 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
875 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
876 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
877 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
878 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
879 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
880 1, 2, 0, 1, 1, 1, 1, 1, 2, 0,
881 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
882 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
883 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
884 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
885 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
886 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
887 2, 2, 2, 2, 3, 2, 2, 2, 2, 2,
888 2, 2, 2, 2, 2, 2, 2, 2, 3, 2,
889 2, 2, 2, 2, 2, 2, 2, 2, 1, 2,
890 0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
891 2, 2, 2, 2, 2, 1, 2, 0, 1, 2
892 };
893
894 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
895 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
896 means the default is an error. */
897 static const yytype_uint8 yydefact[] =
898 {
899 2, 0, 1, 9, 90, 97, 188, 205, 3, 11,
900 92, 99, 190, 207, 4, 5, 6, 8, 7, 0,
901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
904 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
906 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
907 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
908 0, 0, 0, 0, 0, 0, 0, 10, 12, 13,
909 69, 72, 81, 14, 20, 60, 15, 73, 74, 31,
910 53, 68, 16, 17, 18, 19, 70, 59, 85, 21,
911 22, 23, 24, 25, 61, 75, 76, 47, 57, 48,
912 86, 41, 42, 43, 44, 54, 26, 27, 28, 83,
913 29, 30, 32, 33, 35, 36, 34, 37, 38, 39,
914 45, 64, 78, 71, 79, 80, 84, 40, 62, 65,
915 46, 49, 87, 88, 63, 89, 50, 51, 52, 58,
916 55, 56, 77, 66, 67, 82, 0, 0, 0, 0,
917 91, 93, 94, 95, 96, 0, 0, 0, 98, 100,
918 101, 102, 0, 0, 0, 0, 0, 0, 0, 189,
919 191, 193, 192, 194, 195, 196, 197, 0, 206, 208,
920 104, 103, 108, 111, 109, 117, 118, 119, 120, 124,
921 125, 126, 127, 128, 141, 142, 143, 145, 146, 114,
922 147, 148, 151, 149, 150, 152, 153, 154, 162, 136,
923 137, 138, 139, 155, 165, 132, 134, 166, 171, 172,
924 173, 115, 140, 175, 176, 133, 174, 122, 110, 129,
925 163, 169, 156, 0, 0, 179, 116, 105, 121, 158,
926 106, 112, 113, 130, 131, 177, 157, 159, 160, 107,
927 180, 144, 161, 123, 135, 167, 168, 170, 181, 182,
928 183, 184, 185, 186, 187, 198, 200, 199, 201, 202,
929 203, 204, 209, 164, 178
930 };
931
932 /* YYDEFGOTO[NTERM-NUM]. */
933 static const yytype_int16 yydefgoto[] =
934 {
935 -1, 1, 8, 9, 14, 97, 10, 15, 180, 11,
936 16, 188, 98, 99, 100, 101, 102, 103, 104, 105,
937 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
828938 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
829939 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
830940 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
831941 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
832942 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
833943 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
834 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
835 186, 187, 188, 189, 190, 191, 192, 193, 194, 194,
836 195, 195, 195, 195, 195, 195, 195, 196, 197, 198,
837 199, 200, 201, 202
838 };
839
840 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
841 static const yytype_uint8 yyr2[] =
842 {
843 0, 2, 0, 2, 2, 2, 2, 2, 1, 2,
844 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
845 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
846 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
847 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
848 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
849 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
850 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
851 1, 1, 1, 1, 1, 2, 0, 1, 1, 1,
852 1, 1, 2, 0, 1, 1, 1, 2, 2, 2,
853 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
854 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
855 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
856 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
857 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
858 2, 2, 2, 2, 2, 2, 3, 2, 2, 2,
859 2, 2, 2, 2, 2, 2, 2, 3, 2, 2,
860 2, 2, 2, 2, 2, 2, 2, 1, 2, 0,
861 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
862 2, 2, 2, 2
863 };
864
865 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
866 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
867 means the default is an error. */
868 static const yytype_uint8 yydefact[] =
869 {
870 2, 0, 1, 8, 84, 91, 177, 3, 10, 86,
871 93, 179, 4, 5, 6, 7, 0, 0, 0, 0,
872 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
873 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
874 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
875 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
877 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
878 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
879 11, 12, 68, 71, 80, 13, 19, 59, 14, 72,
880 73, 30, 52, 67, 15, 16, 17, 18, 69, 58,
881 20, 21, 22, 23, 24, 60, 74, 75, 46, 56,
882 47, 40, 41, 42, 43, 53, 25, 26, 27, 82,
883 28, 29, 31, 32, 34, 35, 33, 36, 37, 38,
884 44, 63, 77, 70, 78, 79, 83, 39, 61, 64,
885 45, 48, 62, 49, 50, 51, 57, 54, 55, 76,
886 65, 66, 81, 0, 0, 0, 0, 85, 87, 88,
887 89, 90, 0, 0, 0, 92, 94, 95, 96, 0,
888 0, 0, 0, 0, 0, 0, 178, 180, 182, 181,
889 183, 184, 185, 186, 98, 97, 102, 105, 103, 111,
890 112, 113, 114, 117, 118, 119, 120, 121, 133, 134,
891 135, 137, 138, 108, 139, 140, 143, 141, 142, 144,
892 145, 146, 154, 128, 129, 130, 131, 147, 157, 125,
893 127, 158, 160, 161, 162, 109, 132, 164, 165, 126,
894 163, 116, 104, 122, 155, 159, 148, 0, 0, 168,
895 110, 99, 115, 150, 100, 106, 107, 123, 124, 166,
896 149, 151, 152, 101, 169, 136, 153, 170, 171, 172,
897 173, 174, 175, 176, 187, 189, 188, 190, 191, 192,
898 193, 156, 167
899 };
900
901 /* YYDEFGOTO[NTERM-NUM]. */
902 static const yytype_int16 yydefgoto[] =
903 {
904 -1, 1, 7, 8, 12, 89, 9, 13, 167, 10,
905 14, 175, 90, 91, 92, 93, 94, 95, 96, 97,
906 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
907 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
908 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
909 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
910 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
911 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
912 158, 159, 160, 161, 162, 168, 169, 170, 171, 176,
913 177, 178, 11, 15, 186, 187, 188, 189, 190, 191,
914 192, 193
944 181, 182, 183, 184, 189, 190, 191, 12, 17, 199,
945 200, 201, 202, 203, 204, 205, 206, 13, 18, 208,
946 209
915947 };
916948
917949 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
918950 STATE-NUM. */
919 #define YYPACT_NINF -13
951 #define YYPACT_NINF -103
920952 static const yytype_int16 yypact[] =
921953 {
922 -13, 76, -13, -13, -13, -13, -13, -13, -13, -13,
923 -13, -13, -12, 40, 44, 2, 15, 16, 17, 18,
924 22, 23, 24, 68, 72, 73, 88, 89, 90, 91,
925 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
926 102, 103, 105, 106, 107, 108, 109, 111, 112, 113,
927 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
928 124, 125, 126, 127, 128, 130, 131, 132, 133, 134,
929 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
930 145, 146, 147, 148, 149, 150, 151, 152, 153, -13,
931 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
932 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
933 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
934 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
935 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
936 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
937 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
938 -13, -13, -13, 155, 156, 157, 158, -13, -13, -13,
939 -13, -13, 159, 160, 161, -13, -13, -13, -13, 162,
940 163, 164, 165, 166, 167, 168, -13, -13, -13, -13,
941 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
942 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
943 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
944 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
945 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
946 -13, -13, -13, -13, -13, -13, -13, 169, 170, -13,
947 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
948 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
949 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
950 -13, -13, -13
954 -103, 0, -103, -103, -103, -103, -103, -103, -103, -103,
955 -103, -103, -103, -103, 92, -36, -32, -74, -102, -4,
956 -3, -2, -1, 2, 12, 13, 14, 15, 16, 17,
957 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
958 29, 30, 31, 32, 33, 35, 36, 37, 38, 39,
959 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
960 50, 51, 52, 54, 55, 56, 57, 58, 59, 60,
961 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
962 71, 72, 73, 74, 75, 76, 77, 79, 80, 81,
963 82, 83, 84, 85, 86, 87, 88, -103, -103, -103,
964 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
965 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
966 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
967 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
968 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
969 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
970 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
971 -103, -103, -103, -103, -103, -103, 89, 90, 91, 119,
972 -103, -103, -103, -103, -103, 120, 121, 122, -103, -103,
973 -103, -103, 126, 127, 128, 170, 171, 172, 173, -103,
974 -103, -103, -103, -103, -103, -103, -103, 174, -103, -103,
975 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
976 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
977 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
978 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
979 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
980 -103, -103, -103, 175, 176, -103, -103, -103, -103, -103,
981 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
982 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
983 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
984 -103, -103, -103, -103, -103
951985 };
952986
953987 /* YYPGOTO[NTERM-NUM]. */
954988 static const yytype_int8 yypgoto[] =
955989 {
956 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
957 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
958 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
959 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
960 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
961 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
962 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
963 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
964 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
965 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
966 -13, -13
990 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
991 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
992 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
993 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
994 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
995 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
996 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
997 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
998 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
999 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
1000 -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
1001 -103
9671002 };
9681003
9691004 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
9731008 #define YYTABLE_NINF -1
9741009 static const yytype_uint16 yytable[] =
9751010 {
976 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
977 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
978 36, 37, 38, 39, 40, 194, 195, 196, 197, 41,
979 42, 43, 198, 199, 200, 44, 45, 46, 47, 48,
980 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
981 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
982 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
983 79, 80, 81, 82, 83, 84, 2, 163, 201, 164,
984 165, 172, 202, 203, 85, 86, 87, 3, 88, 173,
985 174, 179, 180, 181, 182, 183, 184, 185, 204, 205,
986 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
987 216, 217, 218, 219, 4, 220, 221, 222, 223, 224,
988 5, 225, 226, 227, 228, 229, 230, 231, 232, 233,
989 234, 235, 236, 237, 238, 239, 240, 241, 242, 166,
990 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
991 253, 254, 255, 256, 257, 258, 259, 260, 261, 262,
992 263, 264, 265, 266, 6, 267, 268, 269, 270, 271,
993 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
994 282
1011 2, 176, 207, 177, 178, 185, 210, 211, 212, 213,
1012 0, 3, 214, 186, 187, 192, 193, 194, 195, 196,
1013 197, 198, 215, 216, 217, 218, 219, 220, 221, 222,
1014 223, 224, 225, 226, 227, 228, 229, 230, 4, 231,
1015 232, 233, 234, 235, 5, 236, 237, 238, 239, 240,
1016 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
1017 251, 252, 253, 179, 254, 255, 256, 257, 258, 259,
1018 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
1019 270, 271, 272, 273, 274, 275, 276, 277, 6, 278,
1020 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
1021 289, 290, 0, 7, 19, 20, 21, 22, 23, 24,
1022 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1023 35, 36, 37, 38, 39, 40, 41, 42, 43, 291,
1024 292, 293, 294, 44, 45, 46, 295, 296, 297, 47,
1025 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1026 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
1027 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1028 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1029 298, 299, 300, 301, 302, 303, 304, 0, 88, 89,
1030 90, 0, 91, 92, 93, 0, 0, 94, 95, 96
9951031 };
9961032
997 static const yytype_uint8 yycheck[] =
1033 static const yytype_int8 yycheck[] =
9981034 {
999 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1000 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1001 32, 33, 34, 35, 36, 10, 10, 10, 10, 41,
1002 42, 43, 10, 10, 10, 47, 48, 49, 50, 51,
1003 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
1004 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1005 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1006 82, 83, 84, 85, 86, 87, 0, 37, 10, 39,
1007 40, 37, 10, 10, 96, 97, 98, 11, 100, 45,
1008 46, 89, 90, 91, 92, 93, 94, 95, 10, 10,
1035 0, 37, 104, 39, 40, 37, 10, 10, 10, 10,
1036 -1, 11, 10, 45, 46, 89, 90, 91, 92, 93,
1037 94, 95, 10, 10, 10, 10, 10, 10, 10, 10,
1038 10, 10, 10, 10, 10, 10, 10, 10, 38, 10,
1039 10, 10, 10, 10, 44, 10, 10, 10, 10, 10,
10091040 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1010 10, 10, 10, 10, 38, 10, 10, 10, 10, 10,
1011 44, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1012 10, 10, 10, 10, 10, 10, 10, 10, 10, 99,
1041 10, 10, 10, 99, 10, 10, 10, 10, 10, 10,
10131042 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1043 10, 10, 10, 10, 10, 10, 10, 10, 88, 10,
10141044 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1015 10, 10, 10, 10, 88, 10, 10, 10, 10, 10,
1016 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1017 10
1045 10, 10, -1, 103, 12, 13, 14, 15, 16, 17,
1046 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1047 28, 29, 30, 31, 32, 33, 34, 35, 36, 10,
1048 10, 10, 10, 41, 42, 43, 10, 10, 10, 47,
1049 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1050 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
1051 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1052 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1053 10, 10, 10, 10, 10, 10, 10, -1, 96, 97,
1054 98, -1, 100, 101, 102, -1, -1, 105, 106, 107
10181055 };
10191056
10201057 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
10211058 symbol of state STATE-NUM. */
10221059 static const yytype_uint8 yystos[] =
10231060 {
1024 0, 102, 0, 11, 38, 44, 88, 103, 104, 107,
1025 110, 193, 105, 108, 111, 194, 12, 13, 14, 15,
1026 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1027 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1028 36, 41, 42, 43, 47, 48, 49, 50, 51, 52,
1029 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
1030 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1031 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1032 83, 84, 85, 86, 87, 96, 97, 98, 100, 106,
1033 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
1034 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
1035 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
1036 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
1037 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
1038 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
1039 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1040 183, 184, 185, 37, 39, 40, 99, 109, 186, 187,
1041 188, 189, 37, 45, 46, 112, 190, 191, 192, 89,
1042 90, 91, 92, 93, 94, 95, 195, 196, 197, 198,
1043 199, 200, 201, 202, 10, 10, 10, 10, 10, 10,
1061 0, 109, 0, 11, 38, 44, 88, 103, 110, 111,
1062 114, 117, 205, 215, 112, 115, 118, 206, 216, 12,
1063 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1064 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1065 33, 34, 35, 36, 41, 42, 43, 47, 48, 49,
1066 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1067 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1068 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
1069 80, 81, 82, 83, 84, 85, 86, 87, 96, 97,
1070 98, 100, 101, 102, 105, 106, 107, 113, 120, 121,
1071 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
1072 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
1073 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
1074 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
1075 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
1076 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
1077 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1078 192, 193, 194, 195, 196, 197, 37, 39, 40, 99,
1079 116, 198, 199, 200, 201, 37, 45, 46, 119, 202,
1080 203, 204, 89, 90, 91, 92, 93, 94, 95, 207,
1081 208, 209, 210, 211, 212, 213, 214, 104, 217, 218,
10441082 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10451083 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10461084 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10491087 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10501088 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10511089 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1052 10, 10, 10
1090 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1091 10, 10, 10, 10, 10
10531092 };
10541093
10551094 #define yyerrok (yyerrstatus = 0)
18631902 YY_REDUCE_PRINT (yyn);
18641903 switch (yyn)
18651904 {
1866 case 8:
1867 #line 109 "util/configparser.y"
1905 case 9:
1906 #line 112 "util/configparser.y"
18681907 {
18691908 OUTYY(("\nP(server:)\n"));
18701909 }
18711910 break;
18721911
1873 case 84:
1874 #line 149 "util/configparser.y"
1912 case 90:
1913 #line 154 "util/configparser.y"
18751914 {
18761915 struct config_stub* s;
18771916 OUTYY(("\nP(stub_zone:)\n"));
18841923 }
18851924 break;
18861925
1887 case 91:
1888 #line 165 "util/configparser.y"
1926 case 97:
1927 #line 170 "util/configparser.y"
18891928 {
18901929 struct config_stub* s;
18911930 OUTYY(("\nP(forward_zone:)\n"));
18981937 }
18991938 break;
19001939
1901 case 97:
1902 #line 181 "util/configparser.y"
1940 case 103:
1941 #line 186 "util/configparser.y"
19031942 {
19041943 OUTYY(("P(server_num_threads:%s)\n", (yyvsp[(2) - (2)].str)));
19051944 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
19091948 }
19101949 break;
19111950
1912 case 98:
1913 #line 190 "util/configparser.y"
1951 case 104:
1952 #line 195 "util/configparser.y"
19141953 {
19151954 OUTYY(("P(server_verbosity:%s)\n", (yyvsp[(2) - (2)].str)));
19161955 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
19201959 }
19211960 break;
19221961
1923 case 99:
1924 #line 199 "util/configparser.y"
1962 case 105:
1963 #line 204 "util/configparser.y"
19251964 {
19261965 OUTYY(("P(server_statistics_interval:%s)\n", (yyvsp[(2) - (2)].str)));
19271966 if(strcmp((yyvsp[(2) - (2)].str), "") == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0)
19331972 }
19341973 break;
19351974
1936 case 100:
1937 #line 210 "util/configparser.y"
1975 case 106:
1976 #line 215 "util/configparser.y"
19381977 {
19391978 OUTYY(("P(server_statistics_cumulative:%s)\n", (yyvsp[(2) - (2)].str)));
19401979 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
19441983 }
19451984 break;
19461985
1947 case 101:
1948 #line 219 "util/configparser.y"
1986 case 107:
1987 #line 224 "util/configparser.y"
19491988 {
19501989 OUTYY(("P(server_extended_statistics:%s)\n", (yyvsp[(2) - (2)].str)));
19511990 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
19551994 }
19561995 break;
19571996
1958 case 102:
1959 #line 228 "util/configparser.y"
1997 case 108:
1998 #line 233 "util/configparser.y"
19601999 {
19612000 OUTYY(("P(server_port:%s)\n", (yyvsp[(2) - (2)].str)));
19622001 if(atoi((yyvsp[(2) - (2)].str)) == 0)
19662005 }
19672006 break;
19682007
1969 case 103:
1970 #line 237 "util/configparser.y"
2008 case 109:
2009 #line 242 "util/configparser.y"
19712010 {
19722011 OUTYY(("P(server_interface:%s)\n", (yyvsp[(2) - (2)].str)));
19732012 if(cfg_parser->cfg->num_ifs == 0)
19812020 }
19822021 break;
19832022
1984 case 104:
1985 #line 250 "util/configparser.y"
2023 case 110:
2024 #line 255 "util/configparser.y"
19862025 {
19872026 OUTYY(("P(server_outgoing_interface:%s)\n", (yyvsp[(2) - (2)].str)));
19882027 if(cfg_parser->cfg->num_out_ifs == 0)
19982037 }
19992038 break;
20002039
2001 case 105:
2002 #line 265 "util/configparser.y"
2040 case 111:
2041 #line 270 "util/configparser.y"
20032042 {
20042043 OUTYY(("P(server_outgoing_range:%s)\n", (yyvsp[(2) - (2)].str)));
20052044 if(atoi((yyvsp[(2) - (2)].str)) == 0)
20092048 }
20102049 break;
20112050
2012 case 106:
2013 #line 274 "util/configparser.y"
2051 case 112:
2052 #line 279 "util/configparser.y"
20142053 {
20152054 OUTYY(("P(server_outgoing_port_permit:%s)\n", (yyvsp[(2) - (2)].str)));
20162055 if(!cfg_mark_ports((yyvsp[(2) - (2)].str), 1,
20202059 }
20212060 break;
20222061
2023 case 107:
2024 #line 283 "util/configparser.y"
2062 case 113:
2063 #line 288 "util/configparser.y"
20252064 {
20262065 OUTYY(("P(server_outgoing_port_avoid:%s)\n", (yyvsp[(2) - (2)].str)));
20272066 if(!cfg_mark_ports((yyvsp[(2) - (2)].str), 0,
20312070 }
20322071 break;
20332072
2034 case 108:
2035 #line 292 "util/configparser.y"
2073 case 114:
2074 #line 297 "util/configparser.y"
20362075 {
20372076 OUTYY(("P(server_outgoing_num_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
20382077 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
20422081 }
20432082 break;
20442083
2045 case 109:
2046 #line 301 "util/configparser.y"
2084 case 115:
2085 #line 306 "util/configparser.y"
20472086 {
20482087 OUTYY(("P(server_incoming_num_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
20492088 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
20532092 }
20542093 break;
20552094
2056 case 110:
2057 #line 310 "util/configparser.y"
2095 case 116:
2096 #line 315 "util/configparser.y"
20582097 {
20592098 OUTYY(("P(server_interface_automatic:%s)\n", (yyvsp[(2) - (2)].str)));
20602099 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
20642103 }
20652104 break;
20662105
2067 case 111:
2068 #line 319 "util/configparser.y"
2106 case 117:
2107 #line 324 "util/configparser.y"
20692108 {
20702109 OUTYY(("P(server_do_ip4:%s)\n", (yyvsp[(2) - (2)].str)));
20712110 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
20752114 }
20762115 break;
20772116
2078 case 112:
2079 #line 328 "util/configparser.y"
2117 case 118:
2118 #line 333 "util/configparser.y"
20802119 {
20812120 OUTYY(("P(server_do_ip6:%s)\n", (yyvsp[(2) - (2)].str)));
20822121 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
20862125 }
20872126 break;
20882127
2089 case 113:
2090 #line 337 "util/configparser.y"
2128 case 119:
2129 #line 342 "util/configparser.y"
20912130 {
20922131 OUTYY(("P(server_do_udp:%s)\n", (yyvsp[(2) - (2)].str)));
20932132 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
20972136 }
20982137 break;
20992138
2100 case 114:
2101 #line 346 "util/configparser.y"
2139 case 120:
2140 #line 351 "util/configparser.y"
21022141 {
21032142 OUTYY(("P(server_do_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
21042143 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
21082147 }
21092148 break;
21102149
2111 case 115:
2112 #line 355 "util/configparser.y"
2150 case 121:
2151 #line 360 "util/configparser.y"
21132152 {
21142153 OUTYY(("P(server_do_daemonize:%s)\n", (yyvsp[(2) - (2)].str)));
21152154 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
21192158 }
21202159 break;
21212160
2122 case 116:
2123 #line 364 "util/configparser.y"
2161 case 122:
2162 #line 369 "util/configparser.y"
21242163 {
21252164 OUTYY(("P(server_use_syslog:%s)\n", (yyvsp[(2) - (2)].str)));
21262165 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
21272166 yyerror("expected yes or no.");
21282167 else cfg_parser->cfg->use_syslog = (strcmp((yyvsp[(2) - (2)].str), "yes")==0);
2129 #ifndef HAVE_SYSLOG_H
2168 #if !defined(HAVE_SYSLOG_H) && !defined(UB_ON_WINDOWS)
21302169 if(strcmp((yyvsp[(2) - (2)].str), "yes") == 0)
21312170 yyerror("no syslog services are available. "
21322171 "(reconfigure and compile to add)");
21352174 }
21362175 break;
21372176
2138 case 117:
2139 #line 378 "util/configparser.y"
2177 case 123:
2178 #line 383 "util/configparser.y"
2179 {
2180 OUTYY(("P(server_log_time_ascii:%s)\n", (yyvsp[(2) - (2)].str)));
2181 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
2182 yyerror("expected yes or no.");
2183 else cfg_parser->cfg->log_time_ascii = (strcmp((yyvsp[(2) - (2)].str), "yes")==0);
2184 free((yyvsp[(2) - (2)].str));
2185 }
2186 break;
2187
2188 case 124:
2189 #line 392 "util/configparser.y"
21402190 {
21412191 OUTYY(("P(server_chroot:%s)\n", (yyvsp[(2) - (2)].str)));
21422192 free(cfg_parser->cfg->chrootdir);
21442194 }
21452195 break;
21462196
2147 case 118:
2148 #line 385 "util/configparser.y"
2197 case 125:
2198 #line 399 "util/configparser.y"
21492199 {
21502200 OUTYY(("P(server_username:%s)\n", (yyvsp[(2) - (2)].str)));
21512201 free(cfg_parser->cfg->username);
21532203 }
21542204 break;
21552205
2156 case 119:
2157 #line 392 "util/configparser.y"
2206 case 126:
2207 #line 406 "util/configparser.y"
21582208 {
21592209 OUTYY(("P(server_directory:%s)\n", (yyvsp[(2) - (2)].str)));
21602210 free(cfg_parser->cfg->directory);
21622212 }
21632213 break;
21642214
2165 case 120:
2166 #line 399 "util/configparser.y"
2215 case 127:
2216 #line 413 "util/configparser.y"
21672217 {
21682218 OUTYY(("P(server_logfile:%s)\n", (yyvsp[(2) - (2)].str)));
21692219 free(cfg_parser->cfg->logfile);
21722222 }
21732223 break;
21742224
2175 case 121:
2176 #line 407 "util/configparser.y"
2225 case 128:
2226 #line 421 "util/configparser.y"
21772227 {
21782228 OUTYY(("P(server_pidfile:%s)\n", (yyvsp[(2) - (2)].str)));
21792229 free(cfg_parser->cfg->pidfile);
21812231 }
21822232 break;
21832233
2184 case 122:
2185 #line 414 "util/configparser.y"
2234 case 129:
2235 #line 428 "util/configparser.y"
21862236 {
21872237 OUTYY(("P(server_root_hints:%s)\n", (yyvsp[(2) - (2)].str)));
21882238 if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, (yyvsp[(2) - (2)].str)))
21902240 }
21912241 break;
21922242
2193 case 123:
2194 #line 421 "util/configparser.y"
2243 case 130:
2244 #line 435 "util/configparser.y"
21952245 {
21962246 OUTYY(("P(server_dlv_anchor_file:%s)\n", (yyvsp[(2) - (2)].str)));
21972247 free(cfg_parser->cfg->dlv_anchor_file);
21992249 }
22002250 break;
22012251
2202 case 124:
2203 #line 428 "util/configparser.y"
2252 case 131:
2253 #line 442 "util/configparser.y"
22042254 {
22052255 OUTYY(("P(server_dlv_anchor:%s)\n", (yyvsp[(2) - (2)].str)));
22062256 if(!cfg_strlist_insert(&cfg_parser->cfg->dlv_anchor_list, (yyvsp[(2) - (2)].str)))
22082258 }
22092259 break;
22102260
2211 case 125:
2212 #line 435 "util/configparser.y"
2261 case 132:
2262 #line 449 "util/configparser.y"
22132263 {
22142264 OUTYY(("P(server_trust_anchor_file:%s)\n", (yyvsp[(2) - (2)].str)));
22152265 if(!cfg_strlist_insert(&cfg_parser->cfg->
22182268 }
22192269 break;
22202270
2221 case 126:
2222 #line 443 "util/configparser.y"
2271 case 133:
2272 #line 457 "util/configparser.y"
22232273 {
22242274 OUTYY(("P(server_trusted_keys_file:%s)\n", (yyvsp[(2) - (2)].str)));
22252275 if(!cfg_strlist_insert(&cfg_parser->cfg->
22282278 }
22292279 break;
22302280
2231 case 127:
2232 #line 451 "util/configparser.y"
2281 case 134:
2282 #line 465 "util/configparser.y"
22332283 {
22342284 OUTYY(("P(server_trust_anchor:%s)\n", (yyvsp[(2) - (2)].str)));
22352285 if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, (yyvsp[(2) - (2)].str)))
22372287 }
22382288 break;
22392289
2240 case 128:
2241 #line 458 "util/configparser.y"
2290 case 135:
2291 #line 472 "util/configparser.y"
2292 {
2293 OUTYY(("P(server_domain_insecure:%s)\n", (yyvsp[(2) - (2)].str)));
2294 if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, (yyvsp[(2) - (2)].str)))
2295 yyerror("out of memory");
2296 }
2297 break;
2298
2299 case 136:
2300 #line 479 "util/configparser.y"
22422301 {
22432302 OUTYY(("P(server_hide_identity:%s)\n", (yyvsp[(2) - (2)].str)));
22442303 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
22482307 }
22492308 break;
22502309
2251 case 129:
2252 #line 467 "util/configparser.y"
2310 case 137:
2311 #line 488 "util/configparser.y"
22532312 {
22542313 OUTYY(("P(server_hide_version:%s)\n", (yyvsp[(2) - (2)].str)));
22552314 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
22592318 }
22602319 break;
22612320
2262 case 130:
2263 #line 476 "util/configparser.y"
2321 case 138:
2322 #line 497 "util/configparser.y"
22642323 {
22652324 OUTYY(("P(server_identity:%s)\n", (yyvsp[(2) - (2)].str)));
22662325 free(cfg_parser->cfg->identity);
22682327 }
22692328 break;
22702329
2271 case 131:
2272 #line 483 "util/configparser.y"
2330 case 139:
2331 #line 504 "util/configparser.y"
22732332 {
22742333 OUTYY(("P(server_version:%s)\n", (yyvsp[(2) - (2)].str)));
22752334 free(cfg_parser->cfg->version);
22772336 }
22782337 break;
22792338
2280 case 132:
2281 #line 490 "util/configparser.y"
2339 case 140:
2340 #line 511 "util/configparser.y"
22822341 {
22832342 OUTYY(("P(server_msg_buffer_size:%s)\n", (yyvsp[(2) - (2)].str)));
22842343 if(atoi((yyvsp[(2) - (2)].str)) == 0)
22902349 }
22912350 break;
22922351
2293 case 133:
2294 #line 501 "util/configparser.y"
2352 case 141:
2353 #line 522 "util/configparser.y"
22952354 {
22962355 OUTYY(("P(server_msg_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
22972356 if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->msg_cache_size))
23002359 }
23012360 break;
23022361
2303 case 134:
2304 #line 509 "util/configparser.y"
2362 case 142:
2363 #line 530 "util/configparser.y"
23052364 {
23062365 OUTYY(("P(server_msg_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
23072366 if(atoi((yyvsp[(2) - (2)].str)) == 0)
23152374 }
23162375 break;
23172376
2318 case 135:
2319 #line 522 "util/configparser.y"
2377 case 143:
2378 #line 543 "util/configparser.y"
23202379 {
23212380 OUTYY(("P(server_num_queries_per_thread:%s)\n", (yyvsp[(2) - (2)].str)));
23222381 if(atoi((yyvsp[(2) - (2)].str)) == 0)
23262385 }
23272386 break;
23282387
2329 case 136:
2330 #line 531 "util/configparser.y"
2388 case 144:
2389 #line 552 "util/configparser.y"
23312390 {
23322391 OUTYY(("P(server_jostle_timeout:%s)\n", (yyvsp[(2) - (2)].str)));
23332392 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
23372396 }
23382397 break;
23392398
2340 case 137:
2341 #line 540 "util/configparser.y"
2399 case 145:
2400 #line 561 "util/configparser.y"
23422401 {
23432402 OUTYY(("P(server_rrset_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
23442403 if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->rrset_cache_size))
23472406 }
23482407 break;
23492408
2350 case 138:
2351 #line 548 "util/configparser.y"
2409 case 146:
2410 #line 569 "util/configparser.y"
23522411 {
23532412 OUTYY(("P(server_rrset_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
23542413 if(atoi((yyvsp[(2) - (2)].str)) == 0)
23622421 }
23632422 break;
23642423
2365 case 139:
2366 #line 561 "util/configparser.y"
2424 case 147:
2425 #line 582 "util/configparser.y"
23672426 {
23682427 OUTYY(("P(server_infra_host_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
23692428 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
23732432 }
23742433 break;
23752434
2376 case 140:
2377 #line 570 "util/configparser.y"
2435 case 148:
2436 #line 591 "util/configparser.y"
23782437 {
23792438 OUTYY(("P(server_infra_lame_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
23802439 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
23842443 }
23852444 break;
23862445
2387 case 141:
2388 #line 579 "util/configparser.y"
2446 case 149:
2447 #line 600 "util/configparser.y"
23892448 {
23902449 OUTYY(("P(server_infra_cache_numhosts:%s)\n", (yyvsp[(2) - (2)].str)));
23912450 if(atoi((yyvsp[(2) - (2)].str)) == 0)
23952454 }
23962455 break;
23972456
2398 case 142:
2399 #line 588 "util/configparser.y"
2457 case 150:
2458 #line 609 "util/configparser.y"
24002459 {
24012460 OUTYY(("P(server_infra_cache_lame_size:%s)\n", (yyvsp[(2) - (2)].str)));
24022461 if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->
24062465 }
24072466 break;
24082467
2409 case 143:
2410 #line 597 "util/configparser.y"
2468 case 151:
2469 #line 618 "util/configparser.y"
24112470 {
24122471 OUTYY(("P(server_infra_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
24132472 if(atoi((yyvsp[(2) - (2)].str)) == 0)
24212480 }
24222481 break;
24232482
2424 case 144:
2425 #line 610 "util/configparser.y"
2483 case 152:
2484 #line 631 "util/configparser.y"
24262485 {
24272486 OUTYY(("P(server_target_fetch_policy:%s)\n", (yyvsp[(2) - (2)].str)));
24282487 free(cfg_parser->cfg->target_fetch_policy);
24302489 }
24312490 break;
24322491
2433 case 145:
2434 #line 617 "util/configparser.y"
2492 case 153:
2493 #line 638 "util/configparser.y"
24352494 {
24362495 OUTYY(("P(server_harden_short_bufsize:%s)\n", (yyvsp[(2) - (2)].str)));
24372496 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
24422501 }
24432502 break;
24442503
2445 case 146:
2446 #line 627 "util/configparser.y"
2504 case 154:
2505 #line 648 "util/configparser.y"
24472506 {
24482507 OUTYY(("P(server_harden_large_queries:%s)\n", (yyvsp[(2) - (2)].str)));
24492508 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
24542513 }
24552514 break;
24562515
2457 case 147:
2458 #line 637 "util/configparser.y"
2516 case 155:
2517 #line 658 "util/configparser.y"
24592518 {
24602519 OUTYY(("P(server_harden_glue:%s)\n", (yyvsp[(2) - (2)].str)));
24612520 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
24662525 }
24672526 break;
24682527
2469 case 148:
2470 #line 647 "util/configparser.y"
2528 case 156:
2529 #line 668 "util/configparser.y"
24712530 {
24722531 OUTYY(("P(server_harden_dnssec_stripped:%s)\n", (yyvsp[(2) - (2)].str)));
24732532 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
24782537 }
24792538 break;
24802539
2481 case 149:
2482 #line 657 "util/configparser.y"
2540 case 157:
2541 #line 678 "util/configparser.y"
24832542 {
24842543 OUTYY(("P(server_harden_referral_path:%s)\n", (yyvsp[(2) - (2)].str)));
24852544 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
24902549 }
24912550 break;
24922551
2493 case 150:
2494 #line 667 "util/configparser.y"
2552 case 158:
2553 #line 688 "util/configparser.y"
24952554 {
24962555 OUTYY(("P(server_use_caps_for_id:%s)\n", (yyvsp[(2) - (2)].str)));
24972556 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
25022561 }
25032562 break;
25042563
2505 case 151:
2506 #line 677 "util/configparser.y"
2564 case 159:
2565 #line 698 "util/configparser.y"
25072566 {
25082567 OUTYY(("P(server_private_address:%s)\n", (yyvsp[(2) - (2)].str)));
25092568 if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, (yyvsp[(2) - (2)].str)))
25112570 }
25122571 break;
25132572
2514 case 152:
2515 #line 684 "util/configparser.y"
2573 case 160:
2574 #line 705 "util/configparser.y"
25162575 {
25172576 OUTYY(("P(server_private_domain:%s)\n", (yyvsp[(2) - (2)].str)));
25182577 if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, (yyvsp[(2) - (2)].str)))
25202579 }
25212580 break;
25222581
2523 case 153:
2524 #line 691 "util/configparser.y"
2582 case 161:
2583 #line 712 "util/configparser.y"
25252584 {
25262585 OUTYY(("P(server_unwanted_reply_threshold:%s)\n", (yyvsp[(2) - (2)].str)));
25272586 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
25312590 }
25322591 break;
25332592
2534 case 154:
2535 #line 700 "util/configparser.y"
2593 case 162:
2594 #line 721 "util/configparser.y"
25362595 {
25372596 OUTYY(("P(server_do_not_query_address:%s)\n", (yyvsp[(2) - (2)].str)));
25382597 if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, (yyvsp[(2) - (2)].str)))
25402599 }
25412600 break;
25422601
2543 case 155:
2544 #line 707 "util/configparser.y"
2602 case 163:
2603 #line 728 "util/configparser.y"
25452604 {
25462605 OUTYY(("P(server_do_not_query_localhost:%s)\n", (yyvsp[(2) - (2)].str)));
25472606 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
25522611 }
25532612 break;
25542613
2555 case 156:
2556 #line 717 "util/configparser.y"
2614 case 164:
2615 #line 738 "util/configparser.y"
25572616 {
25582617 OUTYY(("P(server_access_control:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
25592618 if(strcmp((yyvsp[(3) - (3)].str), "deny")!=0 && strcmp((yyvsp[(3) - (3)].str), "refuse")!=0 &&
25682627 }
25692628 break;
25702629
2571 case 157:
2572 #line 731 "util/configparser.y"
2630 case 165:
2631 #line 752 "util/configparser.y"
25732632 {
25742633 OUTYY(("P(server_module_conf:%s)\n", (yyvsp[(2) - (2)].str)));
25752634 free(cfg_parser->cfg->module_conf);
25772636 }
25782637 break;
25792638
2580 case 158:
2581 #line 738 "util/configparser.y"
2639 case 166:
2640 #line 759 "util/configparser.y"
25822641 {
25832642 OUTYY(("P(server_val_override_date:%s)\n", (yyvsp[(2) - (2)].str)));
25842643 if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
25972656 }
25982657 break;
25992658
2600 case 159:
2601 #line 756 "util/configparser.y"
2659 case 167:
2660 #line 777 "util/configparser.y"
2661 {
2662 OUTYY(("P(server_val_sig_skew_min:%s)\n", (yyvsp[(2) - (2)].str)));
2663 if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
2664 cfg_parser->cfg->val_sig_skew_min = 0;
2665 } else {
2666 cfg_parser->cfg->val_sig_skew_min = atoi((yyvsp[(2) - (2)].str));
2667 if(!cfg_parser->cfg->val_sig_skew_min)
2668 yyerror("number expected");
2669 }
2670 free((yyvsp[(2) - (2)].str));
2671 }
2672 break;
2673
2674 case 168:
2675 #line 790 "util/configparser.y"
2676 {
2677 OUTYY(("P(server_val_sig_skew_max:%s)\n", (yyvsp[(2) - (2)].str)));
2678 if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
2679 cfg_parser->cfg->val_sig_skew_max = 0;
2680 } else {
2681 cfg_parser->cfg->val_sig_skew_max = atoi((yyvsp[(2) - (2)].str));
2682 if(!cfg_parser->cfg->val_sig_skew_max)
2683 yyerror("number expected");
2684 }
2685 free((yyvsp[(2) - (2)].str));
2686 }
2687 break;
2688
2689 case 169:
2690 #line 803 "util/configparser.y"
26022691 {
26032692 OUTYY(("P(server_cache_max_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
26042693 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
26082697 }
26092698 break;
26102699
2611 case 160:
2612 #line 765 "util/configparser.y"
2700 case 170:
2701 #line 812 "util/configparser.y"
2702 {
2703 OUTYY(("P(server_cache_min_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
2704 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
2705 yyerror("number expected");
2706 else cfg_parser->cfg->min_ttl = atoi((yyvsp[(2) - (2)].str));
2707 free((yyvsp[(2) - (2)].str));
2708 }
2709 break;
2710
2711 case 171:
2712 #line 821 "util/configparser.y"
26132713 {
26142714 OUTYY(("P(server_bogus_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
26152715 if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
26192719 }
26202720 break;
26212721
2622 case 161:
2623 #line 774 "util/configparser.y"
2722 case 172:
2723 #line 830 "util/configparser.y"
26242724 {
26252725 OUTYY(("P(server_val_clean_additional:%s)\n", (yyvsp[(2) - (2)].str)));
26262726 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
26312731 }
26322732 break;
26332733
2634 case 162:
2635 #line 784 "util/configparser.y"
2734 case 173:
2735 #line 840 "util/configparser.y"
26362736 {
26372737 OUTYY(("P(server_val_permissive_mode:%s)\n", (yyvsp[(2) - (2)].str)));
26382738 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
26432743 }
26442744 break;
26452745
2646 case 163:
2647 #line 794 "util/configparser.y"
2746 case 174:
2747 #line 850 "util/configparser.y"
26482748 {
26492749 OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", (yyvsp[(2) - (2)].str)));
26502750 free(cfg_parser->cfg->val_nsec3_key_iterations);
26522752 }
26532753 break;
26542754
2655 case 164:
2656 #line 801 "util/configparser.y"
2755 case 175:
2756 #line 857 "util/configparser.y"
26572757 {
26582758 OUTYY(("P(server_key_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
26592759 if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->key_cache_size))
26622762 }
26632763 break;
26642764
2665 case 165:
2666 #line 809 "util/configparser.y"
2765 case 176:
2766 #line 865 "util/configparser.y"
26672767 {
26682768 OUTYY(("P(server_key_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
26692769 if(atoi((yyvsp[(2) - (2)].str)) == 0)
26772777 }
26782778 break;
26792779
2680 case 166:
2681 #line 822 "util/configparser.y"
2780 case 177:
2781 #line 878 "util/configparser.y"
26822782 {
26832783 OUTYY(("P(server_neg_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
26842784 if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->neg_cache_size))
26872787 }
26882788 break;
26892789
2690 case 167:
2691 #line 830 "util/configparser.y"
2790 case 178:
2791 #line 886 "util/configparser.y"
26922792 {
26932793 OUTYY(("P(server_local_zone:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
26942794 if(strcmp((yyvsp[(3) - (3)].str), "static")!=0 && strcmp((yyvsp[(3) - (3)].str), "deny")!=0 &&
27092809 }
27102810 break;
27112811
2712 case 168:
2713 #line 850 "util/configparser.y"
2812 case 179:
2813 #line 906 "util/configparser.y"
27142814 {
27152815 OUTYY(("P(server_local_data:%s)\n", (yyvsp[(2) - (2)].str)));
27162816 if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, (yyvsp[(2) - (2)].str)))
27182818 }
27192819 break;
27202820
2721 case 169:
2722 #line 857 "util/configparser.y"
2821 case 180:
2822 #line 913 "util/configparser.y"
27232823 {
27242824 char* ptr;
27252825 OUTYY(("P(server_local_data_ptr:%s)\n", (yyvsp[(2) - (2)].str)));
27352835 }
27362836 break;
27372837
2738 case 170:
2739 #line 872 "util/configparser.y"
2838 case 181:
2839 #line 928 "util/configparser.y"
27402840 {
27412841 OUTYY(("P(name:%s)\n", (yyvsp[(2) - (2)].str)));
27422842 free(cfg_parser->cfg->stubs->name);
27442844 }
27452845 break;
27462846
2747 case 171:
2748 #line 879 "util/configparser.y"
2847 case 182:
2848 #line 935 "util/configparser.y"
27492849 {
27502850 OUTYY(("P(stub-host:%s)\n", (yyvsp[(2) - (2)].str)));
27512851 if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, (yyvsp[(2) - (2)].str)))
27532853 }
27542854 break;
27552855
2756 case 172:
2757 #line 886 "util/configparser.y"
2856 case 183:
2857 #line 942 "util/configparser.y"
27582858 {
27592859 OUTYY(("P(stub-addr:%s)\n", (yyvsp[(2) - (2)].str)));
27602860 if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, (yyvsp[(2) - (2)].str)))
27622862 }
27632863 break;
27642864
2765 case 173:
2766 #line 893 "util/configparser.y"
2865 case 184:
2866 #line 949 "util/configparser.y"
27672867 {
27682868 OUTYY(("P(stub-prime:%s)\n", (yyvsp[(2) - (2)].str)));
27692869 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
27742874 }
27752875 break;
27762876
2777 case 174:
2778 #line 903 "util/configparser.y"
2877 case 185:
2878 #line 959 "util/configparser.y"
27792879 {
27802880 OUTYY(("P(name:%s)\n", (yyvsp[(2) - (2)].str)));
27812881 free(cfg_parser->cfg->forwards->name);
27832883 }
27842884 break;
27852885
2786 case 175:
2787 #line 910 "util/configparser.y"
2886 case 186:
2887 #line 966 "util/configparser.y"
27882888 {
27892889 OUTYY(("P(forward-host:%s)\n", (yyvsp[(2) - (2)].str)));
27902890 if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, (yyvsp[(2) - (2)].str)))
27922892 }
27932893 break;
27942894
2795 case 176:
2796 #line 917 "util/configparser.y"
2895 case 187:
2896 #line 973 "util/configparser.y"
27972897 {
27982898 OUTYY(("P(forward-addr:%s)\n", (yyvsp[(2) - (2)].str)));
27992899 if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, (yyvsp[(2) - (2)].str)))
28012901 }
28022902 break;
28032903
2804 case 177:
2805 #line 924 "util/configparser.y"
2904 case 188:
2905 #line 980 "util/configparser.y"
28062906 {
28072907 OUTYY(("\nP(remote-control:)\n"));
28082908 }
28092909 break;
28102910
2811 case 187:
2812 #line 935 "util/configparser.y"
2911 case 198:
2912 #line 991 "util/configparser.y"
28132913 {
28142914 OUTYY(("P(control_enable:%s)\n", (yyvsp[(2) - (2)].str)));
28152915 if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
28202920 }
28212921 break;
28222922
2823 case 188:
2824 #line 945 "util/configparser.y"
2923 case 199:
2924 #line 1001 "util/configparser.y"
28252925 {
28262926 OUTYY(("P(control_port:%s)\n", (yyvsp[(2) - (2)].str)));
28272927 if(atoi((yyvsp[(2) - (2)].str)) == 0)
28312931 }
28322932 break;
28332933
2834 case 189:
2835 #line 954 "util/configparser.y"
2934 case 200:
2935 #line 1010 "util/configparser.y"
28362936 {
28372937 OUTYY(("P(control_interface:%s)\n", (yyvsp[(2) - (2)].str)));
28382938 if(!cfg_strlist_insert(&cfg_parser->cfg->control_ifs, (yyvsp[(2) - (2)].str)))
28402940 }
28412941 break;
28422942
2843 case 190:
2844 #line 961 "util/configparser.y"
2943 case 201:
2944 #line 1017 "util/configparser.y"
28452945 {
28462946 OUTYY(("P(rc_server_key_file:%s)\n", (yyvsp[(2) - (2)].str)));
28472947 free(cfg_parser->cfg->server_key_file);
28492949 }
28502950 break;
28512951
2852 case 191:
2853 #line 968 "util/configparser.y"
2952 case 202:
2953 #line 1024 "util/configparser.y"
28542954 {
28552955 OUTYY(("P(rc_server_cert_file:%s)\n", (yyvsp[(2) - (2)].str)));
28562956 free(cfg_parser->cfg->server_cert_file);
28582958 }
28592959 break;
28602960
2861 case 192:
2862 #line 975 "util/configparser.y"
2961 case 203:
2962 #line 1031 "util/configparser.y"
28632963 {
28642964 OUTYY(("P(rc_control_key_file:%s)\n", (yyvsp[(2) - (2)].str)));
28652965 free(cfg_parser->cfg->control_key_file);
28672967 }
28682968 break;
28692969
2870 case 193:
2871 #line 982 "util/configparser.y"
2970 case 204:
2971 #line 1038 "util/configparser.y"
28722972 {
28732973 OUTYY(("P(rc_control_cert_file:%s)\n", (yyvsp[(2) - (2)].str)));
28742974 free(cfg_parser->cfg->control_cert_file);
28762976 }
28772977 break;
28782978
2979 case 205:
2980 #line 1045 "util/configparser.y"
2981 {
2982 OUTYY(("\nP(python:)\n"));
2983 }
2984 break;
2985
2986 case 209:
2987 #line 1054 "util/configparser.y"
2988 {
2989 OUTYY(("P(python-script:%s)\n", (yyvsp[(2) - (2)].str)));
2990 free(cfg_parser->cfg->python_script);
2991 cfg_parser->cfg->python_script = (yyvsp[(2) - (2)].str);
2992 }
2993 break;
2994
28792995
28802996 /* Line 1267 of yacc.c. */
2881 #line 2883 "util/configparser.c"
2997 #line 2999 "util/configparser.c"
28822998 default: break;
28832999 }
28843000 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
30923208 }
30933209
30943210
3095 #line 988 "util/configparser.y"
3211 #line 1059 "util/configparser.y"
30963212
30973213
30983214 /* parse helper routines could be here */
4545 COLON = 262,
4646 ANY = 263,
4747 ZONESTR = 264,
48 STRING = 265,
48 STRING_ARG = 265,
4949 VAR_SERVER = 266,
5050 VAR_VERBOSITY = 267,
5151 VAR_NUM_THREADS = 268,
135135 VAR_LOCAL_DATA_PTR = 352,
136136 VAR_JOSTLE_TIMEOUT = 353,
137137 VAR_STUB_PRIME = 354,
138 VAR_UNWANTED_REPLY_THRESHOLD = 355
138 VAR_UNWANTED_REPLY_THRESHOLD = 355,
139 VAR_LOG_TIME_ASCII = 356,
140 VAR_DOMAIN_INSECURE = 357,
141 VAR_PYTHON = 358,
142 VAR_PYTHON_SCRIPT = 359,
143 VAR_VAL_SIG_SKEW_MIN = 360,
144 VAR_VAL_SIG_SKEW_MAX = 361,
145 VAR_CACHE_MIN_TTL = 362
139146 };
140147 #endif
141148 /* Tokens. */
146153 #define COLON 262
147154 #define ANY 263
148155 #define ZONESTR 264
149 #define STRING 265
156 #define STRING_ARG 265
150157 #define VAR_SERVER 266
151158 #define VAR_VERBOSITY 267
152159 #define VAR_NUM_THREADS 268
237244 #define VAR_JOSTLE_TIMEOUT 353
238245 #define VAR_STUB_PRIME 354
239246 #define VAR_UNWANTED_REPLY_THRESHOLD 355
247 #define VAR_LOG_TIME_ASCII 356
248 #define VAR_DOMAIN_INSECURE 357
249 #define VAR_PYTHON 358
250 #define VAR_PYTHON_SCRIPT 359
251 #define VAR_VAL_SIG_SKEW_MIN 360
252 #define VAR_VAL_SIG_SKEW_MAX 361
253 #define VAR_CACHE_MIN_TTL 362
240254
241255
242256
248262 char* str;
249263 }
250264 /* Line 1489 of yacc.c. */
251 #line 253 "util/configparser.h"
265 #line 267 "util/configparser.h"
252266 YYSTYPE;
253267 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
254268 # define YYSTYPE_IS_DECLARED 1
6565 };
6666
6767 %token SPACE LETTER NEWLINE COMMENT COLON ANY ZONESTR
68 %token <str> STRING
68 %token <str> STRING_ARG
6969 %token VAR_SERVER VAR_VERBOSITY VAR_NUM_THREADS VAR_PORT
7070 %token VAR_OUTGOING_RANGE VAR_INTERFACE
7171 %token VAR_DO_IP4 VAR_DO_IP6 VAR_DO_UDP VAR_DO_TCP
9595 %token VAR_CONTROL_INTERFACE VAR_CONTROL_PORT VAR_SERVER_KEY_FILE
9696 %token VAR_SERVER_CERT_FILE VAR_CONTROL_KEY_FILE VAR_CONTROL_CERT_FILE
9797 %token VAR_EXTENDED_STATISTICS VAR_LOCAL_DATA_PTR VAR_JOSTLE_TIMEOUT
98 %token VAR_STUB_PRIME VAR_UNWANTED_REPLY_THRESHOLD
98 %token VAR_STUB_PRIME VAR_UNWANTED_REPLY_THRESHOLD VAR_LOG_TIME_ASCII
99 %token VAR_DOMAIN_INSECURE VAR_PYTHON VAR_PYTHON_SCRIPT VAR_VAL_SIG_SKEW_MIN
100 %token VAR_VAL_SIG_SKEW_MAX VAR_CACHE_MIN_TTL
99101
100102 %%
101103 toplevelvars: /* empty */ | toplevelvars toplevelvar ;
102104 toplevelvar: serverstart contents_server | stubstart contents_stub |
103 forwardstart contents_forward | rcstart contents_rc
105 forwardstart contents_forward | pythonstart contents_py |
106 rcstart contents_rc
104107 ;
105108
106109 /* server: declaration */
142145 server_harden_referral_path | server_private_address |
143146 server_private_domain | server_extended_statistics |
144147 server_local_data_ptr | server_jostle_timeout |
145 server_unwanted_reply_threshold
148 server_unwanted_reply_threshold | server_log_time_ascii |
149 server_domain_insecure | server_val_sig_skew_min |
150 server_val_sig_skew_max | server_cache_min_ttl
146151 ;
147152 stubstart: VAR_STUB_ZONE
148153 {
176181 | ;
177182 content_forward: forward_name | forward_host | forward_addr
178183 ;
179 server_num_threads: VAR_NUM_THREADS STRING
184 server_num_threads: VAR_NUM_THREADS STRING_ARG
180185 {
181186 OUTYY(("P(server_num_threads:%s)\n", $2));
182187 if(atoi($2) == 0 && strcmp($2, "0") != 0)
185190 free($2);
186191 }
187192 ;
188 server_verbosity: VAR_VERBOSITY STRING
193 server_verbosity: VAR_VERBOSITY STRING_ARG
189194 {
190195 OUTYY(("P(server_verbosity:%s)\n", $2));
191196 if(atoi($2) == 0 && strcmp($2, "0") != 0)
194199 free($2);
195200 }
196201 ;
197 server_statistics_interval: VAR_STATISTICS_INTERVAL STRING
202 server_statistics_interval: VAR_STATISTICS_INTERVAL STRING_ARG
198203 {
199204 OUTYY(("P(server_statistics_interval:%s)\n", $2));
200205 if(strcmp($2, "") == 0 || strcmp($2, "0") == 0)
205210 free($2);
206211 }
207212 ;
208 server_statistics_cumulative: VAR_STATISTICS_CUMULATIVE STRING
213 server_statistics_cumulative: VAR_STATISTICS_CUMULATIVE STRING_ARG
209214 {
210215 OUTYY(("P(server_statistics_cumulative:%s)\n", $2));
211216 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
214219 free($2);
215220 }
216221 ;
217 server_extended_statistics: VAR_EXTENDED_STATISTICS STRING
222 server_extended_statistics: VAR_EXTENDED_STATISTICS STRING_ARG
218223 {
219224 OUTYY(("P(server_extended_statistics:%s)\n", $2));
220225 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
223228 free($2);
224229 }
225230 ;
226 server_port: VAR_PORT STRING
231 server_port: VAR_PORT STRING_ARG
227232 {
228233 OUTYY(("P(server_port:%s)\n", $2));
229234 if(atoi($2) == 0)
232237 free($2);
233238 }
234239 ;
235 server_interface: VAR_INTERFACE STRING
240 server_interface: VAR_INTERFACE STRING_ARG
236241 {
237242 OUTYY(("P(server_interface:%s)\n", $2));
238243 if(cfg_parser->cfg->num_ifs == 0)
245250 cfg_parser->cfg->ifs[cfg_parser->cfg->num_ifs++] = $2;
246251 }
247252 ;
248 server_outgoing_interface: VAR_OUTGOING_INTERFACE STRING
253 server_outgoing_interface: VAR_OUTGOING_INTERFACE STRING_ARG
249254 {
250255 OUTYY(("P(server_outgoing_interface:%s)\n", $2));
251256 if(cfg_parser->cfg->num_out_ifs == 0)
260265 cfg_parser->cfg->num_out_ifs++] = $2;
261266 }
262267 ;
263 server_outgoing_range: VAR_OUTGOING_RANGE STRING
268 server_outgoing_range: VAR_OUTGOING_RANGE STRING_ARG
264269 {
265270 OUTYY(("P(server_outgoing_range:%s)\n", $2));
266271 if(atoi($2) == 0)
269274 free($2);
270275 }
271276 ;
272 server_outgoing_port_permit: VAR_OUTGOING_PORT_PERMIT STRING
277 server_outgoing_port_permit: VAR_OUTGOING_PORT_PERMIT STRING_ARG
273278 {
274279 OUTYY(("P(server_outgoing_port_permit:%s)\n", $2));
275280 if(!cfg_mark_ports($2, 1,
278283 free($2);
279284 }
280285 ;
281 server_outgoing_port_avoid: VAR_OUTGOING_PORT_AVOID STRING
286 server_outgoing_port_avoid: VAR_OUTGOING_PORT_AVOID STRING_ARG
282287 {
283288 OUTYY(("P(server_outgoing_port_avoid:%s)\n", $2));
284289 if(!cfg_mark_ports($2, 0,
287292 free($2);
288293 }
289294 ;
290 server_outgoing_num_tcp: VAR_OUTGOING_NUM_TCP STRING
295 server_outgoing_num_tcp: VAR_OUTGOING_NUM_TCP STRING_ARG
291296 {
292297 OUTYY(("P(server_outgoing_num_tcp:%s)\n", $2));
293298 if(atoi($2) == 0 && strcmp($2, "0") != 0)
296301 free($2);
297302 }
298303 ;
299 server_incoming_num_tcp: VAR_INCOMING_NUM_TCP STRING
304 server_incoming_num_tcp: VAR_INCOMING_NUM_TCP STRING_ARG
300305 {
301306 OUTYY(("P(server_incoming_num_tcp:%s)\n", $2));
302307 if(atoi($2) == 0 && strcmp($2, "0") != 0)
305310 free($2);
306311 }
307312 ;
308 server_interface_automatic: VAR_INTERFACE_AUTOMATIC STRING
313 server_interface_automatic: VAR_INTERFACE_AUTOMATIC STRING_ARG
309314 {
310315 OUTYY(("P(server_interface_automatic:%s)\n", $2));
311316 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
314319 free($2);
315320 }
316321 ;
317 server_do_ip4: VAR_DO_IP4 STRING
322 server_do_ip4: VAR_DO_IP4 STRING_ARG
318323 {
319324 OUTYY(("P(server_do_ip4:%s)\n", $2));
320325 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
323328 free($2);
324329 }
325330 ;
326 server_do_ip6: VAR_DO_IP6 STRING
331 server_do_ip6: VAR_DO_IP6 STRING_ARG
327332 {
328333 OUTYY(("P(server_do_ip6:%s)\n", $2));
329334 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
332337 free($2);
333338 }
334339 ;
335 server_do_udp: VAR_DO_UDP STRING
340 server_do_udp: VAR_DO_UDP STRING_ARG
336341 {
337342 OUTYY(("P(server_do_udp:%s)\n", $2));
338343 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
341346 free($2);
342347 }
343348 ;
344 server_do_tcp: VAR_DO_TCP STRING
349 server_do_tcp: VAR_DO_TCP STRING_ARG
345350 {
346351 OUTYY(("P(server_do_tcp:%s)\n", $2));
347352 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
350355 free($2);
351356 }
352357 ;
353 server_do_daemonize: VAR_DO_DAEMONIZE STRING
358 server_do_daemonize: VAR_DO_DAEMONIZE STRING_ARG
354359 {
355360 OUTYY(("P(server_do_daemonize:%s)\n", $2));
356361 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
359364 free($2);
360365 }
361366 ;
362 server_use_syslog: VAR_USE_SYSLOG STRING
367 server_use_syslog: VAR_USE_SYSLOG STRING_ARG
363368 {
364369 OUTYY(("P(server_use_syslog:%s)\n", $2));
365370 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
366371 yyerror("expected yes or no.");
367372 else cfg_parser->cfg->use_syslog = (strcmp($2, "yes")==0);
368 #ifndef HAVE_SYSLOG_H
373 #if !defined(HAVE_SYSLOG_H) && !defined(UB_ON_WINDOWS)
369374 if(strcmp($2, "yes") == 0)
370375 yyerror("no syslog services are available. "
371376 "(reconfigure and compile to add)");
373378 free($2);
374379 }
375380 ;
376 server_chroot: VAR_CHROOT STRING
381 server_log_time_ascii: VAR_LOG_TIME_ASCII STRING_ARG
382 {
383 OUTYY(("P(server_log_time_ascii:%s)\n", $2));
384 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
385 yyerror("expected yes or no.");
386 else cfg_parser->cfg->log_time_ascii = (strcmp($2, "yes")==0);
387 free($2);
388 }
389 ;
390 server_chroot: VAR_CHROOT STRING_ARG
377391 {
378392 OUTYY(("P(server_chroot:%s)\n", $2));
379393 free(cfg_parser->cfg->chrootdir);
380394 cfg_parser->cfg->chrootdir = $2;
381395 }
382396 ;
383 server_username: VAR_USERNAME STRING
397 server_username: VAR_USERNAME STRING_ARG
384398 {
385399 OUTYY(("P(server_username:%s)\n", $2));
386400 free(cfg_parser->cfg->username);
387401 cfg_parser->cfg->username = $2;
388402 }
389403 ;
390 server_directory: VAR_DIRECTORY STRING
404 server_directory: VAR_DIRECTORY STRING_ARG
391405 {
392406 OUTYY(("P(server_directory:%s)\n", $2));
393407 free(cfg_parser->cfg->directory);
394408 cfg_parser->cfg->directory = $2;
395409 }
396410 ;
397 server_logfile: VAR_LOGFILE STRING
411 server_logfile: VAR_LOGFILE STRING_ARG
398412 {
399413 OUTYY(("P(server_logfile:%s)\n", $2));
400414 free(cfg_parser->cfg->logfile);
402416 cfg_parser->cfg->use_syslog = 0;
403417 }
404418 ;
405 server_pidfile: VAR_PIDFILE STRING
419 server_pidfile: VAR_PIDFILE STRING_ARG
406420 {
407421 OUTYY(("P(server_pidfile:%s)\n", $2));
408422 free(cfg_parser->cfg->pidfile);
409423 cfg_parser->cfg->pidfile = $2;
410424 }
411425 ;
412 server_root_hints: VAR_ROOT_HINTS STRING
426 server_root_hints: VAR_ROOT_HINTS STRING_ARG
413427 {
414428 OUTYY(("P(server_root_hints:%s)\n", $2));
415429 if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, $2))
416430 yyerror("out of memory");
417431 }
418432 ;
419 server_dlv_anchor_file: VAR_DLV_ANCHOR_FILE STRING
433 server_dlv_anchor_file: VAR_DLV_ANCHOR_FILE STRING_ARG
420434 {
421435 OUTYY(("P(server_dlv_anchor_file:%s)\n", $2));
422436 free(cfg_parser->cfg->dlv_anchor_file);
423437 cfg_parser->cfg->dlv_anchor_file = $2;
424438 }
425439 ;
426 server_dlv_anchor: VAR_DLV_ANCHOR STRING
440 server_dlv_anchor: VAR_DLV_ANCHOR STRING_ARG
427441 {
428442 OUTYY(("P(server_dlv_anchor:%s)\n", $2));
429443 if(!cfg_strlist_insert(&cfg_parser->cfg->dlv_anchor_list, $2))
430444 yyerror("out of memory");
431445 }
432446 ;
433 server_trust_anchor_file: VAR_TRUST_ANCHOR_FILE STRING
447 server_trust_anchor_file: VAR_TRUST_ANCHOR_FILE STRING_ARG
434448 {
435449 OUTYY(("P(server_trust_anchor_file:%s)\n", $2));
436450 if(!cfg_strlist_insert(&cfg_parser->cfg->
438452 yyerror("out of memory");
439453 }
440454 ;
441 server_trusted_keys_file: VAR_TRUSTED_KEYS_FILE STRING
455 server_trusted_keys_file: VAR_TRUSTED_KEYS_FILE STRING_ARG
442456 {
443457 OUTYY(("P(server_trusted_keys_file:%s)\n", $2));
444458 if(!cfg_strlist_insert(&cfg_parser->cfg->
446460 yyerror("out of memory");
447461 }
448462 ;
449 server_trust_anchor: VAR_TRUST_ANCHOR STRING
463 server_trust_anchor: VAR_TRUST_ANCHOR STRING_ARG
450464 {
451465 OUTYY(("P(server_trust_anchor:%s)\n", $2));
452466 if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, $2))
453467 yyerror("out of memory");
454468 }
455469 ;
456 server_hide_identity: VAR_HIDE_IDENTITY STRING
470 server_domain_insecure: VAR_DOMAIN_INSECURE STRING_ARG
471 {
472 OUTYY(("P(server_domain_insecure:%s)\n", $2));
473 if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, $2))
474 yyerror("out of memory");
475 }
476 ;
477 server_hide_identity: VAR_HIDE_IDENTITY STRING_ARG
457478 {
458479 OUTYY(("P(server_hide_identity:%s)\n", $2));
459480 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
462483 free($2);
463484 }
464485 ;
465 server_hide_version: VAR_HIDE_VERSION STRING
486 server_hide_version: VAR_HIDE_VERSION STRING_ARG
466487 {
467488 OUTYY(("P(server_hide_version:%s)\n", $2));
468489 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
471492 free($2);
472493 }
473494 ;
474 server_identity: VAR_IDENTITY STRING
495 server_identity: VAR_IDENTITY STRING_ARG
475496 {
476497 OUTYY(("P(server_identity:%s)\n", $2));
477498 free(cfg_parser->cfg->identity);
478499 cfg_parser->cfg->identity = $2;
479500 }
480501 ;
481 server_version: VAR_VERSION STRING
502 server_version: VAR_VERSION STRING_ARG
482503 {
483504 OUTYY(("P(server_version:%s)\n", $2));
484505 free(cfg_parser->cfg->version);
485506 cfg_parser->cfg->version = $2;
486507 }
487508 ;
488 server_msg_buffer_size: VAR_MSG_BUFFER_SIZE STRING
509 server_msg_buffer_size: VAR_MSG_BUFFER_SIZE STRING_ARG
489510 {
490511 OUTYY(("P(server_msg_buffer_size:%s)\n", $2));
491512 if(atoi($2) == 0)
496517 free($2);
497518 }
498519 ;
499 server_msg_cache_size: VAR_MSG_CACHE_SIZE STRING
520 server_msg_cache_size: VAR_MSG_CACHE_SIZE STRING_ARG
500521 {
501522 OUTYY(("P(server_msg_cache_size:%s)\n", $2));
502523 if(!cfg_parse_memsize($2, &cfg_parser->cfg->msg_cache_size))
504525 free($2);
505526 }
506527 ;
507 server_msg_cache_slabs: VAR_MSG_CACHE_SLABS STRING
528 server_msg_cache_slabs: VAR_MSG_CACHE_SLABS STRING_ARG
508529 {
509530 OUTYY(("P(server_msg_cache_slabs:%s)\n", $2));
510531 if(atoi($2) == 0)
517538 free($2);
518539 }
519540 ;
520 server_num_queries_per_thread: VAR_NUM_QUERIES_PER_THREAD STRING
541 server_num_queries_per_thread: VAR_NUM_QUERIES_PER_THREAD STRING_ARG
521542 {
522543 OUTYY(("P(server_num_queries_per_thread:%s)\n", $2));
523544 if(atoi($2) == 0)
526547 free($2);
527548 }
528549 ;
529 server_jostle_timeout: VAR_JOSTLE_TIMEOUT STRING
550 server_jostle_timeout: VAR_JOSTLE_TIMEOUT STRING_ARG
530551 {
531552 OUTYY(("P(server_jostle_timeout:%s)\n", $2));
532553 if(atoi($2) == 0 && strcmp($2, "0") != 0)
535556 free($2);
536557 }
537558 ;
538 server_rrset_cache_size: VAR_RRSET_CACHE_SIZE STRING
559 server_rrset_cache_size: VAR_RRSET_CACHE_SIZE STRING_ARG
539560 {
540561 OUTYY(("P(server_rrset_cache_size:%s)\n", $2));
541562 if(!cfg_parse_memsize($2, &cfg_parser->cfg->rrset_cache_size))
543564 free($2);
544565 }
545566 ;
546 server_rrset_cache_slabs: VAR_RRSET_CACHE_SLABS STRING
567 server_rrset_cache_slabs: VAR_RRSET_CACHE_SLABS STRING_ARG
547568 {
548569 OUTYY(("P(server_rrset_cache_slabs:%s)\n", $2));
549570 if(atoi($2) == 0)
556577 free($2);
557578 }
558579 ;
559 server_infra_host_ttl: VAR_INFRA_HOST_TTL STRING
580 server_infra_host_ttl: VAR_INFRA_HOST_TTL STRING_ARG
560581 {
561582 OUTYY(("P(server_infra_host_ttl:%s)\n", $2));
562583 if(atoi($2) == 0 && strcmp($2, "0") != 0)
565586 free($2);
566587 }
567588 ;
568 server_infra_lame_ttl: VAR_INFRA_LAME_TTL STRING
589 server_infra_lame_ttl: VAR_INFRA_LAME_TTL STRING_ARG
569590 {
570591 OUTYY(("P(server_infra_lame_ttl:%s)\n", $2));
571592 if(atoi($2) == 0 && strcmp($2, "0") != 0)
574595 free($2);
575596 }
576597 ;
577 server_infra_cache_numhosts: VAR_INFRA_CACHE_NUMHOSTS STRING
598 server_infra_cache_numhosts: VAR_INFRA_CACHE_NUMHOSTS STRING_ARG
578599 {
579600 OUTYY(("P(server_infra_cache_numhosts:%s)\n", $2));
580601 if(atoi($2) == 0)
583604 free($2);
584605 }
585606 ;
586 server_infra_cache_lame_size: VAR_INFRA_CACHE_LAME_SIZE STRING
607 server_infra_cache_lame_size: VAR_INFRA_CACHE_LAME_SIZE STRING_ARG
587608 {
588609 OUTYY(("P(server_infra_cache_lame_size:%s)\n", $2));
589610 if(!cfg_parse_memsize($2, &cfg_parser->cfg->
592613 free($2);
593614 }
594615 ;
595 server_infra_cache_slabs: VAR_INFRA_CACHE_SLABS STRING
616 server_infra_cache_slabs: VAR_INFRA_CACHE_SLABS STRING_ARG
596617 {
597618 OUTYY(("P(server_infra_cache_slabs:%s)\n", $2));
598619 if(atoi($2) == 0)
605626 free($2);
606627 }
607628 ;
608 server_target_fetch_policy: VAR_TARGET_FETCH_POLICY STRING
629 server_target_fetch_policy: VAR_TARGET_FETCH_POLICY STRING_ARG
609630 {
610631 OUTYY(("P(server_target_fetch_policy:%s)\n", $2));
611632 free(cfg_parser->cfg->target_fetch_policy);
612633 cfg_parser->cfg->target_fetch_policy = $2;
613634 }
614635 ;
615 server_harden_short_bufsize: VAR_HARDEN_SHORT_BUFSIZE STRING
636 server_harden_short_bufsize: VAR_HARDEN_SHORT_BUFSIZE STRING_ARG
616637 {
617638 OUTYY(("P(server_harden_short_bufsize:%s)\n", $2));
618639 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
622643 free($2);
623644 }
624645 ;
625 server_harden_large_queries: VAR_HARDEN_LARGE_QUERIES STRING
646 server_harden_large_queries: VAR_HARDEN_LARGE_QUERIES STRING_ARG
626647 {
627648 OUTYY(("P(server_harden_large_queries:%s)\n", $2));
628649 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
632653 free($2);
633654 }
634655 ;
635 server_harden_glue: VAR_HARDEN_GLUE STRING
656 server_harden_glue: VAR_HARDEN_GLUE STRING_ARG
636657 {
637658 OUTYY(("P(server_harden_glue:%s)\n", $2));
638659 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
642663 free($2);
643664 }
644665 ;
645 server_harden_dnssec_stripped: VAR_HARDEN_DNNSEC_STRIPPED STRING
666 server_harden_dnssec_stripped: VAR_HARDEN_DNNSEC_STRIPPED STRING_ARG
646667 {
647668 OUTYY(("P(server_harden_dnssec_stripped:%s)\n", $2));
648669 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
652673 free($2);
653674 }
654675 ;
655 server_harden_referral_path: VAR_HARDEN_REFERRAL_PATH STRING
676 server_harden_referral_path: VAR_HARDEN_REFERRAL_PATH STRING_ARG
656677 {
657678 OUTYY(("P(server_harden_referral_path:%s)\n", $2));
658679 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
662683 free($2);
663684 }
664685 ;
665 server_use_caps_for_id: VAR_USE_CAPS_FOR_ID STRING
686 server_use_caps_for_id: VAR_USE_CAPS_FOR_ID STRING_ARG
666687 {
667688 OUTYY(("P(server_use_caps_for_id:%s)\n", $2));
668689 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
672693 free($2);
673694 }
674695 ;
675 server_private_address: VAR_PRIVATE_ADDRESS STRING
696 server_private_address: VAR_PRIVATE_ADDRESS STRING_ARG
676697 {
677698 OUTYY(("P(server_private_address:%s)\n", $2));
678699 if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, $2))
679700 yyerror("out of memory");
680701 }
681702 ;
682 server_private_domain: VAR_PRIVATE_DOMAIN STRING
703 server_private_domain: VAR_PRIVATE_DOMAIN STRING_ARG
683704 {
684705 OUTYY(("P(server_private_domain:%s)\n", $2));
685706 if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, $2))
686707 yyerror("out of memory");
687708 }
688709 ;
689 server_unwanted_reply_threshold: VAR_UNWANTED_REPLY_THRESHOLD STRING
710 server_unwanted_reply_threshold: VAR_UNWANTED_REPLY_THRESHOLD STRING_ARG
690711 {
691712 OUTYY(("P(server_unwanted_reply_threshold:%s)\n", $2));
692713 if(atoi($2) == 0 && strcmp($2, "0") != 0)
695716 free($2);
696717 }
697718 ;
698 server_do_not_query_address: VAR_DO_NOT_QUERY_ADDRESS STRING
719 server_do_not_query_address: VAR_DO_NOT_QUERY_ADDRESS STRING_ARG
699720 {
700721 OUTYY(("P(server_do_not_query_address:%s)\n", $2));
701722 if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, $2))
702723 yyerror("out of memory");
703724 }
704725 ;
705 server_do_not_query_localhost: VAR_DO_NOT_QUERY_LOCALHOST STRING
726 server_do_not_query_localhost: VAR_DO_NOT_QUERY_LOCALHOST STRING_ARG
706727 {
707728 OUTYY(("P(server_do_not_query_localhost:%s)\n", $2));
708729 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
712733 free($2);
713734 }
714735 ;
715 server_access_control: VAR_ACCESS_CONTROL STRING STRING
736 server_access_control: VAR_ACCESS_CONTROL STRING_ARG STRING_ARG
716737 {
717738 OUTYY(("P(server_access_control:%s %s)\n", $2, $3));
718739 if(strcmp($3, "deny")!=0 && strcmp($3, "refuse")!=0 &&
726747 }
727748 }
728749 ;
729 server_module_conf: VAR_MODULE_CONF STRING
750 server_module_conf: VAR_MODULE_CONF STRING_ARG
730751 {
731752 OUTYY(("P(server_module_conf:%s)\n", $2));
732753 free(cfg_parser->cfg->module_conf);
733754 cfg_parser->cfg->module_conf = $2;
734755 }
735756 ;
736 server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING
757 server_val_override_date: VAR_VAL_OVERRIDE_DATE STRING_ARG
737758 {
738759 OUTYY(("P(server_val_override_date:%s)\n", $2));
739760 if(strlen($2) == 0 || strcmp($2, "0") == 0) {
751772 free($2);
752773 }
753774 ;
754 server_cache_max_ttl: VAR_CACHE_MAX_TTL STRING
775 server_val_sig_skew_min: VAR_VAL_SIG_SKEW_MIN STRING_ARG
776 {
777 OUTYY(("P(server_val_sig_skew_min:%s)\n", $2));
778 if(strlen($2) == 0 || strcmp($2, "0") == 0) {
779 cfg_parser->cfg->val_sig_skew_min = 0;
780 } else {
781 cfg_parser->cfg->val_sig_skew_min = atoi($2);
782 if(!cfg_parser->cfg->val_sig_skew_min)
783 yyerror("number expected");
784 }
785 free($2);
786 }
787 ;
788 server_val_sig_skew_max: VAR_VAL_SIG_SKEW_MAX STRING_ARG
789 {
790 OUTYY(("P(server_val_sig_skew_max:%s)\n", $2));
791 if(strlen($2) == 0 || strcmp($2, "0") == 0) {
792 cfg_parser->cfg->val_sig_skew_max = 0;
793 } else {
794 cfg_parser->cfg->val_sig_skew_max = atoi($2);
795 if(!cfg_parser->cfg->val_sig_skew_max)
796 yyerror("number expected");
797 }
798 free($2);
799 }
800 ;
801 server_cache_max_ttl: VAR_CACHE_MAX_TTL STRING_ARG
755802 {
756803 OUTYY(("P(server_cache_max_ttl:%s)\n", $2));
757804 if(atoi($2) == 0 && strcmp($2, "0") != 0)
760807 free($2);
761808 }
762809 ;
763 server_bogus_ttl: VAR_BOGUS_TTL STRING
810 server_cache_min_ttl: VAR_CACHE_MIN_TTL STRING_ARG
811 {
812 OUTYY(("P(server_cache_min_ttl:%s)\n", $2));
813 if(atoi($2) == 0 && strcmp($2, "0") != 0)
814 yyerror("number expected");
815 else cfg_parser->cfg->min_ttl = atoi($2);
816 free($2);
817 }
818 ;
819 server_bogus_ttl: VAR_BOGUS_TTL STRING_ARG
764820 {
765821 OUTYY(("P(server_bogus_ttl:%s)\n", $2));
766822 if(atoi($2) == 0 && strcmp($2, "0") != 0)
769825 free($2);
770826 }
771827 ;
772 server_val_clean_additional: VAR_VAL_CLEAN_ADDITIONAL STRING
828 server_val_clean_additional: VAR_VAL_CLEAN_ADDITIONAL STRING_ARG
773829 {
774830 OUTYY(("P(server_val_clean_additional:%s)\n", $2));
775831 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
779835 free($2);
780836 }
781837 ;
782 server_val_permissive_mode: VAR_VAL_PERMISSIVE_MODE STRING
838 server_val_permissive_mode: VAR_VAL_PERMISSIVE_MODE STRING_ARG
783839 {
784840 OUTYY(("P(server_val_permissive_mode:%s)\n", $2));
785841 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
789845 free($2);
790846 }
791847 ;
792 server_val_nsec3_keysize_iterations: VAR_VAL_NSEC3_KEYSIZE_ITERATIONS STRING
848 server_val_nsec3_keysize_iterations: VAR_VAL_NSEC3_KEYSIZE_ITERATIONS STRING_ARG
793849 {
794850 OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", $2));
795851 free(cfg_parser->cfg->val_nsec3_key_iterations);
796852 cfg_parser->cfg->val_nsec3_key_iterations = $2;
797853 }
798854 ;
799 server_key_cache_size: VAR_KEY_CACHE_SIZE STRING
855 server_key_cache_size: VAR_KEY_CACHE_SIZE STRING_ARG
800856 {
801857 OUTYY(("P(server_key_cache_size:%s)\n", $2));
802858 if(!cfg_parse_memsize($2, &cfg_parser->cfg->key_cache_size))
804860 free($2);
805861 }
806862 ;
807 server_key_cache_slabs: VAR_KEY_CACHE_SLABS STRING
863 server_key_cache_slabs: VAR_KEY_CACHE_SLABS STRING_ARG
808864 {
809865 OUTYY(("P(server_key_cache_slabs:%s)\n", $2));
810866 if(atoi($2) == 0)
817873 free($2);
818874 }
819875 ;
820 server_neg_cache_size: VAR_NEG_CACHE_SIZE STRING
876 server_neg_cache_size: VAR_NEG_CACHE_SIZE STRING_ARG
821877 {
822878 OUTYY(("P(server_neg_cache_size:%s)\n", $2));
823879 if(!cfg_parse_memsize($2, &cfg_parser->cfg->neg_cache_size))
825881 free($2);
826882 }
827883 ;
828 server_local_zone: VAR_LOCAL_ZONE STRING STRING
884 server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
829885 {
830886 OUTYY(("P(server_local_zone:%s %s)\n", $2, $3));
831887 if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
845901 }
846902 }
847903 ;
848 server_local_data: VAR_LOCAL_DATA STRING
904 server_local_data: VAR_LOCAL_DATA STRING_ARG
849905 {
850906 OUTYY(("P(server_local_data:%s)\n", $2));
851907 if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, $2))
852908 fatal_exit("out of memory adding local-data");
853909 }
854910 ;
855 server_local_data_ptr: VAR_LOCAL_DATA_PTR STRING
911 server_local_data_ptr: VAR_LOCAL_DATA_PTR STRING_ARG
856912 {
857913 char* ptr;
858914 OUTYY(("P(server_local_data_ptr:%s)\n", $2));
867923 }
868924 }
869925 ;
870 stub_name: VAR_NAME STRING
926 stub_name: VAR_NAME STRING_ARG
871927 {
872928 OUTYY(("P(name:%s)\n", $2));
873929 free(cfg_parser->cfg->stubs->name);
874930 cfg_parser->cfg->stubs->name = $2;
875931 }
876932 ;
877 stub_host: VAR_STUB_HOST STRING
933 stub_host: VAR_STUB_HOST STRING_ARG
878934 {
879935 OUTYY(("P(stub-host:%s)\n", $2));
880936 if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, $2))
881937 yyerror("out of memory");
882938 }
883939 ;
884 stub_addr: VAR_STUB_ADDR STRING
940 stub_addr: VAR_STUB_ADDR STRING_ARG
885941 {
886942 OUTYY(("P(stub-addr:%s)\n", $2));
887943 if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, $2))
888944 yyerror("out of memory");
889945 }
890946 ;
891 stub_prime: VAR_STUB_PRIME STRING
947 stub_prime: VAR_STUB_PRIME STRING_ARG
892948 {
893949 OUTYY(("P(stub-prime:%s)\n", $2));
894950 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
898954 free($2);
899955 }
900956 ;
901 forward_name: VAR_NAME STRING
957 forward_name: VAR_NAME STRING_ARG
902958 {
903959 OUTYY(("P(name:%s)\n", $2));
904960 free(cfg_parser->cfg->forwards->name);
905961 cfg_parser->cfg->forwards->name = $2;
906962 }
907963 ;
908 forward_host: VAR_FORWARD_HOST STRING
964 forward_host: VAR_FORWARD_HOST STRING_ARG
909965 {
910966 OUTYY(("P(forward-host:%s)\n", $2));
911967 if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, $2))
912968 yyerror("out of memory");
913969 }
914970 ;
915 forward_addr: VAR_FORWARD_ADDR STRING
971 forward_addr: VAR_FORWARD_ADDR STRING_ARG
916972 {
917973 OUTYY(("P(forward-addr:%s)\n", $2));
918974 if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, $2))
930986 rc_server_key_file | rc_server_cert_file | rc_control_key_file |
931987 rc_control_cert_file
932988 ;
933 rc_control_enable: VAR_CONTROL_ENABLE STRING
989 rc_control_enable: VAR_CONTROL_ENABLE STRING_ARG
934990 {
935991 OUTYY(("P(control_enable:%s)\n", $2));
936992 if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
940996 free($2);
941997 }
942998 ;
943 rc_control_port: VAR_CONTROL_PORT STRING
999 rc_control_port: VAR_CONTROL_PORT STRING_ARG
9441000 {
9451001 OUTYY(("P(control_port:%s)\n", $2));
9461002 if(atoi($2) == 0)
9491005 free($2);
9501006 }
9511007 ;
952 rc_control_interface: VAR_CONTROL_INTERFACE STRING
1008 rc_control_interface: VAR_CONTROL_INTERFACE STRING_ARG
9531009 {
9541010 OUTYY(("P(control_interface:%s)\n", $2));
9551011 if(!cfg_strlist_insert(&cfg_parser->cfg->control_ifs, $2))
9561012 yyerror("out of memory");
9571013 }
9581014 ;
959 rc_server_key_file: VAR_SERVER_KEY_FILE STRING
1015 rc_server_key_file: VAR_SERVER_KEY_FILE STRING_ARG
9601016 {
9611017 OUTYY(("P(rc_server_key_file:%s)\n", $2));
9621018 free(cfg_parser->cfg->server_key_file);
9631019 cfg_parser->cfg->server_key_file = $2;
9641020 }
9651021 ;
966 rc_server_cert_file: VAR_SERVER_CERT_FILE STRING
1022 rc_server_cert_file: VAR_SERVER_CERT_FILE STRING_ARG
9671023 {
9681024 OUTYY(("P(rc_server_cert_file:%s)\n", $2));
9691025 free(cfg_parser->cfg->server_cert_file);
9701026 cfg_parser->cfg->server_cert_file = $2;
9711027 }
9721028 ;
973 rc_control_key_file: VAR_CONTROL_KEY_FILE STRING
1029 rc_control_key_file: VAR_CONTROL_KEY_FILE STRING_ARG
9741030 {
9751031 OUTYY(("P(rc_control_key_file:%s)\n", $2));
9761032 free(cfg_parser->cfg->control_key_file);
9771033 cfg_parser->cfg->control_key_file = $2;
9781034 }
9791035 ;
980 rc_control_cert_file: VAR_CONTROL_CERT_FILE STRING
1036 rc_control_cert_file: VAR_CONTROL_CERT_FILE STRING_ARG
9811037 {
9821038 OUTYY(("P(rc_control_cert_file:%s)\n", $2));
9831039 free(cfg_parser->cfg->control_cert_file);
9841040 cfg_parser->cfg->control_cert_file = $2;
9851041 }
9861042 ;
1043 pythonstart: VAR_PYTHON
1044 {
1045 OUTYY(("\nP(python:)\n"));
1046 }
1047 ;
1048 contents_py: contents_py content_py
1049 | ;
1050 content_py: py_script
1051 ;
1052 py_script: VAR_PYTHON_SCRIPT STRING_ARG
1053 {
1054 OUTYY(("P(python-script:%s)\n", $2));
1055 free(cfg_parser->cfg->python_script);
1056 cfg_parser->cfg->python_script = $2;
1057 }
9871058 %%
9881059
9891060 /* parse helper routines could be here */
88
99 #ifndef UTIL_CONFIGYYRENAME_H
1010 #define UTIL_CONFIGYYRENAME_H
11 #include "config.h"
1211
1312 /* defines to change symbols so that no yacc/lex symbols clash */
1413 #define yymaxdepth ub_c_maxdepth
718718 uint16_t flags;
719719 int attach_edns = 1;
720720
721 if(!cached) {
721 if(!cached || rep->authoritative) {
722722 /* original flags, copy RD and CD bits from query. */
723723 flags = rep->flags | (qflags & (BIT_RD|BIT_CD));
724724 } else {
7070 #define PARSE_TABLE_SIZE 32
7171 /** Maximum TTL that is allowed. */
7272 extern uint32_t MAX_TTL;
73 /** Minimum TTL that is allowed. */
74 extern uint32_t MIN_TTL;
7375 /** Negative cache time (for entries without any RRs.) */
7476 #define NORR_TTL 5 /* seconds */
7577
5252
5353 /** MAX TTL default for messages and rrsets */
5454 uint32_t MAX_TTL = 3600 * 24 * 10; /* ten days */
55 /** MIN TTL default for messages and rrsets */
56 uint32_t MIN_TTL = 0;
5557
5658 /** allocate qinfo, return 0 on error */
5759 static int
9698 rep->ar_numrrsets = ar;
9799 rep->rrset_count = total;
98100 rep->security = sec;
101 rep->authoritative = 0;
99102 /* array starts after the refs */
100103 if(region)
101104 rep->rrsets = (struct ub_packed_rrset_key**)&(rep->ref[0]);
157160 /* RFC 2181 Section 8. if msb of ttl is set treat as if zero. */
158161 if(*rr_ttl & 0x80000000U)
159162 *rr_ttl = 0;
163 if(*rr_ttl < MIN_TTL)
164 *rr_ttl = MIN_TTL;
160165 if(*rr_ttl < data->ttl)
161166 data->ttl = *rr_ttl;
162167
9898 uint16_t flags;
9999
100100 /**
101 * This flag informs unbound the answer is authoritative and
102 * the AA flag should be preserved.
103 */
104 uint8_t authoritative;
105
106 /**
101107 * Number of RRs in the query section.
102108 * If qdcount is not 0, then it is 1, and the data that appears
103109 * in the reply is the same as the query_info.
104110 * Host byte order.
105111 */
106 uint16_t qdcount;
112 uint8_t qdcount;
107113
108114 /**
109115 * TTL of the entire reply (for negative caching).
126132 size_t an_numrrsets;
127133
128134 /** Count of authority section RRsets */
129 size_t ns_numrrsets;
130
135 size_t ns_numrrsets;
131136 /** Count of additional section RRsets */
132137 size_t ar_numrrsets;
133138
6868 #include "libunbound/libworker.h"
6969 #include "libunbound/context.h"
7070 #include "util/tube.h"
71 #ifdef UB_ON_WINDOWS
72 #include "winrc/win_svc.h"
73 #endif
74
75 #ifdef WITH_PYTHONMODULE
76 #include "pythonmod/pythonmod.h"
77 #endif
7178
7279 int
7380 fptr_whitelist_comm_point(comm_point_callback_t *fptr)
95102 if(fptr == &pending_udp_timer_cb) return 1;
96103 else if(fptr == &outnet_tcptimer) return 1;
97104 else if(fptr == &worker_stat_timer_cb) return 1;
105 #ifdef UB_ON_WINDOWS
106 else if(fptr == &wsvc_cron_cb) return 1;
107 #endif
98108 return 0;
99109 }
100110
117127 else if(fptr == &comm_point_local_handle_callback) return 1;
118128 else if(fptr == &comm_point_raw_handle_callback) return 1;
119129 else if(fptr == &tube_handle_signal) return 1;
130 #ifdef UB_ON_WINDOWS
131 else if(fptr == &worker_win_stop_cb) return 1;
132 #endif
120133 return 0;
121134 }
122135
285298 {
286299 if(fptr == &iter_init) return 1;
287300 else if(fptr == &val_init) return 1;
301 #ifdef WITH_PYTHONMODULE
302 else if(fptr == &pythonmod_init) return 1;
303 #endif
288304 return 0;
289305 }
290306
293309 {
294310 if(fptr == &iter_deinit) return 1;
295311 else if(fptr == &val_deinit) return 1;
312 #ifdef WITH_PYTHONMODULE
313 else if(fptr == &pythonmod_deinit) return 1;
314 #endif
296315 return 0;
297316 }
298317
302321 {
303322 if(fptr == &iter_operate) return 1;
304323 else if(fptr == &val_operate) return 1;
324 #ifdef WITH_PYTHONMODULE
325 else if(fptr == &pythonmod_operate) return 1;
326 #endif
305327 return 0;
306328 }
307329
311333 {
312334 if(fptr == &iter_inform_super) return 1;
313335 else if(fptr == &val_inform_super) return 1;
336 #ifdef WITH_PYTHONMODULE
337 else if(fptr == &pythonmod_inform_super) return 1;
338 #endif
314339 return 0;
315340 }
316341
320345 {
321346 if(fptr == &iter_clear) return 1;
322347 else if(fptr == &val_clear) return 1;
348 #ifdef WITH_PYTHONMODULE
349 else if(fptr == &pythonmod_clear) return 1;
350 #endif
323351 return 0;
324352 }
325353
328356 {
329357 if(fptr == &iter_get_mem) return 1;
330358 else if(fptr == &val_get_mem) return 1;
359 #ifdef WITH_PYTHONMODULE
360 else if(fptr == &pythonmod_get_mem) return 1;
361 #endif
331362 return 0;
332363 }
333364
37773777 4184,
37783778 4185,
37793779 4188,
3780 4191,
37803781 4199,
37813782 4300,
37823783 4301,
38183819 4357,
38193820 4358,
38203821 4359,
3822 4361,
38213823 4368,
38223824 4369,
38233825 4370,
38293831 4379,
38303832 4389,
38313833 4390,
3834 4394,
3835 4395,
38323836 4400,
38333837 4401,
38343838 4402,
38683872 4548,
38693873 4549,
38703874 4550,
3875 4551,
3876 4552,
38713877 4554,
38723878 4555,
38733879 4556,
38763882 4567,
38773883 4568,
38783884 4569,
3885 4591,
38793886 4592,
38803887 4593,
38813888 4594,
39413948 4751,
39423949 4752,
39433950 4784,
3951 4785,
39443952 4800,
39453953 4801,
39463954 4802,
3955 4803,
39473956 4827,
39483957 4837,
39493958 4838,
40804089 5235,
40814090 5236,
40824091 5237,
4092 5245,
40834093 5246,
40844094 5247,
40854095 5248,
41264136 5360,
41274137 5361,
41284138 5362,
4139 5363,
41294140 5397,
41304141 5398,
41314142 5399,
43594370 6443,
43604371 6444,
43614372 6445,
4373 6446,
43624374 6456,
43634375 6471,
43644376 6480,
46824694 8555,
46834695 8567,
46844696 8600,
4697 8610,
46854698 8611,
46864699 8612,
46874700 8613,
46884701 8614,
46894702 8686,
46904703 8699,
4704 8732,
46914705 8733,
46924706 8763,
46934707 8764,
47744788 9217,
47754789 9222,
47764790 9255,
4791 9278,
4792 9279,
47774793 9280,
47784794 9281,
47794795 9282,
48194835 9618,
48204836 9628,
48214837 9629,
4838 9667,
4839 9668,
48224840 9700,
48234841 9747,
48244842 9750,
48694887 10103,
48704888 10104,
48714889 10107,
4890 10110,
48724891 10113,
48734892 10114,
48744893 10115,
48764895 10128,
48774896 10160,
48784897 10200,
4898 10201,
48794899 10252,
48804900 10260,
48814901 10288,
48864906 10544,
48874907 10800,
48884908 10805,
4909 10860,
48894910 10990,
48904911 11000,
48914912 11001,
48994920 11165,
49004921 11201,
49014922 11208,
4923 11211,
49024924 11319,
49034925 11320,
49044926 11321,
50015023 18241,
50025024 18262,
50035025 18463,
5026 18634,
5027 18635,
50045028 18769,
50055029 18881,
50065030 18888,
50785102 24386,
50795103 24465,
50805104 24554,
5105 24676,
50815106 24677,
50825107 24678,
50835108 24680,
51725197 43188,
51735198 43189,
51745199 43190,
5200 43440,
51755201 43441,
51765202 44321,
51775203 44322,
164164
165165 void lock_basic_init(lock_basic_t* lock)
166166 {
167 *lock = CreateMutex(NULL, /* security attrs NULL, not process inherit*/
168 0, /* false, we do not hold the lock initially */
169 NULL); /* create anonymous mutex */
170 if(*lock == NULL) {
171 log_win_err("CreateMutex failed", GetLastError());
172 fatal_exit("lock init failed");
173 }
167 /* implement own lock, because windows HANDLE as Mutex usage
168 * uses too many handles and would bog down the whole system. */
169 (void)InterlockedExchange(lock, 0);
174170 }
175171
176172 void lock_basic_destroy(lock_basic_t* lock)
177173 {
178 if(!CloseHandle(*lock)) {
179 log_win_err("CloseHandle(Mutex) failed", GetLastError());
180 }
181 *lock = NULL;
174 (void)InterlockedExchange(lock, 0);
182175 }
183176
184177 void lock_basic_lock(lock_basic_t* lock)
185178 {
186 DWORD ret = WaitForSingleObject(*lock, INFINITE);
187 if(ret == WAIT_FAILED) {
188 log_win_err("WaitForSingleObject(Mutex):WAIT_FAILED",
189 GetLastError());
190 } else if(ret == WAIT_TIMEOUT) {
191 log_win_err("WaitForSingleObject(Mutex):WAIT_TIMEOUT",
192 GetLastError());
193 }
194 /* both WAIT_ABANDONED and WAIT_OBJECT_0 mean we have the lock */
179 LONG wait = 1; /* wait 1 msec at first */
180
181 while(InterlockedExchange(lock, 1)) {
182 /* if the old value was 1 then if was already locked */
183 Sleep(wait); /* wait with sleep */
184 wait *= 2; /* exponential backoff for waiting */
185 }
186 /* the old value was 0, but we inserted 1, we locked it! */
195187 }
196188
197189 void lock_basic_unlock(lock_basic_t* lock)
198190 {
199 if(!ReleaseMutex(*lock)) {
200 log_win_err("ReleaseMutex failed", GetLastError());
201 }
191 /* unlock it by inserting the value of 0. xchg for cache coherency. */
192 (void)InterlockedExchange(lock, 0);
202193 }
203194
204195 void ub_thread_key_create(ub_thread_key_t* key, void* f)
229220
230221 void ub_thread_create(ub_thread_t* thr, void* (*func)(void*), void* arg)
231222 {
223 #ifndef HAVE__BEGINTHREADEX
232224 *thr = CreateThread(NULL, /* default security (no inherit handle) */
233225 0, /* default stack size */
234226 (LPTHREAD_START_ROUTINE)func, arg,
235227 0, /* default flags, run immediately */
236228 NULL); /* do not store thread identifier anywhere */
229 #else
230 /* the begintheadex routine setups for the C lib; aligns stack */
231 *thr=(ub_thread_t)_beginthreadex(NULL, 0, (void*)func, arg, 0, NULL);
232 #endif
237233 if(*thr == NULL) {
238234 log_win_err("CreateThread failed", GetLastError());
239235 fatal_exit("thread create failed");
201201 #include <windows.h>
202202
203203 /* Use a mutex */
204 typedef HANDLE lock_rw_t;
204 typedef LONG lock_rw_t;
205205 #define lock_rw_init(lock) lock_basic_init(lock)
206206 #define lock_rw_destroy(lock) lock_basic_destroy(lock)
207207 #define lock_rw_rdlock(lock) lock_basic_lock(lock)
209209 #define lock_rw_unlock(lock) lock_basic_unlock(lock)
210210
211211 /** the basic lock is a mutex, implemented opaquely, for error handling. */
212 typedef HANDLE lock_basic_t;
212 typedef LONG lock_basic_t;
213213 void lock_basic_init(lock_basic_t* lock);
214214 void lock_basic_destroy(lock_basic_t* lock);
215215 void lock_basic_lock(lock_basic_t* lock);
216216 void lock_basic_unlock(lock_basic_t* lock);
217217
218218 /** on windows no spinlock, use mutex too. */
219 typedef HANDLE lock_quick_t;
219 typedef LONG lock_quick_t;
220220 #define lock_quick_init(lock) lock_basic_init(lock)
221221 #define lock_quick_destroy(lock) lock_basic_destroy(lock)
222222 #define lock_quick_lock(lock) lock_basic_lock(lock)
5353 # define LOG_INFO 6
5454 # define LOG_DEBUG 7
5555 #endif
56 #ifdef UB_ON_WINDOWS
57 # include "winrc/win_svc.h"
58 #endif
5659
5760 /* default verbosity */
5861 enum verbosity_value verbosity = 0;
6467 static ub_thread_key_t logkey;
6568 /** the identity of this executable/process */
6669 static const char* ident="unbound";
67 #ifdef HAVE_SYSLOG_H
70 #if defined(HAVE_SYSLOG_H) || defined(UB_ON_WINDOWS)
6871 /** are we using syslog(3) to log to */
6972 static int logging_to_syslog = 0;
7073 #endif /* HAVE_SYSLOG_H */
7174 /** time to print in log, if NULL, use time(2) */
7275 static uint32_t* log_now = NULL;
76 /** print time in UTC or in secondsfrom1970 */
77 static int log_time_asc = 0;
7378
7479 void
7580 log_init(const char* filename, int use_syslog, const char* chrootdir)
8085 ub_thread_key_create(&logkey, NULL);
8186 }
8287 if(logfile
83 #ifdef HAVE_SYSLOG_H
88 #if defined(HAVE_SYSLOG_H) || defined(UB_ON_WINDOWS)
8489 || logging_to_syslog
8590 #endif
8691 )
100105 logging_to_syslog = 1;
101106 return;
102107 }
108 #elif defined(UB_ON_WINDOWS)
109 if(logging_to_syslog) {
110 logging_to_syslog = 0;
111 }
112 if(use_syslog) {
113 logging_to_syslog = 1;
114 return;
115 }
103116 #endif /* HAVE_SYSLOG_H */
104117 if(!filename || !filename[0]) {
105118 logfile = stderr;
138151 log_now = t;
139152 }
140153
154 void log_set_time_asc(int use_asc)
155 {
156 log_time_asc = use_asc;
157 }
158
141159 void
142160 log_vmsg(int pri, const char* type,
143161 const char *format, va_list args)
144162 {
145163 char message[MAXSYSLOGMSGLEN];
146164 unsigned int* tid = (unsigned int*)ub_thread_key_get(logkey);
147 uint32_t now;
165 time_t now;
166 #if defined(HAVE_STRFTIME) && defined(HAVE_LOCALTIME_R)
167 char tmbuf[32];
168 struct tm tm;
169 #endif
148170 (void)pri;
149171 vsnprintf(message, sizeof(message), format, args);
150172 #ifdef HAVE_SYSLOG_H
153175 (int)getpid(), tid?*tid:0, type, message);
154176 return;
155177 }
178 #elif defined(UB_ON_WINDOWS)
179 if(logging_to_syslog) {
180 char m[32768];
181 HANDLE* s;
182 LPCTSTR str = m;
183 DWORD tp = MSG_GENERIC_ERR;
184 WORD wt = EVENTLOG_ERROR_TYPE;
185 if(strcmp(type, "info") == 0) {
186 tp=MSG_GENERIC_INFO;
187 wt=EVENTLOG_INFORMATION_TYPE;
188 } else if(strcmp(type, "warning") == 0) {
189 tp=MSG_GENERIC_WARN;
190 wt=EVENTLOG_WARNING_TYPE;
191 } else if(strcmp(type, "notice") == 0
192 || strcmp(type, "debug") == 0) {
193 tp=MSG_GENERIC_SUCCESS;
194 wt=EVENTLOG_SUCCESS;
195 }
196 snprintf(m, sizeof(m), "[%s:%x] %s: %s",
197 ident, tid?*tid:0, type, message);
198 s = RegisterEventSource(NULL, SERVICE_NAME);
199 if(!s) return;
200 ReportEvent(s, wt, 0, tp, NULL, 1, 0, &str, NULL);
201 DeregisterEventSource(s);
202 return;
203 }
156204 #endif /* HAVE_SYSLOG_H */
157205 if(!logfile) return;
158206 if(log_now)
159 now = *log_now;
160 else now = (uint32_t)time(NULL);
207 now = (time_t)*log_now;
208 else now = (time_t)time(NULL);
209 #if defined(HAVE_STRFTIME) && defined(HAVE_LOCALTIME_R)
210 if(log_time_asc && strftime(tmbuf, sizeof(tmbuf), "%b %d %H:%M:%S",
211 localtime_r(&now, &tm))%(sizeof(tmbuf)) != 0) {
212 /* %sizeof buf!=0 because old strftime returned max on error */
213 fprintf(logfile, "%s %s[%d:%x] %s: %s\n", tmbuf,
214 ident, (int)getpid(), tid?*tid:0, type, message);
215 } else
216 #endif
161217 fprintf(logfile, "[%u] %s[%d:%x] %s: %s\n", (unsigned)now,
162218 ident, (int)getpid(), tid?*tid:0, type, message);
163219 fflush(logfile);
4141 #ifndef UTIL_LOG_H
4242 #define UTIL_LOG_H
4343
44 #include "config.h"
45 #ifdef HAVE_STDARG_H
46 #include <stdarg.h>
47 #endif
48
4944 /**
5045 * verbosity value:
5146 */
5954 /** 3 - query level information */
6055 VERB_QUERY,
6156 /** 4 - algorithm level information */
62 VERB_ALGO
57 VERB_ALGO,
58 /** 5 - querier client information */
59 VERB_CLIENT
6360 };
6461
6562 /** The global verbosity setting */
110107 * if NULL, time(2) is used.
111108 */
112109 void log_set_time(uint32_t* t);
110
111 /**
112 * Set if the time value is printed ascii or decimal in log entries.
113 * @param use_asc: if true, ascii is printed, otherwise decimal.
114 * If the conversion fails or you have no time functions,
115 * decimal is printed.
116 */
117 void log_set_time_asc(int use_asc);
113118
114119 /**
115120 * Log informational message.
181181 #endif
182182 memmove(&r, &base->reads, sizeof(fd_set));
183183 memmove(&w, &base->writes, sizeof(fd_set));
184 memmove(&base->ready, &base->content, sizeof(fd_set));
184185
185186 if((ret = select(base->maxfd+1, &r, &w, NULL, wait)) == -1) {
186187 ret = errno;
196197
197198 for(i=0; i<base->maxfd+1; i++) {
198199 short bits = 0;
199 if(!base->fds[i]) {
200 if(!base->fds[i] || !(FD_ISSET(i, &base->ready))) {
200201 continue;
201202 }
202203 if(FD_ISSET(i, &r)) {
300301 if(ev->ev_events&EV_WRITE) {
301302 FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->writes);
302303 }
304 FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->content);
305 FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->ready);
303306 if(ev->ev_fd > ev->ev_base->maxfd)
304307 ev->ev_base->maxfd = ev->ev_fd;
305308 }
330333 ev->ev_base->fds[ev->ev_fd] = NULL;
331334 FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->reads);
332335 FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->writes);
336 FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->ready);
337 FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->content);
333338 }
334339 ev->added = 0;
335340 return 0;
8787 int maxfd;
8888 /** capacity - size of the fds array */
8989 int capfd;
90 /** fdset for read write */
91 fd_set reads, writes;
90 /** fdset for read write, for fds ready, and added */
91 fd_set reads, writes, ready, content;
9292 /** array of 0 - maxsig of ptr to event for it */
9393 struct event** signals;
9494 /** if we need to exit */
5757 struct mesh_state;
5858 struct val_anchors;
5959 struct val_neg_cache;
60 struct iter_forwards;
6061
6162 /** Maximum number of modules in operation */
6263 #define MAX_MODULE 5
207208 /** negative cache, configured by the validator. if not NULL,
208209 * contains NSEC record lookup trees. */
209210 struct val_neg_cache* neg_cache;
211 /** Mapping of forwarding zones to targets.
212 * iterator forwarder information. per-thread, created by worker */
213 struct iter_forwards* fwds;
210214 /** module specific data. indexed by module id. */
211215 void* modinfo[MAX_MODULE];
212216 };
460460 if(match > min) match = min;
461461 return match;
462462 }
463
464 void
465 addr_to_str(struct sockaddr_storage* addr, socklen_t addrlen,
466 char* buf, size_t len)
467 {
468 int af = (int)((struct sockaddr_in*)addr)->sin_family;
469 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
470 if(addr_is_ip6(addr, addrlen))
471 sinaddr = &((struct sockaddr_in6*)addr)->sin6_addr;
472 if(inet_ntop(af, sinaddr, buf, (socklen_t)len) == 0) {
473 snprintf(buf, len, "(inet_ntop_error)");
474 }
475 }
476
477 int
478 addr_is_ip4mapped(struct sockaddr_storage* addr, socklen_t addrlen)
479 {
480 /* prefix for ipv4 into ipv6 mapping is ::ffff:x.x.x.x */
481 const uint8_t map_prefix[16] =
482 {0,0,0,0, 0,0,0,0, 0,0,0xff,0xff, 0,0,0,0};
483 uint8_t* s;
484 if(!addr_is_ip6(addr, addrlen))
485 return 0;
486 /* s is 16 octet ipv6 address string */
487 s = (uint8_t*)&((struct sockaddr_in6*)addr)->sin6_addr;
488 return (memcmp(s, map_prefix, 12) == 0);
489 }
257257 int addr_in_common(struct sockaddr_storage* addr1, int net1,
258258 struct sockaddr_storage* addr2, int net2, socklen_t addrlen);
259259
260 /**
261 * Put address into string, works for IPv4 and IPv6.
262 * @param addr: address
263 * @param addrlen: length of address
264 * @param buf: result string stored here
265 * @param len: length of buf.
266 * On failure a string with "error" is stored inside.
267 */
268 void addr_to_str(struct sockaddr_storage* addr, socklen_t addrlen,
269 char* buf, size_t len);
270
271 /**
272 * See if sockaddr is an ipv6 mapped ipv4 address, ::ffff:0.0.0.0
273 * @param addr: address
274 * @param addrlen: length of address
275 * @return true if so
276 */
277 int addr_is_ip4mapped(struct sockaddr_storage* addr, socklen_t addrlen);
278
260279 #endif /* NET_HELP_H */
3737 *
3838 * This file contains event notification functions.
3939 */
40
40 #include "config.h"
4141 #include "util/netevent.h"
4242 #include "util/log.h"
4343 #include "util/net_help.h"
159159 b->eb->base=(struct event_base *)ev_loop_new(EVFLAG_AUTO);
160160 # else
161161 (void)sigs;
162 # ifdef HAVE_EVENT_BASE_NEW
163 b->eb->base = event_base_new();
164 # else
162165 b->eb->base = event_init();
166 # endif
163167 # endif
164168 #endif
165169 if(!b->eb->base) {
249253 if(errno == ENETUNREACH && verbosity < VERB_ALGO)
250254 return 0;
251255 #endif
256 /* squelch errors where people deploy AAAA ::ffff:bla for
257 * authority servers, which we try for intranets. */
258 if(errno == EINVAL && addr_is_ip4mapped(
259 (struct sockaddr_storage*)addr, addrlen) &&
260 verbosity < VERB_DETAIL)
261 return 0;
252262 #ifndef USE_WINSOCK
253263 verbose(VERB_OPS, "sendto failed: %s", strerror(errno));
254264 #else
865875 return 1;
866876 log_err("tcp writev: %s", strerror(errno));
867877 #else
878 if(WSAGetLastError() == WSAENOTCONN)
879 return 1;
868880 if(WSAGetLastError() == WSAEINPROGRESS)
869881 return 1;
870882 if(WSAGetLastError() == WSAEWOULDBLOCK) {
13841396 /* close fd after removing from event lists, or epoll.. is messed up */
13851397 if(c->fd != -1 && !c->do_not_close) {
13861398 verbose(VERB_ALGO, "close fd %d", c->fd);
1399 #ifndef USE_WINSOCK
13871400 close(c->fd);
1401 #else
1402 closesocket(c->fd);
1403 #endif
13881404 }
13891405 c->fd = -1;
13901406 }
14841500 else c->ev->ev.ev_events |= EV_WRITE;
14851501 }
14861502 if(newfd != -1) {
1487 if(c->fd != -1)
1503 if(c->fd != -1) {
1504 #ifndef USE_WINSOCK
14881505 close(c->fd);
1506 #else
1507 closesocket(c->fd);
1508 #endif
1509 }
14891510 c->fd = newfd;
14901511 c->ev->ev.ev_fd = c->fd;
14911512 }
5959 #ifndef NET_EVENT_H
6060 #define NET_EVENT_H
6161
62 #include "config.h"
6362 struct comm_point;
6463 struct comm_reply;
6564 struct event_base;
8080 /** Number of bytes to reseed after */
8181 #define REKEY_BYTES (1 << 24)
8282
83 /* (re)setup system seed */
84 void
85 ub_systemseed(unsigned int seed)
86 {
87 /* RAND_ is threadsafe, by the way */
88 if(!RAND_status()) {
89 /* try to seed it */
90 unsigned char buf[256];
91 unsigned int v = seed;
92 size_t i;
93 for(i=0; i<256/sizeof(seed); i++) {
94 memmove(buf+i*sizeof(seed), &v, sizeof(seed));
95 v = v*seed + (unsigned int)i;
96 }
97 RAND_seed(buf, 256);
98 if(!RAND_status()) {
99 log_err("Random generator has no entropy "
100 "(error %ld)", ERR_get_error());
101 } else {
102 verbose(VERB_OPS, "openssl has no entropy, "
103 "seeding with time and pid");
104 }
105 }
106 }
107
83108 /** reseed random generator */
84109 static void
85110 ub_arc4random_stir(struct ub_randstate* s, struct ub_randstate* from)
93118 for(i=0; i<SEED_SIZE; i++)
94119 rand_buf[i] = (unsigned char)ub_random(from);
95120 } else {
96 if (RAND_bytes(rand_buf, (int)sizeof(rand_buf)) <= 0)
97 fatal_exit("Couldn't obtain random bytes (error %ld)",
121 if(!RAND_status())
122 ub_systemseed((unsigned)getpid()^(unsigned)time(NULL));
123 if (RAND_bytes(rand_buf, (int)sizeof(rand_buf)) <= 0) {
124 /* very unlikely that this happens, since we seeded
125 * above, if it does; complain and keep going */
126 log_err("Couldn't obtain random bytes (error %ld)",
98127 ERR_get_error());
128 s->rc4_ready = 256;
129 return;
130 }
99131 }
100132 RC4_set_key(&s->rc4, SEED_SIZE, rand_buf);
101133
119151 log_err("malloc failure in random init");
120152 return NULL;
121153 }
122
123 /* RAND_ is threadsafe, by the way */
124 if(!RAND_status()) {
125 /* try to seed it */
126 unsigned char buf[256];
127 unsigned int v = seed;
128 size_t i;
129 for(i=0; i<256/sizeof(seed); i++) {
130 memmove(buf+i*sizeof(seed), &v, sizeof(seed));
131 v = v*seed + (unsigned int)i;
132 }
133 RAND_seed(buf, 256);
134 if(!RAND_status()) {
135 log_err("Random generator has no entropy (error %ld)",
136 ERR_get_error());
137 return NULL;
138 }
139 verbose(VERB_OPS, "openssl has no entropy, seeding with time"
140 " and pid");
141 }
154 ub_systemseed(seed);
142155 ub_arc4random_stir(s, from);
143156 return s;
144157 }
4747 struct ub_randstate;
4848
4949 /**
50 * Initialize the system randomness. Obtains entropy from the system
51 * before a chroot or privilege makes it unavailable.
52 * You do not have to call this, otherwise ub_initstate does so.
53 * @param seed: seed value to create state (if no good entropy is found).
54 */
55 void ub_systemseed(unsigned int seed);
56
57 /**
5058 * Initialize a random generator state for use
5159 * @param seed: seed value to create state contents.
5260 * (ignored for arc4random).
510510 table->markdelfunc = md;
511511 lock_quick_unlock(&table->lock);
512512 }
513
514 void
515 lruhash_traverse(struct lruhash* h, int wr,
516 void (*func)(struct lruhash_entry*, void*), void* arg)
517 {
518 size_t i;
519 struct lruhash_entry* e;
520
521 lock_quick_lock(&h->lock);
522 for(i=0; i<h->size; i++) {
523 lock_quick_lock(&h->array[i].lock);
524 for(e = h->array[i].overflow_list; e; e = e->overflow_next) {
525 if(wr) {
526 lock_rw_wrlock(&e->lock);
527 } else {
528 lock_rw_rdlock(&e->lock);
529 }
530 (*func)(e, arg);
531 lock_rw_unlock(&e->lock);
532 }
533 lock_quick_unlock(&h->array[i].lock);
534 }
535 lock_quick_unlock(&h->lock);
536 }
400400 */
401401 size_t lruhash_get_mem(struct lruhash* table);
402402
403 /**
404 * Traverse a lruhash. Call back for every element in the table.
405 * @param h: hash table. Locked before use.
406 * @param wr: if true writelock is obtained on element, otherwise readlock.
407 * @param func: function for every element. Do not lock or unlock elements.
408 * @param arg: user argument to func.
409 */
410 void lruhash_traverse(struct lruhash* h, int wr,
411 void (*func)(struct lruhash_entry*, void*), void* arg);
412
403413 #endif /* UTIL_STORAGE_LRUHASH_H */
208208 lruhash_setmarkdel(sl->array[i], md);
209209 }
210210 }
211
212 void slabhash_traverse(struct slabhash* sh, int wr,
213 void (*func)(struct lruhash_entry*, void*), void* arg)
214 {
215 size_t i;
216 for(i=0; i<sh->size; i++)
217 lruhash_traverse(sh->array[i], wr, func, arg);
218 }
172172 * @param md: markdel function ptr.
173173 */
174174 void slabhash_setmarkdel(struct slabhash* table, lruhash_markdelfunc_t md);
175
176 /**
177 * Traverse a slabhash.
178 * @param table: slabbed hash table.
179 * @param wr: if true, writelock is obtained, otherwise readlock.
180 * @param func: function to call for every element.
181 * @param arg: user argument to function.
182 */
183 void slabhash_traverse(struct slabhash* table, int wr,
184 void (*func)(struct lruhash_entry*, void*), void* arg);
175185
176186 /* --- test representation --- */
177187 /** test structure contains test key */
481481 free(tube);
482482 log_err("WSACreateEvent: %s", wsa_strerror(WSAGetLastError()));
483483 }
484 if(!WSAResetEvent(tube->event)) {
485 log_err("WSAResetEvent: %s", wsa_strerror(WSAGetLastError()));
486 }
484487 lock_basic_init(&tube->res_lock);
485488 verbose(VERB_ALGO, "tube created");
486489 return tube;
9494 return -1;
9595 }
9696
97 /** Find ptr in base array */
98 static int
99 zero_waitfor(WSAEVENT waitfor[], WSAEVENT x)
100 {
101 int i;
102 for(i=0; i<WSK_MAX_ITEMS; i++) {
103 if(waitfor[i] == x)
104 waitfor[i] = 0;
105 }
106 }
107
97108 void *event_init(uint32_t* time_secs, struct timeval* time_tv)
98109 {
99110 struct event_base* base = (struct event_base*)malloc(
127138 }
128139 base->tcp_stickies = 0;
129140 base->tcp_reinvigorated = 0;
141 verbose(VERB_CLIENT, "winsock_event inited");
130142 return base;
131143 }
132144
148160 #ifndef S_SPLINT_S
149161 wait->tv_sec = (time_t)-1;
150162 #endif
163 verbose(VERB_CLIENT, "winsock_event handle_timeouts");
151164
152165 while((rbnode_t*)(p = (struct event*)rbtree_first(base->times))
153166 !=RBTREE_NULL) {
165178 wait->tv_usec = p->ev_timeout.tv_usec
166179 - now->tv_usec;
167180 }
181 verbose(VERB_CLIENT, "winsock_event wait=%d.%6.6d",
182 (int)wait->tv_sec, (int)wait->tv_usec);
168183 return;
169184 }
170185 #endif
174189 fptr_ok(fptr_whitelist_event(p->ev_callback));
175190 (*p->ev_callback)(p->ev_fd, EV_TIMEOUT, p->ev_arg);
176191 }
192 verbose(VERB_CLIENT, "winsock_event wait=(-1)");
193 }
194
195 /** handle is_signal events and see if signalled */
196 static void handle_signal(struct event* ev)
197 {
198 DWORD ret;
199 log_assert(ev->is_signal && ev->hEvent);
200 /* see if the event is signalled */
201 ret = WSAWaitForMultipleEvents(1, &ev->hEvent, 0 /* any object */,
202 0 /* return immediately */, 0 /* not alertable for IOcomple*/);
203 if(ret == WSA_WAIT_IO_COMPLETION || ret == WSA_WAIT_FAILED) {
204 log_err("WSAWaitForMultipleEvents(signal) failed: %s",
205 wsa_strerror(WSAGetLastError()));
206 return;
207 }
208 if(ret == WSA_WAIT_TIMEOUT) {
209 /* not signalled */
210 return;
211 }
212
213 /* reset the signal */
214 if(!WSAResetEvent(ev->hEvent))
215 log_err("WSAResetEvent failed: %s",
216 wsa_strerror(WSAGetLastError()));
217 /* do the callback (which may set the signal again) */
218 fptr_ok(fptr_whitelist_event(ev->ev_callback));
219 (*ev->ev_callback)(ev->ev_fd, ev->ev_events, ev->ev_arg);
177220 }
178221
179222 /** call select and callbacks for that */
181224 {
182225 DWORD timeout = 0; /* in milliseconds */
183226 DWORD ret;
184 WSAEVENT waitfor[WSK_MAX_ITEMS];
185227 struct event* eventlist[WSK_MAX_ITEMS];
186228 WSANETWORKEVENTS netev;
187229 int i, numwait = 0, startidx = 0, was_timeout = 0;
188230 int newstickies = 0;
189231 struct timeval nultm;
232
233 verbose(VERB_CLIENT, "winsock_event handle_select");
190234
191235 #ifndef S_SPLINT_S
192236 if(wait->tv_sec==(time_t)-1)
206250 if(base->items[i]->ev_fd == -1 && !base->items[i]->is_signal)
207251 continue; /* skip timer only events */
208252 eventlist[numwait] = base->items[i];
209 waitfor[numwait++] = base->items[i]->hEvent;
253 base->waitfor[numwait++] = base->items[i]->hEvent;
254 if(numwait == WSK_MAX_ITEMS)
255 break; /* sanity check */
210256 }
211257 log_assert(numwait <= WSA_MAXIMUM_WAIT_EVENTS);
258 verbose(VERB_CLIENT, "winsock_event bmax=%d numwait=%d wait=%x "
259 "timeout=%d", base->max, numwait, (int)wait, (int)timeout);
212260
213261 /* do the wait */
214262 if(numwait == 0) {
218266 }
219267 was_timeout = 1;
220268 } else {
221 ret = WSAWaitForMultipleEvents(numwait, waitfor,
269 ret = WSAWaitForMultipleEvents(numwait, base->waitfor,
222270 0 /* do not wait for all, just one will do */,
223271 wait?timeout:WSA_INFINITE,
224272 0); /* we are not alertable (IO completion events) */
234282 } else
235283 startidx = ret - WSA_WAIT_EVENT_0;
236284 }
285 verbose(VERB_CLIENT, "winsock_event wake was_timeout=%d startidx=%d",
286 was_timeout, startidx);
237287
238288 /* get new time after wait */
239289 if(settime(base) < 0)
242292 /* callbacks */
243293 if(base->tcp_stickies)
244294 startidx = 0; /* process all events, some are sticky */
245
295 for(i=startidx; i<numwait; i++)
296 eventlist[i]->just_checked = 1;
297
298 verbose(VERB_CLIENT, "winsock_event signals");
299 for(i=startidx; i<numwait; i++) {
300 if(!base->waitfor[i])
301 continue; /* was deleted */
302 if(eventlist[i]->is_signal) {
303 eventlist[i]->just_checked = 0;
304 handle_signal(eventlist[i]);
305 }
306 }
307 /* early exit - do not process network, exit quickly */
308 if(base->need_to_exit)
309 return 0;
310
311 verbose(VERB_CLIENT, "winsock_event net");
246312 for(i=startidx; i<numwait; i++) {
247313 short bits = 0;
248314 /* eventlist[i] fired */
249 if(eventlist[i]->is_signal) {
250 /* not a network event at all */
251 fptr_ok(fptr_whitelist_event(
252 eventlist[i]->ev_callback));
253 (*eventlist[i]->ev_callback)(eventlist[i]->ev_fd,
254 eventlist[i]->ev_events,
255 eventlist[i]->ev_arg);
256 continue;
257 }
315 /* see if eventlist[i] is still valid and just checked from
316 * WSAWaitForEvents */
317 if(!base->waitfor[i])
318 continue; /* was deleted */
319 if(!eventlist[i]->just_checked)
320 continue; /* added by other callback */
321 if(eventlist[i]->is_signal)
322 continue; /* not a network event at all */
323 eventlist[i]->just_checked = 0;
324
258325 if(WSAEnumNetworkEvents(eventlist[i]->ev_fd,
259 waitfor[i], /* reset the event handle */
326 base->waitfor[i], /* reset the event handle */
260327 /*NULL,*/ /* do not reset the event handle */
261328 &netev) != 0) {
262329 log_err("WSAEnumNetworkEvents failed: %s",
340407 (eventlist[i]->old_events&EV_READ)?"EV_READ":"",
341408 (eventlist[i]->old_events&EV_WRITE)?"EV_WRITE":"");
342409 }
410 verbose(VERB_CLIENT, "winsock_event net");
343411 if(base->tcp_reinvigorated) {
412 verbose(VERB_CLIENT, "winsock_event reinvigorated");
344413 base->tcp_reinvigorated = 0;
345414 newstickies = 1;
346415 }
347416 base->tcp_stickies = newstickies;
417 verbose(VERB_CLIENT, "winsock_event handle_select end");
348418 return 0;
349419 }
350420
372442 int event_base_loopexit(struct event_base *base,
373443 struct timeval * ATTR_UNUSED(tv))
374444 {
445 verbose(VERB_CLIENT, "winsock_event loopexit");
375446 base->need_to_exit = 1;
376447 return 0;
377448 }
378449
379450 void event_base_free(struct event_base *base)
380451 {
452 verbose(VERB_CLIENT, "winsock_event event_base_free");
381453 if(!base)
382454 return;
383455 if(base->items)
398470 ev->ev_callback = cb;
399471 fptr_ok(fptr_whitelist_event(ev->ev_callback));
400472 ev->ev_arg = arg;
473 ev->just_checked = 0;
401474 ev->added = 0;
402475 }
403476
421494 if(ev->added)
422495 event_del(ev);
423496 log_assert(ev->ev_fd==-1 || find_fd(ev->ev_base, ev->ev_fd) == -1);
424 if(ev->ev_base->max == ev->ev_base->cap)
425 return -1;
426 ev->idx = ev->ev_base->max++;
427 ev->ev_base->items[ev->idx] = ev;
428497 ev->is_tcp = 0;
429498 ev->is_signal = 0;
499 ev->just_checked = 0;
430500
431501 if((ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
432502 BOOL b=0;
433503 int t, l;
434504 long events = 0;
505
506 if(ev->ev_base->max == ev->ev_base->cap)
507 return -1;
508 ev->idx = ev->ev_base->max++;
509 ev->ev_base->items[ev->idx] = ev;
510
435511 if( (ev->ev_events&EV_READ) )
436512 events |= FD_READ;
437513 if( (ev->ev_events&EV_WRITE) )
499575 (ev->ev_events&EV_TIMEOUT)?" EV_TIMEOUT":"");
500576 if(!ev->added)
501577 return 0;
502 log_assert(ev->added && ev->ev_base->max > 0)
503 /* remove item and compact the list */
504 ev->ev_base->items[ev->idx] = ev->ev_base->items[ev->ev_base->max-1];
505 ev->ev_base->items[ev->ev_base->max-1] = NULL;
506 ev->ev_base->max--;
507 if(ev->idx < ev->ev_base->max)
508 ev->ev_base->items[ev->idx]->idx = ev->idx;
509
578 log_assert(ev->added);
510579 if((ev->ev_events&EV_TIMEOUT))
511580 (void)rbtree_delete(ev->ev_base->times, &ev->node);
512581 if((ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
582 log_assert(ev->ev_base->max > 0);
583 /* remove item and compact the list */
584 ev->ev_base->items[ev->idx] =
585 ev->ev_base->items[ev->ev_base->max-1];
586 ev->ev_base->items[ev->ev_base->max-1] = NULL;
587 ev->ev_base->max--;
588 if(ev->idx < ev->ev_base->max)
589 ev->ev_base->items[ev->idx]->idx = ev->idx;
590 zero_waitfor(ev->ev_base->waitfor, ev->hEvent);
591
513592 if(WSAEventSelect(ev->ev_fd, ev->hEvent, 0) != 0)
514593 log_err("WSAEventSelect(disable) failed: %s",
515594 wsa_strerror(WSAGetLastError()));
517596 log_err("WSACloseEvent failed: %s",
518597 wsa_strerror(WSAGetLastError()));
519598 }
599 ev->just_checked = 0;
520600 ev->added = 0;
521601 return 0;
522602 }
144144 * event_add a sudden interest in the event has incepted.
145145 */
146146 int tcp_reinvigorated;
147
147 /** The list of events that is currently being processed. */
148 WSAEVENT waitfor[WSK_MAX_ITEMS];
148149 };
149150
150151 /**
187188 * User created and user closed WSAEvent. Only signaled/unsigneled,
188189 * no read/write/distinctions needed. */
189190 int is_signal;
191 /** used during callbacks to see which events were just checked */
192 int just_checked;
190193 };
191194
192195 /** create event base */
3939 */
4040 #include "config.h"
4141 #include "validator/val_anchor.h"
42 #include "validator/val_sigcrypt.h"
4243 #include "util/data/packed_rrset.h"
4344 #include "util/data/dname.h"
4445 #include "util/log.h"
204205 * @param type: type or RR
205206 * @param dclass: class of RR
206207 * @param rdata: rdata wireformat, starting with rdlength.
208 * If NULL, nothing is stored, but an entry is created.
207209 * @param rdata_len: length of rdata including rdlength.
208210 * @return: NULL on error, else the trust anchor.
209211 */
227229 if(!ta)
228230 return NULL;
229231 }
232 if(!rdata)
233 return ta;
230234 /* look for duplicates */
231235 if(anchor_find_key(ta, rdata, rdata_len, type)) {
232236 return ta;
276280 log_nametypeclass(VERB_QUERY, "adding trusted key",
277281 ldns_rdf_data(owner),
278282 ldns_rr_get_type(rr), ldns_rr_get_class(rr));
283 return ta;
284 }
285
286 /**
287 * Insert insecure anchor
288 * @param anchors: anchor storage.
289 * @param str: the domain name.
290 * @return NULL on error, Else last trust anchor point
291 */
292 static struct trust_anchor*
293 anchor_insert_insecure(struct val_anchors* anchors, const char* str)
294 {
295 struct trust_anchor* ta;
296 ldns_rdf* nm = ldns_dname_new_frm_str(str);
297 if(!nm) {
298 log_err("parse error in domain name '%s'", str);
299 return NULL;
300 }
301 ta = anchor_store_new_key(anchors, ldns_rdf_data(nm), LDNS_RR_TYPE_DS,
302 LDNS_RR_CLASS_IN, NULL, 0);
303 ldns_rdf_deep_free(nm);
279304 return ta;
280305 }
281306
819844 }
820845
821846 /**
847 * Check DS algos for support, warn if not.
848 * @param ta: trust anchor
849 * @return number of DS anchors with unsupported algorithms.
850 */
851 static size_t
852 anchors_ds_unsupported(struct trust_anchor* ta)
853 {
854 size_t i, num = 0;
855 for(i=0; i<ta->numDS; i++) {
856 if(!ds_digest_algo_is_supported(ta->ds_rrset, i) ||
857 !ds_key_algo_is_supported(ta->ds_rrset, i))
858 num++;
859 }
860 return num;
861 }
862
863 /**
864 * Check DNSKEY algos for support, warn if not.
865 * @param ta: trust anchor
866 * @return number of DNSKEY anchors with unsupported algorithms.
867 */
868 static size_t
869 anchors_dnskey_unsupported(struct trust_anchor* ta)
870 {
871 size_t i, num = 0;
872 for(i=0; i<ta->numDNSKEY; i++) {
873 if(!dnskey_algo_is_supported(ta->dnskey_rrset, i))
874 num++;
875 }
876 return num;
877 }
878
879 /**
822880 * Assemble the rrsets in the anchors, ready for use by validator.
823881 * @param anchors: trust anchor storage.
824882 * @return: false on error.
827885 anchors_assemble_rrsets(struct val_anchors* anchors)
828886 {
829887 struct trust_anchor* ta;
830 RBTREE_FOR(ta, struct trust_anchor*, anchors->tree) {
888 struct trust_anchor* next;
889 size_t nods, nokey;
890 ta=(struct trust_anchor*)rbtree_first(anchors->tree);
891 while((rbnode_t*)ta != RBTREE_NULL) {
892 next = (struct trust_anchor*)rbtree_next(&ta->node);
893 if(ta->numDS == 0 && ta->numDNSKEY == 0) {
894 ta = next; /* skip unsigned entries, nothing to do */
895 continue;
896 }
831897 if(!anchors_assemble(anchors, ta)) {
832898 log_err("out of memory");
833899 return 0;
834900 }
901 nods = anchors_ds_unsupported(ta);
902 nokey = anchors_dnskey_unsupported(ta);
903 if(nods) {
904 log_nametypeclass(0, "warning: unsupported "
905 "algorithm for trust anchor",
906 ta->name, LDNS_RR_TYPE_DS, ta->dclass);
907 }
908 if(nokey) {
909 log_nametypeclass(0, "warning: unsupported "
910 "algorithm for trust anchor",
911 ta->name, LDNS_RR_TYPE_DNSKEY, ta->dclass);
912 }
913 if(nods == ta->numDS && nokey == ta->numDNSKEY) {
914 char b[257];
915 dname_str(ta->name, b);
916 log_warn("trust anchor %s has no supported algorithms,"
917 " the anchor is ignored", b);
918 (void)rbtree_delete(anchors->tree, &ta->node);
919 }
920 ta = next;
835921 }
836922 return 1;
837923 }
842928 struct config_strlist* f;
843929 char* nm;
844930 ldns_buffer* parsebuf = ldns_buffer_new(65535);
931 for(f = cfg->domain_insecure; f; f = f->next) {
932 if(!f->str || f->str[0] == 0) /* empty "" */
933 continue;
934 if(!anchor_insert_insecure(anchors, f->str)) {
935 log_err("error in domain-insecure: %s", f->str);
936 ldns_buffer_free(parsebuf);
937 return 0;
938 }
939 }
845940 for(f = cfg->trust_anchor_file_list; f; f = f->next) {
846941 if(!f->str || f->str[0] == 0) /* empty "" */
847942 continue;
900995 return 0;
901996 }
902997 }
998 /* first assemble, since it may delete useless anchors */
999 anchors_assemble_rrsets(anchors);
9031000 init_parents(anchors);
904 anchors_assemble_rrsets(anchors);
9051001 ldns_buffer_free(parsebuf);
9061002 return 1;
9071003 }
369369 case LDNS_RSASHA1:
370370 case LDNS_RSASHA1_NSEC3:
371371 case LDNS_RSAMD5:
372 #ifdef HAVE_EVP_SHA256
372 #if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
373373 case LDNS_RSASHA256:
374 case LDNS_RSASHA256_NSEC3:
375374 #endif
376 #ifdef HAVE_EVP_SHA512
375 #if defined(HAVE_EVP_SHA512) && defined(USE_SHA2)
377376 case LDNS_RSASHA512:
378 case LDNS_RSASHA512_NSEC3:
379377 #endif
380378 return 1;
381379 default:
522520 if(algo != dnskey_get_algo(dnskey, i) ||
523521 tag != dnskey_calc_keytag(dnskey, i))
524522 continue;
525
526523 numchecked ++;
524
527525 /* see if key verifies */
528526 sec = dnskey_verify_rrset_sig(env->scratch,
529527 env->scratch_buffer, ve, now, rrset, dnskey, i,
10691067 return 0;
10701068 }
10711069 if(incep - now > 0) {
1072 sigdate_error("verify: signature bad, current time is"
1073 " before inception date", expi, incep, now);
1074 return 0;
1070 /* within skew ? (calc here to avoid calculation normally) */
1071 int32_t skew = (expi-incep)/10;
1072 if(skew < ve->skew_min) skew = ve->skew_min;
1073 if(skew > ve->skew_max) skew = ve->skew_max;
1074 if(incep - now > skew) {
1075 sigdate_error("verify: signature bad, current time is"
1076 " before inception date", expi, incep, now);
1077 return 0;
1078 }
1079 sigdate_error("verify warning suspicious signature inception "
1080 " or bad local clock", expi, incep, now);
10751081 }
10761082 if(now - expi > 0) {
1077 sigdate_error("verify: signature expired", expi, incep, now);
1078 return 0;
1083 int32_t skew = (expi-incep)/10;
1084 if(skew < ve->skew_min) skew = ve->skew_min;
1085 if(skew > ve->skew_max) skew = ve->skew_max;
1086 if(now - expi > skew) {
1087 sigdate_error("verify: signature expired", expi,
1088 incep, now);
1089 return 0;
1090 }
1091 sigdate_error("verify warning suspicious signature expiration "
1092 " or bad local clock", expi, incep, now);
10791093 }
10801094 return 1;
1081
10821095 }
10831096
10841097 /** adjust rrset TTL for verified rrset, compare to original TTL and expi */
11761189 *sig = NULL;
11771190 newlen = i2d_DSA_SIG(dsasig, sig);
11781191 if(newlen < 0) {
1179 free(sig);
1192 free(*sig);
11801193 return 0;
11811194 }
11821195 *len = (unsigned int)newlen;
12201233 break;
12211234 case LDNS_RSASHA1:
12221235 case LDNS_RSASHA1_NSEC3:
1223 #ifdef HAVE_EVP_SHA256
1236 #if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
12241237 case LDNS_RSASHA256:
1225 case LDNS_RSASHA256_NSEC3:
12261238 #endif
1227 #ifdef HAVE_EVP_SHA512
1239 #if defined(HAVE_EVP_SHA512) && defined(USE_SHA2)
12281240 case LDNS_RSASHA512:
1229 case LDNS_RSASHA512_NSEC3:
12301241 #endif
12311242 rsa = ldns_key_buf2rsa_raw(key, keylen);
12321243 if(!rsa) {
12411252 }
12421253
12431254 /* select SHA version */
1244 #ifdef HAVE_EVP_SHA256
1245 if(algo == LDNS_RSASHA256 ||
1246 algo == LDNS_RSASHA256_NSEC3)
1255 #if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
1256 if(algo == LDNS_RSASHA256)
12471257 *digest_type = EVP_sha256();
12481258 else
12491259 #endif
1250 #ifdef HAVE_EVP_SHA512
1251 if(algo == LDNS_RSASHA512 ||
1252 algo == LDNS_RSASHA512_NSEC3)
1260 #if defined(HAVE_EVP_SHA512) && defined(USE_SHA2)
1261 if(algo == LDNS_RSASHA512)
12531262 *digest_type = EVP_sha512();
12541263 else
12551264 #endif
717717 }
718718
719719 void
720 val_mark_insecure(struct reply_info* rep, struct key_entry_key* kkey,
720 val_mark_insecure(struct reply_info* rep, uint8_t* kname,
721721 struct rrset_cache* r, struct module_env* env)
722722 {
723723 size_t i;
724724 struct packed_rrset_data* d;
725 log_assert(key_entry_isnull(kkey));
726725 for(i=0; i<rep->rrset_count; i++) {
727726 d = (struct packed_rrset_data*)rep->rrsets[i]->entry.data;
728727 if(d->security == sec_status_unchecked &&
729 dname_subdomain_c(rep->rrsets[i]->rk.dname, kkey->name)) {
728 dname_subdomain_c(rep->rrsets[i]->rk.dname, kname)) {
730729 /* mark as insecure */
731730 d->security = sec_status_insecure;
732731 rrset_update_sec_status(r, rep->rrsets[i], *env->now);
239239 * Mark all unchecked rrset entries below a NULL key entry as insecure.
240240 * Only security==unchecked rrsets are updated.
241241 * @param rep: the reply with rrsets.
242 * @param kkey: key entry, key_entry_isnull() for it. A key entry that marks
243 * the end of secure space into insecure space.
242 * @param kname: end of secure space name.
244243 * @param r: rrset cache to store updated security status into.
245244 * @param env: module environment
246245 */
247 void val_mark_insecure(struct reply_info* rep, struct key_entry_key* kkey,
246 void val_mark_insecure(struct reply_info* rep, uint8_t* kname,
248247 struct rrset_cache* r, struct module_env* env);
249248
250249 /**
121121 return 0;
122122 }
123123 val_env->date_override = cfg->val_date_override;
124 val_env->skew_min = cfg->val_sig_skew_min;
125 val_env->skew_max = cfg->val_sig_skew_max;
124126 c = cfg_count_numbers(cfg->val_nsec3_key_iterations);
125127 if(c < 1 || (c&1)) {
126128 log_err("validator: unparseable or odd nsec3 key "
282284 return 0;
283285 }
284286
287 /* cannot validate positive RRSIG response. (negatives can) */
288 if(qstate->qinfo.qtype == LDNS_RR_TYPE_RRSIG &&
289 rcode == LDNS_RCODE_NOERROR && ret_msg &&
290 ret_msg->rep->an_numrrsets > 0) {
291 verbose(VERB_ALGO, "cannot validate RRSIG, no sigs on sigs.");
292 return 0;
293 }
294
285295 /* validate unchecked, and re-validate bogus messages */
286296 if (ret_msg && ret_msg->rep->security > sec_status_bogus)
287297 {
12081218 else if(vq->key_entry == NULL || (vq->trust_anchor &&
12091219 dname_strict_subdomain_c(vq->trust_anchor->name,
12101220 vq->key_entry->name))) {
1221 /* trust anchor is an 'unsigned' trust anchor */
1222 if(vq->trust_anchor && vq->trust_anchor->numDS == 0 &&
1223 vq->trust_anchor->numDNSKEY == 0) {
1224 vq->chase_reply->security = sec_status_insecure;
1225 val_mark_insecure(vq->chase_reply,
1226 vq->trust_anchor->name,
1227 qstate->env->rrset_cache, qstate->env);
1228 vq->dlv_checked=1; /* skip DLV check */
1229 /* go to finished state to cache this result */
1230 vq->state = VAL_FINISHED_STATE;
1231 return 1;
1232 }
12111233 /* fire off a trust anchor priming query. */
12121234 verbose(VERB_DETAIL, "prime trust anchor");
12131235 if(!prime_trust_anchor(qstate, vq, id, vq->trust_anchor))
12211243 * However, we do set the status to INSECURE, since it is
12221244 * essentially proven insecure. */
12231245 vq->chase_reply->security = sec_status_insecure;
1224 val_mark_insecure(vq->chase_reply, vq->key_entry,
1246 val_mark_insecure(vq->chase_reply, vq->key_entry->name,
12251247 qstate->env->rrset_cache, qstate->env);
12261248 /* go to finished state to cache this result */
12271249 vq->state = VAL_FINISHED_STATE;
13931415 verbose(VERB_DETAIL, "Verified that %sresponse is INSECURE",
13941416 vq->signer_name?"":"unsigned ");
13951417 vq->chase_reply->security = sec_status_insecure;
1396 val_mark_insecure(vq->chase_reply, vq->key_entry,
1418 val_mark_insecure(vq->chase_reply, vq->key_entry->name,
13971419 qstate->env->rrset_cache, qstate->env);
13981420 return 1;
13991421 }
19081930 if(!needs_validation(qstate, qstate->return_rcode,
19091931 qstate->return_msg)) {
19101932 /* no need to validate this */
1933 if(qstate->return_msg)
1934 qstate->return_msg->rep->security =
1935 sec_status_indeterminate;
19111936 qstate->ext_state[id] = module_finished;
19121937 return;
19131938 }
6969 /** for debug testing a fixed validation date can be entered.
7070 * if 0, current time is used for rrsig validation */
7171 int32_t date_override;
72
73 /** clock skew min for signatures */
74 int32_t skew_min;
75
76 /** clock skew max for signatures */
77 int32_t skew_max;
7278
7379 /** TTL for bogus data; used instead of untrusted TTL from data.
7480 * Bogus data will not be verified more often than this interval.
0 README for Unbound on Windows.
1
2 (C) 2009, W.C.A. Wijngaards, NLnet Labs.
3
4 See LICENSE for the license text file.
5
6
7 +++ Introduction
8
9 Unbound is a recursive DNS server. It does caching, full recursion, stub
10 recursion, DNSSEC validation, NSEC3, IPv6. More information can be found
11 at the http://unbound.net site. Unbound has been built and tested on
12 Windows XP and Windows Vista.
13
14 At http://unbound.net/documentation is an install and configuration manual
15 for windows.
16
17 email: unbound-bugs@nlnetlabs.nl
18
19
20 +++ How to use it
21
22 In ControlPanels\SystemTasks\Services you can start/stop the daemon.
23 In ControlPanels\SystemTasks\Logbooks you can see log entries (unless you
24 configured unbound to log to file).
25
26 By default the daemon provides service only to localhost. See the manual
27 on how to change that (you need to edit the config file).
28
29 To change options, edit the service.conf file. The example.conf file
30 contains information on the various configuration options. The config
31 file is the same as on Unix. The options log-time-ascii, chroot, username
32 and pidfile are not supported on windows.
33
34
35 +++ How to compile
36
37 Unbound is open source under the BSD license. You can compile it yourself.
38
39 1. Install MinGW and MSYS. http://www.mingw.org
40 This is a free, open source, compiler and build environment.
41 Note, if your username contains a space, create a directory
42 C:\msys\...\home\user to work in (click on MSYS; type: mkdir /home/user ).
43
44 2. Install openssl, or compile it yourself. http://www.openssl.org
45 Ldns and unbound need the header files and libraries. Static linking makes
46 things easier. This is an open source library for cryptographic functions.
47
48 3. Compile LDNS
49 Get the source code tarball http://nlnetlabs.nl/ldns
50 Move it into the C:\msys\...\home\user directory.
51 Double click on the MSYS icon and give these commands
52 $ cd /home/user
53 $ tar xzvf ldns-xxx.tar.gz
54 $ cd ldns-xxx
55 $ ./configure
56 If you compiled openssl yourself, pass --with-ssl=../openssl-xxx
57 $ make
58
59 4. Compile Unbound
60 Get the source code tarball http://unbound.net
61 Move it into the C:\msys\...\home\user directory.
62 Double click on the MSYS icon and give these commands
63 $ cd /home/user
64 $ tar xzvf unbound-xxx.tar.gz
65 $ cd unbound-xxx
66 $ ./configure --enable-static-exe --with-ldns=../ldns-xxx
67 If you compiled openssl yourself, pass --with-ssl=../openssl-xxx too.
68 The configure options for libevent or threads are not applicable for
69 windows, because builtin alternatives for the windows platform are used.
70 $ make
71 And you have unbound.exe
72
73 If you run unbound-service-install.exe (double click in the explorer),
74 unbound is installed as a service in the controlpanels\systemtasks\services,
75 from the current directory. unbound-service-remove.exe uninstalls the service.
76
77 Unbound and its utilities also work from the commandline (like on unix) if
78 you prefer.
79
80
81 +++ CREDITS
82
83 Unbound was written in portable C by Wouter Wijngaards (NLnet Labs).
84 See the CREDITS file in the source package for more contributor information.
85 Email unbound-bugs@nlnetlabs.nl
86
0 /*
1 * winrc/anchor-update.c - windows trust anchor update util
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * This file is made because contrib/update-anchor.sh does not work on
39 * windows (no shell).
40 */
41 #include "config.h"
42 #include "libunbound/unbound.h"
43
44 /** usage */
45 static void
46 usage(void)
47 {
48 printf("usage: { name-of-domain filename }+ \n");
49 printf("exit codes: 0 anchors updated, 1 no changes, 2 errors.\n");
50 exit(1);
51 }
52
53 /** fatal exit */
54 static void fatal(const char* str)
55 {
56 printf("fatal error: %s\n", str);
57 exit(2);
58 }
59
60 /** lookup data */
61 static struct ub_result*
62 do_lookup(struct ub_ctx* ctx, char* domain)
63 {
64 struct ub_result* result = NULL;
65 int r;
66 r = ub_resolve(ctx, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN,
67 &result);
68 if(r) {
69 printf("failed to lookup %s\n", ub_strerror(r));
70 fatal("ub_resolve failed");
71 }
72 if(!result->havedata && (result->rcode == LDNS_RCODE_SERVFAIL ||
73 result->rcode == LDNS_RCODE_REFUSED))
74 return NULL; /* probably no internet connection */
75 if(!result->havedata) fatal("result has no data");
76 if(!result->secure) fatal("result is not secure");
77 return result;
78 }
79
80 /** get answer into ldns rr list */
81 static ldns_rr_list*
82 result2answer(struct ub_result* result)
83 {
84 ldns_pkt* p = NULL;
85 ldns_rr_list* a;
86 if(ldns_wire2pkt(&p, result->answer_packet, result->answer_len)
87 != LDNS_STATUS_OK)
88 return NULL;
89 a = ldns_pkt_answer(p);
90 ldns_pkt_set_answer(p, NULL);
91 ldns_pkt_free(p);
92 return a;
93 }
94
95 /** print result to file */
96 static void
97 do_print(struct ub_result* result, char* file)
98 {
99 FILE* out;
100 ldns_rr_list* list = result2answer(result);
101 if(!list) fatal("result2answer failed");
102
103 out = fopen(file, "w");
104 if(!out) {
105 perror(file);
106 fatal("fopen failed");
107 }
108 ldns_rr_list_print(out, list);
109 fclose(out);
110 ldns_rr_list_deep_free(list);
111 }
112
113 /** update domain to file */
114 static int
115 do_update(char* domain, char* file)
116 {
117 struct ub_ctx* ctx;
118 struct ub_result* result;
119 int r;
120 printf("updating %s to %s\n", domain, file);
121 ctx = ub_ctx_create();
122 if(!ctx) fatal("ub_ctx_create failed");
123
124 if((r=ub_ctx_add_ta_file(ctx, file))) {
125 printf("%s\n", ub_strerror(r));
126 fatal("ub_ctx_add_ta_file failed");
127 }
128
129 if(!(result=do_lookup(ctx, domain))) {
130 ub_ctx_delete(ctx);
131 return 1;
132 }
133 ub_ctx_delete(ctx);
134 do_print(result, file);
135 ub_resolve_free(result);
136 return 0;
137 }
138
139 /** anchor update main */
140 int main(int argc, char** argv)
141 {
142 int retcode = 1;
143 if(argc == 1) {
144 usage();
145 }
146 argc--;
147 argv++;
148 while(argc > 0) {
149 int r = do_update(argv[0], argv[1]);
150 if(r == 0) retcode = 0;
151
152 /* next */
153 argc-=2;
154 argv+=2;
155 }
156 return retcode;
157 }
Binary diff not shown
Binary diff not shown
0 ; for Unbound
1 ; severity default Success Informational Warning Error
2
3 ; .bin file created with:
4 ; "/c/Program Files/Microsoft SDKs/Windows/v6.1/Bin/mc" -c gen_msg.mc
5 ; mv MSG00001.bin gen_msg.bin
6 ; rm gen_msg.h
7 ; and pasted contents of gen_msg.rc into rsrc_unbound.rc
8
9 FacilityNames=(Server=0x1)
10 MessageIdTypeDef=DWORD
11
12 MessageID=0x1
13 Severity=Success
14 Facility=Server
15 SymbolicName=MSG_GENERIC_SUCCESS
16 Language=English
17 %1
18 .
19
20 MessageID=0x2
21 Severity=Informational
22 Facility=Server
23 SymbolicName=MSG_GENERIC_INFO
24 Language=English
25 %1
26 .
27
28 MessageID=0x3
29 Severity=Warning
30 Facility=Server
31 SymbolicName=MSG_GENERIC_WARN
32 Language=English
33 %1
34 .
35
36 MessageID=0x4
37 Severity=Error
38 Facility=Server
39 SymbolicName=MSG_GENERIC_ERR
40 Language=English
41 %1
42 .
43
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound trust anchor tool"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "anchor-update"
25 VALUE "OriginalFilename", "anchor-update.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
37
38 /* vista administrator access, show UAC prompt */
39 1 RT_MANIFEST "winrc/vista_user.manifest"
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound Service Install Util"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "unbound-service-install"
25 VALUE "OriginalFilename", "unbound-service-install.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
37
38 /* error message formats */
39 LANGUAGE 0x9,0x1
40 1 11 "winrc/gen_msg.bin"
41
42 /* vista administrator access, show UAC prompt */
43 1 RT_MANIFEST "winrc/vista_admin.manifest"
44
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound Service Remove Util"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "unbound-service-remove"
25 VALUE "OriginalFilename", "unbound-service-remove.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
37
38 /* error message formats */
39 LANGUAGE 0x9,0x1
40 1 11 "winrc/gen_msg.bin"
41
42 /* vista administrator access, show UAC prompt */
43 1 RT_MANIFEST "winrc/vista_admin.manifest"
44
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7 /*
8 1 ICON "winrc/unbound64.ico"
9 2 ICON "winrc/unbound48.ico"
10 3 ICON "winrc/unbound32.ico"
11 4 ICON "winrc/unbound16.ico"
12 */
13
14 1 VERSIONINFO
15 FILEVERSION RSRC_PACKAGE_VERSION
16 PRODUCTVERSION RSRC_PACKAGE_VERSION
17 FILEFLAGSMASK 0
18 FILEFLAGS 0
19 FILEOS VOS__WINDOWS32
20 FILETYPE VFT_APP
21 FILESUBTYPE 0
22 BEGIN
23 BLOCK "StringFileInfo"
24 BEGIN
25 BLOCK "040904E4"
26 BEGIN
27 VALUE "CompanyName", "NLnet Labs"
28 VALUE "FileDescription", "Unbound DNS Server"
29 VALUE "FileVersion", PACKAGE_VERSION
30 VALUE "InternalName", "unbound"
31 VALUE "OriginalFilename", "unbound.exe"
32 VALUE "ProductName", "unbound"
33 VALUE "ProductVersion", PACKAGE_VERSION
34 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
35 END
36 END
37 BLOCK "VarFileInfo"
38 BEGIN
39 /* English(409), windows ANSI codepage (1252) */
40 VALUE "Translation", 0x409, 0x1252
41 END
42 END
43
44 /* error message formats */
45 LANGUAGE 0x9,0x1
46 /* id=1 type=RT_MESSAGETABLE */
47 1 11 "winrc/gen_msg.bin"
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound Configuration Checker"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "unbound-checkconf"
25 VALUE "OriginalFilename", "unbound-checkconf.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound Remote Control Tool"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "unbound-control"
25 VALUE "OriginalFilename", "unbound-control.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
0 /*
1 Unbound resource file for windows. For use with windres
2 */
3 #include "winver.h"
4 #include "config.h"
5
6 1 ICON "winrc/combined.ico"
7
8 1 VERSIONINFO
9 FILEVERSION RSRC_PACKAGE_VERSION
10 PRODUCTVERSION RSRC_PACKAGE_VERSION
11 FILEFLAGSMASK 0
12 FILEFLAGS 0
13 FILEOS VOS__WINDOWS32
14 FILETYPE VFT_APP
15 FILESUBTYPE 0
16 BEGIN
17 BLOCK "StringFileInfo"
18 BEGIN
19 BLOCK "040904E4"
20 BEGIN
21 VALUE "CompanyName", "NLnet Labs"
22 VALUE "FileDescription", "Unbound Lookup Utility"
23 VALUE "FileVersion", PACKAGE_VERSION
24 VALUE "InternalName", "unbound-host"
25 VALUE "OriginalFilename", "unbound-host.exe"
26 VALUE "ProductName", "unbound"
27 VALUE "ProductVersion", PACKAGE_VERSION
28 VALUE "LegalCopyright", "(C) 2009 NLnet Labs. Source is BSD licensed."
29 END
30 END
31 BLOCK "VarFileInfo"
32 BEGIN
33 /* English(409), windows ANSI codepage (1252) */
34 VALUE "Translation", 0x409, 0x1252
35 END
36 END
0 # Unbound configuration file on windows.
1 # See example.conf for more settings and syntax
2 server:
3 # verbosity level 0-4 of logging
4 verbosity: 0
5
6 # if you want to log to a file use
7 #logfile: "C:\unbound.log"
8
9 # on Windows, this setting makes reports go into the Application log
10 # found in ControlPanels - System tasks - Logs
11 #use-syslog: yes
12
0 # The NSIS (http://nsis.sourceforge.net) install script.
1 # This script is BSD licensed.
2 SetCompressor /solid /final lzma
3
4 !include LogicLib.nsh
5 !include MUI2.nsh
6 !include setup_servicelib.nsh
7
8 !define VERSION "0.0.0"
9 !define QUADVERSION "0.0.0.0"
10
11 outFile "unbound_setup_${VERSION}.exe"
12 Name "Unbound"
13
14 # default install directory
15 installDir "$PROGRAMFILES\Unbound"
16 installDirRegKey HKLM "Software\Unbound" "InstallLocation"
17 RequestExecutionLevel admin
18 #give credits to Nullsoft: BrandingText ""
19 VIAddVersionKey "ProductName" "Unbound"
20 VIAddVersionKey "CompanyName" "NLnet Labs"
21 VIAddVersionKey "FileDescription" "(un)install the unbound DNS resolver"
22 VIAddVersionKey "LegalCopyright" "Copyright 2009, NLnet Labs"
23 VIAddVersionKey "FileVersion" "${QUADVERSION}"
24 VIAddVersionKey "ProductVersion" "${QUADVERSION}"
25 VIProductVersion "${QUADVERSION}"
26
27 # Global Variables
28 Var StartMenuFolder
29
30 # use ReserveFile for files required before actual installation
31 # makes the installer start faster
32 #ReserveFile "System.dll"
33 #ReserveFile "NsExec.dll"
34
35 !define MUI_ICON "${NSISDIR}\contrib\graphics\icons\orange-install-nsis.ico"
36 !define MUI_UNICON "${NSISDIR}\contrib\graphics\icons\orange-uninstall-nsis.ico"
37
38 !define MUI_HEADERIMAGE
39 !define MUI_HEADERIMAGE_RIGHT
40 !define MUI_HEADERIMAGE_BITMAP "setup_top.bmp"
41 !define MUI_WELCOMEFINISHPAGE_BITMAP "setup_left.bmp"
42 !define MUI_ABORTWARNING
43 #!define MUI_FINISHPAGE_NOAUTOCLOSE # so we can inspect install log.
44
45 !insertmacro MUI_PAGE_WELCOME
46 !insertmacro MUI_PAGE_LICENSE "..\LICENSE"
47 !insertmacro MUI_PAGE_COMPONENTS
48 !insertmacro MUI_PAGE_DIRECTORY
49
50 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
51 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Unbound"
52 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
53 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Unbound"
54 !insertmacro MUI_PAGE_STARTMENU UnboundStartMenu $StartMenuFolder
55
56 !insertmacro MUI_PAGE_INSTFILES
57 !insertmacro MUI_PAGE_FINISH
58
59 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the uninstallation of Unbound.$\r$\n$\r$\nClick Next to continue."
60 !insertmacro MUI_UNPAGE_WELCOME
61 !insertmacro MUI_UNPAGE_CONFIRM
62 !insertmacro MUI_UNPAGE_INSTFILES
63 !insertmacro MUI_UNPAGE_FINISH
64
65 !insertmacro MUI_LANGUAGE "English"
66
67 # default section, one per component, we have one component.
68 section "Unbound" SectionUnbound
69 SectionIn RO # cannot unselect this one
70 # real work in postinstall
71 sectionEnd
72
73 section "DLV - dlv.isc.org" SectionDLV
74 # add estimated size for key (Kb)
75 AddSize 2
76 SetOutPath $INSTDIR
77 NSISdl::download "http://ftp.isc.org/www/dlv/dlv.isc.org.key" "$INSTDIR\dlv.isc.org.key"
78 Pop $R0 # result from Inetc::get
79 ${If} $R0 != "success"
80 MessageBox MB_OK|MB_ICONEXCLAMATION "Download error (ftp.isc.org: $R0), click OK to abort installation" /SD IDOK
81 SetOutPath "C:\"
82 RMDir "$INSTDIR" # doesnt work directory in use by us ...
83 Abort
84 ${EndIf}
85 sectionEnd
86
87 section "-hidden.postinstall"
88 # copy files
89 setOutPath $INSTDIR
90 File "..\LICENSE"
91 File "README.txt"
92 File "..\unbound.exe"
93 File "..\unbound-checkconf.exe"
94 File "..\unbound-control.exe"
95 File "..\unbound-host.exe"
96 File "..\unbound-service-install.exe"
97 File "..\unbound-service-remove.exe"
98 File "..\anchor-update.exe"
99 File "unbound-website.url"
100 File "service.conf"
101 File "..\doc\example.conf"
102
103 # Store DLV choice
104 SectionGetFlags ${SectionDLV} $R0
105 IntOp $R0 $R0 & ${SF_SELECTED}
106 ${If} $R0 == ${SF_SELECTED}
107 ClearErrors
108 FileOpen $R1 "$INSTDIR\service.conf" a
109 IfErrors done
110 FileSeek $R1 0 END
111 FileWrite $R1 "$\nserver: dlv-anchor-file: $\"$INSTDIR\dlv.isc.org.key$\"$\n"
112 FileClose $R1
113 done:
114 WriteRegStr HKLM "Software\Unbound" "CronAction" "$\"$INSTDIR\anchor-update.exe$\" dlv.isc.org $\"$INSTDIR\dlv.isc.org.key$\""
115 ${Else}
116 WriteRegStr HKLM "Software\Unbound" "CronAction" "$\"$INSTDIR\anchor-update.exe$\" "
117 ${EndIf}
118
119 # store installation folder
120 WriteRegStr HKLM "Software\Unbound" "InstallLocation" "$INSTDIR"
121 WriteRegStr HKLM "Software\Unbound" "ConfigFile" "$INSTDIR\service.conf"
122 WriteRegDWORD HKLM "Software\Unbound" "CronTime" 86400
123
124 # uninstaller
125 WriteUninstaller "uninst.exe"
126
127 # register uninstaller
128 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "DisplayName" "Unbound"
129 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "UninstallString" "$\"$INSTDIR\uninst.exe$\""
130 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "QuietUninstallString" "$\"$INSTDIR\uninst.exe$\" /S"
131 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "NoModify" "1"
132 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "NoRepair" "1"
133 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "URLInfoAbout" "http://unbound.net"
134 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound" "Publisher" "NLnet Labs"
135
136 # start menu items
137 !insertmacro MUI_STARTMENU_WRITE_BEGIN UnboundStartMenu
138 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
139 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\unbound.net website.lnk" "$INSTDIR\unbound-website.url" "" "$INSTDIR\unbound.exe" "" "" "" "Visit the unbound website"
140 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\uninst.exe" "" "" "" "" "" "Uninstall unbound"
141 !insertmacro MUI_STARTMENU_WRITE_END
142
143 # install service entry
144 nsExec::ExecToLog '"$INSTDIR\unbound-service-install.exe"'
145 # start unbound service
146 !insertmacro SERVICE "start" "unbound" ""
147 sectionEnd
148
149 # set section descriptions
150 LangString DESC_unbound ${LANG_ENGLISH} "The base unbound DNS(SEC) validating caching resolver. $\r$\n$\r$\nIt can be found in the Services control panel, and a config file is in the Program Files folder."
151 LangString DESC_dlv ${LANG_ENGLISH} "Set up to use DLV with dlv.isc.org. Downloads the key with a leap of faith. $\r$\n$\r$\nThis provides public keys that are used for security verification."
152
153 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
154 !insertmacro MUI_DESCRIPTION_TEXT ${SectionUnbound} $(DESC_unbound)
155 !insertmacro MUI_DESCRIPTION_TEXT ${SectionDLV} $(DESC_dlv)
156 !insertmacro MUI_FUNCTION_DESCRIPTION_END
157
158 # setup macros for uninstall functions.
159 !undef UN
160 !define UN "un."
161
162 # uninstaller section
163 section "un.Unbound"
164 # stop unbound service
165 !insertmacro SERVICE "stop" "unbound" ""
166 # uninstall service entry
167 nsExec::ExecToLog '"$INSTDIR\unbound-service-remove.exe"'
168 # deregister uninstall
169 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Unbound"
170 Delete "$INSTDIR\uninst.exe" # delete self
171 Delete "$INSTDIR\LICENSE"
172 Delete "$INSTDIR\README.txt"
173 Delete "$INSTDIR\unbound.exe"
174 Delete "$INSTDIR\unbound-checkconf.exe"
175 Delete "$INSTDIR\unbound-control.exe"
176 Delete "$INSTDIR\unbound-host.exe"
177 Delete "$INSTDIR\unbound-service-install.exe"
178 Delete "$INSTDIR\unbound-service-remove.exe"
179 Delete "$INSTDIR\anchor-update.exe"
180 Delete "$INSTDIR\unbound-website.url"
181 Delete "$INSTDIR\service.conf"
182 Delete "$INSTDIR\example.conf"
183 Delete "$INSTDIR\dlv.isc.org.key"
184 RMDir "$INSTDIR"
185
186 # start menu items
187 !insertmacro MUI_STARTMENU_GETFOLDER UnboundStartMenu $StartMenuFolder
188 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
189 Delete "$SMPROGRAMS\$StartMenuFolder\unbound.net website.lnk"
190 RMDir "$SMPROGRAMS\$StartMenuFolder"
191
192 DeleteRegKey /ifempty HKLM "Software\Unbound"
193 sectionEnd
Binary diff not shown
0 ; Taken from http://nsis.sourceforge.net/NSIS_Service_Lib on 10-mar-2009
1 ;
2
3 ; NSIS SERVICE LIBRARY - servicelib.nsh
4 ; Version 1.5 - Jun 25th, 2008
5 ; Questions/Comments - dselkirk@hotmail.com
6 ;
7 ; Description:
8 ; Provides an interface to window services
9 ;
10 ; Inputs:
11 ; action - systemlib action ie. create, delete, start, stop, pause,
12 ; continue, installed, running, status
13 ; name - name of service to manipulate
14 ; param - action parameters; usage: var1=value1;var2=value2;...etc.
15 ; (don't forget to add a ';' after the last value!)
16 ;
17 ; Actions:
18 ; create - creates a new windows service
19 ; Parameters:
20 ; path - path to service executable
21 ; autostart - automatically start with system ie. 1|0
22 ; interact - interact with the desktop ie. 1|0
23 ; depend - service dependencies
24 ; user - user that runs the service
25 ; password - password of the above user
26 ; display - display name in service's console
27 ; description - Description of service
28 ;
29 ; delete - deletes a windows service
30 ; start - start a stopped windows service
31 ; stop - stops a running windows service
32 ; pause - pauses a running windows service
33 ; continue - continues a paused windows service
34 ; installed - is the provided service installed
35 ; Parameters:
36 ; action - if true then invokes the specified action
37 ; running - is the provided service running
38 ; Parameters:
39 ; action - if true then invokes the specified action
40 ; status - check the status of the provided service
41 ;
42 ; If run from uninstall define "UN" as "un." before running.
43 ;
44 ; Usage:
45 ; Method 1:
46 ; Push "action"
47 ; Push "name"
48 ; Push "param"
49 ; Call Service
50 ; Pop $0 ;response
51 ;
52 ; Method 2:
53 ; !insertmacro SERVICE "action" "name" "param"
54 ;
55 ; History:
56 ; 1.0 - 09/15/2003 - Initial release
57 ; 1.1 - 09/16/2003 - Changed &l to i, thx brainsucker
58 ; 1.2 - 02/29/2004 - Fixed documentation.
59 ; 1.3 - 01/05/2006 - Fixed interactive flag and pop order (Kichik)
60 ; 1.4 - 12/07/2006 - Added display and depend, fixed datatypes (Vitoco)
61 ; 1.5 - 06/25/2008 - Added description of service.(DeSafe.com/liuqixing#gmail.com)
62
63 !ifndef SERVICELIB
64 !define SERVICELIB
65
66 !define SC_MANAGER_ALL_ACCESS 0x3F
67 !define SERVICE_ALL_ACCESS 0xF01FF
68
69 !define SERVICE_CONTROL_STOP 1
70 !define SERVICE_CONTROL_PAUSE 2
71 !define SERVICE_CONTROL_CONTINUE 3
72
73 !define SERVICE_STOPPED 0x1
74 !define SERVICE_START_PENDING 0x2
75 !define SERVICE_STOP_PENDING 0x3
76 !define SERVICE_RUNNING 0x4
77 !define SERVICE_CONTINUE_PENDING 0x5
78 !define SERVICE_PAUSE_PENDING 0x6
79 !define SERVICE_PAUSED 0x7
80
81 !ifndef UN
82 !define UN ""
83 !endif
84
85 !macro SERVICE ACTION NAME PARAM
86 Push '${ACTION}'
87 Push '${NAME}'
88 Push '${PARAM}'
89 Call ${UN}Service
90 !macroend
91
92 !macro FUNC_GETPARAM
93 Push $0
94 Push $1
95 Push $2
96 Push $3
97 Push $4
98 Push $5
99 Push $6
100 Push $7
101 Exch 8
102 Pop $1 ;name
103 Exch 8
104 Pop $2 ;source
105 StrCpy $0 ""
106 StrLen $7 $2
107 StrCpy $3 0
108 lbl_loop:
109 IntCmp $3 $7 0 0 lbl_done
110 StrLen $4 "$1="
111 StrCpy $5 $2 $4 $3
112 StrCmp $5 "$1=" 0 lbl_next
113 IntOp $5 $3 + $4
114 StrCpy $3 $5
115 lbl_loop2:
116 IntCmp $3 $7 0 0 lbl_done
117 StrCpy $6 $2 1 $3
118 StrCmp $6 ";" 0 lbl_next2
119 IntOp $6 $3 - $5
120 StrCpy $0 $2 $6 $5
121 Goto lbl_done
122 lbl_next2:
123 IntOp $3 $3 + 1
124 Goto lbl_loop2
125 lbl_next:
126 IntOp $3 $3 + 1
127 Goto lbl_loop
128 lbl_done:
129 Pop $5
130 Pop $4
131 Pop $3
132 Pop $2
133 Pop $1
134 Exch 2
135 Pop $6
136 Pop $7
137 Exch $0
138 !macroend
139
140 !macro CALL_GETPARAM VAR NAME DEFAULT LABEL
141 Push $1
142 Push ${NAME}
143 Call ${UN}GETPARAM
144 Pop $6
145 StrCpy ${VAR} "${DEFAULT}"
146 StrCmp $6 "" "${LABEL}" 0
147 StrCpy ${VAR} $6
148 !macroend
149
150 !macro FUNC_SERVICE UN
151 Push $0
152 Push $1
153 Push $2
154 Push $3
155 Push $4
156 Push $5
157 Push $6
158 Push $7
159 Exch 8
160 Pop $1 ;param
161 Exch 8
162 Pop $2 ;name
163 Exch 8
164 Pop $3 ;action
165 ;$0 return
166 ;$4 OpenSCManager
167 ;$5 OpenService
168
169 StrCpy $0 "false"
170 System::Call 'advapi32::OpenSCManagerA(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.r4'
171 IntCmp $4 0 lbl_done
172 StrCmp $3 "create" lbl_create
173 System::Call 'advapi32::OpenServiceA(i r4, t r2, i ${SERVICE_ALL_ACCESS}) i.r5'
174 IntCmp $5 0 lbl_done
175
176 lbl_select:
177 StrCmp $3 "delete" lbl_delete
178 StrCmp $3 "start" lbl_start
179 StrCmp $3 "stop" lbl_stop
180 StrCmp $3 "pause" lbl_pause
181 StrCmp $3 "continue" lbl_continue
182 StrCmp $3 "installed" lbl_installed
183 StrCmp $3 "running" lbl_running
184 StrCmp $3 "status" lbl_status
185 Goto lbl_done
186
187 ; create service
188 lbl_create:
189 Push $R1 ;depend
190 Push $R2 ;user
191 Push $R3 ;password
192 Push $R4 ;interact
193 Push $R5 ;autostart
194 Push $R6 ;path
195 Push $R7 ;display
196 Push $R8 ;description
197
198 !insertmacro CALL_GETPARAM $R1 "depend" "n" "lbl_depend"
199 StrCpy $R1 't "$R1"'
200 lbl_depend:
201 StrCmp $R1 "n" 0 lbl_machine ;old name of depend param
202 !insertmacro CALL_GETPARAM $R1 "machine" "n" "lbl_machine"
203 StrCpy $R1 't "$R1"'
204 lbl_machine:
205
206 !insertmacro CALL_GETPARAM $R2 "user" "n" "lbl_user"
207 StrCpy $R2 't "$R2"'
208 lbl_user:
209
210 !insertmacro CALL_GETPARAM $R3 "password" "n" "lbl_password"
211 StrCpy $R3 't "$R3"'
212 lbl_password:
213
214 !insertmacro CALL_GETPARAM $R4 "interact" "0x10" "lbl_interact"
215 StrCpy $6 0x10
216 IntCmp $R4 0 +2
217 IntOp $6 $6 | 0x100
218 StrCpy $R4 $6
219 lbl_interact:
220
221 !insertmacro CALL_GETPARAM $R5 "autostart" "0x3" "lbl_autostart"
222 StrCpy $6 0x3
223 IntCmp $R5 0 +2
224 StrCpy $6 0x2
225 StrCpy $R5 $6
226 lbl_autostart:
227
228 !insertmacro CALL_GETPARAM $R6 "path" "n" "lbl_path"
229 lbl_path:
230
231 !insertmacro CALL_GETPARAM $R7 "display" "$2" "lbl_display"
232 lbl_display:
233
234 !insertmacro CALL_GETPARAM $R8 "description" "$2" "lbl_description"
235 lbl_description:
236
237 System::Call 'advapi32::CreateServiceA(i r4, t r2, t R7, i ${SERVICE_ALL_ACCESS}, \
238 i R4, i R5, i 0, t R6, n, n, $R1, $R2, $R3) i.r6'
239
240 ; write description of service
241 WriteRegStr HKLM "SYSTEM\ControlSet001\Services\$2" "Description" $R8
242
243 Pop $R8
244 Pop $R7
245 Pop $R6
246 Pop $R5
247 Pop $R4
248 Pop $R3
249 Pop $R2
250 Pop $R1
251 StrCmp $6 0 lbl_done lbl_good
252
253 ; delete service
254 lbl_delete:
255 System::Call 'advapi32::DeleteService(i r5) i.r6'
256 StrCmp $6 0 lbl_done lbl_good
257
258 ; start service
259 lbl_start:
260 System::Call 'advapi32::StartServiceA(i r5, i 0, i 0) i.r6'
261 StrCmp $6 0 lbl_done lbl_good
262
263 ; stop service
264 lbl_stop:
265 Push $R1
266 System::Call '*(i,i,i,i,i,i,i) i.R1'
267 System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_STOP}, i $R1) i'
268 System::Free $R1
269 Pop $R1
270 StrCmp $6 0 lbl_done lbl_good
271
272 ; pause service
273 lbl_pause:
274 Push $R1
275 System::Call '*(i,i,i,i,i,i,i) i.R1'
276 System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_PAUSE}, i $R1) i'
277 System::Free $R1
278 Pop $R1
279 StrCmp $6 0 lbl_done lbl_good
280
281 ; continue service
282 lbl_continue:
283 Push $R1
284 System::Call '*(i,i,i,i,i,i,i) i.R1'
285 System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_CONTINUE}, i $R1) i'
286 System::Free $R1
287 Pop $R1
288 StrCmp $6 0 lbl_done lbl_good
289
290 ; is installed
291 lbl_installed:
292 !insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
293 StrCpy $3 $7
294 Goto lbl_select
295
296 ; is service running
297 lbl_running:
298 Push $R1
299 System::Call '*(i,i,i,i,i,i,i) i.R1'
300 System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
301 System::Call '*$R1(i, i.r6)'
302 System::Free $R1
303 Pop $R1
304 IntFmt $6 "0x%X" $6
305 StrCmp $6 ${SERVICE_RUNNING} 0 lbl_done
306 !insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
307 StrCpy $3 $7
308 Goto lbl_select
309
310 lbl_status:
311 Push $R1
312 System::Call '*(i,i,i,i,i,i,i) i.R1'
313 System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
314 System::Call '*$R1(i, i .r6)'
315 System::Free $R1
316 Pop $R1
317 IntFmt $6 "0x%X" $6
318 StrCpy $0 "running"
319 IntCmp $6 ${SERVICE_RUNNING} lbl_done
320 StrCpy $0 "stopped"
321 IntCmp $6 ${SERVICE_STOPPED} lbl_done
322 StrCpy $0 "start_pending"
323 IntCmp $6 ${SERVICE_START_PENDING} lbl_done
324 StrCpy $0 "stop_pending"
325 IntCmp $6 ${SERVICE_STOP_PENDING} lbl_done
326 StrCpy $0 "running"
327 IntCmp $6 ${SERVICE_RUNNING} lbl_done
328 StrCpy $0 "continue_pending"
329 IntCmp $6 ${SERVICE_CONTINUE_PENDING} lbl_done
330 StrCpy $0 "pause_pending"
331 IntCmp $6 ${SERVICE_PAUSE_PENDING} lbl_done
332 StrCpy $0 "paused"
333 IntCmp $6 ${SERVICE_PAUSED} lbl_done
334 StrCpy $0 "unknown"
335 Goto lbl_done
336
337 lbl_good:
338 StrCpy $0 "true"
339 lbl_done:
340 IntCmp $5 0 +2
341 System::Call 'advapi32::CloseServiceHandle(i r5) n'
342 IntCmp $4 0 +2
343 System::Call 'advapi32::CloseServiceHandle(i r4) n'
344 Pop $4
345 Pop $3
346 Pop $2
347 Pop $1
348 Exch 3
349 Pop $5
350 Pop $7
351 Pop $6
352 Exch $0
353 !macroend
354
355 Function Service
356 !insertmacro FUNC_SERVICE ""
357 FunctionEnd
358
359 Function un.Service
360 !insertmacro FUNC_SERVICE "un."
361 FunctionEnd
362
363 Function GetParam
364 !insertmacro FUNC_GETPARAM
365 FunctionEnd
366
367 Function un.GetParam
368 !insertmacro FUNC_GETPARAM
369 FunctionEnd
370
371 !endif
Binary diff not shown
0 /*
1 * winrc/unbound-service-install.c - windows services installation util
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * This file contains functions to integrate with the windows services API.
39 * This means it handles the commandline switches to install and remove
40 * the service (via CreateService and DeleteService), it handles
41 * the ServiceMain() main service entry point when started as a service,
42 * and it handles the Handler[_ex]() to process requests to the service
43 * (such as start and stop and status).
44 */
45 #include "config.h"
46 #include "winrc/w_inst.h"
47
48 /** Install service main */
49 int main(int ATTR_UNUSED(argc), char** ATTR_UNUSED(argv))
50 {
51 /*FILE* out = fopen("unbound-service-install.log", "w");*/
52 wsvc_install(NULL, "unbound-service-install.exe");
53 return 0;
54 }
0 /*
1 * winrc/unbound-service-install.c - windows services installation util
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * This file contains functions to integrate with the windows services API.
39 * This means it handles the commandline switches to install and remove
40 * the service (via CreateService and DeleteService), it handles
41 * the ServiceMain() main service entry point when started as a service,
42 * and it handles the Handler[_ex]() to process requests to the service
43 * (such as start and stop and status).
44 */
45 #include "config.h"
46 #include "winrc/w_inst.h"
47
48 /** Install service main */
49 int main(int ATTR_UNUSED(argc), char** ATTR_UNUSED(argv))
50 {
51 /*FILE* out = fopen("unbound-service-remove.log", "w");*/
52 wsvc_remove(NULL);
53 return 0;
54 }
0 [InternetShortcut]
1 URL=http://unbound.net/
2
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
2 <assemblyIdentity version="1.0.0.0"
3 processorArchitecture="X86" name="unbound-service-install.exe" type="win32"/>
4 <description>Installs or removes the unbound service in the services control panel</description>
5 <!-- Identify the application security requirements. -->
6 <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
7 <ms_asmv2:security>
8 <ms_asmv2:requestedPrivileges>
9 <ms_asmv2:requestedExecutionLevel
10 level="requireAdministrator"
11 uiAccess="false"/>
12 </ms_asmv2:requestedPrivileges>
13 </ms_asmv2:security>
14 </ms_asmv2:trustInfo>
15 </assembly>
0 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
2 <assemblyIdentity version="1.0.0.0"
3 processorArchitecture="X86" name="anchor-update.exe" type="win32"/>
4 <description>Retrieve latest version of trust anchor</description>
5 <!-- Identify the application security requirements. -->
6 <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
7 <ms_asmv2:security>
8 <ms_asmv2:requestedPrivileges>
9 <ms_asmv2:requestedExecutionLevel
10 level="asInvoker"
11 uiAccess="false"/>
12 </ms_asmv2:requestedPrivileges>
13 </ms_asmv2:security>
14 </ms_asmv2:trustInfo>
15 </assembly>
0 /*
1 * winrc/w_inst.h - install and remove functions
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * Contains install and remove functions that manipulate the
39 * windows services API and windows registry.
40 */
41 #include "config.h"
42 #include "winrc/w_inst.h"
43 #include "winrc/win_svc.h"
44
45 /** exit with windows error */
46 static void
47 fatal_win(FILE* out, const char* str)
48 {
49 if(out) fprintf(out, "%s (%d)\n", str, (int)GetLastError());
50 exit(1);
51 }
52
53 /** install registry entries for eventlog */
54 static void
55 event_reg_install(FILE* out, const char* pathname)
56 {
57 char buf[1024];
58 HKEY hk;
59 DWORD t;
60 if(out) fprintf(out, "install reg entries for %s\n", pathname);
61 snprintf(buf, sizeof(buf), "SYSTEM\\CurrentControlSet\\Services"
62 "\\EventLog\\Application\\%s", SERVICE_NAME);
63 if(RegCreateKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)buf,
64 0, /* reserved, mustbezero */
65 NULL, /* class of key, ignored */
66 REG_OPTION_NON_VOLATILE, /* values saved on disk */
67 KEY_WRITE, /* we want write permission */
68 NULL, /* use default security descriptor */
69 &hk, /* result */
70 NULL)) /* not interested if key new or existing */
71 fatal_win(out, "could not create registry key");
72
73 /* message file */
74 if(RegSetValueEx(hk, (LPCTSTR)"EventMessageFile",
75 0, /* reserved, mustbezero */
76 REG_EXPAND_SZ, /* value type (string w env subst) */
77 pathname, /* data */
78 (DWORD)strlen(pathname)+1)) /* length of data */
79 {
80 RegCloseKey(hk);
81 fatal_win(out, "could not registry set EventMessageFile");
82 }
83
84 /* event types */
85 t = EVENTLOG_SUCCESS | EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE
86 | EVENTLOG_INFORMATION_TYPE;
87 if(RegSetValueEx(hk, (LPCTSTR)"TypesSupported", 0, REG_DWORD,
88 (LPBYTE)&t, sizeof(t))) {
89 RegCloseKey(hk);
90 fatal_win(out, "could not registry set TypesSupported");
91 }
92
93 /* category message file */
94 if(RegSetValueEx(hk, (LPCTSTR)"CategoryMessageFile", 0, REG_EXPAND_SZ,
95 pathname, (DWORD)strlen(pathname)+1)) {
96 RegCloseKey(hk);
97 fatal_win(out, "could not registry set CategoryMessageFile");
98 }
99 t = 1;
100 if(RegSetValueEx(hk, (LPCTSTR)"CategoryCount", 0, REG_DWORD,
101 (LPBYTE)&t, sizeof(t))) {
102 RegCloseKey(hk);
103 fatal_win(out, "could not registry set CategoryCount");
104 }
105
106
107 RegCloseKey(hk);
108 if(out) fprintf(out, "installed reg entries\n");
109 }
110
111 /** remove regisytry entries for eventlog */
112 static void
113 event_reg_remove(FILE* out)
114 {
115 char buf[1024];
116 HKEY hk;
117 if(out) fprintf(out, "remove reg entries\n");
118 snprintf(buf, sizeof(buf), "SYSTEM\\CurrentControlSet\\Services"
119 "\\EventLog\\Application");
120 if(RegCreateKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)buf,
121 0, /* reserved, mustbezero */
122 NULL, /* class of key, ignored */
123 REG_OPTION_NON_VOLATILE, /* values saved on disk */
124 DELETE, /* we want key delete permission */
125 NULL, /* use default security descriptor */
126 &hk, /* result */
127 NULL)) /* not interested if key new or existing */
128 fatal_win(out, "could not open registry key");
129 if(RegDeleteKey(hk, (LPCTSTR)SERVICE_NAME)) {
130 RegCloseKey(hk);
131 fatal_win(out, "could not delete registry key");
132 }
133 RegCloseKey(hk);
134 if(out) fprintf(out, "removed reg entries\n");
135 }
136
137 /**
138 * put quotes around string. Needs one space in front
139 * @param out: debugfile
140 * @param str: to be quoted.
141 * @param maxlen: max length of the string buffer.
142 */
143 static void
144 quote_it(FILE* out, char* str, size_t maxlen)
145 {
146 if(strlen(str) == maxlen) {
147 if(out) fprintf(out, "string too long %s", str);
148 exit(1);
149 }
150 str[0]='"';
151 str[strlen(str)+1]=0;
152 str[strlen(str)]='"';
153 }
154
155 /** change suffix */
156 static void
157 change(FILE* out, char* path, size_t max, const char* from, const char* to)
158 {
159 size_t fromlen = strlen(from);
160 size_t tolen = strlen(to);
161 size_t pathlen = strlen(path);
162 if(pathlen - fromlen + tolen >= max) {
163 if(out) fprintf(out, "string too long %s", path);
164 exit(1);
165 }
166 snprintf(path+pathlen-fromlen, max-(pathlen-fromlen), "%s", to);
167 }
168
169 /* Install service in servicecontrolmanager */
170 void
171 wsvc_install(FILE* out, const char* rename)
172 {
173 SC_HANDLE scm;
174 SC_HANDLE sv;
175 TCHAR path[MAX_PATH+2+256];
176 if(out) fprintf(out, "installing unbound service\n");
177 if(!GetModuleFileName(NULL, path+1, MAX_PATH))
178 fatal_win(out, "could not GetModuleFileName");
179 /* change 'unbound-service-install' to 'unbound' */
180 if(rename)
181 change(out, path+1, sizeof(path)-1, rename, "unbound.exe");
182
183 event_reg_install(out, path+1);
184
185 /* have to quote it because of spaces in directory names */
186 /* could append arguments to be sent to ServiceMain */
187 quote_it(out, path, sizeof(path));
188 strcat(path, " -w service");
189 scm = OpenSCManager(NULL, NULL, (int)SC_MANAGER_CREATE_SERVICE);
190 if(!scm) fatal_win(out, "could not OpenSCManager");
191 sv = CreateService(
192 scm,
193 SERVICE_NAME, /* name of service */
194 "Unbound DNS validator", /* display name */
195 SERVICE_ALL_ACCESS, /* desired access */
196 SERVICE_WIN32_OWN_PROCESS, /* service type */
197 SERVICE_AUTO_START, /* start type */
198 SERVICE_ERROR_NORMAL, /* error control type */
199 path, /* path to service's binary */
200 NULL, /* no load ordering group */
201 NULL, /* no tag identifier */
202 NULL, /* no deps */
203 NULL, /* on LocalSystem */
204 NULL /* no password */
205 );
206 if(!sv) {
207 CloseServiceHandle(scm);
208 fatal_win(out, "could not CreateService");
209 }
210 CloseServiceHandle(sv);
211 CloseServiceHandle(scm);
212 if(out) fprintf(out, "unbound service installed\n");
213 }
214
215 /* Remove installed service from servicecontrolmanager */
216 void
217 wsvc_remove(FILE* out)
218 {
219 SC_HANDLE scm;
220 SC_HANDLE sv;
221 if(out) fprintf(out, "removing unbound service\n");
222 scm = OpenSCManager(NULL, NULL, (int)SC_MANAGER_ALL_ACCESS);
223 if(!scm) fatal_win(out, "could not OpenSCManager");
224 sv = OpenService(scm, SERVICE_NAME, DELETE);
225 if(!sv) {
226 CloseServiceHandle(scm);
227 fatal_win(out, "could not OpenService");
228 }
229 if(!DeleteService(sv)) {
230 fatal_win(out, "could not DeleteService");
231 }
232 CloseServiceHandle(sv);
233 CloseServiceHandle(scm);
234 event_reg_remove(out);
235 if(out) fprintf(out, "unbound service removed\n");
236 }
0 /*
1 * winrc/w_inst.h - install and remove functions
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * Contains install and remove functions that manipulate the
39 * windows services API and windows registry.
40 */
41
42 #ifndef WINRC_W_INST_H
43 #define WINRC_W_INST_H
44
45 /**
46 * Install service in servicecontrolmanager, setup registry
47 * @param out: debug output printed here (errors). or NULL.
48 * @param rename: if nonNULL this executable is not unbound.exe but this name.
49 */
50 void wsvc_install(FILE* out, const char* rename);
51
52 /**
53 * Remove installed service from servicecontrolmanager, registry entries
54 * @param out: debug output printed here (errors). or NULL.
55 */
56 void wsvc_remove(FILE* out);
57
58 #endif /* WINRC_W_INST_H */
0 /*
1 * winrc/win_svc.c - windows services API implementation for unbound
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * This file contains functions to integrate with the windows services API.
39 * This means it handles the commandline switches to install and remove
40 * the service (via CreateService and DeleteService), it handles
41 * the ServiceMain() main service entry point when started as a service,
42 * and it handles the Handler[_ex]() to process requests to the service
43 * (such as start and stop and status).
44 */
45 #include "config.h"
46 #include "winrc/win_svc.h"
47 #include "winrc/w_inst.h"
48 #include "daemon/daemon.h"
49 #include "daemon/worker.h"
50 #include "util/config_file.h"
51 #include "util/netevent.h"
52 #include "util/winsock_event.h"
53
54 /** global service status */
55 static SERVICE_STATUS service_status;
56 /** global service status handle */
57 static SERVICE_STATUS_HANDLE service_status_handle;
58 /** global service stop event */
59 static WSAEVENT service_stop_event = NULL;
60 /** event struct for stop callbacks */
61 static struct event service_stop_ev;
62 /** if stop even means shutdown or restart */
63 static int service_stop_shutdown = 0;
64 /** config file to open. global communication to service_main() */
65 static char* service_cfgfile = CONFIGFILE;
66 /** commandline verbosity. global communication to service_main() */
67 static int service_cmdline_verbose = 0;
68 /** the cron callback */
69 static struct comm_timer* service_cron = NULL;
70 /** the cron thread */
71 static ub_thread_t cron_thread = NULL;
72 /** if cron has already done its quick check */
73 static int cron_was_quick = 0;
74
75 /**
76 * Report current service status to service control manager
77 * @param state: current state
78 * @param exitcode: error code (when stopped)
79 * @param wait: pending operation estimated time in milliseconds.
80 */
81 static void report_status(DWORD state, DWORD exitcode, DWORD wait)
82 {
83 static DWORD checkpoint = 1;
84 service_status.dwCurrentState = state;
85 service_status.dwWin32ExitCode = exitcode;
86 service_status.dwWaitHint = wait;
87 if(state == SERVICE_START_PENDING)
88 service_status.dwControlsAccepted = 0;
89 else service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
90 if(state == SERVICE_RUNNING || state == SERVICE_STOPPED)
91 service_status.dwCheckPoint = 0;
92 else service_status.dwCheckPoint = checkpoint++;
93 SetServiceStatus(service_status_handle, &service_status);
94 }
95
96 /**
97 * Service control handler. Called by serviceControlManager when a control
98 * code is sent to the service (with ControlService).
99 * @param ctrl: control code
100 */
101 static void
102 hdlr(DWORD ctrl)
103 {
104 if(ctrl == SERVICE_CONTROL_STOP) {
105 report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);
106 service_stop_shutdown = 1;
107 /* send signal to stop */
108 if(!WSASetEvent(service_stop_event))
109 log_err("Could not WSASetEvent: %s",
110 wsa_strerror(WSAGetLastError()));
111 return;
112 } else {
113 /* ctrl == SERVICE_CONTROL_INTERROGATE or whatever */
114 /* update status */
115 report_status(service_status.dwCurrentState, NO_ERROR, 0);
116 }
117 }
118
119 /**
120 * report event to system event log
121 * For use during startup and shutdown.
122 * @param str: the error
123 */
124 static void
125 reportev(const char* str)
126 {
127 char b[256];
128 HANDLE* s;
129 LPCTSTR msg = b;
130 /* print quickly to keep GetLastError value */
131 snprintf(b, sizeof(b), "%s: %s (%d)", SERVICE_NAME,
132 str, (int)GetLastError());
133 s = RegisterEventSource(NULL, SERVICE_NAME);
134 if(!s) return;
135 ReportEvent(s, /* event log */
136 EVENTLOG_ERROR_TYPE, /* event type */
137 0, /* event category */
138 MSG_GENERIC_ERR, /* event ID (from gen_msg.mc) */
139 NULL, /* user security context */
140 1, /* numstrings */
141 0, /* binary size */
142 &msg, /* strings */
143 NULL); /* binary data */
144 DeregisterEventSource(s);
145 }
146
147 /**
148 * Obtain registry string (if it exists).
149 * @param key: key string
150 * @param name: name of value to fetch.
151 * @return malloced string with the result or NULL if it did not
152 * exist on an error (logged) was encountered.
153 */
154 static char*
155 lookup_reg_str(const char* key, const char* name)
156 {
157 HKEY hk = NULL;
158 DWORD type = 0;
159 BYTE buf[1024];
160 DWORD len = (DWORD)sizeof(buf);
161 LONG ret;
162 char* result = NULL;
163 ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hk);
164 if(ret == ERROR_FILE_NOT_FOUND)
165 return NULL; /* key does not exist */
166 else if(ret != ERROR_SUCCESS) {
167 reportev("RegOpenKeyEx failed");
168 return NULL;
169 }
170 ret = RegQueryValueEx(hk, (LPCTSTR)name, 0, &type, buf, &len);
171 if(RegCloseKey(hk))
172 reportev("RegCloseKey");
173 if(ret == ERROR_FILE_NOT_FOUND)
174 return NULL; /* name does not exist */
175 else if(ret != ERROR_SUCCESS) {
176 reportev("RegQueryValueEx failed");
177 return NULL;
178 }
179 if(type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) {
180 buf[sizeof(buf)-1] = 0;
181 buf[sizeof(buf)-2] = 0; /* for multi_sz */
182 result = strdup(buf);
183 if(!result) reportev("out of memory");
184 }
185 return result;
186 }
187
188 /**
189 * Obtain registry integer (if it exists).
190 * @param key: key string
191 * @param name: name of value to fetch.
192 * @return integer value (if it exists), or 0 on error.
193 */
194 static int
195 lookup_reg_int(const char* key, const char* name)
196 {
197 HKEY hk = NULL;
198 DWORD type = 0;
199 BYTE buf[1024];
200 DWORD len = (DWORD)sizeof(buf);
201 LONG ret;
202 int result = 0;
203 ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hk);
204 if(ret == ERROR_FILE_NOT_FOUND)
205 return 0; /* key does not exist */
206 else if(ret != ERROR_SUCCESS) {
207 reportev("RegOpenKeyEx failed");
208 return 0;
209 }
210 ret = RegQueryValueEx(hk, (LPCTSTR)name, 0, &type, buf, &len);
211 if(RegCloseKey(hk))
212 reportev("RegCloseKey");
213 if(ret == ERROR_FILE_NOT_FOUND)
214 return 0; /* name does not exist */
215 else if(ret != ERROR_SUCCESS) {
216 reportev("RegQueryValueEx failed");
217 return 0;
218 }
219 if(type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) {
220 buf[sizeof(buf)-1] = 0;
221 buf[sizeof(buf)-2] = 0; /* for multi_sz */
222 result = atoi(buf);
223 } else if(type == REG_DWORD) {
224 result = *(DWORD*)buf;
225 }
226 return result;
227 }
228
229 /**
230 * Init service. Keeps calling status pending to tell service control
231 * manager that this process is not hanging.
232 * @param r: restart, true on restart
233 * @param d: daemon returned here.
234 * @param c: config file returned here.
235 * @return false if failed.
236 */
237 static int
238 service_init(int r, struct daemon** d, struct config_file** c)
239 {
240 struct config_file* cfg = NULL;
241 struct daemon* daemon = NULL;
242
243 if(!service_cfgfile) {
244 char* newf = lookup_reg_str("Software\\Unbound", "ConfigFile");
245 if(newf) service_cfgfile = newf;
246 else service_cfgfile = strdup(CONFIGFILE);
247 if(!service_cfgfile) fatal_exit("out of memory");
248 }
249
250 /* create daemon */
251 if(r) daemon = *d;
252 else daemon = daemon_init();
253 if(!daemon) return 0;
254 if(!r) report_status(SERVICE_START_PENDING, NO_ERROR, 2800);
255
256 /* read config */
257 cfg = config_create();
258 if(!cfg) return 0;
259 if(!config_read(cfg, service_cfgfile, daemon->chroot)) {
260 if(errno != ENOENT) {
261 log_err("error in config file");
262 return 0;
263 }
264 log_warn("could not open config file, using defaults");
265 }
266 if(!r) report_status(SERVICE_START_PENDING, NO_ERROR, 2600);
267
268 verbose(VERB_QUERY, "winservice - apply settings");
269 /* apply settings and init */
270 verbosity = cfg->verbosity + service_cmdline_verbose;
271 if(cfg->directory && cfg->directory[0]) {
272 if(chdir(cfg->directory)) {
273 log_err("could not chdir to %s: %s",
274 cfg->directory, strerror(errno));
275 if(errno != ENOENT)
276 return 0;
277 log_warn("could not change directory - continuing");
278 } else
279 verbose(VERB_QUERY, "chdir to %s", cfg->directory);
280 }
281 log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
282 if(!r) report_status(SERVICE_START_PENDING, NO_ERROR, 2400);
283 verbose(VERB_QUERY, "winservice - apply cfg");
284 daemon_apply_cfg(daemon, cfg);
285
286 /* open ports */
287 /* keep reporting that we are busy starting */
288 if(!r) report_status(SERVICE_START_PENDING, NO_ERROR, 2200);
289 verbose(VERB_QUERY, "winservice - open ports");
290 if(!daemon_open_shared_ports(daemon)) return 0;
291 verbose(VERB_QUERY, "winservice - ports opened");
292 if(!r) report_status(SERVICE_START_PENDING, NO_ERROR, 2000);
293
294 *d = daemon;
295 *c = cfg;
296 return 1;
297 }
298
299 /**
300 * Deinit the service
301 */
302 static void
303 service_deinit(struct daemon* daemon, struct config_file* cfg)
304 {
305 daemon_cleanup(daemon);
306 config_delete(cfg);
307 daemon_delete(daemon);
308 }
309
310 /**
311 * The main function for the service.
312 * Called by the services API when starting unbound on windows in background.
313 * Arguments could have been present in the string 'path'.
314 * @param argc: nr args
315 * @param argv: arg text.
316 */
317 static void
318 service_main(DWORD ATTR_UNUSED(argc), LPTSTR* ATTR_UNUSED(argv))
319 {
320 struct config_file* cfg = NULL;
321 struct daemon* daemon = NULL;
322
323 service_status_handle = RegisterServiceCtrlHandler(SERVICE_NAME,
324 (LPHANDLER_FUNCTION)hdlr);
325 if(!service_status_handle) {
326 reportev("Could not RegisterServiceCtrlHandler");
327 return;
328 }
329
330 service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
331 service_status.dwServiceSpecificExitCode = 0;
332
333 /* we are now starting up */
334 report_status(SERVICE_START_PENDING, NO_ERROR, 3000);
335 if(!service_init(0, &daemon, &cfg)) {
336 reportev("Could not service_init");
337 report_status(SERVICE_STOPPED, NO_ERROR, 0);
338 return;
339 }
340
341 /* event that gets signalled when we want to quit; it
342 * should get registered in the worker-0 waiting loop. */
343 service_stop_event = WSACreateEvent();
344 if(service_stop_event == WSA_INVALID_EVENT) {
345 log_err("WSACreateEvent: %s", wsa_strerror(WSAGetLastError()));
346 reportev("Could not WSACreateEvent");
347 report_status(SERVICE_STOPPED, NO_ERROR, 0);
348 return;
349 }
350 if(!WSAResetEvent(service_stop_event)) {
351 log_err("WSAResetEvent: %s", wsa_strerror(WSAGetLastError()));
352 }
353
354 /* SetServiceStatus SERVICE_RUNNING;*/
355 report_status(SERVICE_RUNNING, NO_ERROR, 0);
356 verbose(VERB_QUERY, "winservice - init complete");
357
358 /* daemon performs work */
359 while(!service_stop_shutdown) {
360 daemon_fork(daemon);
361 if(!service_stop_shutdown) {
362 daemon_cleanup(daemon);
363 config_delete(cfg); cfg=NULL;
364 if(!service_init(1, &daemon, &cfg)) {
365 reportev("Could not service_init");
366 report_status(SERVICE_STOPPED, NO_ERROR, 0);
367 return;
368 }
369 }
370 }
371
372 /* exit */
373 verbose(VERB_ALGO, "winservice - cleanup.");
374 report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);
375 service_deinit(daemon, cfg);
376 free(service_cfgfile);
377 if(service_stop_event) (void)WSACloseEvent(service_stop_event);
378 verbose(VERB_QUERY, "winservice - full stop");
379 report_status(SERVICE_STOPPED, NO_ERROR, 0);
380 }
381
382 /** start the service */
383 static void
384 service_start(const char* cfgfile, int v, int c)
385 {
386 SERVICE_TABLE_ENTRY myservices[2] = {
387 {SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION)service_main},
388 {NULL, NULL} };
389 verbosity=v;
390 if(verbosity >= VERB_QUERY) {
391 /* log to file about start sequence */
392 fclose(fopen("C:\\unbound.log", "w"));
393 log_init("C:\\unbound.log", 0, 0);
394 verbose(VERB_QUERY, "open logfile");
395 } else log_init(0, 1, 0); /* otherwise, use Application log */
396 if(c) {
397 service_cfgfile = strdup(cfgfile);
398 if(!service_cfgfile) fatal_exit("out of memory");
399 } else service_cfgfile = NULL;
400 service_cmdline_verbose = v;
401 /* this call returns when service has stopped. */
402 if(!StartServiceCtrlDispatcher(myservices)) {
403 reportev("Could not StartServiceCtrlDispatcher");
404 }
405 }
406
407 void
408 wsvc_command_option(const char* wopt, const char* cfgfile, int v, int c)
409 {
410 if(strcmp(wopt, "install") == 0)
411 wsvc_install(stdout, NULL);
412 else if(strcmp(wopt, "remove") == 0)
413 wsvc_remove(stdout);
414 else if(strcmp(wopt, "service") == 0)
415 service_start(cfgfile, v, c);
416 else fatal_exit("unknown option: %s", wopt);
417 exit(0);
418 }
419
420 void
421 worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void* arg)
422 {
423 struct worker* worker = (struct worker*)arg;
424 verbose(VERB_QUERY, "caught stop signal (wsaevent)");
425 worker->need_to_exit = 1;
426 comm_base_exit(worker->base);
427 }
428
429 /** wait for cron process to finish */
430 static void
431 waitforit(PROCESS_INFORMATION* pinfo)
432 {
433 DWORD ret = WaitForSingleObject(pinfo->hProcess, INFINITE);
434 verbose(VERB_ALGO, "cronaction done");
435 if(ret != WAIT_OBJECT_0) {
436 return; /* did not end successfully */
437 }
438 if(!GetExitCodeProcess(pinfo->hProcess, &ret)) {
439 log_err("GetExitCodeProcess failed");
440 return;
441 }
442 verbose(VERB_ALGO, "exit code is %d", (int)ret);
443 if(ret != 1) {
444 if(!WSASetEvent(service_stop_event))
445 log_err("Could not WSASetEvent: %s",
446 wsa_strerror(WSAGetLastError()));
447 }
448 }
449
450 /** Do the cron action and wait for result exit value */
451 static void*
452 win_do_cron(void* ATTR_UNUSED(arg))
453 {
454 int mynum=65;
455 char* cronaction;
456 log_thread_set(&mynum);
457 cronaction = lookup_reg_str("Software\\Unbound", "CronAction");
458 if(cronaction) {
459 STARTUPINFO sinfo;
460 PROCESS_INFORMATION pinfo;
461 memset(&pinfo, 0, sizeof(pinfo));
462 memset(&sinfo, 0, sizeof(sinfo));
463 sinfo.cb = sizeof(sinfo);
464 verbose(VERB_ALGO, "cronaction: %s", cronaction);
465 if(!CreateProcess(NULL, cronaction, NULL, NULL, 0,
466 CREATE_NO_WINDOW, NULL, NULL, &sinfo, &pinfo))
467 log_err("CreateProcess error");
468 else {
469 waitforit(&pinfo);
470 CloseHandle(pinfo.hProcess);
471 CloseHandle(pinfo.hThread);
472 }
473 free(cronaction);
474 }
475 /* stop self */
476 CloseHandle(cron_thread);
477 cron_thread = NULL;
478 return NULL;
479 }
480
481 /** Set the timer for cron for the next wake up */
482 static void
483 set_cron_timer()
484 {
485 struct timeval tv;
486 int crontime;
487 if(cron_was_quick == 0) {
488 cron_was_quick = 1;
489 crontime = 3600; /* first update some time after boot */
490 } else {
491 crontime = lookup_reg_int("Software\\Unbound", "CronTime");
492 if(crontime == 0) crontime = 60*60*24; /* 24 hours */
493 }
494 memset(&tv, 0, sizeof(tv));
495 tv.tv_sec = (time_t)crontime;
496 comm_timer_set(service_cron, &tv);
497 }
498
499 void
500 wsvc_cron_cb(void* arg)
501 {
502 struct worker* worker = (struct worker*)arg;
503 /* perform cronned operation */
504 verbose(VERB_ALGO, "cron timer callback");
505 if(cron_thread == NULL) {
506 /* create new thread to do it */
507 ub_thread_create(&cron_thread, win_do_cron, worker);
508 }
509 /* reschedule */
510 set_cron_timer();
511 }
512
513 void wsvc_setup_worker(struct worker* worker)
514 {
515 /* if not started with -w service, do nothing */
516 if(!service_stop_event)
517 return;
518 if(!winsock_register_wsaevent(comm_base_internal(worker->base),
519 &service_stop_ev, service_stop_event,
520 &worker_win_stop_cb, worker)) {
521 fatal_exit("could not register wsaevent");
522 return;
523 }
524 if(!service_cron) {
525 service_cron = comm_timer_create(worker->base,
526 wsvc_cron_cb, worker);
527 if(!service_cron)
528 fatal_exit("could not create cron timer");
529 set_cron_timer();
530 }
531 }
532
533 void wsvc_desetup_worker(struct worker* ATTR_UNUSED(worker))
534 {
535 comm_timer_delete(service_cron);
536 service_cron = NULL;
537 }
0 /*
1 * winrc/win_svc.h - windows services API implementation for unbound
2 *
3 * Copyright (c) 2009, NLnet Labs. All rights reserved.
4 *
5 * This software is open source.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * Neither the name of the NLNET LABS nor the names of its contributors may
19 * be used to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /**
36 * \file
37 *
38 * This file contains functions to integrate with the windows services API.
39 * This means it handles the commandline switches to install and remove
40 * the service (via CreateService and DeleteService), it handles
41 * the ServiceMain() main service entry point when started as a service,
42 * and it handles the Handler[_ex]() to process requests to the service
43 * (such as start and stop and status).
44 */
45
46 #ifndef WINRC_WIN_SVC_H
47 #define WINRC_WIN_SVC_H
48 struct worker;
49
50 /** service name for unbound (internal to ServiceManager) */
51 #define SERVICE_NAME "unbound"
52
53 /** from gen_msg.h - success message record for windows message log */
54 #define MSG_GENERIC_SUCCESS ((DWORD)0x20010001L)
55 /** from gen_msg.h - informational message record for windows message log */
56 #define MSG_GENERIC_INFO ((DWORD)0x60010002L)
57 /** from gen_msg.h - warning message record for windows message log */
58 #define MSG_GENERIC_WARN ((DWORD)0xA0010003L)
59 /** from gen_msg.h - error message record for windows message log */
60 #define MSG_GENERIC_ERR ((DWORD)0xE0010004L)
61
62 /**
63 * Handle commandline service for windows.
64 * @param wopt: windows option string (install, remove, service).
65 * @param cfgfile: configfile to open (default or passed with -c).
66 * @param v: amount of commandline verbosity added with -v.
67 * @param c: true if cfgfile was set by commandline -c option.
68 */
69 void wsvc_command_option(const char* wopt, const char* cfgfile, int v, int c);
70
71 /**
72 * Setup lead worker events.
73 * @param worker: the worker
74 */
75 void wsvc_setup_worker(struct worker* worker);
76
77 /**
78 * Desetup lead worker events.
79 * @param worker: the worker
80 */
81 void wsvc_desetup_worker(struct worker* worker);
82
83 /** windows worker stop event callback handler */
84 void worker_win_stop_cb(int fd, short ev, void* arg);
85
86 /** windows cron timer callback handler */
87 void wsvc_cron_cb(void* arg);
88
89 #endif /* WINRC_WIN_SVC_H */