mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-08-17 21:25:50 +02:00
Compare commits
82
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cb879967d | ||
|
|
2703db44aa | ||
|
|
d5ac360be4 | ||
|
|
f91066ba47 | ||
|
|
e31c9620b1 | ||
|
|
d99661bb57 | ||
|
|
c1a40f1beb | ||
|
|
56d9e9677e | ||
|
|
c13d85690b | ||
|
|
45dd63d7c8 | ||
|
|
8ab18cb0f7 | ||
|
|
4e2ca85842 | ||
|
|
71d292580b | ||
|
|
d4b612e48b | ||
|
|
3d7ad2de3c | ||
|
|
24cb32dc6b | ||
|
|
4263f2a692 | ||
|
|
8459b5f55f | ||
|
|
6acc20abf4 | ||
|
|
498039108b | ||
|
|
d165625c4d | ||
|
|
af6cbba475 | ||
|
|
14f657933c | ||
|
|
1808c93e15 | ||
|
|
8078891a28 | ||
|
|
9a102eed3e | ||
|
|
02c493bd2d | ||
|
|
e2f8a1cb82 | ||
|
|
78a3c4e93d | ||
|
|
5eb7ff35ca | ||
|
|
4e1eab891b | ||
|
|
31a3035c60 | ||
|
|
aaab8cb352 | ||
|
|
fc0dcf12c3 | ||
|
|
4664c66f06 | ||
|
|
56f3cd33ec | ||
|
|
a64adc395f | ||
|
|
66f896ddbf | ||
|
|
ee5ee20071 | ||
|
|
fc3fc7a1f3 | ||
|
|
7be0e5b814 | ||
|
|
d4cfee1f00 | ||
|
|
f7059107b3 | ||
|
|
7a528cdf53 | ||
|
|
f90f5a2583 | ||
|
|
76ee7a352a | ||
|
|
148e8a69c9 | ||
|
|
39e4ba0e78 | ||
|
|
afda1a8bcc | ||
|
|
092a325270 | ||
|
|
cc6322ac0f | ||
|
|
2487f435f6 | ||
|
|
423e1a95a8 | ||
|
|
8ffff3c0a3 | ||
|
|
39e01091e7 | ||
|
|
8527bd4aff | ||
|
|
1dec098624 | ||
|
|
283f2a5edb | ||
|
|
0db56d8a0d | ||
|
|
065d2ad96f | ||
|
|
d7f2306161 | ||
|
|
66c8bd4ad1 | ||
|
|
725929734e | ||
|
|
60f51c1197 | ||
|
|
85abd17e90 | ||
|
|
ef69508048 | ||
|
|
97854e6bc5 | ||
|
|
01af814844 | ||
|
|
6de373e04c | ||
|
|
4a6d702edf | ||
|
|
0bad5716d4 | ||
|
|
55fe583de8 | ||
|
|
55aefcad19 | ||
|
|
fa07056f79 | ||
|
|
5990dde29b | ||
|
|
f9074eb440 | ||
|
|
54318b8c35 | ||
|
|
3bbe7a2e0b | ||
|
|
0f56fd3042 | ||
|
|
0d3ecd25df | ||
|
|
96d4800692 | ||
|
|
d13686227c |
+32
-31
@@ -34,6 +34,7 @@ libtool=@libtool@
|
||||
ldnsdir=@ldnsdir@
|
||||
staticexe=@staticexe@
|
||||
configfile=@ub_conf_file@
|
||||
CHECKLOCK_SRC=@CHECKLOCK_SRC@
|
||||
|
||||
YACC=@YACC@
|
||||
LEX=@LEX@
|
||||
@@ -62,55 +63,55 @@ COMMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/services/*.c \
|
||||
$(srcdir)/services/cache/*.c $(srcdir)/util/*.c \
|
||||
$(srcdir)/util/data/*.c $(srcdir)/util/storage/*.c \
|
||||
$(srcdir)/iterator/*.c $(srcdir)/validator/*.c)) \
|
||||
util/configparser.c util/configlexer.c testcode/checklocks.c
|
||||
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.o))
|
||||
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS))
|
||||
util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
|
||||
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
|
||||
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
|
||||
UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
|
||||
$(wildcard $(srcdir)/testcode/unit*.c)) \
|
||||
testcode/readhex.c testcode/ldns-testpkts.c smallapp/worker_cb.c \
|
||||
$(COMMON_SRC)
|
||||
UNITTEST_OBJ=$(addprefix $(BUILD),$(UNITTEST_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
UNITTEST_OBJ=$(addprefix $(BUILD),$(UNITTEST_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
DAEMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/daemon/*.c)) \
|
||||
$(COMMON_SRC)
|
||||
DAEMON_OBJ=$(addprefix $(BUILD),$(DAEMON_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
DAEMON_OBJ=$(addprefix $(BUILD),$(DAEMON_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
CHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
CHECKCONF_OBJ=$(addprefix $(BUILD),$(CHECKCONF_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
CHECKCONF_OBJ=$(addprefix $(BUILD),$(CHECKCONF_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
HOST_SRC=smallapp/unbound-host.c
|
||||
HOST_OBJ=$(addprefix $(BUILD),$(HOST_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
HOST_OBJ=$(addprefix $(BUILD),$(HOST_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c \
|
||||
daemon/worker.c daemon/acl_list.c daemon/daemon.c daemon/stats.c \
|
||||
testcode/replay.c testcode/fake_event.c $(filter-out util/netevent.c \
|
||||
services/listen_dnsport.c services/outside_network.c, $(COMMON_SRC))
|
||||
TESTBOUND_OBJ=$(addprefix $(BUILD),$(TESTBOUND_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
TESTBOUND_OBJ=$(addprefix $(BUILD),$(TESTBOUND_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
LOCKVERIFY_SRC=testcode/lock_verify.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
LOCKVERIFY_OBJ=$(addprefix $(BUILD),$(LOCKVERIFY_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
LOCKVERIFY_OBJ=$(addprefix $(BUILD),$(LOCKVERIFY_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
PKTVIEW_SRC=testcode/pktview.c testcode/readhex.c smallapp/worker_cb.c \
|
||||
$(COMMON_SRC)
|
||||
PKTVIEW_OBJ=$(addprefix $(BUILD),$(PKTVIEW_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
PKTVIEW_OBJ=$(addprefix $(BUILD),$(PKTVIEW_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
SIGNIT_SRC=testcode/signit.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
SIGNIT_OBJ=$(addprefix $(BUILD),$(SIGNIT_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
SIGNIT_OBJ=$(addprefix $(BUILD),$(SIGNIT_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
MEMSTATS_SRC=testcode/memstats.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
MEMSTATS_OBJ=$(addprefix $(BUILD),$(MEMSTATS_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
MEMSTATS_OBJ=$(addprefix $(BUILD),$(MEMSTATS_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
ASYNCLOOK_SRC=testcode/asynclook.c
|
||||
ASYNCLOOK_OBJ=$(addprefix $(BUILD),$(ASYNCLOOK_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
ASYNCLOOK_OBJ=$(addprefix $(BUILD),$(ASYNCLOOK_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
STREAMTCP_SRC=testcode/streamtcp.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
STREAMTCP_OBJ=$(addprefix $(BUILD),$(STREAMTCP_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
STREAMTCP_OBJ=$(addprefix $(BUILD),$(STREAMTCP_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
PERF_SRC=testcode/perf.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
PERF_OBJ=$(addprefix $(BUILD),$(PERF_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
PERF_OBJ=$(addprefix $(BUILD),$(PERF_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
DELAYER_SRC=testcode/delayer.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
DELAYER_OBJ=$(addprefix $(BUILD),$(DELAYER_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
DELAYER_OBJ=$(addprefix $(BUILD),$(DELAYER_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
HARVEST_SRC=testcode/harvest.c
|
||||
HARVEST_OBJ=$(addprefix $(BUILD),$(HARVEST_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
HARVEST_OBJ=$(addprefix $(BUILD),$(HARVEST_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
LIBUNBOUND_SRC=$(patsubst $(srcdir)/%,%, \
|
||||
$(wildcard $(srcdir)/libunbound/*.c) $(COMMON_SRC))
|
||||
LIBUNBOUND_OBJ=$(addprefix $(BUILD),$(LIBUNBOUND_SRC:.c=.o)) $(COMPAT_OBJ)
|
||||
LIBUNBOUND_OBJ=$(addprefix $(BUILD),$(LIBUNBOUND_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
ALL_SRC=$(sort $(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \
|
||||
$(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) $(SIGNIT_SRC) \
|
||||
$(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \
|
||||
$(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \
|
||||
$(HARVEST_SRC) )
|
||||
ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.o) \
|
||||
$(addprefix compat/,$(LIBOBJS))) $(COMPAT_OBJ)
|
||||
ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.lo) \
|
||||
$(addprefix compat/,$(LIBOBJS:.o=.lo))) $(COMPAT_OBJ)
|
||||
|
||||
COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS)
|
||||
@@ -118,7 +119,7 @@ LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLA
|
||||
|
||||
.PHONY: clean realclean doc lint all install uninstall tests test download_ldns strip lib
|
||||
|
||||
$(BUILD)%.o: $(srcdir)/%.c
|
||||
$(BUILD)%.lo: $(srcdir)/%.c
|
||||
$(INFO) Build $<
|
||||
@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
|
||||
then (cd $(ldnsdir); $(MAKE) copy-headers); fi
|
||||
@@ -131,13 +132,13 @@ tests: all unittest testbound lock-verify pktview signit memstats \
|
||||
asynclook streamtcp perf delayer harvest
|
||||
|
||||
test: tests
|
||||
bash testcode/do-tests.sh
|
||||
if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi
|
||||
|
||||
lib: libunbound.la
|
||||
|
||||
libunbound.la: $(LIBUNBOUND_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK_LIB) --export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ:.o=.lo)) -rpath $(libdir) $(LIBS)
|
||||
$Q$(LINK_LIB) --export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
|
||||
|
||||
ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
|
||||
ldnslib=$(ldnsdir)/lib/libldns.a
|
||||
@@ -269,12 +270,12 @@ install:
|
||||
$(LIBTOOL) --mode=install cp unbound $(DESTDIR)$(sbindir)/unbound
|
||||
$(LIBTOOL) --mode=install cp unbound-checkconf $(DESTDIR)$(sbindir)/unbound-checkconf
|
||||
$(LIBTOOL) --mode=install cp unbound-host $(DESTDIR)$(sbindir)/unbound-host
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
$(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/libunbound.3 $(DESTDIR)$(mandir)/man3
|
||||
if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 $(srcdir)/doc/example.conf $(DESTDIR)$(configfile); fi
|
||||
$(INSTALL) -c -m 644 doc/libunbound.3 $(DESTDIR)$(mandir)/man3
|
||||
if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi
|
||||
$(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound.h $(DESTDIR)$(includedir)/unbound.h
|
||||
$(LIBTOOL) --mode=install cp libunbound.la $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
||||
@@ -289,8 +290,8 @@ uninstall:
|
||||
@echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand"
|
||||
|
||||
download_ldns:
|
||||
svn export https://www.nlnetlabs.nl/ldns/svn/trunk/makedist.sh ldns_makedist.sh
|
||||
./ldns_makedist.sh -s -d https://www.nlnetlabs.nl/ldns/svn/trunk
|
||||
svn export https://www.nlnetlabs.nl/svn/ldns/trunk/makedist.sh ldns_makedist.sh
|
||||
./ldns_makedist.sh -s -d https://www.nlnetlabs.nl/svn/ldns/trunk
|
||||
mv ldns-*_pre_*.tar.gz ldns-src.tar.gz
|
||||
rm ldns-*_pre_*.tar.gz.sha1 ldns_makedist.sh
|
||||
|
||||
@@ -307,7 +308,7 @@ $(BUILD)%.d: $(srcdir)/%.c
|
||||
then (cd $(ldnsdir); $(MAKE) copy-headers); fi
|
||||
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
||||
$Q$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< \
|
||||
| sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \
|
||||
| sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.lo $@ : !g'\'' > $@; \
|
||||
[ -s $@ ] || rm -f $@'
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
|
||||
Vendored
+370
-198
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Taken from FreeBSD src / lib / libc / stdtime / localtime.c 1.43 revision.
|
||||
* localtime.c 7.78.
|
||||
* tzfile.h 1.8
|
||||
* adapted to be replacement gmtime_r.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#define MONSPERYEAR 12
|
||||
#define DAYSPERNYEAR 365
|
||||
#define DAYSPERLYEAR 366
|
||||
#define SECSPERMIN 60
|
||||
#define SECSPERHOUR (60*60)
|
||||
#define SECSPERDAY (24*60*60)
|
||||
#define DAYSPERWEEK 7
|
||||
#define TM_SUNDAY 0
|
||||
#define TM_MONDAY 1
|
||||
#define TM_TUESDAY 2
|
||||
#define TM_WEDNESDAY 3
|
||||
#define TM_THURSDAY 4
|
||||
#define TM_FRIDAY 5
|
||||
#define TM_SATURDAY 6
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
#define EPOCH_YEAR 1970
|
||||
#define EPOCH_WDAY TM_THURSDAY
|
||||
|
||||
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
|
||||
|
||||
static const int mon_lengths[2][MONSPERYEAR] = {
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
};
|
||||
|
||||
static const int year_lengths[2] = {
|
||||
DAYSPERNYEAR, DAYSPERLYEAR
|
||||
};
|
||||
|
||||
static void
|
||||
timesub(timep, offset, tmp)
|
||||
const time_t * const timep;
|
||||
const long offset;
|
||||
struct tm * const tmp;
|
||||
{
|
||||
long days;
|
||||
long rem;
|
||||
long y;
|
||||
int yleap;
|
||||
const int * ip;
|
||||
|
||||
days = *timep / SECSPERDAY;
|
||||
rem = *timep % SECSPERDAY;
|
||||
rem += (offset);
|
||||
while (rem < 0) {
|
||||
rem += SECSPERDAY;
|
||||
--days;
|
||||
}
|
||||
while (rem >= SECSPERDAY) {
|
||||
rem -= SECSPERDAY;
|
||||
++days;
|
||||
}
|
||||
tmp->tm_hour = (int) (rem / SECSPERHOUR);
|
||||
rem = rem % SECSPERHOUR;
|
||||
tmp->tm_min = (int) (rem / SECSPERMIN);
|
||||
/*
|
||||
** A positive leap second requires a special
|
||||
** representation. This uses "... ??:59:60" et seq.
|
||||
*/
|
||||
tmp->tm_sec = (int) (rem % SECSPERMIN) ;
|
||||
tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK);
|
||||
if (tmp->tm_wday < 0)
|
||||
tmp->tm_wday += DAYSPERWEEK;
|
||||
y = EPOCH_YEAR;
|
||||
#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400)
|
||||
while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
|
||||
long newy;
|
||||
|
||||
newy = y + days / DAYSPERNYEAR;
|
||||
if (days < 0)
|
||||
--newy;
|
||||
days -= (newy - y) * DAYSPERNYEAR +
|
||||
LEAPS_THRU_END_OF(newy - 1) -
|
||||
LEAPS_THRU_END_OF(y - 1);
|
||||
y = newy;
|
||||
}
|
||||
tmp->tm_year = y - TM_YEAR_BASE;
|
||||
tmp->tm_yday = (int) days;
|
||||
ip = mon_lengths[yleap];
|
||||
for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
|
||||
days = days - (long) ip[tmp->tm_mon];
|
||||
tmp->tm_mday = (int) (days + 1);
|
||||
tmp->tm_isdst = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Re-entrant version of gmtime.
|
||||
*/
|
||||
struct tm * gmtime_r(const time_t* timep, struct tm *tm)
|
||||
{
|
||||
timesub(timep, 0L, tm);
|
||||
return tm;
|
||||
}
|
||||
@@ -56,8 +56,12 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -23,8 +23,12 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@@ -62,7 +66,11 @@ inet_ntop(int af, const void *src, char *dst, size_t size)
|
||||
case AF_INET6:
|
||||
return (inet_ntop6(src, dst, size));
|
||||
default:
|
||||
#ifdef EAFNOSUPPORT
|
||||
errno = EAFNOSUPPORT;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
#endif
|
||||
return (NULL);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
|
||||
@@ -70,7 +70,11 @@ inet_pton(af, src, dst)
|
||||
case AF_INET6:
|
||||
return (inet_pton6(src, dst));
|
||||
default:
|
||||
#ifdef EAFNOSUPPORT
|
||||
errno = EAFNOSUPPORT;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
#endif
|
||||
return (-1);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/* socketpair.c - windows mingw32 replacement for socketpair.
|
||||
* creates a pipe that works like a socketpair a bit
|
||||
* Taken from libevent-1.4.3.stable WIN32-Code/misc.c
|
||||
* License: BSD.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int
|
||||
socketpair(int d, int type, int protocol, int *sv)
|
||||
{
|
||||
static int count;
|
||||
char buf[64];
|
||||
HANDLE fd;
|
||||
DWORD dwMode;
|
||||
(void)d; (void)type; (void)protocol;
|
||||
sprintf(buf, "\\\\.\\pipe\\levent-%d", count++);
|
||||
/* Create a duplex pipe which will behave like a socket pair */
|
||||
fd = CreateNamedPipe(buf, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_NOWAIT,
|
||||
PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, NULL);
|
||||
if (fd == INVALID_HANDLE_VALUE)
|
||||
return (-1);
|
||||
sv[0] = (int)fd;
|
||||
|
||||
fd = CreateFile(buf, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (fd == INVALID_HANDLE_VALUE)
|
||||
return (-1);
|
||||
dwMode = PIPE_NOWAIT;
|
||||
SetNamedPipeHandleState(fd, &dwMode, NULL, NULL);
|
||||
sv[1] = (int)fd;
|
||||
|
||||
return (0);
|
||||
}
|
||||
Vendored
+25
-9
@@ -4,7 +4,7 @@
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
timestamp='2006-07-02'
|
||||
timestamp='2007-05-17'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -161,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm*) machine=arm-unknown ;;
|
||||
sh3el) machine=shl-unknown ;;
|
||||
sh3eb) machine=sh-unknown ;;
|
||||
sh5el) machine=sh5le-unknown ;;
|
||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
@@ -329,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
@@ -780,7 +781,7 @@ EOF
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
i*:MINGW*:*)
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
@@ -790,12 +791,15 @@ EOF
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
x86:Interix*:[3456]*)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
EM64T:Interix*:[3456]*)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:Interix*:[3456]*)
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
EM64T | authenticamd)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
esac ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
@@ -950,6 +954,9 @@ EOF
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa:Linux:*:*)
|
||||
echo xtensa-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
@@ -1208,6 +1215,15 @@ EOF
|
||||
SX-6:SUPER-UX:*:*)
|
||||
echo sx6-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-7:SUPER-UX:*:*)
|
||||
echo sx7-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-8:SUPER-UX:*:*)
|
||||
echo sx8-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-8R:SUPER-UX:*:*)
|
||||
echo sx8r-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
Power*:Rhapsody:*:*)
|
||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
||||
+144
-4
@@ -21,6 +21,9 @@
|
||||
/* Define to 1 if your system has a working `chown' function. */
|
||||
#undef HAVE_CHOWN
|
||||
|
||||
/* Define to 1 if you have the `chroot' function. */
|
||||
#undef HAVE_CHROOT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
@@ -36,18 +39,33 @@
|
||||
/* Define to 1 if you have the <event.h> header file. */
|
||||
#undef HAVE_EVENT_H
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
||||
#undef HAVE_FSEEKO
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
/* Whether getaddrinfo is available */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the `getpwnam' function. */
|
||||
#undef HAVE_GETPWNAM
|
||||
|
||||
/* Define to 1 if you have the `getrlimit' function. */
|
||||
#undef HAVE_GETRLIMIT
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* If you have HMAC_CTX_init */
|
||||
#undef HAVE_HMAC_CTX_INIT
|
||||
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
@@ -60,8 +78,11 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
/* if the function 'ioctlsocket' is available */
|
||||
#undef HAVE_IOCTLSOCKET
|
||||
|
||||
/* Define to 1 if you have the `kill' function. */
|
||||
#undef HAVE_KILL
|
||||
|
||||
/* Define to 1 if you have the `ldns' library (-lldns). */
|
||||
#undef HAVE_LIBLDNS
|
||||
@@ -76,6 +97,9 @@
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
@@ -97,12 +121,42 @@
|
||||
/* Define to 1 if the system has the type `pthread_spinlock_t'. */
|
||||
#undef HAVE_PTHREAD_SPINLOCK_T
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define to 1 if you have the `random' function. */
|
||||
#undef HAVE_RANDOM
|
||||
|
||||
/* Define to 1 if you have the `recvmsg' function. */
|
||||
#undef HAVE_RECVMSG
|
||||
|
||||
/* Define to 1 if you have the `sbrk' function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
/* Define to 1 if you have the `sendmsg' function. */
|
||||
#undef HAVE_SENDMSG
|
||||
|
||||
/* Define to 1 if you have the `setsid' function. */
|
||||
#undef HAVE_SETSID
|
||||
|
||||
/* Define to 1 if you have the `sigprocmask' function. */
|
||||
#undef HAVE_SIGPROCMASK
|
||||
|
||||
/* Define to 1 if you have the `sleep' function. */
|
||||
#undef HAVE_SLEEP
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `socketpair' function. */
|
||||
#undef HAVE_SOCKETPAIR
|
||||
|
||||
/* Using Solaris threads */
|
||||
#undef HAVE_SOLARIS_THREADS
|
||||
|
||||
/* Define to 1 if you have the `srandom' function. */
|
||||
#undef HAVE_SRANDOM
|
||||
|
||||
/* Define if you have the SSL libraries installed. */
|
||||
#undef HAVE_SSL
|
||||
|
||||
@@ -148,27 +202,54 @@
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
#undef HAVE_SYS_UIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define to 1 if you have the `tzset' function. */
|
||||
#undef HAVE_TZSET
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#undef HAVE_WINDOWS_H
|
||||
|
||||
/* Using Windows threads */
|
||||
#undef HAVE_WINDOWS_THREADS
|
||||
|
||||
/* Define to 1 if you have the <winsock2.h> header file. */
|
||||
#undef HAVE_WINSOCK2_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* Define to 1 if you have the `writev' function. */
|
||||
#undef HAVE_WRITEV
|
||||
|
||||
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||
#undef HAVE_WS2TCPIP_H
|
||||
|
||||
/* Define to the maximum message length to pass to syslog. */
|
||||
#undef MAXSYSLOGMSGLEN
|
||||
|
||||
/* Define if mkdir has one argument. */
|
||||
#undef MKDIR_HAS_ONE_ARG
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
@@ -184,7 +265,7 @@
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Pathname to unbound process id file */
|
||||
/* default pidfile location */
|
||||
#undef PIDFILE
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
@@ -200,6 +281,9 @@
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* default username */
|
||||
#undef UB_USERNAME
|
||||
|
||||
/* use statistics for allocs and frees, for debug use */
|
||||
#undef UNBOUND_ALLOC_STATS
|
||||
|
||||
@@ -209,6 +293,12 @@
|
||||
/* Define if you want to use internal select based events */
|
||||
#undef USE_MINI_EVENT
|
||||
|
||||
/* Whether the windows socket API is used */
|
||||
#undef USE_WINSOCK
|
||||
|
||||
/* the version of the windows API enabled */
|
||||
#undef WINVER
|
||||
|
||||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
|
||||
`char[]'. */
|
||||
#undef YYTEXT_POINTER
|
||||
@@ -342,6 +432,14 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
@@ -382,6 +480,10 @@
|
||||
#define RAND_MAX 2147483647
|
||||
#endif
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
|
||||
#ifndef IPV6_MIN_MTU
|
||||
#define IPV6_MIN_MTU 1280
|
||||
#endif /* IPV6_MIN_MTU */
|
||||
@@ -399,30 +501,68 @@
|
||||
#define MAXINCLUDES 10
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf snprintf_unbound
|
||||
#define vsnprintf vsnprintf_unbound
|
||||
#include <stdarg.h>
|
||||
int snprintf (char *str, size_t count, const char *fmt, ...);
|
||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
#ifndef HAVE_INET_PTON
|
||||
#define inet_pton inet_pton_unbound
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
#endif /* HAVE_INET_PTON */
|
||||
#ifndef HAVE_INET_NTOP
|
||||
#define inet_ntop inet_ntop_unbound
|
||||
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_INET_ATON
|
||||
#define inet_aton inet_aton_unbound
|
||||
int inet_aton(const char *cp, struct in_addr *addr);
|
||||
#endif
|
||||
#ifndef HAVE_MEMMOVE
|
||||
#define memmove memmove_unbound
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCPY
|
||||
#define strlcpy strlcpy_unbound
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
#ifndef HAVE_GMTIME_R
|
||||
#define gmtime_r gmtime_r_unbound
|
||||
struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
#endif
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
#define getaddrinfo getaddrinfo_unbound
|
||||
#define gai_strerror gai_strerror_unbound
|
||||
#define freeaddrinfo freeaddrinfo_unbound
|
||||
#define getnameinfo getnameinfo_unbound
|
||||
struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SLEEP
|
||||
#define sleep(x) Sleep((x)*1000) /* on win32 */
|
||||
#endif /* HAVE_SLEEP */
|
||||
#ifndef HAVE_USLEEP
|
||||
#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
|
||||
#endif /* HAVE_USLEEP */
|
||||
#ifndef HAVE_RANDOM
|
||||
#define random rand /* on win32, for tests only (bad random) */
|
||||
#endif /* HAVE_RANDOM */
|
||||
#ifndef HAVE_SRANDOM
|
||||
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
||||
#endif /* HAVE_SRANDOM */
|
||||
#ifndef HAVE_SOCKETPAIR
|
||||
int socketpair(int d, int type, int protocol, int *sv);
|
||||
#endif
|
||||
|
||||
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define FD_SET_T (u_int)
|
||||
#else
|
||||
#define FD_SET_T
|
||||
#endif
|
||||
|
||||
#include "ldns/ldns.h"
|
||||
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
|
||||
Vendored
+15
-5
@@ -4,7 +4,7 @@
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
timestamp='2006-09-20'
|
||||
timestamp='2007-04-29'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -245,12 +245,12 @@ case $basic_machine in
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore \
|
||||
| maxq | mb | microblaze | mcore | mep \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -324,7 +324,7 @@ case $basic_machine in
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
@@ -683,6 +683,10 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
basic_machine=arm-unknown
|
||||
os=-mingw32ce
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
@@ -925,6 +929,9 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh5el)
|
||||
basic_machine=sh5le-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
@@ -1219,7 +1226,7 @@ case $os in
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1414,6 +1421,9 @@ case $basic_machine in
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
|
||||
+283
-69
@@ -1,13 +1,15 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.57)
|
||||
AC_PREREQ(2.56)
|
||||
|
||||
AC_INIT(unbound,1.0.0, unbound-bugs@nlnetlabs.nl, unbound)
|
||||
AC_INIT(unbound,1.0.2, unbound-bugs@nlnetlabs.nl, unbound)
|
||||
|
||||
LIBUNBOUND_CURRENT=0
|
||||
LIBUNBOUND_REVISION=12
|
||||
LIBUNBOUND_REVISION=14
|
||||
LIBUNBOUND_AGE=0
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
# 1.0.2 had 0:14:0
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
@@ -45,21 +47,49 @@ esac
|
||||
|
||||
#
|
||||
# Determine configuration file
|
||||
ub_conf_file=${sysconfdir}/unbound/unbound.conf
|
||||
# the eval is to evaluate shell expansion twice
|
||||
ub_conf_file=`eval echo "${sysconfdir}/unbound/unbound.conf"`
|
||||
AC_ARG_WITH([conf_file],
|
||||
AC_HELP_STRING([--with-conf-file=path], [Pathname to the Unbound configuration file]),
|
||||
[ub_conf_file=$withval])
|
||||
AC_HELP_STRING([--with-conf-file=path],
|
||||
[Pathname to the Unbound configuration file]),
|
||||
[ub_conf_file="$withval"])
|
||||
AC_SUBST(ub_conf_file)
|
||||
# the eval is to evaluate shell expansion twice, once
|
||||
# for $nsd_conf_file and once for the ${prefix} within it.
|
||||
AC_DEFINE_UNQUOTED(CONFIGFILE, ["`eval echo $ub_conf_file`"], [Pathname to the Unbound configuration file])
|
||||
AC_DEFINE_UNQUOTED(CONFIGFILE, ["$ub_conf_file"], [Pathname to the Unbound configuration file])
|
||||
|
||||
# Determine run, chroot directory and pidfile locations
|
||||
ub_cfg=`eval echo $ub_conf_file`
|
||||
ub_dir=`dirname $ub_cfg`
|
||||
AC_DEFINE_UNQUOTED(RUN_DIR, ["$ub_dir"], [Directory to chdir to])
|
||||
AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$ub_dir"], [Directory to chroot to])
|
||||
AC_DEFINE_UNQUOTED(PIDFILE, ["$ub_dir/unbound.pid"], [Pathname to unbound process id file])
|
||||
AC_ARG_WITH(run-dir,
|
||||
AC_HELP_STRING([--with-run-dir=path],
|
||||
[set default directory to chdir to (by default dir part of cfg file)]),
|
||||
UNBOUND_RUN_DIR="$withval",
|
||||
UNBOUND_RUN_DIR=`dirname "$ub_conf_file"`)
|
||||
AC_SUBST(UNBOUND_RUN_DIR)
|
||||
AC_DEFINE_UNQUOTED(RUN_DIR, ["$UNBOUND_RUN_DIR"], [Directory to chdir to])
|
||||
|
||||
AC_ARG_WITH(chroot-dir,
|
||||
AC_HELP_STRING([--with-chroot-dir=path],
|
||||
[set default directory to chroot to (by default same as run-dir)]),
|
||||
UNBOUND_CHROOT_DIR="$withval",
|
||||
UNBOUND_CHROOT_DIR="$UNBOUND_RUN_DIR")
|
||||
AC_SUBST(UNBOUND_CHROOT_DIR)
|
||||
AC_DEFINE_UNQUOTED(CHROOT_DIR, ["$UNBOUND_CHROOT_DIR"], [Directory to chroot to])
|
||||
|
||||
AC_ARG_WITH(pidfile,
|
||||
AC_HELP_STRING([--with-pidfile=filename],
|
||||
[set default pathname to unbound pidfile (default run-dir/unbound.pid)]),
|
||||
UNBOUND_PIDFILE="$withval",
|
||||
UNBOUND_PIDFILE="$UNBOUND_RUN_DIR/unbound.pid")
|
||||
AC_SUBST(UNBOUND_PIDFILE)
|
||||
AC_DEFINE_UNQUOTED(PIDFILE, ["$UNBOUND_PIDFILE"], [default pidfile location])
|
||||
|
||||
AC_ARG_WITH(username,
|
||||
AC_HELP_STRING([--with-username=user],
|
||||
[set default user that unbound changes to (default user is unbound)]),
|
||||
UNBOUND_USERNAME="$withval",
|
||||
UNBOUND_USERNAME="unbound")
|
||||
AC_SUBST(UNBOUND_USERNAME)
|
||||
AC_DEFINE_UNQUOTED(UB_USERNAME, ["$UNBOUND_USERNAME"], [default username])
|
||||
|
||||
AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
|
||||
|
||||
dnl routine to help check for compiler flags.
|
||||
AC_DEFUN([CHECK_COMPILER_FLAG],
|
||||
@@ -144,6 +174,10 @@ CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"])
|
||||
|
||||
AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])
|
||||
|
||||
# MinGW32 tests
|
||||
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT])
|
||||
# end mingw32 tests
|
||||
|
||||
CHECK_COMPILER_FLAG_NEEDED(-std=c99 -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE,
|
||||
[
|
||||
#include "confdefs.h"
|
||||
@@ -231,6 +265,17 @@ int test() {
|
||||
}
|
||||
], [CFLAGS="$CFLAGS -D_BSD_SOURCE"])
|
||||
|
||||
CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE,
|
||||
[
|
||||
#include <netinet/in.h>
|
||||
|
||||
int test() {
|
||||
struct in6_pktinfo inf;
|
||||
int a = (int)sizeof(inf);
|
||||
return a;
|
||||
}
|
||||
], [CFLAGS="$CFLAGS -D_GNU_SOURCE"])
|
||||
|
||||
CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112,
|
||||
[
|
||||
#include "confdefs.h"
|
||||
@@ -358,7 +403,11 @@ AC_DEFUN([AC_PROG_OBJC], [:])
|
||||
AC_DEFUN([AC_PROG_OBJCCPP], [:])
|
||||
AC_DEFUN([AC_LIBTOOL_CXX], [:])
|
||||
AC_DEFUN([AC_LIBTOOL_F77], [:])
|
||||
AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [./libtool])
|
||||
# always use ./libtool unless override from commandline (libtool=mylibtool)
|
||||
if test -z "$libtool"; then
|
||||
libtool="./libtool"
|
||||
fi
|
||||
AC_SUBST(libtool)
|
||||
AC_PATH_TOOL(AR, ar, [false])
|
||||
if test $AR = false; then
|
||||
AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it])
|
||||
@@ -375,7 +424,7 @@ AC_PROG_LIBTOOL
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
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],,, [AC_INCLUDES_DEFAULT])
|
||||
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],,, [AC_INCLUDES_DEFAULT])
|
||||
|
||||
# check for types
|
||||
AC_CHECK_TYPE(int8_t, char)
|
||||
@@ -426,26 +475,6 @@ AC_INCLUDES_DEFAULT
|
||||
#endif
|
||||
])
|
||||
|
||||
# Check for yyunput
|
||||
AC_DEFUN([CHECK_YYUNPUT],
|
||||
[AC_MSG_CHECKING(whether lex can not generate yyunput)
|
||||
AC_CACHE_VAL(ac_cv_c_yy_unput,
|
||||
[ac_cv_c_yy_unput=no
|
||||
if $LEX --nounput -h 2>&1 | grep "do not generate" 2>&1 >/dev/null; then
|
||||
ac_cv_c_yy_unput="yes"
|
||||
else
|
||||
ac_cv_c_yy_unput="no"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_MSG_RESULT($ac_cv_c_yy_unput)
|
||||
if test $ac_cv_c_yy_unput = yes; then
|
||||
LEX="$LEX --nounput"
|
||||
fi
|
||||
])dnl
|
||||
|
||||
CHECK_YYUNPUT
|
||||
|
||||
# add option to disable the evil rpath
|
||||
dnl Check whether to use rpath or not
|
||||
AC_ARG_ENABLE(rpath,
|
||||
@@ -490,9 +519,34 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
|
||||
if test "x$enable_rpath" = xyes; then
|
||||
RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib"
|
||||
fi
|
||||
AC_CHECK_LIB(crypto, HMAC_CTX_init,, [
|
||||
|
||||
AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
|
||||
ORIGLIBS="$LIBS"
|
||||
LIBS="$LIBS -lcrypto"
|
||||
AC_TRY_LINK(, [
|
||||
int HMAC_CTX_init(void);
|
||||
(void)HMAC_CTX_init();
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
|
||||
[If you have HMAC_CTX_init])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
# check if -lwsock32 or -lgdi32 are needed.
|
||||
LIBS="$LIBS -lgdi32"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
|
||||
AC_TRY_LINK([], [
|
||||
int HMAC_CTX_init(void);
|
||||
(void)HMAC_CTX_init();
|
||||
],[
|
||||
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
|
||||
[If you have HMAC_CTX_init])
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
|
||||
])
|
||||
])
|
||||
])
|
||||
fi
|
||||
AC_SUBST(HAVE_SSL)
|
||||
AC_SUBST(RUNTIME_PATH)
|
||||
@@ -521,6 +575,7 @@ fi
|
||||
# check solaris thread library
|
||||
AC_ARG_WITH(solaris-threads, AC_HELP_STRING([--with-solaris-threads],
|
||||
[use solaris native thread library.]), [ ],[ withval="no" ])
|
||||
ub_have_sol_threads=no
|
||||
if test x_$withval != x_no; then
|
||||
if test x_$ub_have_pthreads != x_no; then
|
||||
AC_WARN([Have pthreads already, ignoring --with-solaris-threads])
|
||||
@@ -531,12 +586,31 @@ if test x_$withval != x_no; then
|
||||
|
||||
CHECK_COMPILER_FLAG(mt, [CFLAGS="$CFLAGS -mt"],
|
||||
[CFLAGS="$CFLAGS -D_REENTRANT"])
|
||||
ub_have_sol_threads=yes
|
||||
] , [
|
||||
AC_ERROR([no solaris threads found.])
|
||||
])
|
||||
fi
|
||||
fi
|
||||
|
||||
# check windows threads
|
||||
if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then
|
||||
AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_MSG_CHECKING([for CreateThread])
|
||||
AC_TRY_COMPILE([
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
], [
|
||||
HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
|
||||
,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
# check to see if libraries are needed for these functions.
|
||||
AC_SEARCH_LIBS([inet_pton], [nsl])
|
||||
AC_SEARCH_LIBS([socket], [socket])
|
||||
@@ -545,7 +619,7 @@ AC_SEARCH_LIBS([socket], [socket])
|
||||
AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
|
||||
[use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
|
||||
[ ],[ withval="no" ])
|
||||
if test x_$withval == x_yes -o x_$withval != x_no; then
|
||||
if test x_$withval = x_yes -o x_$withval != x_no; then
|
||||
AC_MSG_CHECKING(for libevent)
|
||||
if test x_$withval = x_ -o x_$withval = x_yes; then
|
||||
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
|
||||
@@ -621,6 +695,8 @@ AC_ARG_ENABLE(lock_checks, AC_HELP_STRING([--enable-lock-checks],
|
||||
, )
|
||||
if test x_$enable_lock_checks = x_yes; then
|
||||
AC_DEFINE(ENABLE_LOCK_CHECKS, 1, [Define if you want to use debug lock checking (slow).])
|
||||
CHECKLOCK_SRC="testcode/checklocks.c"
|
||||
AC_SUBST(CHECKLOCK_SRC)
|
||||
fi
|
||||
|
||||
# set memory allocation checking if requested
|
||||
@@ -638,6 +714,116 @@ AC_FUNC_FORK
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_FSEEKO
|
||||
AC_SYS_LARGEFILE
|
||||
dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko
|
||||
CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1,
|
||||
[
|
||||
#include <stdio.h>
|
||||
int test() {
|
||||
int a = fseeko(stdin, 0, 0);
|
||||
return a;
|
||||
}
|
||||
], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"])
|
||||
|
||||
AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(for getaddrinfo)
|
||||
ac_cv_func_getaddrinfo=no
|
||||
AC_LINK_IFELSE(
|
||||
[
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
char* getaddrinfo();
|
||||
char* (*f) () = getaddrinfo;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
int main() {
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
dnl this case on linux, solaris, bsd
|
||||
[ac_cv_func_getaddrinfo="yes"],
|
||||
dnl no quick getaddrinfo, try mingw32 and winsock2 library.
|
||||
ORIGLIBS="$LIBS"
|
||||
LIBS="$LIBS -lws2_32"
|
||||
AC_LINK_IFELSE(
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
],
|
||||
[
|
||||
(void)getaddrinfo(NULL, NULL, NULL, NULL);
|
||||
]
|
||||
),
|
||||
[
|
||||
ac_cv_func_getaddrinfo="yes"
|
||||
dnl already: LIBS="$LIBS -lws2_32"
|
||||
AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used])
|
||||
],
|
||||
[
|
||||
ac_cv_func_getaddrinfo="no"
|
||||
LIBS="$ORIGLIBS"
|
||||
])
|
||||
)
|
||||
|
||||
AC_MSG_RESULT($ac_cv_func_getaddrinfo)
|
||||
if test $ac_cv_func_getaddrinfo = yes; then
|
||||
AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
AC_CHECK_GETADDRINFO_WITH_INCLUDES
|
||||
if test $ac_cv_func_getaddrinfo = no; then
|
||||
AC_LIBOBJ([fake-rfc2553])
|
||||
fi
|
||||
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev])
|
||||
|
||||
# check mkdir
|
||||
AC_MSG_CHECKING([whether mkdir has one arg])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
(void)mkdir("directory");
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.])
|
||||
,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
# check ioctlsocket
|
||||
AC_MSG_CHECKING(for ioctlsocket)
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
], [
|
||||
(void)ioctlsocket(0, 0, NULL);
|
||||
]), [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
|
||||
],[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_REPLACE_FUNCS(inet_aton)
|
||||
AC_REPLACE_FUNCS(inet_pton)
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
AC_REPLACE_FUNCS(snprintf)
|
||||
AC_REPLACE_FUNCS(strlcpy)
|
||||
AC_REPLACE_FUNCS(memmove)
|
||||
AC_REPLACE_FUNCS(gmtime_r)
|
||||
AC_REPLACE_FUNCS(socketpair) dnl for mingw32
|
||||
|
||||
# check this after all other compilation checks, since the linking of the lib
|
||||
# may break checks after this.
|
||||
@@ -650,21 +836,9 @@ AC_ARG_WITH(ldns,
|
||||
AC_SUBST(ldnsdir)
|
||||
])
|
||||
|
||||
AC_CHECK_LIB(ldns, ldns_rr_new, [
|
||||
AC_CHECK_LIB(ldns, ldns_buffer_copy, [
|
||||
dnl ldns was found, check compat functions
|
||||
AC_CHECK_LIB(ldns, [ldns_rr_free])
|
||||
AC_REPLACE_FUNCS(inet_aton)
|
||||
AC_REPLACE_FUNCS(inet_pton)
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
AC_REPLACE_FUNCS(snprintf)
|
||||
AC_REPLACE_FUNCS(strlcpy)
|
||||
AC_REPLACE_FUNCS(memmove)
|
||||
|
||||
AC_CHECK_FUNCS([getaddrinfo])
|
||||
if test $ac_cv_func_getaddrinfo = no; then
|
||||
AC_LIBOBJ([fake-rfc2553])
|
||||
fi
|
||||
|
||||
] , [
|
||||
dnl use the builtin ldns-src.tar.gz file to build ldns.
|
||||
if test ! -f $srcdir/ldns-src.tar.gz; then
|
||||
@@ -676,24 +850,14 @@ echo "*** ldns library not found (--with-ldns= to specify by hand) ***"
|
||||
echo "*** Building ldns library from package included in this one. ***"
|
||||
echo "*** ***"
|
||||
echo "****************************************************************"
|
||||
if test -d ldns-src; then rm -rf ldns-src; fi
|
||||
mkdir ldns-src; cp $srcdir/ldns-src.tar.gz ldns-src/ldns-src.tar.gz; (cd ldns-src; gzip -cd ldns-src.tar.gz | tar xf -); rm -f ldns-src/ldns-src.tar.gz
|
||||
ldnsdir=`ls -d ldns-src/ldns*`
|
||||
AC_MSG_NOTICE([Configure $ldnsdir])
|
||||
echo "(cd $ldnsdir && ./configure)"
|
||||
(cd $ldnsdir && ./configure)
|
||||
AC_MSG_NOTICE([Finished $ldnsdir configure])
|
||||
CPPFLAGS="$CPPFLAGS -I$ldnsdir/include"
|
||||
if test -d $srcdir/ldns-src; then rm -rf $srcdir/ldns-src; fi
|
||||
mkdir $srcdir/ldns-src; cp $srcdir/ldns-src.tar.gz $srcdir/ldns-src/ldns-src.tar.gz; (cd $srcdir/ldns-src; gzip -cd ldns-src.tar.gz | tar xf -); rm -f $srcdir/ldns-src/ldns-src.tar.gz; mv $srcdir/ldns-src $srcdir/ldns-srcb; mv $srcdir/ldns-srcb/ldns* $srcdir/ldns-src; rmdir $srcdir/ldns-srcb
|
||||
ldnsdir="ldns-src"
|
||||
AC_MSG_NOTICE([Configure $ldnsdir scheduled after config.status])
|
||||
AC_CONFIG_SUBDIRS([ldns-src])
|
||||
CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
|
||||
AC_SUBST(ldnsdir)
|
||||
dnl use ldns compat functions
|
||||
AC_DEFINE(HAVE_INET_ATON)
|
||||
AC_DEFINE(HAVE_INET_PTON)
|
||||
AC_DEFINE(HAVE_INET_NTOP)
|
||||
AC_DEFINE(HAVE_SNPRINTF)
|
||||
AC_DEFINE(HAVE_STRLCPY)
|
||||
AC_DEFINE(HAVE_MEMMOVE)
|
||||
AC_DEFINE(HAVE_GETADDRINFO)
|
||||
])
|
||||
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
|
||||
|
||||
@@ -740,6 +904,14 @@ AH_BOTTOM([
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
@@ -780,6 +952,10 @@ AH_BOTTOM([
|
||||
#define RAND_MAX 2147483647
|
||||
#endif
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
|
||||
#ifndef IPV6_MIN_MTU
|
||||
#define IPV6_MIN_MTU 1280
|
||||
#endif /* IPV6_MIN_MTU */
|
||||
@@ -797,30 +973,68 @@ AH_BOTTOM([
|
||||
#define MAXINCLUDES 10
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf snprintf_unbound
|
||||
#define vsnprintf vsnprintf_unbound
|
||||
#include <stdarg.h>
|
||||
int snprintf (char *str, size_t count, const char *fmt, ...);
|
||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
#ifndef HAVE_INET_PTON
|
||||
#define inet_pton inet_pton_unbound
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
#endif /* HAVE_INET_PTON */
|
||||
#ifndef HAVE_INET_NTOP
|
||||
#define inet_ntop inet_ntop_unbound
|
||||
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_INET_ATON
|
||||
#define inet_aton inet_aton_unbound
|
||||
int inet_aton(const char *cp, struct in_addr *addr);
|
||||
#endif
|
||||
#ifndef HAVE_MEMMOVE
|
||||
#define memmove memmove_unbound
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCPY
|
||||
#define strlcpy strlcpy_unbound
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
#ifndef HAVE_GMTIME_R
|
||||
#define gmtime_r gmtime_r_unbound
|
||||
struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
#endif
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
#define getaddrinfo getaddrinfo_unbound
|
||||
#define gai_strerror gai_strerror_unbound
|
||||
#define freeaddrinfo freeaddrinfo_unbound
|
||||
#define getnameinfo getnameinfo_unbound
|
||||
struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SLEEP
|
||||
#define sleep(x) Sleep((x)*1000) /* on win32 */
|
||||
#endif /* HAVE_SLEEP */
|
||||
#ifndef HAVE_USLEEP
|
||||
#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */
|
||||
#endif /* HAVE_USLEEP */
|
||||
#ifndef HAVE_RANDOM
|
||||
#define random rand /* on win32, for tests only (bad random) */
|
||||
#endif /* HAVE_RANDOM */
|
||||
#ifndef HAVE_SRANDOM
|
||||
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
||||
#endif /* HAVE_SRANDOM */
|
||||
#ifndef HAVE_SOCKETPAIR
|
||||
int socketpair(int d, int type, int protocol, int *sv);
|
||||
#endif
|
||||
|
||||
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define FD_SET_T (u_int)
|
||||
#else
|
||||
#define FD_SET_T
|
||||
#endif
|
||||
|
||||
#include "ldns/ldns.h"
|
||||
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
@@ -846,6 +1060,6 @@ void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
|
||||
#define UNBOUND_DNS_PORT 53
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-checkconf.8 doc/unbound.conf.5])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -5,3 +5,5 @@ distribution but may be helpful.
|
||||
* parseunbound.pl: perl script to run from cron that parses statistics from
|
||||
the log file and stores them.
|
||||
* unbound.spec and unbound.init: RPM specfile and Linux rc.d initfile.
|
||||
* update-anchor.sh: shell script that uses unbound-host to update a set
|
||||
of trust anchor files. Run from cron twice a month.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
Summary: Validating, recursive, and caching DNS resolver
|
||||
Name: unbound
|
||||
Version: 0.12
|
||||
Version: 1.0.1
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
|
||||
Source1: unbound.init
|
||||
#Source1: unbound.init
|
||||
Group: System Environment/Daemons
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: flex, openssl-devel
|
||||
@@ -32,17 +32,18 @@ The source code is under a BSD License.
|
||||
# This is a build using libldns builtin version, the resulting binaries
|
||||
# do not require libldns and this package does not have version dependencies.
|
||||
# Could be smaller using a dependency on libldns (use --with-ldns=).
|
||||
%configure --enable-debug --with-conf-file=%{_localstatedir}/%{name}/unbound.conf --disable-static --disable-rpath
|
||||
%configure --with-conf-file=%{_localstatedir}/%{name}/unbound.conf --disable-rpath
|
||||
|
||||
%build
|
||||
%{__make} %{?_smp_mflags}
|
||||
#%{__make} %{?_smp_mflags}
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
%{__make} DESTDIR=%{buildroot} install
|
||||
install -d 0700 %{buildroot}%{_localstatedir}/%{name}
|
||||
install -d 0755 %{buildroot}%{_initrddir}
|
||||
install -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/unbound
|
||||
install -m 0755 contrib/unbound.init %{buildroot}%{_initrddir}/unbound
|
||||
# add symbolic link from /etc/unbound.conf -> /var/unbound/unbound.conf
|
||||
ln -s %{_localstatedir}/unbound/unbound.conf %{buildroot}%{_sysconfdir}/unbound.conf
|
||||
# remove static library from install (fedora packaging guidelines)
|
||||
@@ -91,6 +92,9 @@ if [ "$1" -ge "1" ]; then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Thu May 22 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.0.0
|
||||
- contrib changes from Patrick Vande Walle.
|
||||
|
||||
* Thu Apr 25 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.12
|
||||
- Using parts from ports collection entry by Jaap Akkerhuis.
|
||||
- Using Fedoraproject wiki guidelines.
|
||||
|
||||
Executable
+134
@@ -0,0 +1,134 @@
|
||||
#!/bin/sh
|
||||
# update-anchor.sh, update a trust anchor.
|
||||
# this file is BSD licensed.
|
||||
|
||||
# which validating lookup to use.
|
||||
ubhost=unbound-host
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo "usage: update-anchor [-b] <zone name> <trust anchor file>"
|
||||
echo " performs an update of trust anchor file"
|
||||
echo " the trust anchor file is overwritten with the latest keys"
|
||||
echo " the trust anchor file should contain only keys for one zone"
|
||||
echo " -b causes keyfile to be made in bind format."
|
||||
echo " without -b the file is made in unbound format."
|
||||
echo " "
|
||||
echo "alternate:"
|
||||
echo " update-anchor [-b] -d directory"
|
||||
echo " update all <zone>.anchor files in the directory."
|
||||
echo " "
|
||||
echo " name the files br.anchor se.anchor ..., and include them in"
|
||||
echo " the validating resolver config file."
|
||||
echo " put keys for the root in a file with the name root.anchor."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage
|
||||
fi
|
||||
bindformat="no"
|
||||
filearg='-f'
|
||||
if test X"$1" = "X-b"; then
|
||||
shift
|
||||
bindformat="yes"
|
||||
filearg='-F'
|
||||
fi
|
||||
if test $# -ne 2; then
|
||||
echo "arguments wrong."
|
||||
usage
|
||||
fi
|
||||
|
||||
function do_update() {
|
||||
# arguments: <zonename> <keyfile>
|
||||
zonename="$1"
|
||||
keyfile="$2"
|
||||
|
||||
tmpfile="/tmp/update-anchor.$$"
|
||||
$ubhost -v $filearg "$keyfile" -t DNSKEY "$zonename" >$tmpfile
|
||||
if test $? -ne 0; then
|
||||
rm -f $tmpfile
|
||||
echo "Error: Could not update zone $zonename anchor file $keyfile"
|
||||
echo "Cause: $ubhost lookup failed"
|
||||
echo " (Is the domain decommissioned? Is connectivity lost?)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# has the lookup been DNSSEC validated?
|
||||
if grep '(secure)$' $tmpfile >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
rm -f $tmpfile
|
||||
echo "Error: Could not update zone $zonename anchor file $keyfile"
|
||||
echo "Cause: result of lookup was not secure"
|
||||
echo " (keys too far out of date? domain changed ownership?)"
|
||||
return 3
|
||||
fi
|
||||
|
||||
if test $bindformat = "yes"; then
|
||||
# are there any KSK keys on board?
|
||||
echo 'trusted-keys {' > "$keyfile"
|
||||
if grep ' has DNSKEY record 257' $tmpfile >/dev/null 2>&1; then
|
||||
# store KSK keys in anchor file
|
||||
grep '(secure)$' $tmpfile | \
|
||||
grep ' has DNSKEY record 257' | \
|
||||
sed -e 's/ (secure)$/";/' | \
|
||||
sed -e 's/ has DNSKEY record \([0-9]*\) \([0-9]*\) \([0-9]*\) /. \1 \2 \3 "/' | \
|
||||
sed -e 's/^\.\././' >> "$keyfile"
|
||||
else
|
||||
# store all keys in the anchor file
|
||||
grep '(secure)$' $tmpfile | \
|
||||
sed -e 's/ (secure)$/";/' | \
|
||||
sed -e 's/ has DNSKEY record \([0-9]*\) \([0-9]*\) \([0-9]*\) /. \1 \2 \3 "/' | \
|
||||
sed -e 's/^\.\././' >> "$keyfile"
|
||||
fi
|
||||
echo '};' >> "$keyfile"
|
||||
else #not bindformat
|
||||
# are there any KSK keys on board?
|
||||
if grep ' has DNSKEY record 257' $tmpfile >/dev/null 2>&1; then
|
||||
# store KSK keys in anchor file
|
||||
grep '(secure)$' $tmpfile | \
|
||||
grep ' has DNSKEY record 257' | \
|
||||
sed -e 's/ (secure)$//' | \
|
||||
sed -e 's/ has DNSKEY record /. IN DNSKEY /' | \
|
||||
sed -e 's/^\.\././' > "$keyfile"
|
||||
else
|
||||
# store all keys in the anchor file
|
||||
grep '(secure)$' $tmpfile | \
|
||||
sed -e 's/ (secure)$//' | \
|
||||
sed -e 's/ has DNSKEY record /. IN DNSKEY /' | \
|
||||
sed -e 's/^\.\././' > "$keyfile"
|
||||
fi
|
||||
fi # endif-bindformat
|
||||
|
||||
echo "$zonename key file $keyfile updated."
|
||||
|
||||
rm -f $tmpfile
|
||||
}
|
||||
|
||||
if test X"$1" = "X-d"; then
|
||||
tdir="$2"
|
||||
echo "start updating in $2"
|
||||
for x in $tdir/*.anchor; do
|
||||
if test `basename "$x"` = "root.anchor"; then
|
||||
zname="."
|
||||
else
|
||||
zname=`basename "$x" .anchor`
|
||||
fi
|
||||
do_update "$zname" "$x"
|
||||
done
|
||||
echo "done updating in $2"
|
||||
else
|
||||
# regular invocation
|
||||
if test X"$1" = "X."; then
|
||||
zname="$1"
|
||||
else
|
||||
# strip trailing dot from zone name
|
||||
zname="`echo $1 | sed -e 's/\.$//'`"
|
||||
fi
|
||||
kfile="$2"
|
||||
do_update $zname $kfile
|
||||
exit $?
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+46
-4
@@ -76,15 +76,24 @@ static RETSIGTYPE record_sigh(int sig)
|
||||
switch(sig)
|
||||
{
|
||||
case SIGTERM:
|
||||
#ifdef SIGQUIT
|
||||
case SIGQUIT:
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
case SIGBREAK:
|
||||
#endif
|
||||
case SIGINT:
|
||||
sig_record_quit++;
|
||||
break;
|
||||
#ifdef SIGHUP
|
||||
case SIGHUP:
|
||||
sig_record_reload++;
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
case SIGPIPE:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
log_err("ignoring signal %d", sig);
|
||||
}
|
||||
@@ -98,10 +107,20 @@ static void
|
||||
signal_handling_record()
|
||||
{
|
||||
if( signal(SIGTERM, record_sigh) == SIG_ERR ||
|
||||
#ifdef SIGQUIT
|
||||
signal(SIGQUIT, record_sigh) == SIG_ERR ||
|
||||
signal(SIGINT, record_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
signal(SIGBREAK, record_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
signal(SIGHUP, record_sigh) == SIG_ERR ||
|
||||
signal(SIGPIPE, SIG_IGN) == SIG_ERR)
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN) == SIG_ERR ||
|
||||
#endif
|
||||
signal(SIGINT, record_sigh) == SIG_ERR
|
||||
)
|
||||
log_err("install sighandler: %s", strerror(errno));
|
||||
}
|
||||
|
||||
@@ -112,8 +131,10 @@ signal_handling_record()
|
||||
static void
|
||||
signal_handling_playback(struct worker* wrk)
|
||||
{
|
||||
#ifdef SIGHUP
|
||||
if(sig_record_reload)
|
||||
worker_sighandler(SIGHUP, wrk);
|
||||
#endif
|
||||
if(sig_record_quit)
|
||||
worker_sighandler(SIGTERM, wrk);
|
||||
sig_record_quit = 0;
|
||||
@@ -125,11 +146,26 @@ daemon_init()
|
||||
{
|
||||
struct daemon* daemon = (struct daemon*)calloc(1,
|
||||
sizeof(struct daemon));
|
||||
#ifdef USE_WINSOCK
|
||||
int r;
|
||||
WSADATA wsa_data;
|
||||
#endif
|
||||
if(!daemon)
|
||||
return NULL;
|
||||
#ifdef USE_WINSOCK
|
||||
r = WSAStartup(MAKEWORD(2,2), &wsa_data);
|
||||
if(r != 0) {
|
||||
fatal_exit("could not init winsock. WSAStartup: %s",
|
||||
wsa_strerror(r));
|
||||
}
|
||||
#endif /* USE_WINSOCK */
|
||||
signal_handling_record();
|
||||
checklock_start();
|
||||
ERR_load_crypto_strings();
|
||||
#ifdef HAVE_TZSET
|
||||
/* init timezone info while we are not chrooted yet */
|
||||
tzset();
|
||||
#endif
|
||||
daemon->need_to_exit = 0;
|
||||
modstack_init(&daemon->mods);
|
||||
if(!(daemon->env = (struct module_env*)calloc(1,
|
||||
@@ -278,7 +314,7 @@ thread_start(void* arg)
|
||||
struct worker* worker = (struct worker*)arg;
|
||||
log_thread_set(&worker->thread_num);
|
||||
ub_thread_blocksigs();
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
/* close pipe ends used by main */
|
||||
close(worker->cmd_send_fd);
|
||||
worker->cmd_send_fd = -1;
|
||||
@@ -305,7 +341,7 @@ daemon_start_others(struct daemon* daemon)
|
||||
for(i=1; i<daemon->num; i++) {
|
||||
ub_thread_create(&daemon->workers[i]->thr_id,
|
||||
thread_start, daemon->workers[i]);
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
/* close pipe end of child */
|
||||
close(daemon->workers[i]->cmd_recv_fd);
|
||||
daemon->workers[i]->cmd_recv_fd = -1;
|
||||
@@ -433,4 +469,10 @@ daemon_delete(struct daemon* daemon)
|
||||
ERR_free_strings();
|
||||
RAND_cleanup();
|
||||
checklock_stop();
|
||||
#ifdef USE_WINSOCK
|
||||
if(WSACleanup() != 0) {
|
||||
log_err("Could not WSACleanup: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+51
-2
@@ -52,16 +52,22 @@
|
||||
#include "util/module.h"
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_MINI_EVENT
|
||||
#include "util/mini_event.h"
|
||||
# ifdef USE_WINSOCK
|
||||
# include "util/winsock_event.h"
|
||||
# else
|
||||
# include "util/mini_event.h"
|
||||
# endif
|
||||
#else
|
||||
#include <event.h>
|
||||
# include <event.h>
|
||||
#endif
|
||||
|
||||
/** global debug value to keep track of heap memory allocation */
|
||||
@@ -88,6 +94,7 @@ static void usage()
|
||||
static void
|
||||
checkrlimits(struct config_file* cfg)
|
||||
{
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
int list = ((cfg->do_ip4?1:0) + (cfg->do_ip6?1:0)) *
|
||||
((cfg->do_udp?1:0) + (cfg->do_tcp?1 +
|
||||
(int)cfg->incoming_num_tcp:0));
|
||||
@@ -134,6 +141,24 @@ checkrlimits(struct config_file* cfg)
|
||||
log_warn("increased limit(open files) from %u to %u",
|
||||
(unsigned)avail, (unsigned)total+10);
|
||||
}
|
||||
if(total > 1024 &&
|
||||
strncmp(event_get_version(), "mini-event", 10) == 0) {
|
||||
log_err("too many file descriptors requested. The builtin"
|
||||
"mini-event cannot handle more than 1024. Config "
|
||||
"for less fds or compile with libevent");
|
||||
fatal_exit("configuration needs too many file descriptors");
|
||||
}
|
||||
if(perthread > 64 &&
|
||||
strncmp(event_get_version(), "winsock-event", 13) == 0) {
|
||||
log_err("too many file descriptors requested. The winsock"
|
||||
" event handler cannot handle more than 64 per "
|
||||
" thread. Config for less fds or compile with "
|
||||
" libevent");
|
||||
fatal_exit("configuration needs too many file descriptors");
|
||||
}
|
||||
#else
|
||||
(void)cfg;
|
||||
#endif /* HAVE_GETRLIMIT */
|
||||
}
|
||||
|
||||
/** set verbosity, check rlimits, cache settings */
|
||||
@@ -166,6 +191,7 @@ apply_settings(struct daemon* daemon, struct config_file* cfg,
|
||||
checkrlimits(cfg);
|
||||
}
|
||||
|
||||
#ifdef HAVE_KILL
|
||||
/** Read existing pid from pidfile.
|
||||
* @param file: file name of pid file.
|
||||
* @return: the pid from the file or -1 if none.
|
||||
@@ -253,11 +279,13 @@ checkoldpid(struct config_file* cfg)
|
||||
(unsigned)old);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_KILL */
|
||||
|
||||
/** detach from command line */
|
||||
static void
|
||||
detach(struct config_file* cfg)
|
||||
{
|
||||
#ifdef HAVE_WORKING_FORK
|
||||
int fd;
|
||||
/* Take off... */
|
||||
switch (fork()) {
|
||||
@@ -271,8 +299,10 @@ detach(struct config_file* cfg)
|
||||
exit(0);
|
||||
}
|
||||
/* detach */
|
||||
#ifdef HAVE_SETSID
|
||||
if(setsid() == -1)
|
||||
fatal_exit("setsid() failed: %s", strerror(errno));
|
||||
#endif
|
||||
if ((fd = open("/dev/null", O_RDWR, 0)) != -1) {
|
||||
(void)dup2(fd, STDIN_FILENO);
|
||||
(void)dup2(fd, STDOUT_FILENO);
|
||||
@@ -280,6 +310,9 @@ detach(struct config_file* cfg)
|
||||
if (fd > 2)
|
||||
(void)close(fd);
|
||||
}
|
||||
#else
|
||||
(void)cfg;
|
||||
#endif /* HAVE_WORKING_FORK */
|
||||
}
|
||||
|
||||
/** daemonize, drop user priviliges and chroot if needed */
|
||||
@@ -287,6 +320,7 @@ static void
|
||||
do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
char** cfgfile)
|
||||
{
|
||||
#ifdef HAVE_GETPWNAM
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
/* initialize, but not to 0 (root) */
|
||||
@@ -303,6 +337,8 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
gid = pwd->pw_gid;
|
||||
endpwent();
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_CHROOT
|
||||
if(cfg->chrootdir && cfg->chrootdir[0]) {
|
||||
if(chdir(cfg->chrootdir)) {
|
||||
fatal_exit("unable to chdir to chroot %s: %s",
|
||||
@@ -317,6 +353,9 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
strlen(cfg->chrootdir)) == 0)
|
||||
(*cfgfile) += strlen(cfg->chrootdir);
|
||||
}
|
||||
#else
|
||||
(void)cfgfile;
|
||||
#endif
|
||||
if(cfg->directory && cfg->directory[0]) {
|
||||
char* dir = cfg->directory;
|
||||
if(cfg->chrootdir && cfg->chrootdir[0] &&
|
||||
@@ -331,6 +370,7 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
verbose(VERB_QUERY, "chdir to %s", dir);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_GETPWNAM
|
||||
if(cfg->username && cfg->username[0]) {
|
||||
if(setgid(gid) != 0)
|
||||
fatal_exit("unable to set group id of %s: %s",
|
||||
@@ -341,16 +381,20 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
verbose(VERB_QUERY, "drop user privileges, run as %s",
|
||||
cfg->username);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_KILL
|
||||
/* check old pid file before forking */
|
||||
if(cfg->pidfile && cfg->pidfile[0]) {
|
||||
checkoldpid(cfg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* init logfile just before fork */
|
||||
log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
|
||||
if(!debug_mode && cfg->do_daemonize) {
|
||||
detach(cfg);
|
||||
}
|
||||
#ifdef HAVE_KILL
|
||||
if(cfg->pidfile && cfg->pidfile[0]) {
|
||||
char* pf = cfg->pidfile;
|
||||
if(cfg->chrootdir && cfg->chrootdir[0] &&
|
||||
@@ -360,6 +404,9 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
if(!(daemon->pidfile = strdup(pf)))
|
||||
log_err("pidf: malloc failed");
|
||||
}
|
||||
#else
|
||||
(void)daemon;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,8 +481,10 @@ main(int argc, char* argv[])
|
||||
int cmdline_verbose = 0;
|
||||
int debug_mode = 0;
|
||||
|
||||
#ifdef HAVE_SBRK
|
||||
/* take debug snapshot of heap */
|
||||
unbound_start_brk = sbrk(0);
|
||||
#endif
|
||||
|
||||
log_init(NULL, 0, NULL);
|
||||
/* parse the options */
|
||||
|
||||
+34
-3
@@ -67,7 +67,9 @@
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
/** Size of an UDP datagram */
|
||||
@@ -102,6 +104,7 @@ debug_memleak(size_t accounted, size_t heap,
|
||||
static void
|
||||
debug_total_mem(size_t calctotal)
|
||||
{
|
||||
#ifdef HAVE_SBRK
|
||||
extern void* unbound_start_brk;
|
||||
extern size_t unbound_mem_alloc, unbound_mem_freed;
|
||||
void* cur = sbrk(0);
|
||||
@@ -111,6 +114,9 @@ debug_total_mem(size_t calctotal)
|
||||
(unsigned)unbound_mem_alloc, (unsigned)unbound_mem_freed);
|
||||
debug_memleak(calctotal, (size_t)total,
|
||||
unbound_mem_alloc, unbound_mem_freed);
|
||||
#else
|
||||
(void)calctotal;
|
||||
#endif /* HAVE_SBRK */
|
||||
}
|
||||
#endif /* UNBOUND_ALLOC_STATS */
|
||||
|
||||
@@ -840,20 +846,24 @@ worker_sighandler(int sig, void* arg)
|
||||
* in the cause for unbound to exit */
|
||||
struct worker* worker = (struct worker*)arg;
|
||||
switch(sig) {
|
||||
#ifdef SIGHUP
|
||||
case SIGHUP:
|
||||
verbose(VERB_QUERY, "caught signal SIGHUP");
|
||||
comm_base_exit(worker->base);
|
||||
break;
|
||||
#endif
|
||||
case SIGINT:
|
||||
verbose(VERB_QUERY, "caught signal SIGINT");
|
||||
worker->need_to_exit = 1;
|
||||
comm_base_exit(worker->base);
|
||||
break;
|
||||
#ifdef SIGQUIT
|
||||
case SIGQUIT:
|
||||
verbose(VERB_QUERY, "caught signal SIGQUIT");
|
||||
worker->need_to_exit = 1;
|
||||
comm_base_exit(worker->base);
|
||||
break;
|
||||
#endif
|
||||
case SIGTERM:
|
||||
verbose(VERB_QUERY, "caught signal SIGTERM");
|
||||
worker->need_to_exit = 1;
|
||||
@@ -941,17 +951,26 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
||||
return 0;
|
||||
}
|
||||
if(do_sigs) {
|
||||
#ifdef SIGHUP
|
||||
ub_thread_sig_unblock(SIGHUP);
|
||||
#endif
|
||||
ub_thread_sig_unblock(SIGINT);
|
||||
#ifdef SIGQUIT
|
||||
ub_thread_sig_unblock(SIGQUIT);
|
||||
#endif
|
||||
ub_thread_sig_unblock(SIGTERM);
|
||||
#ifndef LIBEVENT_SIGNAL_PROBLEM
|
||||
worker->comsig = comm_signal_create(worker->base,
|
||||
worker_sighandler, worker);
|
||||
if(!worker->comsig || !comm_signal_bind(worker->comsig, SIGHUP)
|
||||
|| !comm_signal_bind(worker->comsig, SIGINT)
|
||||
if(!worker->comsig
|
||||
#ifdef SIGHUP
|
||||
|| !comm_signal_bind(worker->comsig, SIGHUP)
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
|| !comm_signal_bind(worker->comsig, SIGQUIT)
|
||||
#endif
|
||||
|| !comm_signal_bind(worker->comsig, SIGTERM)
|
||||
|| !comm_signal_bind(worker->comsig, SIGQUIT)) {
|
||||
|| !comm_signal_bind(worker->comsig, SIGINT)) {
|
||||
log_err("could not create signal handlers");
|
||||
worker_delete(worker);
|
||||
return 0;
|
||||
@@ -1185,3 +1204,15 @@ int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int order_lock_cmp(const void* ATTR_UNUSED(e1), const void* ATTR_UNUSED(e2))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int codeline_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
-4
@@ -1,10 +1,14 @@
|
||||
Unbound was developed at NLnet Labs by Wouter Wijngaards.
|
||||
|
||||
Unbound was devised by Bill Manning, David Blacka, and Matt Larson
|
||||
from the University of California and from Verisign. The Java prototype
|
||||
was made in further cooperation with Geoff Sisson and Roy Arends from Nominet.
|
||||
Unbound was architected in January of 2004 by Jakob Schlyter of Kirei
|
||||
and Roy Arends of Nominet. VeriSign and EP.Net funded development of
|
||||
the prototype, which was built by David Blacka and Matt Larson of VeriSign.
|
||||
Late in 2006, NLnet Labs joined the effort, writing an implementation in C
|
||||
based on the existing prototype and using experience NLnet Labs gained
|
||||
during the development of NSD, an authoritative DNS server.
|
||||
|
||||
At NLnet Labs, Jelte Jansen and Mark Santcroos reviewed the unbound C sources.
|
||||
At NLnet Labs, Jelte Jansen, Mark Santcroos and Matthijs Mekking
|
||||
reviewed the unbound C sources.
|
||||
|
||||
Jakob Schlyter - for advice on secure settings, random numbers and blacklists.
|
||||
|
||||
|
||||
+185
@@ -1,6 +1,191 @@
|
||||
6 August 2008: Wouter
|
||||
- patch for scrubber that removes ends of CNAMEs, no more DNAMEs
|
||||
from cache. Remove more irrelevant rrsets from the message.
|
||||
|
||||
5 August 2008: Wouter
|
||||
- fixup DS test so apex nodata works again (from trunk).
|
||||
|
||||
4 August 2008: Wouter
|
||||
- Bug #201 fixup from trunk; fixes segfault on exit cleanup
|
||||
- iana port nrs updated.
|
||||
|
||||
30 July 2008: Wouter
|
||||
- fixup DS qtype validation bug. (fix taken from trunk).
|
||||
|
||||
21 July 2008: Wouter
|
||||
- #198: nicer entropy warning message. manpage OS hints.
|
||||
|
||||
19 July 2008: Wouter
|
||||
- #198: fixup manpage to suggest entropy chroot fix.
|
||||
|
||||
18 July 2008: Wouter
|
||||
- branch for 1.0 support.
|
||||
|
||||
17 July 2008: Wouter
|
||||
- fix bug #196, compile outside source tree.
|
||||
- fix bug #195, add --with-username=user configure option.
|
||||
- print error and exit if started with config that requires more
|
||||
fds than the builtin minievent can handle.
|
||||
|
||||
16 July 2008: Wouter
|
||||
- made svn tag 1.0.1, trunk now 1.0.2
|
||||
- sha256 checksums enabled in makedist.sh
|
||||
|
||||
15 July 2008: Wouter
|
||||
- Follow draft-ietf-dnsop-default-local-zones-06 added reverse
|
||||
IPv6 example prefix to AS112 default blocklist.
|
||||
- fixup lookup of DS records by client with trustanchor for same.
|
||||
- libunbound ub_resolve, fix handling of error condition during setup.
|
||||
- lowered log_hex blocksize to fit through BSD syslog linesize.
|
||||
- no useless initialisation if getpwnam not available.
|
||||
- iana, ldns snapshot updated.
|
||||
|
||||
3 July 2008: Wouter
|
||||
- Matthijs fixed memory leaks in root hints file reading.
|
||||
|
||||
26 June 2008: Wouter
|
||||
- fixup streamtcp bounds setting for udp mode, in the test framework.
|
||||
- contrib item for updating trust anchors.
|
||||
|
||||
25 June 2008: Wouter
|
||||
- fixup fwd_ancil test typos.
|
||||
- Fix for newegg lameness : ok for qtype=A, but lame for others.
|
||||
- fixup unit test for infra cache, test lame merging.
|
||||
- porting to mingw, bind, listen, getsockopt and setsockopt error
|
||||
handling.
|
||||
|
||||
24 June 2008: Wouter
|
||||
- removed testcode/checklocks from production code compilation path.
|
||||
- streamtcp can use UDP mode (connected UDP socket), for testing IPv6
|
||||
on windows.
|
||||
- fwd_ancil test fails if platform support is lacking.
|
||||
|
||||
23 June 2008: Wouter
|
||||
- fixup minitpkg to cleanup on windows with its file locking troubles.
|
||||
- minitpkg shows skipped tests in report.
|
||||
- skip ipv6 tests on ipv4 only hosts (requires only ipv6 localhost not
|
||||
ipv6 connectivity).
|
||||
- winsock event handler keeps track of sticky TCP events, that have
|
||||
not been fully handled yet. when interest in the event(s) resumes,
|
||||
they are sent again. When WOULDBLOCK is returned events are cleared.
|
||||
- skip tests that need signals when testing on mingw.
|
||||
|
||||
18 June 2008: Wouter
|
||||
- open testbound replay files in binary mode, because fseek/ftell
|
||||
do not work in ascii-mode on windows. The b does nothing on unix.
|
||||
unittest and testbound tests work on windows (xp too).
|
||||
- ioctlsocket prints nicer error message.
|
||||
- fixed up some TCP porting for winsock.
|
||||
- lack of IPv6 gives a warning, no fatal error.
|
||||
- use WSAGetLastError() on windows instead of errno for some errors.
|
||||
|
||||
17 June 2008: Wouter
|
||||
- outgoing num fds 32 by default on windows ; it supports less
|
||||
fds for waiting on than unixes.
|
||||
- winsock_event minievent handler for windows. (you could also
|
||||
attempt to link with libevent/libev ports for windows).
|
||||
- neater crypto check and gdi32 detection.
|
||||
- unbound.exe works to resolve and validate www.nlnetlabs.nl on vista.
|
||||
|
||||
16 June 2008: Wouter
|
||||
- on windows, use windows threads, mutex and thread-local-storage(Tls).
|
||||
- detect if openssl needs gdi32.
|
||||
- if no threading, THREADS_DISABLED is defined for use in the code.
|
||||
- sets USE_WINSOCK if using ws2_32 on windows.
|
||||
- wsa_strerror() function for more readable errors.
|
||||
- WSA Startup and Cleanup called in unbound.exe.
|
||||
|
||||
13 June 2008: Wouter
|
||||
- port mingw32, more signal ifdefs, detect sleep, usleep,
|
||||
random, srandom (used inside the tests).
|
||||
- signed or unsigned FD_SET is cast.
|
||||
|
||||
10 June 2008: Wouter
|
||||
- fixup warnings compiling on eeepc xandros linux.
|
||||
|
||||
9 June 2008: Wouter
|
||||
- in iteration response type code
|
||||
* first check for SOA record (negative answer) before NS record
|
||||
and lameness.
|
||||
* check if no AA bit for non-forwarder, and thus lame zone.
|
||||
In response to error report by Richard Doty for mail.opusnet.com.
|
||||
- fixup unput warning from lexer on freeBSD.
|
||||
- bug#183. pidfile, rundir, and chroot configure options. Also the
|
||||
example.conf and manual pages get the configured defaults.
|
||||
You can use: (or accept the defaults to /usr/local/etc/unbound/)
|
||||
--with-conf-file=filename
|
||||
--with-pidfile=filename
|
||||
--with-run-dir=path
|
||||
--with-chroot-dir=path
|
||||
|
||||
8 June 2008: Wouter
|
||||
- if multiple CNAMEs, use the first one. Fixup akamai CNAME bug.
|
||||
Reported by Robert Edmonds.
|
||||
- iana port updated.
|
||||
|
||||
4 June 2008: Wouter
|
||||
- updated libtool files with newer version.
|
||||
- iana portlist updated.
|
||||
|
||||
3 June 2008: Wouter
|
||||
- fixup local-zone: "30.172.in-addr.arpa." nodefault, so that the
|
||||
trailing dot is not used during comparison.
|
||||
|
||||
2 June 2008: Wouter
|
||||
- Jelte fixed bugs in my absence
|
||||
- bug 178: fixed unportable shell usage in configure (relied on
|
||||
bash shell).
|
||||
- bug 180: fixed buffer overflow in unbound-checkconf use of strncat.
|
||||
- bug 181: fixed buffer overflow in ldns (called by unbound to parse
|
||||
config file parts).
|
||||
- fixes by Wouter
|
||||
- bug 177: fixed compilation failure on opensuse, the
|
||||
--disable-static configure flag caused problems. (Patch from
|
||||
Klaus Singvogel)
|
||||
- bug 179: same fix as 177.
|
||||
- bug 185: --disable-shared not passed along to ldns included with
|
||||
unbound. Fixed so that configure parameters are passed to the
|
||||
subdir configure script.
|
||||
fixed that ./libtool is used always, you can still override
|
||||
manually with ./configure libtool=mylibtool or set $libtool in
|
||||
the environment.
|
||||
- update of the ldns tarball to current ldns svn version (fix 181).
|
||||
- bug 184: -r option for unbound-host, read resolv.conf for
|
||||
forwarder. (Note that forwarder must support DNSSEC for validation
|
||||
to succeed).
|
||||
|
||||
23 May 2008: Wouter
|
||||
- mingw32 porting.
|
||||
- test for sys/wait.h
|
||||
- WSAEWOULDBLOCK test after nonblocking TCP connect.
|
||||
- write_iov_buffer removed: unused and no struct iov on windows.
|
||||
- signed/unsigned warning fixup mini_event.
|
||||
- use ioctlsocket to set nonblocking I/O if fnctl is unavailable.
|
||||
- skip signals that are not defined
|
||||
- detect pwd.h.
|
||||
- detect getpwnam, getrlimit, setsid, sbrk, chroot.
|
||||
- default config has no chroot if chroot() unavailable.
|
||||
- if no kill() then no pidfile is read or written.
|
||||
- gmtime_r is replaced by nonthreadsafe alternative if unavail.
|
||||
used in rrsig time validation errors.
|
||||
|
||||
22 May 2008: Wouter
|
||||
- contrib unbound.spec from Patrick Vande Walle.
|
||||
- fixup bug#175: call tzset before chroot to have correct timestamps
|
||||
in system log.
|
||||
- do not generate lex input and lex unput functions.
|
||||
- mingw port. replacement functions labelled _unbound.
|
||||
- fix bug 174 - check for tcp_sigpipe that ldns-testns is installed.
|
||||
|
||||
19 May 2008: Wouter
|
||||
- fedora 9, check in6_pktinfo define in configure.
|
||||
- CREDITS fixup of history.
|
||||
- ignore ldns-1.2.2 if installed, use builtin 1.3.0-pre alternative.
|
||||
|
||||
16 May 2008: Wouter
|
||||
- fixup for MacOSX hosts file reading (reported by John Dickinson).
|
||||
- created 1.0.0 svn tag.
|
||||
- trunk version 1.0.1.
|
||||
|
||||
14 May 2008: Wouter
|
||||
- accepted patch from Ondrej Sury for library version libtool option.
|
||||
|
||||
+15
@@ -43,6 +43,21 @@ This software is under BSD license, see LICENSE for details.
|
||||
The server periodically checks if the amount of memory used fits with
|
||||
the amount of memory it thinks it should be using, and reports
|
||||
memory usage in detail.
|
||||
* --with-conf-file=filename
|
||||
Set default location of config file,
|
||||
the default is /usr/local/etc/unbound/unbound.conf.
|
||||
* --with-pidfile=filename
|
||||
Set default location of pidfile,
|
||||
the default is /usr/local/etc/unbound/unbound.pid.
|
||||
* --with-run-dir=path
|
||||
Set default working directory,
|
||||
the default is /usr/local/etc/unbound.
|
||||
* --with-chroot-dir=path
|
||||
Set default chroot directory,
|
||||
the default is /usr/local/etc/unbound.
|
||||
* --with-username=user
|
||||
Set default user name to change to,
|
||||
the default is the "unbound" user.
|
||||
|
||||
* 'make test' attempts to run a series of tests, depending on the support
|
||||
programs that are installed.
|
||||
|
||||
@@ -54,6 +54,12 @@ o EVP hardware crypto support.
|
||||
|
||||
Features soon after 1.0.
|
||||
o EDNS fallback after timeout (firewall drops all edns traffic problem).
|
||||
o IPv6 reverse, IP4 reverse local-data shorthand for PTR records (?).
|
||||
cumbersome to reverse notate by hand for the operator.
|
||||
o zone name appending for local-data. Perhaps read zonefiles. Perhaps it is
|
||||
too much authority feature creep.
|
||||
o option to disable cache snooping from the clients (the nonRD queries),
|
||||
with allow, refused, drop choices.
|
||||
|
||||
For 1.x; features that have been requested during the beta test.
|
||||
o command channel for couple of tasks. Like rndc.
|
||||
@@ -65,3 +71,8 @@ o command channel for couple of tasks. Like rndc.
|
||||
o add/del static preload data to change the domain redirections.
|
||||
o and maybe also start, stop, reload.
|
||||
|
||||
|
||||
o on windows version, libunbound uses a NamedPipe, examine security status
|
||||
make sure the OS makes it safe like on unix.
|
||||
o on windows version, implement that OS ancillary data capabilities for
|
||||
interface-automatic. IPPKTINFO, IP6PKTINFO for WSARecvMsg, WSASendMsg.
|
||||
|
||||
@@ -162,17 +162,17 @@ server:
|
||||
# How to do this is specific to your OS.
|
||||
#
|
||||
# If you give "" no chroot is performed. The path must not end in a /.
|
||||
# chroot: "/usr/local/etc/unbound"
|
||||
# chroot: "@UNBOUND_CHROOT_DIR@"
|
||||
|
||||
# if given, user privileges are dropped (after binding port),
|
||||
# and the given username is assumed. Default is user "unbound".
|
||||
# If you give "" no privileges are dropped.
|
||||
# username: "unbound"
|
||||
# username: "@UNBOUND_USERNAME@"
|
||||
|
||||
# the working directory. The relative files in this config are
|
||||
# relative to this directory. If you give "" the working directory
|
||||
# is not changed.
|
||||
# directory: "/usr/local/etc/unbound"
|
||||
# directory: "@UNBOUND_RUN_DIR@"
|
||||
|
||||
# the log file, "" means log to stderr.
|
||||
# Use of this option sets use-syslog to "no".
|
||||
@@ -183,7 +183,7 @@ server:
|
||||
# use-syslog: yes
|
||||
|
||||
# the pid file.
|
||||
# pidfile: "/usr/local/etc/unbound/unbound.pid"
|
||||
# pidfile: "@UNBOUND_PIDFILE@"
|
||||
|
||||
# file to read root hints from.
|
||||
# get one from ftp://FTP.INTERNIC.NET/domain/named.cache
|
||||
@@ -36,7 +36,7 @@ The unbound-checkconf program exits with status code 1 on error,
|
||||
0 for a correct config file.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /usr/local/etc/unbound/unbound.conf
|
||||
.I @ub_conf_file@
|
||||
unbound configuration file.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
+7
-1
@@ -14,7 +14,7 @@
|
||||
.SH "SYNOPSIS"
|
||||
.LP
|
||||
.B unbound\-host
|
||||
.RB [ \-vdh ]
|
||||
.RB [ \-vdhr ]
|
||||
.RB [ \-c
|
||||
.IR class ]
|
||||
.RB [ \-t
|
||||
@@ -81,6 +81,12 @@ are read.
|
||||
.B \-C \fIconfigfile
|
||||
Uses the specified unbound.conf to prime
|
||||
.IR libunbound (3).
|
||||
.TP
|
||||
.B \-r
|
||||
Read /etc/resolv.conf, and use the forward DNS servers from there (those could
|
||||
have been set by DHCP). More info in
|
||||
.IR resolv.conf (5).
|
||||
Breaks validation if those servers do not support DNSSEC.
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
Some examples of use. The keys shown below are fakes, thus a security failure
|
||||
|
||||
@@ -31,8 +31,8 @@ The available options are:
|
||||
Show the version and commandline option help.
|
||||
.TP
|
||||
.B \-c\fI cfgfile
|
||||
Set the config file with settings for unbound to read instead of the
|
||||
file at default location /usr/local/etc/unbound/unbound.conf. The syntax is
|
||||
Set the config file with settings for unbound to read instead of reading the
|
||||
file at the default location, @ub_conf_file@. The syntax is
|
||||
described in \fIunbound.conf\fR(5).
|
||||
.TP
|
||||
.B \-d
|
||||
@@ -50,6 +50,10 @@ example.conf file with all the options.
|
||||
server:
|
||||
directory: "/etc/unbound"
|
||||
username: unbound # make sure it can write to pidfile.
|
||||
# make sure unbound can access entropy from inside the chroot.
|
||||
# e.g. on linux the use these commands (on BSD, devfs(8) is used):
|
||||
# mount --bind -n /dev/random /etc/unbound/dev/random
|
||||
# and mount --bind -n /dev/log /etc/unbound/dev/log
|
||||
chroot: "/etc/unbound"
|
||||
# logfile: "/etc/unbound/unbound.log" #uncomment to use logfile.
|
||||
pidfile: "/etc/unbound/unbound.pid"
|
||||
@@ -254,11 +258,11 @@ Additionally, unbound may need to access /dev/random (for entropy)
|
||||
and to /dev/log (if you use syslog) from inside the chroot.
|
||||
.IP
|
||||
If given a chroot is done to the given directory. The default is
|
||||
"/usr/local/etc/unbound". If you give "" no chroot is performed.
|
||||
"@UNBOUND_CHROOT_DIR@". If you give "" no chroot is performed.
|
||||
.TP
|
||||
.B username: \fI<name>
|
||||
If given, after binding the port the user privileges are dropped. Default is
|
||||
"unbound". If you give username: "" no user change is performed.
|
||||
"@UNBOUND_USERNAME@". If you give username: "" no user change is performed.
|
||||
.IP
|
||||
If this user is not capable of binding the
|
||||
port, reloads (by signal HUP) will still retain the opened ports.
|
||||
@@ -266,7 +270,7 @@ If you change the port number in the config file, and that new port number
|
||||
requires privileges, then a reload will fail; a restart is needed.
|
||||
.TP
|
||||
.B directory: \fI<directory>
|
||||
Sets the working directory for the program.
|
||||
Sets the working directory for the program. Default is "@UNBOUND_RUN_DIR@".
|
||||
.TP
|
||||
.B logfile: \fI<filename>
|
||||
If "" is given, logging goes to stderr, or nowhere once daemonized.
|
||||
@@ -286,14 +290,14 @@ The logfile setting is overridden when use\-syslog is turned on.
|
||||
The default is to log to syslog.
|
||||
.TP
|
||||
.B pidfile: \fI<filename>
|
||||
The process id is written to the file. Default is "/usr/local/etc/unbound/unbound.pid".
|
||||
The process id is written to the file. Default is "@UNBOUND_PIDFILE@".
|
||||
So,
|
||||
.nf
|
||||
kill \-HUP `cat /usr/local/etc/unbound/unbound.pid`
|
||||
kill \-HUP `cat @UNBOUND_PIDFILE@`
|
||||
.fi
|
||||
triggers a reload,
|
||||
.nf
|
||||
kill \-QUIT `cat /usr/local/etc/unbound/unbound.pid`
|
||||
kill \-QUIT `cat @UNBOUND_PIDFILE@`
|
||||
.fi
|
||||
gracefully terminates.
|
||||
.TP
|
||||
@@ -563,6 +567,14 @@ Reverse data for zone D.F.ip6.arpa.
|
||||
.TP 10
|
||||
\h'5'\fIreverse RFC4291 IPv6 Link Local Addresses\fR
|
||||
Reverse data for zones 8.E.F.ip6.arpa to B.E.F.ip6.arpa.
|
||||
.TP 10
|
||||
\h'5'\fIreverse IPv6 Example Prefix\fR
|
||||
Reverse data for zone 8.B.D.0.1.0.0.2.ip6.arpa. This zone is used for
|
||||
tutorials and examples. You can remove the block on this zone with:
|
||||
.nf
|
||||
local-zone: 8.B.D.0.1.0.0.2.ip6.arpa. nodefault
|
||||
.fi
|
||||
This also works with the other default zones.
|
||||
.\" End of local-zone listing.
|
||||
.TP 5
|
||||
.B local\-data: \fI"<resource record string>"
|
||||
@@ -663,15 +675,18 @@ server:
|
||||
.fi
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /usr/local/etc/unbound
|
||||
default unbound working directory and default
|
||||
.I @UNBOUND_RUN_DIR@
|
||||
default unbound working directory.
|
||||
.TP
|
||||
.I @UNBOUND_CHROOT_DIR@
|
||||
default
|
||||
\fIchroot\fR(2)
|
||||
location.
|
||||
.TP
|
||||
.I unbound.conf
|
||||
.I @ub_conf_file@
|
||||
unbound configuration file.
|
||||
.TP
|
||||
.I unbound.pid
|
||||
.I @UNBOUND_PIDFILE@
|
||||
default unbound pidfile with process ID of the running daemon.
|
||||
.TP
|
||||
.I unbound.log
|
||||
+18
-10
@@ -334,23 +334,20 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
if(status != LDNS_STATUS_OK) {
|
||||
log_err("reading root hints %s %d: %s", fname,
|
||||
lineno, ldns_get_errorstr_by_id(status));
|
||||
fclose(f);
|
||||
return 0;
|
||||
goto stop_read;
|
||||
}
|
||||
if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_NS) {
|
||||
if(!delegpt_add_ns(dp, hints->region,
|
||||
ldns_rdf_data(ldns_rr_rdf(rr, 0)))) {
|
||||
log_err("out of memory reading root hints");
|
||||
fclose(f);
|
||||
return 0;
|
||||
goto stop_read;
|
||||
}
|
||||
c = ldns_rr_get_class(rr);
|
||||
if(!dp->name) {
|
||||
if(!delegpt_set_name(dp, hints->region,
|
||||
ldns_rdf_data(ldns_rr_owner(rr)))){
|
||||
log_err("out of memory.");
|
||||
fclose(f);
|
||||
return 0;
|
||||
goto stop_read;
|
||||
}
|
||||
}
|
||||
} else if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_A) {
|
||||
@@ -366,8 +363,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
ldns_rdf_size(ldns_rr_owner(rr)),
|
||||
(struct sockaddr_storage*)&sa, len)) {
|
||||
log_err("out of memory reading root hints");
|
||||
fclose(f);
|
||||
return 0;
|
||||
goto stop_read;
|
||||
}
|
||||
} else if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) {
|
||||
struct sockaddr_in6 sa;
|
||||
@@ -382,8 +378,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
ldns_rdf_size(ldns_rr_owner(rr)),
|
||||
(struct sockaddr_storage*)&sa, len)) {
|
||||
log_err("out of memory reading root hints");
|
||||
fclose(f);
|
||||
return 0;
|
||||
goto stop_read;
|
||||
}
|
||||
} else {
|
||||
log_warn("root hints %s:%d skipping type %d",
|
||||
@@ -392,6 +387,11 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
|
||||
ldns_rr_free(rr);
|
||||
}
|
||||
|
||||
if (origin)
|
||||
ldns_rdf_deep_free(origin);
|
||||
if (prev_rr)
|
||||
ldns_rdf_deep_free(prev_rr);
|
||||
fclose(f);
|
||||
if(!dp->name) {
|
||||
log_warn("root hints %s: no NS content", fname);
|
||||
@@ -402,6 +402,14 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
}
|
||||
delegpt_log(VERB_QUERY, dp);
|
||||
return 1;
|
||||
|
||||
stop_read:
|
||||
if (origin)
|
||||
ldns_rdf_deep_free(origin);
|
||||
if (prev_rr)
|
||||
ldns_rdf_deep_free(prev_rr);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** read root hints list */
|
||||
|
||||
@@ -104,6 +104,7 @@ response_type_from_server(int rdset,
|
||||
struct dns_msg* msg, struct query_info* request, struct delegpt* dp)
|
||||
{
|
||||
uint8_t* origzone = (uint8_t*)"\000"; /* the default */
|
||||
struct ub_packed_rrset_key* s;
|
||||
size_t origzonelen = 1;
|
||||
size_t i;
|
||||
|
||||
@@ -188,12 +189,10 @@ response_type_from_server(int rdset,
|
||||
}
|
||||
|
||||
/* Looking at the authority section, we just look and see if
|
||||
* there is a delegation NS set, turning it into a delegation.
|
||||
* Otherwise, we will have to conclude ANSWER (either it is
|
||||
* NOERROR/NODATA, or an non-authoritative answer). */
|
||||
* there is a SOA record, that means a NOERROR/NODATA */
|
||||
for(i = msg->rep->an_numrrsets; i < (msg->rep->an_numrrsets +
|
||||
msg->rep->ns_numrrsets); i++) {
|
||||
struct ub_packed_rrset_key* s = msg->rep->rrsets[i];
|
||||
s = msg->rep->rrsets[i];
|
||||
|
||||
/* The normal way of detecting NOERROR/NODATA. */
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_SOA &&
|
||||
@@ -204,19 +203,32 @@ response_type_from_server(int rdset,
|
||||
return RESPONSE_TYPE_LAME;
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
}
|
||||
/* Looking at the authority section, we just look and see if
|
||||
* there is a delegation NS set, turning it into a delegation.
|
||||
* Otherwise, we will have to conclude ANSWER (either it is
|
||||
* NOERROR/NODATA, or an non-authoritative answer). */
|
||||
for(i = msg->rep->an_numrrsets; i < (msg->rep->an_numrrsets +
|
||||
msg->rep->ns_numrrsets); i++) {
|
||||
s = msg->rep->rrsets[i];
|
||||
|
||||
/* Detect REFERRAL/LAME/ANSWER based on the relationship
|
||||
* of the NS set to the originating zone name. */
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_NS) {
|
||||
/* If we are getting an NS set for the zone we
|
||||
* thought we were contacting, then it is an answer.*/
|
||||
/* FIXME: is this correct? */
|
||||
if(query_dname_compare(s->rk.dname, origzone) == 0) {
|
||||
/* see if mistakenly a recursive server was
|
||||
* deployed and is responding nonAA */
|
||||
if( (msg->rep->flags&BIT_RA) &&
|
||||
!(msg->rep->flags&BIT_AA) && !rdset)
|
||||
return RESPONSE_TYPE_LAME;
|
||||
/* Or if a lame server is deployed,
|
||||
* which gives ns==zone delegation from cache
|
||||
* without AA bit as well, with nodata nosoa*/
|
||||
if(msg->rep->an_numrrsets==0 &&
|
||||
!(msg->rep->flags&BIT_AA) && !rdset)
|
||||
return RESPONSE_TYPE_LAME;
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
/* If we are getting a referral upwards (or to
|
||||
|
||||
+69
-6
@@ -189,7 +189,11 @@ parse_get_cname_target(struct rrset_parse* rrset, uint8_t** sname,
|
||||
if(rrset->rr_count != 1) {
|
||||
verbose(VERB_ALGO, "Found CNAME rrset with "
|
||||
"size > 1: %u", (unsigned)rrset->rr_count);
|
||||
return 0;
|
||||
/* use the first CNAME! */
|
||||
rrset->rr_count = 1;
|
||||
rrset->size = rrset->rr_first->size;
|
||||
rrset->rr_last = rrset->rr_first;
|
||||
rrset->rr_first->next = NULL;
|
||||
}
|
||||
if(rrset->rr_first->size < sizeof(uint16_t)+1)
|
||||
return 0; /* CNAME rdata too small */
|
||||
@@ -316,7 +320,7 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
{
|
||||
uint8_t* sname = qinfo->qname;
|
||||
size_t snamelen = qinfo->qname_len;
|
||||
struct rrset_parse* rrset, *prev;
|
||||
struct rrset_parse* rrset, *prev, *nsset=NULL;
|
||||
|
||||
if(FLAGS_GET_RCODE(msg->flags) != LDNS_RCODE_NOERROR &&
|
||||
FLAGS_GET_RCODE(msg->flags) != LDNS_RCODE_NXDOMAIN)
|
||||
@@ -412,7 +416,10 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
}
|
||||
|
||||
/* Mark the additional names from relevant rrset as OK. */
|
||||
mark_additional_rrset(pkt, msg, rrset);
|
||||
/* only for RRsets that match the query name, other ones
|
||||
* will be removed by sanitize, so no additional for them */
|
||||
if(dname_pkt_compare(pkt, qinfo->qname, rrset->dname) == 0)
|
||||
mark_additional_rrset(pkt, msg, rrset);
|
||||
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
@@ -420,6 +427,24 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
|
||||
/* Mark additional names from AUTHORITY */
|
||||
while(rrset && rrset->section == LDNS_SECTION_AUTHORITY) {
|
||||
if(rrset->type==LDNS_RR_TYPE_DNAME ||
|
||||
rrset->type==LDNS_RR_TYPE_CNAME ||
|
||||
rrset->type==LDNS_RR_TYPE_A ||
|
||||
rrset->type==LDNS_RR_TYPE_AAAA) {
|
||||
remove_rrset("normalize: removing irrelevant "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
/* only one NS set allowed in authority section */
|
||||
if(rrset->type==LDNS_RR_TYPE_NS) {
|
||||
if(nsset == NULL) {
|
||||
nsset = rrset;
|
||||
} else {
|
||||
remove_rrset("normalize: removing irrelevant "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mark_additional_rrset(pkt, msg, rrset);
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
@@ -443,6 +468,13 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(rrset->type==LDNS_RR_TYPE_DNAME ||
|
||||
rrset->type==LDNS_RR_TYPE_CNAME ||
|
||||
rrset->type==LDNS_RR_TYPE_NS) {
|
||||
remove_rrset("normalize: removing irrelevant "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
}
|
||||
@@ -494,18 +526,47 @@ store_rrset(ldns_buffer* pkt, struct msg_parse* msg, struct module_env* env,
|
||||
*
|
||||
* @param pkt: packet.
|
||||
* @param msg: msg to normalize.
|
||||
* @param qinfo: the question originally asked.
|
||||
* @param zonename: name of server zone.
|
||||
* @param env: module environment with config and cache.
|
||||
* @return 0 on error.
|
||||
*/
|
||||
static int
|
||||
scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, uint8_t* zonename,
|
||||
struct module_env* env)
|
||||
scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
struct query_info* qinfo, uint8_t* zonename, struct module_env* env)
|
||||
{
|
||||
struct rrset_parse* rrset, *prev;
|
||||
prev = NULL;
|
||||
rrset = msg->rrset_first;
|
||||
|
||||
/* the first DNAME is allowed to stay. It needs checking before
|
||||
* it can be used from the cache. After normalization, an initial
|
||||
* DNAME will have a correctly synthesized CNAME after it. */
|
||||
if(rrset && rrset->type == LDNS_RR_TYPE_DNAME &&
|
||||
rrset->section == LDNS_SECTION_ANSWER &&
|
||||
pkt_strict_sub(pkt, qinfo->qname, rrset->dname) &&
|
||||
pkt_sub(pkt, rrset->dname, zonename)) {
|
||||
prev = rrset; /* DNAME allowed to stay in answer section */
|
||||
rrset = rrset->rrset_all_next;
|
||||
}
|
||||
|
||||
/* remove all records from the answer section that are
|
||||
* not the same domain name as the query domain name.
|
||||
* The answer section should contain rrsets with the same name
|
||||
* as the question. For DNAMEs a CNAME has been synthesized.
|
||||
* Wildcards have the query name in answer section.
|
||||
* ANY queries get query name in answer section.
|
||||
* Remainders of CNAME chains are cut off and resolved by iterator. */
|
||||
while(rrset && rrset->section == LDNS_SECTION_ANSWER) {
|
||||
if(dname_pkt_compare(pkt, qinfo->qname, rrset->dname) != 0) {
|
||||
remove_rrset("sanitize: removing extraneous answer "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
}
|
||||
|
||||
/* At this point, we brutally remove ALL rrsets that aren't
|
||||
* children of the originating zone. The idea here is that,
|
||||
* as far as we know, the server that we contacted is ONLY
|
||||
@@ -513,6 +574,8 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, uint8_t* zonename,
|
||||
* be authoriative for any other zones, and of course, MAY
|
||||
* NOT be authoritative for some subdomains of the originating
|
||||
* zone. */
|
||||
prev = NULL;
|
||||
rrset = msg->rrset_first;
|
||||
while(rrset) {
|
||||
|
||||
/* skip DNAME records -- they will always be followed by a
|
||||
@@ -585,7 +648,7 @@ scrub_message(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
if(!scrub_normalize(pkt, msg, qinfo, region))
|
||||
return 0;
|
||||
/* delete all out-of-zone information */
|
||||
if(!scrub_sanitize(pkt, msg, zonename, env))
|
||||
if(!scrub_sanitize(pkt, msg, qinfo, zonename, env))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
+11
-10
@@ -130,7 +130,8 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
/** filter out unsuitable targets, return rtt or -1 */
|
||||
static int
|
||||
iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint32_t now, struct delegpt_addr* a)
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
struct delegpt_addr* a)
|
||||
{
|
||||
int rtt;
|
||||
int lame;
|
||||
@@ -143,7 +144,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
}
|
||||
/* check lameness - need zone , class info */
|
||||
if(infra_get_lame_rtt(env->infra_cache, &a->addr, a->addrlen,
|
||||
name, namelen, &lame, &dnsseclame, &rtt, now)) {
|
||||
name, namelen, qtype, &lame, &dnsseclame, &rtt, now)) {
|
||||
if(lame)
|
||||
return -1; /* server is lame */
|
||||
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT)
|
||||
@@ -159,14 +160,14 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
/** lookup RTT information, and also store fastest rtt (if any) */
|
||||
static int
|
||||
iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint32_t now, struct delegpt* dp,
|
||||
int* best_rtt)
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
struct delegpt* dp, int* best_rtt)
|
||||
{
|
||||
int got_it = 0;
|
||||
struct delegpt_addr* a;
|
||||
for(a=dp->result_list; a; a = a->next_result) {
|
||||
a->sel_rtt = iter_filter_unsuitable(iter_env, env,
|
||||
name, namelen, now, a);
|
||||
name, namelen, qtype, now, a);
|
||||
if(a->sel_rtt != -1) {
|
||||
if(!got_it) {
|
||||
*best_rtt = a->sel_rtt;
|
||||
@@ -183,14 +184,14 @@ iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
|
||||
* returns number of best targets (or 0, no suitable targets) */
|
||||
static int
|
||||
iter_filter_order(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint32_t now, struct delegpt* dp,
|
||||
int* selected_rtt)
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
struct delegpt* dp, int* selected_rtt)
|
||||
{
|
||||
int got_num = 0, low_rtt = 0, swap_to_front;
|
||||
struct delegpt_addr* a, *n, *prev=NULL;
|
||||
|
||||
/* fillup sel_rtt and find best rtt in the bunch */
|
||||
got_num = iter_fill_rtt(iter_env, env, name, namelen, now, dp,
|
||||
got_num = iter_fill_rtt(iter_env, env, name, namelen, qtype, now, dp,
|
||||
&low_rtt);
|
||||
if(got_num == 0)
|
||||
return 0;
|
||||
@@ -232,12 +233,12 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env,
|
||||
struct delegpt_addr*
|
||||
iter_server_selection(struct iter_env* iter_env,
|
||||
struct module_env* env, struct delegpt* dp,
|
||||
uint8_t* name, size_t namelen, int* dnssec_expected)
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, int* dnssec_expected)
|
||||
{
|
||||
int sel;
|
||||
int selrtt;
|
||||
struct delegpt_addr* a, *prev;
|
||||
int num = iter_filter_order(iter_env, env, name, namelen,
|
||||
int num = iter_filter_order(iter_env, env, name, namelen, qtype,
|
||||
*env->now, dp, &selrtt);
|
||||
|
||||
if(num == 0)
|
||||
|
||||
@@ -74,6 +74,7 @@ int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
|
||||
* @param dp: delegation point with result list.
|
||||
* @param name: zone name (for lameness check).
|
||||
* @param namelen: length of name.
|
||||
* @param qtype: query type that we want to send.
|
||||
* @param dnssec_expected: set to 0, if a known dnssec-lame server is selected
|
||||
* these are not preferred, but are used as a last resort.
|
||||
* @return best target or NULL if no target.
|
||||
@@ -81,7 +82,7 @@ int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
|
||||
*/
|
||||
struct delegpt_addr* iter_server_selection(struct iter_env* iter_env,
|
||||
struct module_env* env, struct delegpt* dp, uint8_t* name,
|
||||
size_t namelen, int* dnssec_expected);
|
||||
size_t namelen, uint16_t qtype, int* dnssec_expected);
|
||||
|
||||
/**
|
||||
* Allocate dns_msg from parsed msg, in regional.
|
||||
|
||||
+4
-2
@@ -1100,7 +1100,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
|
||||
/* Select the next usable target, filtering out unsuitable targets. */
|
||||
target = iter_server_selection(ie, qstate->env, iq->dp,
|
||||
iq->dp->name, iq->dp->namelen, &iq->dnssec_expected);
|
||||
iq->dp->name, iq->dp->namelen, iq->qchase.qtype,
|
||||
&iq->dnssec_expected);
|
||||
|
||||
/* If no usable target was selected... */
|
||||
if(!target) {
|
||||
@@ -1337,7 +1338,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(!infra_set_lame(qstate->env->infra_cache,
|
||||
&qstate->reply->addr, qstate->reply->addrlen,
|
||||
iq->dp->name, iq->dp->namelen,
|
||||
*qstate->env->now, dnsseclame))
|
||||
*qstate->env->now, dnsseclame,
|
||||
iq->qchase.qtype))
|
||||
log_err("mark host lame: out of memory");
|
||||
} else log_err("%slame response from cache",
|
||||
dnsseclame?"DNSSEC ":"");
|
||||
|
||||
Binary file not shown.
+20
-3
@@ -64,8 +64,20 @@ ub_ctx_create()
|
||||
{
|
||||
struct ub_ctx* ctx;
|
||||
unsigned int seed;
|
||||
#ifdef USE_WINSOCK
|
||||
int r;
|
||||
WSADATA wsa_data;
|
||||
#endif
|
||||
|
||||
log_init(NULL, 0, NULL); /* logs to stderr */
|
||||
log_ident_set("libunbound");
|
||||
#ifdef USE_WINSOCK
|
||||
if((r = WSAStartup(MAKEWORD(2,2), &wsa_data)) != 0) {
|
||||
log_err("could not init winsock. WSAStartup: %s",
|
||||
wsa_strerror(r));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
verbosity = 0; /* errors only */
|
||||
checklock_start();
|
||||
ctx = (struct ub_ctx*)calloc(1, sizeof(*ctx));
|
||||
@@ -97,6 +109,7 @@ ub_ctx_create()
|
||||
errno = e;
|
||||
return NULL;
|
||||
}
|
||||
#ifndef USE_WINSOCK
|
||||
if(!fd_set_nonblock(ctx->rrpipe[0]) ||
|
||||
!fd_set_nonblock(ctx->rrpipe[1]) ||
|
||||
!fd_set_nonblock(ctx->qqpipe[0]) ||
|
||||
@@ -111,6 +124,7 @@ ub_ctx_create()
|
||||
errno = e;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !USE_WINSOCK - it is a pipe(nonsocket) on windows) */
|
||||
lock_basic_init(&ctx->qqpipe_lock);
|
||||
lock_basic_init(&ctx->rrpipe_lock);
|
||||
lock_basic_init(&ctx->cfglock);
|
||||
@@ -231,6 +245,9 @@ ub_ctx_delete(struct ub_ctx* ctx)
|
||||
alloc_clear(&ctx->superalloc);
|
||||
traverse_postorder(&ctx->queries, delq, NULL);
|
||||
free(ctx);
|
||||
#ifdef USE_WINSOCK
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@@ -345,7 +362,7 @@ int ub_ctx_debugout(struct ub_ctx* ctx, void* out)
|
||||
int
|
||||
ub_ctx_async(struct ub_ctx* ctx, int dothread)
|
||||
{
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
if(dothread) /* cannot do threading */
|
||||
return UB_NOERROR;
|
||||
#endif
|
||||
@@ -366,7 +383,7 @@ pollit(struct ub_ctx* ctx, struct timeval* t)
|
||||
fd_set r;
|
||||
#ifndef S_SPLINT_S
|
||||
FD_ZERO(&r);
|
||||
FD_SET(ctx->rrpipe[0], &r);
|
||||
FD_SET(FD_SET_T ctx->rrpipe[0], &r);
|
||||
#endif
|
||||
if(select(ctx->rrpipe[0]+1, &r, NULL, NULL, t) == -1) {
|
||||
return 0;
|
||||
@@ -559,6 +576,7 @@ ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
{
|
||||
struct ctx_query* q;
|
||||
int r;
|
||||
*result = NULL;
|
||||
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
if(!ctx->finalized) {
|
||||
@@ -574,7 +592,6 @@ ub_resolve(struct ub_ctx* ctx, char* name, int rrtype,
|
||||
if(!q)
|
||||
return UB_NOMEM;
|
||||
/* become a resolver thread for a bit */
|
||||
*result = NULL;
|
||||
|
||||
r = libworker_fg(ctx, q);
|
||||
if(r) {
|
||||
|
||||
+20
-1
@@ -366,7 +366,7 @@ libworker_dobg(void* arg)
|
||||
struct libworker* w = (struct libworker*)arg;
|
||||
struct ub_ctx* ctx = w->ctx;
|
||||
log_thread_set(&w->thread_num);
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
/* we are forked */
|
||||
w->is_bg_thread = 0;
|
||||
/* close non-used parts of the pipes */
|
||||
@@ -425,6 +425,10 @@ int libworker_bg(struct ub_ctx* ctx)
|
||||
ub_thread_create(&ctx->bg_tid, libworker_dobg, w);
|
||||
} else {
|
||||
lock_basic_unlock(&ctx->cfglock);
|
||||
#ifndef HAVE_FORK
|
||||
/* no fork on windows */
|
||||
return UB_FORKFAIL;
|
||||
#else /* HAVE_FORK */
|
||||
switch((ctx->bg_pid=fork())) {
|
||||
case 0:
|
||||
w = libworker_setup(ctx, 1);
|
||||
@@ -442,6 +446,7 @@ int libworker_bg(struct ub_ctx* ctx)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif /* HAVE_FORK */
|
||||
}
|
||||
return UB_NOERROR;
|
||||
}
|
||||
@@ -1031,3 +1036,17 @@ void worker_stat_timer_cb(void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int order_lock_cmp(const void* ATTR_UNUSED(e1), const void* ATTR_UNUSED(e2))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
codeline_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# ltmain.sh - Provide generalized library-building support services.
|
||||
# NOTE: Changing this file will not affect anything until you rerun configure.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -43,8 +43,8 @@ EXIT_FAILURE=1
|
||||
|
||||
PROGRAM=ltmain.sh
|
||||
PACKAGE=libtool
|
||||
VERSION=1.5.22
|
||||
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
|
||||
VERSION=1.5.24
|
||||
TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
|
||||
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
@@ -57,6 +57,8 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# Check that we have a working $echo.
|
||||
if test "X$1" = X--no-reexec; then
|
||||
@@ -114,10 +116,10 @@ esac
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${$lt_var+set}\" = set; then
|
||||
save_$lt_var=\$$lt_var
|
||||
$lt_var=C
|
||||
export $lt_var
|
||||
fi"
|
||||
save_$lt_var=\$$lt_var
|
||||
$lt_var=C
|
||||
export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
# Make sure IFS has a sensible default
|
||||
@@ -206,7 +208,13 @@ func_win32_libid ()
|
||||
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
|
||||
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
|
||||
win32_nmres=`eval $NM -f posix -A $1 | \
|
||||
$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
|
||||
$SED -n -e '1,100{
|
||||
/ I /{
|
||||
s,.*,import,
|
||||
p
|
||||
q
|
||||
}
|
||||
}'`
|
||||
case $win32_nmres in
|
||||
import*) win32_libid_type="x86 archive import";;
|
||||
*) win32_libid_type="x86 archive static";;
|
||||
@@ -340,11 +348,11 @@ func_extract_archives ()
|
||||
my_xlib_u=$my_xlib
|
||||
while :; do
|
||||
case " $extracted_archives " in
|
||||
*" $my_xlib_u "*)
|
||||
extracted_serial=`expr $extracted_serial + 1`
|
||||
my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
||||
*) break ;;
|
||||
esac
|
||||
*" $my_xlib_u "*)
|
||||
extracted_serial=`expr $extracted_serial + 1`
|
||||
my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
extracted_archives="$extracted_archives $my_xlib_u"
|
||||
my_xdir="$my_gentop/$my_xlib_u"
|
||||
@@ -474,11 +482,12 @@ do
|
||||
;;
|
||||
|
||||
--version)
|
||||
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
|
||||
$echo
|
||||
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
|
||||
$echo "This is free software; see the source for copying conditions. There is NO"
|
||||
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
echo "\
|
||||
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
@@ -775,7 +784,7 @@ if test -z "$show_help"; then
|
||||
*.class) xform=class ;;
|
||||
*.cpp) xform=cpp ;;
|
||||
*.cxx) xform=cxx ;;
|
||||
*.f90) xform=f90 ;;
|
||||
*.[fF][09]?) xform=[fF][09]. ;;
|
||||
*.for) xform=for ;;
|
||||
*.java) xform=java ;;
|
||||
*.obj) xform=obj ;;
|
||||
@@ -1160,8 +1169,8 @@ EOF
|
||||
do
|
||||
case $arg in
|
||||
-all-static | -static | -static-libtool-libs)
|
||||
case $arg in
|
||||
-all-static)
|
||||
case $arg in
|
||||
-all-static)
|
||||
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
||||
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
|
||||
fi
|
||||
@@ -1170,19 +1179,19 @@ EOF
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
;;
|
||||
-static)
|
||||
-static)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=built
|
||||
;;
|
||||
-static-libtool-libs)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
;;
|
||||
esac
|
||||
-static-libtool-libs)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
;;
|
||||
esac
|
||||
build_libtool_libs=no
|
||||
build_old_libs=yes
|
||||
break
|
||||
@@ -1630,7 +1639,7 @@ EOF
|
||||
continue
|
||||
;;
|
||||
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
compiler_flags="$compiler_flags $arg"
|
||||
compile_command="$compile_command $arg"
|
||||
finalize_command="$finalize_command $arg"
|
||||
@@ -1650,10 +1659,11 @@ EOF
|
||||
# -m* pass through architecture-specific compiler args for GCC
|
||||
# -m*, -t[45]*, -txscale* pass through architecture-specific
|
||||
# compiler args for GCC
|
||||
# -pg pass through profiling flag for GCC
|
||||
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
|
||||
# -F/path gives path to uninstalled frameworks, gcc on darwin
|
||||
# @file GCC response files
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
|
||||
-t[45]*|-txscale*|@*)
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
||||
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
|
||||
|
||||
# Unknown arguments in both finalize_command and compile_command need
|
||||
# to be aesthetically quoted because they are evaled later.
|
||||
@@ -1681,9 +1691,9 @@ EOF
|
||||
|
||||
-no-install)
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
|
||||
# The PATH hackery in wrapper scripts is required on Windows
|
||||
# in order for the loader to find any dlls it needs.
|
||||
# and Darwin in order for the loader to find any dlls it needs.
|
||||
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
|
||||
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
|
||||
fast_install=no
|
||||
@@ -2124,7 +2134,7 @@ EOF
|
||||
lib=
|
||||
found=no
|
||||
case $deplib in
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
compile_deplibs="$deplib $compile_deplibs"
|
||||
finalize_deplibs="$deplib $finalize_deplibs"
|
||||
@@ -2520,9 +2530,9 @@ EOF
|
||||
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
if test -n "$library_names" &&
|
||||
{ { test "$prefer_static_libs" = no ||
|
||||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
||||
test -z "$old_library"; }; then
|
||||
{ { test "$prefer_static_libs" = no ||
|
||||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
||||
test -z "$old_library"; }; then
|
||||
# We need to hardcode the library path
|
||||
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
||||
# Make sure the rpath contains only unique directories.
|
||||
@@ -3229,9 +3239,10 @@ EOF
|
||||
age="0"
|
||||
;;
|
||||
irix|nonstopux)
|
||||
current=`expr $number_major + $number_minor - 1`
|
||||
current=`expr $number_major + $number_minor`
|
||||
age="$number_minor"
|
||||
revision="$number_minor"
|
||||
lt_irix_increment=no
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -3290,7 +3301,8 @@ EOF
|
||||
versuffix="$major.$age.$revision"
|
||||
# Darwin ld doesn't like 0 for these options...
|
||||
minor_current=`expr $current + 1`
|
||||
verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
||||
;;
|
||||
|
||||
freebsd-aout)
|
||||
@@ -3304,8 +3316,11 @@ EOF
|
||||
;;
|
||||
|
||||
irix | nonstopux)
|
||||
major=`expr $current - $age + 1`
|
||||
|
||||
if test "X$lt_irix_increment" = "Xno"; then
|
||||
major=`expr $current - $age`
|
||||
else
|
||||
major=`expr $current - $age + 1`
|
||||
fi
|
||||
case $version_type in
|
||||
nonstopux) verstring_prefix=nonstopux ;;
|
||||
*) verstring_prefix=sgi ;;
|
||||
@@ -3442,11 +3457,11 @@ EOF
|
||||
fi
|
||||
|
||||
# Eliminate all temporary directories.
|
||||
# for path in $notinst_path; do
|
||||
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
|
||||
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
|
||||
# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
|
||||
# done
|
||||
#for path in $notinst_path; do
|
||||
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
|
||||
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
|
||||
# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
|
||||
#done
|
||||
|
||||
if test -n "$xrpath"; then
|
||||
# If the user specified any rpath flags, then add them.
|
||||
@@ -3547,7 +3562,7 @@ EOF
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
$rm conftest
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
||||
ldd_output=`ldd conftest`
|
||||
for i in $deplibs; do
|
||||
name=`expr $i : '-l\(.*\)'`
|
||||
@@ -3909,7 +3924,10 @@ EOF
|
||||
test -n "$hardcode_libdirs"; then
|
||||
libdir="$hardcode_libdirs"
|
||||
if test -n "$hardcode_libdir_flag_spec_ld"; then
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
||||
case $archive_cmds in
|
||||
*\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
|
||||
*) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
|
||||
esac
|
||||
else
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
||||
fi
|
||||
@@ -4275,7 +4293,7 @@ EOF
|
||||
if test -n "$convenience"; then
|
||||
if test -n "$whole_archive_flag_spec"; then
|
||||
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
||||
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
||||
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
||||
else
|
||||
gentop="$output_objdir/${obj}x"
|
||||
generated="$generated $gentop"
|
||||
@@ -5295,6 +5313,8 @@ if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
||||
else
|
||||
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
@@ -6391,8 +6411,10 @@ relink_command=\"$relink_command\""
|
||||
if test -f "$dir/$objdir/$dlname"; then
|
||||
dir="$dir/$objdir"
|
||||
else
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
if test ! -f "$dir/$dlname"; then
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -6458,12 +6480,11 @@ relink_command=\"$relink_command\""
|
||||
# Restore saved environment variables
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${save_$lt_var+set}\" = set; then
|
||||
$lt_var=\$save_$lt_var; export $lt_var
|
||||
fi"
|
||||
eval "if test \"\${save_$lt_var+set}\" = set; then
|
||||
$lt_var=\$save_$lt_var; export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
|
||||
# Now prepare to actually exec the command.
|
||||
exec_cmd="\$cmd$args"
|
||||
else
|
||||
|
||||
+8
-4
@@ -212,11 +212,11 @@ if [ "$SNAPSHOT" = "yes" ]; then
|
||||
fi
|
||||
|
||||
replace_all doc/README
|
||||
replace_all doc/unbound.8
|
||||
replace_all doc/unbound.conf.5
|
||||
replace_all doc/unbound-checkconf.8
|
||||
replace_all doc/unbound.8.in
|
||||
replace_all doc/unbound.conf.5.in
|
||||
replace_all doc/unbound-checkconf.8.in
|
||||
replace_all doc/unbound-host.1
|
||||
replace_all doc/libunbound.3
|
||||
replace_all doc/libunbound.3.in
|
||||
|
||||
info "Renaming Unbound directory to unbound-$version."
|
||||
cd ..
|
||||
@@ -237,15 +237,19 @@ cleanup
|
||||
case $OSTYPE in
|
||||
linux*)
|
||||
sha=`sha1sum unbound-$version.tar.gz | awk '{ print $1 }'`
|
||||
sha256=`sha256sum unbound-$version.tar.gz | awk '{ print $1 }'`
|
||||
;;
|
||||
freebsd*)
|
||||
sha=`sha1 unbound-$version.tar.gz | awk '{ print $5 }'`
|
||||
sha256=`sha256 unbound-$version.tar.gz | awk '{ print $5 }'`
|
||||
;;
|
||||
*)
|
||||
sha=`sha1sum unbound-$version.tar.gz | awk '{ print $1 }'`
|
||||
sha256=`sha256sum unbound-$version.tar.gz | awk '{ print $1 }'`
|
||||
;;
|
||||
esac
|
||||
echo $sha > unbound-$version.tar.gz.sha1
|
||||
echo $sha256 > unbound-$version.tar.gz.sha256
|
||||
|
||||
info "Unbound distribution created successfully."
|
||||
info "SHA1sum: $sha"
|
||||
|
||||
Vendored
+4
@@ -465,6 +465,10 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
size_t newlen, dtarglen;
|
||||
if(now > d->ttl)
|
||||
return NULL;
|
||||
/* only allow validated (with DNSSEC) DNAMEs used from cache
|
||||
* for insecure DNAMEs, query again. */
|
||||
if(d->security != sec_status_secure)
|
||||
return NULL;
|
||||
msg = gen_dns_msg(region, q, 2); /* DNAME + CNAME RRset */
|
||||
if(!msg)
|
||||
return NULL;
|
||||
|
||||
Vendored
+37
-13
@@ -260,12 +260,12 @@ hash_lameness(uint8_t* name, size_t namelen)
|
||||
|
||||
int
|
||||
infra_lookup_lame(struct infra_host_data* host,
|
||||
uint8_t* name, size_t namelen, uint32_t timenow)
|
||||
uint8_t* name, size_t namelen, uint32_t timenow,
|
||||
int* dlame, int* alame, int* olame)
|
||||
{
|
||||
struct lruhash_entry* e;
|
||||
struct infra_lame_key k;
|
||||
struct infra_lame_data *d;
|
||||
int dl;
|
||||
if(!host->lameness)
|
||||
return 0;
|
||||
k.entry.hash = hash_lameness(name, namelen);
|
||||
@@ -281,9 +281,11 @@ infra_lookup_lame(struct infra_host_data* host,
|
||||
lock_rw_unlock(&e->lock);
|
||||
return 0;
|
||||
}
|
||||
dl = d->isdnsseclame;
|
||||
*dlame = d->isdnsseclame;
|
||||
*alame = d->lame_type_A;
|
||||
*olame = d->lame_other;
|
||||
lock_rw_unlock(&e->lock);
|
||||
return dl?2:1;
|
||||
return *dlame || *alame || *olame;
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -329,7 +331,8 @@ infra_lame_deldatafunc(void* d, void* ATTR_UNUSED(arg))
|
||||
int
|
||||
infra_set_lame(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame)
|
||||
uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame,
|
||||
uint16_t qtype)
|
||||
{
|
||||
struct infra_host_data* data;
|
||||
struct lruhash_entry* e;
|
||||
@@ -361,6 +364,8 @@ infra_set_lame(struct infra_cache* infra,
|
||||
k->entry.data = (void*)d;
|
||||
d->ttl = timenow + infra->lame_ttl;
|
||||
d->isdnsseclame = dnsseclame;
|
||||
d->lame_type_A = (!dnsseclame && qtype == LDNS_RR_TYPE_A);
|
||||
d->lame_other = (!dnsseclame && qtype != LDNS_RR_TYPE_A);
|
||||
k->namelen = namelen;
|
||||
e = infra_lookup_host_nottl(infra, addr, addrlen, 1);
|
||||
if(!e) {
|
||||
@@ -392,7 +397,18 @@ infra_set_lame(struct infra_cache* infra,
|
||||
free(d);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
/* lookup existing lameness entry (if any) and merge data */
|
||||
int dlame, alame, olame;
|
||||
if(infra_lookup_lame(data, name, namelen, timenow,
|
||||
&dlame, &alame, &olame)) {
|
||||
/* merge data into new structure */
|
||||
if(dlame) d->isdnsseclame = 1;
|
||||
if(alame) d->lame_type_A = 1;
|
||||
if(olame) d->lame_other = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* inserts new entry, or updates TTL of older entry */
|
||||
lruhash_insert(data->lameness, k->entry.hash, &k->entry, d, NULL);
|
||||
|
||||
@@ -477,28 +493,36 @@ infra_edns_update(struct infra_cache* infra,
|
||||
int
|
||||
infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, int* lame, int* dnsseclame,
|
||||
int* rtt, uint32_t timenow)
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* rtt, uint32_t timenow)
|
||||
{
|
||||
struct infra_host_data* host;
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
addrlen, 0);
|
||||
int lm;
|
||||
int dlm, alm, olm;
|
||||
if(!e)
|
||||
return 0;
|
||||
host = (struct infra_host_data*)e->data;
|
||||
*rtt = rtt_unclamped(&host->rtt);
|
||||
/* check lameness first, if so, ttl on host does not matter anymore */
|
||||
if((lm=infra_lookup_lame(host, name, namelen, timenow))) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
if(lm == 1) {
|
||||
if(infra_lookup_lame(host, name, namelen, timenow, &dlm, &alm, &olm)) {
|
||||
if(alm && qtype == LDNS_RR_TYPE_A) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
*lame = 1;
|
||||
*dnsseclame = 0;
|
||||
} else {
|
||||
return 1;
|
||||
} else if(olm && qtype != LDNS_RR_TYPE_A) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
*lame = 1;
|
||||
*dnsseclame = 0;
|
||||
return 1;
|
||||
} else if(dlm) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
*lame = 0;
|
||||
*dnsseclame = 1;
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
/* no lameness for this type of query */
|
||||
}
|
||||
*lame = 0;
|
||||
*dnsseclame = 0;
|
||||
|
||||
Vendored
+16
-5
@@ -94,6 +94,10 @@ struct infra_lame_data {
|
||||
/** is the host lame (does not serve the zone authoritatively),
|
||||
* or is the host dnssec lame (does not serve DNSSEC data) */
|
||||
int isdnsseclame;
|
||||
/** the host is lame (not authoritative) for A records */
|
||||
int lame_type_A;
|
||||
/** the host is lame (not authoritative) for other query types */
|
||||
int lame_other;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -175,10 +179,14 @@ int infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
* @param name: domain name of zone apex.
|
||||
* @param namelen: length of domain name.
|
||||
* @param timenow: what time it is now.
|
||||
* @return: 0 if not lame or unknown or timed out, 1 if lame, 2 if dnsseclame.
|
||||
* @param dlame: if the function returns true, is set true if dnssec lame.
|
||||
* @param alame: if the function returns true, is set true if qtype A lame.
|
||||
* @param olame: if the function returns true, is set true if qtype other lame.
|
||||
* @return: 0 if not lame or unknown or timed out, 1 if lame
|
||||
*/
|
||||
int infra_lookup_lame(struct infra_host_data* host,
|
||||
uint8_t* name, size_t namelen, uint32_t timenow);
|
||||
uint8_t* name, size_t namelen, uint32_t timenow,
|
||||
int* dlame, int* alame, int* olame);
|
||||
|
||||
/**
|
||||
* Set a host to be lame for the given zone.
|
||||
@@ -190,11 +198,13 @@ int infra_lookup_lame(struct infra_host_data* host,
|
||||
* @param timenow: what time it is now.
|
||||
* @param dnsseclame: if true the host is set dnssec lame.
|
||||
* if false, the host is marked lame (not serving the zone).
|
||||
* @param qtype: the query type for which it is lame.
|
||||
* @return: 0 on error.
|
||||
*/
|
||||
int infra_set_lame(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame);
|
||||
uint8_t* name, size_t namelen, uint32_t timenow, int dnsseclame,
|
||||
uint16_t qtype);
|
||||
|
||||
/**
|
||||
* Update rtt information for the host.
|
||||
@@ -239,6 +249,7 @@ int infra_edns_update(struct infra_cache* infra,
|
||||
* @param addrlen: length of addr.
|
||||
* @param name: zone name.
|
||||
* @param namelen: zone name length.
|
||||
* @param qtype: the query to be made.
|
||||
* @param lame: if function returns true, this returns lameness of the zone.
|
||||
* @param dnsseclame: if function returns true, this returns if the zone
|
||||
* is dnssec-lame.
|
||||
@@ -249,8 +260,8 @@ int infra_edns_update(struct infra_cache* infra,
|
||||
*/
|
||||
int infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, int* lame, int* dnsseclame,
|
||||
int* rtt, uint32_t timenow);
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* rtt, uint32_t timenow);
|
||||
|
||||
/**
|
||||
* Get memory used by the infra cache.
|
||||
|
||||
+128
-29
@@ -49,7 +49,9 @@
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
/** number of queued TCP connections for listen() */
|
||||
@@ -87,7 +89,7 @@ verbose_print_addr(struct addrinfo *addr)
|
||||
|
||||
int
|
||||
create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
socklen_t addrlen, int v6only, int* inuse)
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto)
|
||||
{
|
||||
int s;
|
||||
# if defined(IPV6_USE_MIN_MTU)
|
||||
@@ -96,8 +98,23 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
(void)v6only;
|
||||
# endif
|
||||
if((s = socket(family, socktype, 0)) == -1) {
|
||||
log_err("can't create socket: %s", strerror(errno));
|
||||
*inuse = 0;
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) {
|
||||
*noproto = 1;
|
||||
return -1;
|
||||
}
|
||||
log_err("can't create socket: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEAFNOSUPPORT ||
|
||||
WSAGetLastError() == WSAEPROTONOSUPPORT) {
|
||||
*noproto = 1;
|
||||
return -1;
|
||||
}
|
||||
log_err("can't create socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
*noproto = 0;
|
||||
return -1;
|
||||
}
|
||||
if(family == AF_INET6) {
|
||||
@@ -105,10 +122,17 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
if(v6only) {
|
||||
int val=(v6only==2)?0:1;
|
||||
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
&val, (socklen_t)sizeof(val)) < 0) {
|
||||
(void*)&val, (socklen_t)sizeof(val)) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("setsockopt(..., IPV6_V6ONLY"
|
||||
", ...) failed: %s", strerror(errno));
|
||||
#else
|
||||
log_err("setsockopt(..., IPV6_V6ONLY"
|
||||
", ...) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
close(s);
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
@@ -124,25 +148,41 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
* network stack supports IPV6_USE_MIN_MTU.
|
||||
*/
|
||||
if (setsockopt(s, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
|
||||
"...) failed: %s", strerror(errno));
|
||||
#else
|
||||
log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
|
||||
"...) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
close(s);
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
if(bind(s, (struct sockaddr*)addr, addrlen) != 0) {
|
||||
*noproto = 0;
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef EADDRINUSE
|
||||
*inuse = (errno == EADDRINUSE);
|
||||
if(errno != EADDRINUSE)
|
||||
#endif
|
||||
log_err("can't bind socket: %s", strerror(errno));
|
||||
#endif
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() != WSAEADDRINUSE &&
|
||||
WSAGetLastError() != WSAEADDRNOTAVAIL)
|
||||
log_err("can't bind socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
if(!fd_set_nonblock(s)) {
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
close(s);
|
||||
return -1;
|
||||
@@ -154,34 +194,60 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
* Create and bind TCP listening socket
|
||||
* @param addr: address info ready to make socket.
|
||||
* @param v6only: enable ip6 only flag on ip6 sockets.
|
||||
* @param noproto: if error caused by lack of protocol support.
|
||||
* @return: the socket. -1 on error.
|
||||
*/
|
||||
static int
|
||||
create_tcp_accept_sock(struct addrinfo *addr, int v6only)
|
||||
create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto)
|
||||
{
|
||||
int s, flag;
|
||||
int s;
|
||||
#if defined(SO_REUSEADDR) || defined(IPV6_V6ONLY)
|
||||
int on = 1;
|
||||
#endif /* SO_REUSEADDR || IPV6_V6ONLY */
|
||||
verbose_print_addr(addr);
|
||||
*noproto = 0;
|
||||
if((s = socket(addr->ai_family, addr->ai_socktype, 0)) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) {
|
||||
*noproto = 1;
|
||||
return -1;
|
||||
}
|
||||
log_err("can't create socket: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEAFNOSUPPORT ||
|
||||
WSAGetLastError() == WSAEPROTONOSUPPORT) {
|
||||
*noproto = 1;
|
||||
return -1;
|
||||
}
|
||||
log_err("can't create socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#ifdef SO_REUSEADDR
|
||||
if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on,
|
||||
if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*)&on,
|
||||
(socklen_t)sizeof(on)) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("setsockopt(.. SO_REUSEADDR ..) failed: %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
log_err("setsockopt(.. SO_REUSEADDR ..) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif /* SO_REUSEADDR */
|
||||
#if defined(IPV6_V6ONLY)
|
||||
if(addr->ai_family == AF_INET6 && v6only) {
|
||||
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("setsockopt(..., IPV6_V6ONLY, ...) failed: %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
log_err("setsockopt(..., IPV6_V6ONLY, ...) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -189,20 +255,23 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only)
|
||||
(void)v6only;
|
||||
#endif /* IPV6_V6ONLY */
|
||||
if(bind(s, addr->ai_addr, addr->ai_addrlen) != 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("can't bind socket: %s", strerror(errno));
|
||||
#else
|
||||
log_err("can't bind socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if((flag = fcntl(s, F_GETFL)) == -1) {
|
||||
log_err("can't fcntl F_GETFL: %s", strerror(errno));
|
||||
flag = 0;
|
||||
}
|
||||
flag |= O_NONBLOCK;
|
||||
if(fcntl(s, F_SETFL, flag) == -1) {
|
||||
log_err("can't fcntl F_SETFL: %s", strerror(errno));
|
||||
if(!fd_set_nonblock(s)) {
|
||||
return -1;
|
||||
}
|
||||
if(listen(s, TCP_BACKLOG) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("can't listen: %s", strerror(errno));
|
||||
#else
|
||||
log_err("can't listen: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
return s;
|
||||
@@ -213,26 +282,39 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only)
|
||||
*/
|
||||
static int
|
||||
make_sock(int stype, const char* ifname, const char* port,
|
||||
struct addrinfo *hints, int v6only)
|
||||
struct addrinfo *hints, int v6only, int* noip6)
|
||||
{
|
||||
struct addrinfo *res = NULL;
|
||||
int r, s, inuse;
|
||||
int r, s, inuse, noproto;
|
||||
hints->ai_socktype = stype;
|
||||
*noip6 = 0;
|
||||
if((r=getaddrinfo(ifname, port, hints, &res)) != 0 || !res) {
|
||||
log_err("node %s:%s getaddrinfo: %s %s",
|
||||
ifname?ifname:"default", port, gai_strerror(r),
|
||||
r==EAI_SYSTEM?(char*)strerror(errno):"");
|
||||
#ifdef EAI_SYSTEM
|
||||
r==EAI_SYSTEM?(char*)strerror(errno):""
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
if(stype == SOCK_DGRAM) {
|
||||
verbose_print_addr(res);
|
||||
s = create_udp_sock(res->ai_family, res->ai_socktype,
|
||||
(struct sockaddr*)res->ai_addr,
|
||||
res->ai_addrlen, v6only, &inuse);
|
||||
res->ai_addrlen, v6only, &inuse, &noproto);
|
||||
if(s == -1 && inuse) {
|
||||
log_err("bind: address already in use");
|
||||
} else if(s == -1 && noproto && hints->ai_family == AF_INET6){
|
||||
*noip6 = 1;
|
||||
}
|
||||
} else s = create_tcp_accept_sock(res, v6only);
|
||||
} else {
|
||||
s = create_tcp_accept_sock(res, v6only, &noproto);
|
||||
if(s == -1 && noproto && hints->ai_family == AF_INET6){
|
||||
*noip6 = 1;
|
||||
}
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
return s;
|
||||
}
|
||||
@@ -270,14 +352,14 @@ set_recvpktinfo(int s, int family)
|
||||
if(family == AF_INET6) {
|
||||
# ifdef IPV6_RECVPKTINFO
|
||||
if(setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IPV6_RECVPKTINFO, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
# elif defined(IPV6_PKTINFO)
|
||||
if(setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IPV6_PKTINFO, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
@@ -291,14 +373,14 @@ set_recvpktinfo(int s, int family)
|
||||
} else if(family == AF_INET) {
|
||||
# ifdef IP_RECVDSTADDR
|
||||
if(setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IP_RECVDSTADDR, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
# elif defined(IP_PKTINFO)
|
||||
if(setsockopt(s, IPPROTO_IP, IP_PKTINFO,
|
||||
&on, (socklen_t)sizeof(on)) < 0) {
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IP_PKTINFO, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
@@ -329,12 +411,18 @@ static int
|
||||
ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
|
||||
struct addrinfo *hints, const char* port, struct listen_port** list)
|
||||
{
|
||||
int s;
|
||||
int s, noip6=0;
|
||||
if(!do_udp && !do_tcp)
|
||||
return 0;
|
||||
if(do_auto) {
|
||||
if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1)) == -1)
|
||||
if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1,
|
||||
&noip6)) == -1) {
|
||||
if(noip6) {
|
||||
log_warn("IPv6 protocol not available");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* getting source addr packet info is highly non-portable */
|
||||
if(!set_recvpktinfo(s, hints->ai_family))
|
||||
return 0;
|
||||
@@ -344,15 +432,26 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
|
||||
}
|
||||
} else if(do_udp) {
|
||||
/* regular udp socket */
|
||||
if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1)) == -1)
|
||||
if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1,
|
||||
&noip6)) == -1) {
|
||||
if(noip6) {
|
||||
log_warn("IPv6 protocol not available");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(!port_insert(list, s, listen_type_udp)) {
|
||||
close(s);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(do_tcp) {
|
||||
if((s = make_sock(SOCK_STREAM, ifname, port, hints, 1)) == -1) {
|
||||
if((s = make_sock(SOCK_STREAM, ifname, port, hints, 1,
|
||||
&noip6)) == -1) {
|
||||
if(noip6) {
|
||||
/*log_warn("IPv6 protocol not available");*/
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(!port_insert(list, s, listen_type_tcp)) {
|
||||
|
||||
@@ -171,9 +171,11 @@ size_t listen_get_mem(struct listen_dnsport* listen);
|
||||
* @param v6only: if enabled, IP6 sockets get IP6ONLY option set.
|
||||
* if enabled with value 2 IP6ONLY option is disabled.
|
||||
* @param inuse: on error, this is set true if the port was in use.
|
||||
* @param noproto: on error, this is set true if cause is that the
|
||||
IPv6 proto (family) is not available.
|
||||
* @return: the socket. -1 on error.
|
||||
*/
|
||||
int create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
socklen_t addrlen, int v6only, int* inuse);
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto);
|
||||
|
||||
#endif /* LISTEN_DNSPORT_H */
|
||||
|
||||
+32
-25
@@ -528,9 +528,15 @@ static int
|
||||
lz_nodefault(struct config_file* cfg, const char* name)
|
||||
{
|
||||
struct config_strlist* p;
|
||||
size_t len = strlen(name);
|
||||
if(len == 0) return 0;
|
||||
if(name[len-1] == '.') len--;
|
||||
|
||||
for(p = cfg->local_zones_nodefault; p; p = p->next) {
|
||||
/* compare zone name, lowercase */
|
||||
if(strcasecmp(p->str, name) == 0)
|
||||
/* compare zone name, lowercase, compare without ending . */
|
||||
if(strncasecmp(p->str, name, len) == 0 &&
|
||||
(strlen(p->str) == len || (strlen(p->str)==len+1 &&
|
||||
p->str[len] == '.')))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -614,34 +620,35 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if ( !add_as112_default(zones, cfg, buf, "10.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "16.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "17.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "18.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "19.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "20.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "21.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "22.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "23.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "24.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "25.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "26.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "27.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "28.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "29.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "30.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "31.172.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "168.192.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "0.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "254.169.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "2.0.192.in-addr.arpa") ||
|
||||
!add_as112_default(zones, cfg, buf, "255.255.255.255.in-addr.arpa") ||
|
||||
if ( !add_as112_default(zones, cfg, buf, "10.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "16.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "17.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "18.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "19.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "20.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "21.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "22.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "23.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "24.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "25.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "26.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "27.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "28.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "29.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "30.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "31.172.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "168.192.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "0.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "254.169.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "2.0.192.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "255.255.255.255.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "d.f.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "8.e.f.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "9.e.f.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "a.e.f.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "b.e.f.ip6.arpa.")) {
|
||||
!add_as112_default(zones, cfg, buf, "b.e.f.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "8.b.d.0.1.0.0.2.ip6.arpa.")) {
|
||||
log_err("out of memory adding default zone");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,9 @@
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
/** number of times to retry making a random ID that is unique. */
|
||||
@@ -142,14 +144,28 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
||||
#endif
|
||||
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if(s == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("outgoing tcp: socket: %s", strerror(errno));
|
||||
#else
|
||||
log_err("outgoing tcp: socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "failed address", &w->addr, w->addrlen);
|
||||
return 0;
|
||||
}
|
||||
fd_set_nonblock(s);
|
||||
if(connect(s, (struct sockaddr*)&w->addr, w->addrlen) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef EINPROGRESS
|
||||
if(errno != EINPROGRESS) {
|
||||
#else
|
||||
if(1) {
|
||||
#endif
|
||||
log_err("outgoing tcp: connect: %s", strerror(errno));
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() != WSAEINPROGRESS &&
|
||||
WSAGetLastError() != WSAEWOULDBLOCK) {
|
||||
#endif
|
||||
log_addr(0, "failed address", &w->addr, w->addrlen);
|
||||
close(s);
|
||||
return 0;
|
||||
@@ -652,6 +668,23 @@ pending_delete(struct outside_network* outnet, struct pending* p)
|
||||
{
|
||||
if(!p)
|
||||
return;
|
||||
if(outnet && outnet->udp_wait_first &&
|
||||
(p->next_waiting || p == outnet->udp_wait_last) ) {
|
||||
/* delete from waiting list, if it is in the waiting list */
|
||||
struct pending* prev = NULL, *x = outnet->udp_wait_first;
|
||||
while(x && x != p) {
|
||||
prev = x;
|
||||
x = x->next_waiting;
|
||||
}
|
||||
if(x) {
|
||||
log_assert(x == p);
|
||||
if(prev)
|
||||
prev->next_waiting = p->next_waiting;
|
||||
else outnet->udp_wait_first = p->next_waiting;
|
||||
if(outnet->udp_wait_last == p)
|
||||
outnet->udp_wait_last = prev;
|
||||
}
|
||||
}
|
||||
if(outnet) {
|
||||
(void)rbtree_delete(outnet->pending, p->node.key);
|
||||
}
|
||||
@@ -674,17 +707,17 @@ static int
|
||||
udp_sockport(struct sockaddr_storage* addr, socklen_t addrlen, int port,
|
||||
int* inuse)
|
||||
{
|
||||
int fd;
|
||||
int fd, noproto;
|
||||
if(addr_is_ip6(addr, addrlen)) {
|
||||
struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
|
||||
sa->sin6_port = (in_port_t)htons((uint16_t)port);
|
||||
fd = create_udp_sock(AF_INET6, SOCK_DGRAM,
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse);
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto);
|
||||
} else {
|
||||
struct sockaddr_in* sa = (struct sockaddr_in*)addr;
|
||||
sa->sin_port = (in_port_t)htons((uint16_t)port);
|
||||
fd = create_udp_sock(AF_INET, SOCK_DGRAM,
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse);
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
@@ -1051,7 +1084,8 @@ serviced_delete(struct serviced_query* sq)
|
||||
if(sq->status == serviced_query_UDP_EDNS ||
|
||||
sq->status == serviced_query_UDP) {
|
||||
struct pending* p = (struct pending*)sq->pending;
|
||||
portcomm_loweruse(sq->outnet, p->pc);
|
||||
if(p->pc)
|
||||
portcomm_loweruse(sq->outnet, p->pc);
|
||||
pending_delete(sq->outnet, p);
|
||||
outnet_send_wait_udp(sq->outnet);
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
#include "iterator/iterator.h"
|
||||
#include "validator/validator.h"
|
||||
#include "services/localzone.h"
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
@@ -246,18 +248,18 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir)
|
||||
} else if(cfg->directory && cfg->directory[0]) {
|
||||
/* prepend chdir */
|
||||
if(slashit && cfg->directory[0] != '/')
|
||||
strncat(buf, "/", sizeof(buf)-1);
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
if(strncmp(cfg->chrootdir, cfg->directory,
|
||||
strlen(cfg->chrootdir)) == 0)
|
||||
strncat(buf, cfg->directory+strlen(cfg->chrootdir),
|
||||
sizeof(buf)-1);
|
||||
else strncat(buf, cfg->directory, sizeof(buf)-1);
|
||||
sizeof(buf)-strlen(buf)-1);
|
||||
else strncat(buf, cfg->directory, sizeof(buf)-strlen(buf)-1);
|
||||
slashit = 1;
|
||||
}
|
||||
/* fname */
|
||||
if(slashit && fname[0] != '/')
|
||||
strncat(buf, "/", sizeof(buf)-1);
|
||||
strncat(buf, fname, sizeof(buf)-1);
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
strncat(buf, fname, sizeof(buf)-strlen(buf)-1);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
return buf;
|
||||
}
|
||||
@@ -327,9 +329,9 @@ morechecks(struct config_file* cfg, char* fname)
|
||||
if(fname[0] != '/') {
|
||||
if(getcwd(buf, sizeof(buf)) == NULL)
|
||||
fatal_exit("getcwd: %s", strerror(errno));
|
||||
strncat(buf, "/", sizeof(buf));
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
}
|
||||
strncat(buf, fname, sizeof(buf));
|
||||
strncat(buf, fname, sizeof(buf)-strlen(buf)-1);
|
||||
if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0)
|
||||
fatal_exit("config file %s is not inside chroot %s",
|
||||
buf, cfg->chrootdir);
|
||||
@@ -368,11 +370,13 @@ morechecks(struct config_file* cfg, char* fname)
|
||||
cfg->module_conf);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETPWNAM
|
||||
if(cfg->username && cfg->username[0]) {
|
||||
if(getpwnam(cfg->username) == NULL)
|
||||
fatal_exit("user '%s' does not exist.", cfg->username);
|
||||
endpwent();
|
||||
}
|
||||
#endif
|
||||
|
||||
localzonechecks(cfg);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ static int verb = 0;
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
printf("Usage: unbound-host [-vdh] [-c class] [-t type] hostname\n");
|
||||
printf("Usage: unbound-host [-vdhr] [-c class] [-t type] hostname\n");
|
||||
printf(" [-y key] [-f keyfile] [-F namedkeyfile]\n");
|
||||
printf(" [-C configfile]\n");
|
||||
printf(" Queries the DNS for information.\n");
|
||||
@@ -65,6 +65,8 @@ usage()
|
||||
printf(" -f keyfile read trust anchors from file, with lines as -y.\n");
|
||||
printf(" -F keyfile read named.conf-style trust anchors.\n");
|
||||
printf(" -C config use the specified unbound.conf\n");
|
||||
printf(" -r read forwarder information from /etc/resolv.conf\n");
|
||||
printf(" breaks validation if the fwder does not do DNSSEC.\n");
|
||||
printf(" -v be more verbose, shows nodata and security.\n");
|
||||
printf(" -d debug, traces the action, -d -d shows more.\n");
|
||||
printf(" -h show this usage help.\n");
|
||||
@@ -411,7 +413,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* parse the options */
|
||||
while( (c=getopt(argc, argv, "F:c:df:ht:vy:C:")) != -1) {
|
||||
while( (c=getopt(argc, argv, "F:c:df:hrt:vy:C:")) != -1) {
|
||||
switch(c) {
|
||||
case 'c':
|
||||
qclass = optarg;
|
||||
@@ -425,6 +427,9 @@ int main(int argc, char* argv[])
|
||||
debuglevel = 2; /* at least VERB_DETAIL */
|
||||
check_ub_res(ub_ctx_debuglevel(ctx, debuglevel));
|
||||
break;
|
||||
case 'r':
|
||||
check_ub_res(ub_ctx_resolvconf(ctx, "/etc/resolv.conf"));
|
||||
break;
|
||||
case 't':
|
||||
qtype = optarg;
|
||||
break;
|
||||
|
||||
@@ -160,3 +160,28 @@ void worker_stat_timer_cb(void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
/** keep track of lock id in lock-verify application */
|
||||
struct order_id {
|
||||
/** the thread id that created it */
|
||||
int thr;
|
||||
/** the instance number of creation */
|
||||
int instance;
|
||||
};
|
||||
|
||||
int order_lock_cmp(const void* e1, const void* e2)
|
||||
{
|
||||
struct order_id* o1 = (struct order_id*)e1;
|
||||
struct order_id* o2 = (struct order_id*)e2;
|
||||
if(o1->thr < o2->thr) return -1;
|
||||
if(o1->thr > o2->thr) return 1;
|
||||
if(o1->instance < o2->instance) return -1;
|
||||
if(o1->instance > o2->instance) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
codeline_cmp(const void* a, const void* b)
|
||||
{
|
||||
return strcmp((const char*)a, (const char*)b);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ checkerr(const char* desc, int err)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
/** only one process can communicate with async worker */
|
||||
#define NUMTHR 1
|
||||
#else /* have threads */
|
||||
|
||||
@@ -832,20 +832,3 @@ checklock_thrjoin(pthread_t thread)
|
||||
}
|
||||
|
||||
#endif /* USE_THREAD_DEBUG */
|
||||
|
||||
int order_lock_cmp(const void* e1, const void* e2)
|
||||
{
|
||||
struct order_id* o1 = (struct order_id*)e1;
|
||||
struct order_id* o2 = (struct order_id*)e2;
|
||||
if(o1->thr < o2->thr) return -1;
|
||||
if(o1->thr > o2->thr) return 1;
|
||||
if(o1->instance < o2->instance) return -1;
|
||||
if(o1->instance > o2->instance) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
codeline_cmp(const void* a, const void* b)
|
||||
{
|
||||
return strcmp((const char*)a, (const char*)b);
|
||||
}
|
||||
|
||||
@@ -340,17 +340,4 @@ typedef pthread_key_t ub_thread_key_t;
|
||||
#define ub_thread_key_get(key) pthread_getspecific(key)
|
||||
|
||||
#endif /* USE_THREAD_DEBUG */
|
||||
|
||||
/** keep track of lock id in lock-verify application */
|
||||
struct order_id {
|
||||
/** the thread id that created it */
|
||||
int thr;
|
||||
/** the instance number of creation */
|
||||
int instance;
|
||||
};
|
||||
/** compare two order_ids */
|
||||
int order_lock_cmp(const void* e1, const void* e2);
|
||||
/** compare two codeline structs for rbtree */
|
||||
int codeline_cmp(const void* a, const void* b);
|
||||
|
||||
#endif /* TESTCODE_CHECK_LOCKS_H */
|
||||
|
||||
+129
-26
@@ -364,7 +364,11 @@ service_send(struct ringbuf* ring, struct timeval* now, ldns_buffer* pkt,
|
||||
ldns_buffer_limit(pkt), 0,
|
||||
(struct sockaddr*)srv_addr, srv_len);
|
||||
if(sent == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("sendto: %s", strerror(errno));
|
||||
#else
|
||||
log_err("sendto: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
} else if(sent != (ssize_t)ldns_buffer_limit(pkt)) {
|
||||
log_err("sendto: partial send");
|
||||
}
|
||||
@@ -383,9 +387,16 @@ do_proxy(struct proxy* p, int retsock, ldns_buffer* pkt)
|
||||
r = recv(p->s, ldns_buffer_begin(pkt),
|
||||
ldns_buffer_capacity(pkt), 0);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAGAIN || errno == EINTR)
|
||||
return;
|
||||
log_err("recv: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
return;
|
||||
log_err("recv: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
ldns_buffer_set_limit(pkt, (size_t)r);
|
||||
@@ -395,7 +406,11 @@ do_proxy(struct proxy* p, int retsock, ldns_buffer* pkt)
|
||||
r = sendto(retsock, ldns_buffer_begin(pkt), (size_t)r, 0,
|
||||
(struct sockaddr*)&p->addr, p->addr_len);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("sendto: %s", strerror(errno));
|
||||
#else
|
||||
log_err("sendto: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,13 +460,19 @@ find_create_proxy(struct sockaddr_storage* from, socklen_t from_len,
|
||||
p = (struct proxy*)calloc(1, sizeof(*p));
|
||||
if(!p) fatal_exit("out of memory");
|
||||
p->s = socket(serv_ip6?AF_INET6:AF_INET, SOCK_DGRAM, 0);
|
||||
if(p->s == -1) fatal_exit("socket: %s", strerror(errno));
|
||||
if(p->s == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("socket: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("socket: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
fd_set_nonblock(p->s);
|
||||
memmove(&p->addr, from, from_len);
|
||||
p->addr_len = from_len;
|
||||
p->next = *proxies;
|
||||
*proxies = p;
|
||||
FD_SET(p->s, rorig);
|
||||
FD_SET(FD_SET_T p->s, rorig);
|
||||
if(p->s+1 > *max)
|
||||
*max = p->s+1;
|
||||
return p;
|
||||
@@ -475,9 +496,17 @@ service_recv(int s, struct ringbuf* ring, ldns_buffer* pkt,
|
||||
ldns_buffer_capacity(pkt), 0,
|
||||
(struct sockaddr*)&from, &from_len);
|
||||
if(len < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAGAIN || errno == EINTR)
|
||||
return;
|
||||
fatal_exit("recvfrom: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK ||
|
||||
WSAGetLastError() == WSAEINPROGRESS)
|
||||
return;
|
||||
fatal_exit("recvfrom: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
ldns_buffer_set_limit(pkt, (size_t)len);
|
||||
/* find its proxy element */
|
||||
@@ -531,9 +560,17 @@ service_tcp_listen(int s, fd_set* rorig, int* max, struct tcp_proxy** proxies,
|
||||
socklen_t addr_len;
|
||||
newfd = accept(s, (struct sockaddr*)&addr, &addr_len);
|
||||
if(newfd == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAGAIN || errno == EINTR)
|
||||
return;
|
||||
fatal_exit("accept: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK ||
|
||||
WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAECONNRESET)
|
||||
return;
|
||||
fatal_exit("accept: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
p = (struct tcp_proxy*)calloc(1, sizeof(*p));
|
||||
if(!p) fatal_exit("out of memory");
|
||||
@@ -543,13 +580,25 @@ service_tcp_listen(int s, fd_set* rorig, int* max, struct tcp_proxy** proxies,
|
||||
p->client_s = newfd;
|
||||
p->server_s = socket(addr_is_ip6(srv_addr, srv_len)?AF_INET6:AF_INET,
|
||||
SOCK_STREAM, 0);
|
||||
if(p->server_s == -1)
|
||||
if(p->server_s == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("tcp socket: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("tcp socket: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
fd_set_nonblock(p->client_s);
|
||||
fd_set_nonblock(p->server_s);
|
||||
if(connect(p->server_s, (struct sockaddr*)srv_addr, srv_len) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno != EINPROGRESS) {
|
||||
log_err("tcp connect: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() != WSAEWOULDBLOCK &&
|
||||
WSAGetLastError() != WSAEINPROGRESS) {
|
||||
log_err("tcp connect: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
close(p->server_s);
|
||||
close(p->client_s);
|
||||
free(p);
|
||||
@@ -560,8 +609,8 @@ service_tcp_listen(int s, fd_set* rorig, int* max, struct tcp_proxy** proxies,
|
||||
dl_tv_add(&p->timeout, tcp_timeout);
|
||||
|
||||
/* listen to client and server */
|
||||
FD_SET(p->client_s, rorig);
|
||||
FD_SET(p->server_s, rorig);
|
||||
FD_SET(FD_SET_T p->client_s, rorig);
|
||||
FD_SET(FD_SET_T p->server_s, rorig);
|
||||
if(p->client_s+1 > *max)
|
||||
*max = p->client_s+1;
|
||||
if(p->server_s+1 > *max)
|
||||
@@ -579,11 +628,19 @@ tcp_relay_read(int s, struct tcp_send_list** first,
|
||||
struct timeval* delay, ldns_buffer* pkt)
|
||||
{
|
||||
struct tcp_send_list* item;
|
||||
ssize_t r = read(s, ldns_buffer_begin(pkt), ldns_buffer_capacity(pkt));
|
||||
ssize_t r = recv(s, ldns_buffer_begin(pkt),
|
||||
ldns_buffer_capacity(pkt), 0);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EINTR || errno == EAGAIN)
|
||||
return 1;
|
||||
log_err("tcp read: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
return 1;
|
||||
log_err("tcp read: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return 0;
|
||||
} else if(r == 0) {
|
||||
/* connection closed */
|
||||
@@ -630,11 +687,19 @@ tcp_relay_write(int s, struct tcp_send_list** first,
|
||||
if(!dl_tv_smaller(&p->wait, now))
|
||||
return 1;
|
||||
/* write it */
|
||||
r = write(s, p->item + p->done, p->len - p->done);
|
||||
r = send(s, (void*)(p->item + p->done), p->len - p->done, 0);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EAGAIN || errno == EINTR)
|
||||
return 1;
|
||||
log_err("tcp write: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK ||
|
||||
WSAGetLastError() == WSAEINPROGRESS)
|
||||
return 1;
|
||||
log_err("tcp write: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return 0;
|
||||
} else if(r == 0) {
|
||||
/* closed */
|
||||
@@ -689,8 +754,8 @@ service_tcp_relay(struct tcp_proxy** tcp_proxies, struct timeval* now,
|
||||
if(!tcp_relay_read(p->server_s, &p->answerlist,
|
||||
&p->answerlast, now, delay, pkt)) {
|
||||
close(p->server_s);
|
||||
FD_CLR(p->server_s, worig);
|
||||
FD_CLR(p->server_s, rorig);
|
||||
FD_CLR(FD_SET_T p->server_s, worig);
|
||||
FD_CLR(FD_SET_T p->server_s, rorig);
|
||||
p->server_s = -1;
|
||||
}
|
||||
}
|
||||
@@ -705,8 +770,8 @@ service_tcp_relay(struct tcp_proxy** tcp_proxies, struct timeval* now,
|
||||
delete_it = 1;
|
||||
if(p->querylist && p->server_s != -1 &&
|
||||
dl_tv_smaller(&p->querylist->wait, now))
|
||||
FD_SET(p->server_s, worig);
|
||||
else FD_CLR(p->server_s, worig);
|
||||
FD_SET(FD_SET_T p->server_s, worig);
|
||||
else FD_CLR(FD_SET_T p->server_s, worig);
|
||||
}
|
||||
|
||||
/* can we send on further answers */
|
||||
@@ -720,8 +785,8 @@ service_tcp_relay(struct tcp_proxy** tcp_proxies, struct timeval* now,
|
||||
delete_it = 1;
|
||||
if(p->answerlist && dl_tv_smaller(&p->answerlist->wait,
|
||||
now))
|
||||
FD_SET(p->client_s, worig);
|
||||
else FD_CLR(p->client_s, worig);
|
||||
FD_SET(FD_SET_T p->client_s, worig);
|
||||
else FD_CLR(FD_SET_T p->client_s, worig);
|
||||
if(!p->answerlist && p->server_s == -1)
|
||||
delete_it = 1;
|
||||
}
|
||||
@@ -733,11 +798,11 @@ service_tcp_relay(struct tcp_proxy** tcp_proxies, struct timeval* now,
|
||||
if(delete_it) {
|
||||
struct tcp_proxy* np = p->next;
|
||||
*prev = np;
|
||||
FD_CLR(p->client_s, rorig);
|
||||
FD_CLR(p->client_s, worig);
|
||||
FD_CLR(FD_SET_T p->client_s, rorig);
|
||||
FD_CLR(FD_SET_T p->client_s, worig);
|
||||
if(p->server_s != -1) {
|
||||
FD_CLR(p->server_s, rorig);
|
||||
FD_CLR(p->server_s, worig);
|
||||
FD_CLR(FD_SET_T p->server_s, rorig);
|
||||
FD_CLR(FD_SET_T p->server_s, worig);
|
||||
}
|
||||
tcp_proxy_delete(p);
|
||||
p = np;
|
||||
@@ -853,8 +918,8 @@ service_loop(int udp_s, int listen_s, struct ringbuf* ring,
|
||||
#ifndef S_SPLINT_S
|
||||
FD_ZERO(&rorig);
|
||||
FD_ZERO(&worig);
|
||||
FD_SET(udp_s, &rorig);
|
||||
FD_SET(listen_s, &rorig);
|
||||
FD_SET(FD_SET_T udp_s, &rorig);
|
||||
FD_SET(FD_SET_T listen_s, &rorig);
|
||||
#endif
|
||||
max = udp_s + 1;
|
||||
if(listen_s + 1 > max) max = listen_s + 1;
|
||||
@@ -926,15 +991,29 @@ service(char* bind_str, int bindport, char* serv_str, size_t memsize,
|
||||
if(!pkt)
|
||||
fatal_exit("out of memory");
|
||||
if( signal(SIGINT, delayer_sigh) == SIG_ERR ||
|
||||
signal(SIGTERM, delayer_sigh) == SIG_ERR ||
|
||||
#ifdef SIGHUP
|
||||
signal(SIGHUP, delayer_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
signal(SIGQUIT, delayer_sigh) == SIG_ERR ||
|
||||
signal(SIGALRM, delayer_sigh) == SIG_ERR)
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
signal(SIGBREAK, delayer_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
signal(SIGALRM, delayer_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
signal(SIGTERM, delayer_sigh) == SIG_ERR)
|
||||
fatal_exit("could not bind to signal");
|
||||
/* bind UDP port */
|
||||
if((s = socket(str_is_ip6(bind_str)?AF_INET6:AF_INET,
|
||||
SOCK_DGRAM, 0)) == -1)
|
||||
SOCK_DGRAM, 0)) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("socket: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("socket: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
i=0;
|
||||
if(bindport == 0) {
|
||||
bindport = 1024 + random()%64000;
|
||||
@@ -946,7 +1025,11 @@ service(char* bind_str, int bindport, char* serv_str, size_t memsize,
|
||||
exit(1);
|
||||
}
|
||||
if(bind(s, (struct sockaddr*)&bind_addr, bind_len) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("bind: %s", strerror(errno));
|
||||
#else
|
||||
log_err("bind: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
if(i--==0)
|
||||
fatal_exit("cannot bind any port");
|
||||
bindport = 1024 + random()%64000;
|
||||
@@ -955,21 +1038,41 @@ service(char* bind_str, int bindport, char* serv_str, size_t memsize,
|
||||
fd_set_nonblock(s);
|
||||
/* and TCP port */
|
||||
if((listen_s = socket(str_is_ip6(bind_str)?AF_INET6:AF_INET,
|
||||
SOCK_STREAM, 0)) == -1)
|
||||
SOCK_STREAM, 0)) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("tcp socket: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("tcp socket: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
#ifdef SO_REUSEADDR
|
||||
if(1) {
|
||||
int on = 1;
|
||||
if(setsockopt(listen_s, SOL_SOCKET, SO_REUSEADDR, &on,
|
||||
if(setsockopt(listen_s, SOL_SOCKET, SO_REUSEADDR, (void*)&on,
|
||||
(socklen_t)sizeof(on)) < 0)
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("setsockopt(.. SO_REUSEADDR ..) failed: %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
fatal_exit("setsockopt(.. SO_REUSEADDR ..) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(bind(listen_s, (struct sockaddr*)&bind_addr, bind_len) == -1)
|
||||
if(bind(listen_s, (struct sockaddr*)&bind_addr, bind_len) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("tcp bind: %s", strerror(errno));
|
||||
if(listen(listen_s, 5) == -1)
|
||||
#else
|
||||
fatal_exit("tcp bind: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
if(listen(listen_s, 5) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("tcp listen: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("tcp listen: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
fd_set_nonblock(listen_s);
|
||||
printf("listening on port: %d\n", bindport);
|
||||
|
||||
|
||||
+33
-1
@@ -2,10 +2,27 @@
|
||||
|
||||
NEED_SPLINT='00-lint.tpkg'
|
||||
NEED_DOXYGEN='01-doc.tpkg'
|
||||
NEED_LDNS_TESTNS='fwd_no_edns.tpkg fwd_tcp_tc.tpkg fwd_tcp.tpkg fwd_three_service.tpkg fwd_three.tpkg fwd_ttlexpire.tpkg fwd_udp.tpkg fwd_tcp_tc6.tpkg fwd_compress_c00c.tpkg fwd_ancil.tpkg stat_timer.tpkg 05-asynclook.tpkg stream_tcp.tpkg speed_cache.tpkg fwd_oneport.tpkg fwd_udptmout.tpkg fwd_waitudp.tpkg'
|
||||
NEED_LDNS_TESTNS='fwd_no_edns.tpkg fwd_tcp_tc.tpkg fwd_tcp.tpkg fwd_three_service.tpkg fwd_three.tpkg fwd_ttlexpire.tpkg fwd_udp.tpkg fwd_tcp_tc6.tpkg fwd_compress_c00c.tpkg fwd_ancil.tpkg stat_timer.tpkg 05-asynclook.tpkg stream_tcp.tpkg speed_cache.tpkg fwd_oneport.tpkg fwd_udptmout.tpkg fwd_waitudp.tpkg tcp_sigpipe.tpkg hostsfileosx.tpkg local_nodefault.tpkg'
|
||||
NEED_XXD='fwd_compress_c00c.tpkg'
|
||||
NEED_NC='fwd_compress_c00c.tpkg'
|
||||
NEED_CURL='06-ianaports.tpkg'
|
||||
NEED_WHOAMI='07-confroot.tpkg'
|
||||
NEED_IPV6='fwd_ancil.tpkg fwd_tcp_tc6.tpkg'
|
||||
NEED_JOBCONTROL='tcp_sigpipe.tpkg'
|
||||
|
||||
# test if job control - and also signals - are available (not on mingw).
|
||||
if wait %% 2>&1 | grep "job control not enabled" >/dev/null 2>&1; then
|
||||
JOBCONTROL=no
|
||||
else
|
||||
JOBCONTROL=yes
|
||||
fi
|
||||
|
||||
# test for ipv6, uses streamptcp peculiarity.
|
||||
if ./streamtcp -f ::1 2>&1 | grep "not supported" >/dev/null 2>&1; then
|
||||
HAVE_IPV6=no
|
||||
else
|
||||
HAVE_IPV6=yes
|
||||
fi
|
||||
|
||||
cd testdata;
|
||||
sh ../testcode/mini_tpkg.sh clean
|
||||
@@ -42,6 +59,21 @@ for test in `ls *.tpkg`; do
|
||||
SKIP=1;
|
||||
fi
|
||||
fi
|
||||
if echo $NEED_WHOAMI | grep $test >/dev/null; then
|
||||
if test ! -x "`which whoami`"; then
|
||||
SKIP=1;
|
||||
fi
|
||||
fi
|
||||
if echo $NEED_IPV6 | grep $test >/dev/null; then
|
||||
if test "$HAVE_IPV6" = no; then
|
||||
SKIP=1;
|
||||
fi
|
||||
fi
|
||||
if echo $NEED_JOBCONTROL | grep $test >/dev/null; then
|
||||
if test "$JOBCONTROL" = no; then
|
||||
SKIP=1;
|
||||
fi
|
||||
fi
|
||||
if test $SKIP -eq 0; then
|
||||
echo $test
|
||||
sh ../testcode/mini_tpkg.sh -a ../.. exe $test
|
||||
|
||||
@@ -557,7 +557,11 @@ harvest_main(struct harvest_data* data)
|
||||
static void
|
||||
hv_mkdir(char* dir)
|
||||
{
|
||||
#ifdef MKDIR_HAS_ONE_ARG
|
||||
if(mkdir(dir) == -1) {
|
||||
#else
|
||||
if(mkdir(dir, 0755) == -1) {
|
||||
#endif
|
||||
if(errno == EEXIST)
|
||||
return;
|
||||
perror(dir);
|
||||
|
||||
@@ -708,7 +708,11 @@ adjust_packet(struct entry* match, ldns_pkt* answer_pkt, ldns_pkt* query_pkt)
|
||||
}
|
||||
if(match->sleeptime > 0) {
|
||||
verbose(3, "sleeping for %d seconds\n", match->sleeptime);
|
||||
#ifdef HAVE_SLEEP
|
||||
sleep(match->sleeptime);
|
||||
#else
|
||||
Sleep(match->sleeptime * 1000);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,7 +812,11 @@ handle_query(uint8_t* inbuf, ssize_t inlen, struct entry* entries, int* count,
|
||||
if(p->packet_sleep) {
|
||||
verbose(3, "sleeping for next packet %d secs\n",
|
||||
p->packet_sleep);
|
||||
#ifdef HAVE_SLEEP
|
||||
sleep(p->packet_sleep);
|
||||
#else
|
||||
Sleep(p->packet_sleep * 1000);
|
||||
#endif
|
||||
verbose(3, "wakeup for next packet "
|
||||
"(slept %d secs)\n", p->packet_sleep);
|
||||
}
|
||||
|
||||
+11
-1
@@ -47,11 +47,21 @@
|
||||
#include "util/log.h"
|
||||
#include "util/rbtree.h"
|
||||
#include "util/locks.h"
|
||||
#include "testcode/checklocks.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
|
||||
/* --- data structures --- */
|
||||
struct lock_ref;
|
||||
|
||||
/** keep track of lock id in lock-verify application
|
||||
* Also defined in smallapp/worker_cb.c for fptr_wlist encapsulation
|
||||
* breakage (the security tests break encapsulation for this test app) */
|
||||
struct order_id {
|
||||
/** the thread id that created it */
|
||||
int thr;
|
||||
/** the instance number of creation */
|
||||
int instance;
|
||||
};
|
||||
|
||||
/** a lock */
|
||||
struct order_lock {
|
||||
/** rbnode in all tree */
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
#include "util/log.h"
|
||||
#include "util/rbtree.h"
|
||||
#include "util/locks.h"
|
||||
#include "testcode/checklocks.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
/**
|
||||
|
||||
+19
-4
@@ -18,14 +18,18 @@ if test "$1" = "fake"; then
|
||||
fi
|
||||
if test "$1" = "report" || test "$2" = "report"; then
|
||||
echo "Minitpkg Report"
|
||||
for result in result.*; do
|
||||
name=`echo $result | sed -e 's/result\.//'`
|
||||
for result in *.tpkg; do
|
||||
name=`basename $result .tpkg`
|
||||
if test -f ".done-$name"; then
|
||||
if test "$1" != "-q"; then
|
||||
echo "** PASSED ** : $name"
|
||||
fi
|
||||
else
|
||||
echo "!! FAILED !! : $name"
|
||||
if test -f "result.$name"; then
|
||||
echo "!! FAILED !! : $name"
|
||||
else
|
||||
echo ">> SKIPPED<< : $name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
@@ -56,7 +60,11 @@ dir=$name.$$
|
||||
result=result.$name
|
||||
done=.done-$name
|
||||
success="no"
|
||||
shell="bash"
|
||||
if test -x "`which bash`"; then
|
||||
shell="bash"
|
||||
else
|
||||
shell="sh"
|
||||
fi
|
||||
|
||||
# check already done
|
||||
if test -f .done-$name; then
|
||||
@@ -109,3 +117,10 @@ fi
|
||||
mv $result ..
|
||||
cd ..
|
||||
rm -rf $dir
|
||||
# compat for windows where deletion may not succeed initially (files locked
|
||||
# by processes that still have to exit).
|
||||
if test $? -eq 1; then
|
||||
echo "minitpkg waiting for processes to terminate"
|
||||
sleep 2 # some time to exit, and try again
|
||||
rm -rf $dir
|
||||
fi
|
||||
|
||||
+38
-6
@@ -202,9 +202,16 @@ perfsetup(struct perfinfo* info)
|
||||
fatal_exit("gettimeofday: %s", strerror(errno));
|
||||
sig_info = info;
|
||||
if( signal(SIGINT, perf_sigh) == SIG_ERR ||
|
||||
signal(SIGTERM, perf_sigh) == SIG_ERR ||
|
||||
#ifdef SIGQUIT
|
||||
signal(SIGQUIT, perf_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
signal(SIGHUP, perf_sigh) == SIG_ERR ||
|
||||
signal(SIGQUIT, perf_sigh) == SIG_ERR)
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
signal(SIGBREAK, perf_sigh) == SIG_ERR ||
|
||||
#endif
|
||||
signal(SIGTERM, perf_sigh) == SIG_ERR)
|
||||
fatal_exit("could not bind to signal");
|
||||
info->io = (struct perfio*)calloc(sizeof(struct perfio), info->io_num);
|
||||
if(!info->io) fatal_exit("out of memory");
|
||||
@@ -218,12 +225,18 @@ perfsetup(struct perfinfo* info)
|
||||
info->io[i].fd = socket(
|
||||
addr_is_ip6(&info->dest, info->destlen)?
|
||||
AF_INET6:AF_INET, SOCK_DGRAM, 0);
|
||||
if(info->io[i].fd == -1)
|
||||
if(info->io[i].fd == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
fatal_exit("socket: %s", strerror(errno));
|
||||
#else
|
||||
fatal_exit("socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
}
|
||||
if(info->io[i].fd > info->maxfd)
|
||||
info->maxfd = info->io[i].fd;
|
||||
#ifndef S_SPLINT_S
|
||||
FD_SET(info->io[i].fd, &info->rset);
|
||||
FD_SET(FD_SET_T info->io[i].fd, &info->rset);
|
||||
info->io[i].timeout.tv_usec = ((START_IO_INTERVAL*i)%1000)
|
||||
*1000;
|
||||
info->io[i].timeout.tv_sec = (START_IO_INTERVAL*i)/1000;
|
||||
@@ -260,9 +273,13 @@ perfsend(struct perfinfo* info, size_t n, struct timeval* now)
|
||||
(struct sockaddr*)&info->dest, info->destlen);
|
||||
/*log_hex("send", info->qlist_data[info->qlist_idx],
|
||||
info->qlist_len[info->qlist_idx]);*/
|
||||
if(r == -1)
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("sendto: %s", strerror(errno));
|
||||
else if(r != (ssize_t)info->qlist_len[info->qlist_idx]) {
|
||||
#else
|
||||
log_err("sendto: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
} else if(r != (ssize_t)info->qlist_len[info->qlist_idx]) {
|
||||
log_err("partial sendto");
|
||||
}
|
||||
info->qlist_idx = (info->qlist_idx+1) % info->qlist_size;
|
||||
@@ -281,7 +298,11 @@ perfreply(struct perfinfo* info, size_t n, struct timeval* now)
|
||||
r = recv(info->io[n].fd, ldns_buffer_begin(info->buf),
|
||||
ldns_buffer_capacity(info->buf), 0);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("recv: %s", strerror(errno));
|
||||
#else
|
||||
log_err("recv: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
} else {
|
||||
info->by_rcode[LDNS_RCODE_WIRE(ldns_buffer_begin(
|
||||
info->buf))]++;
|
||||
@@ -552,6 +573,10 @@ int main(int argc, char* argv[])
|
||||
char* nm = argv[0];
|
||||
int c;
|
||||
struct perfinfo info;
|
||||
#ifdef USE_WINSOCK
|
||||
int r;
|
||||
WSADATA wsa_data;
|
||||
#endif
|
||||
|
||||
/* defaults */
|
||||
memset(&info, 0, sizeof(info));
|
||||
@@ -560,6 +585,10 @@ int main(int argc, char* argv[])
|
||||
log_init(NULL, 0, NULL);
|
||||
log_ident_set("perf");
|
||||
checklock_start();
|
||||
#ifdef USE_WINSOCK
|
||||
if((r = WSAStartup(MAKEWORD(2,2), &wsa_data)) != 0)
|
||||
fatal_exit("WSAStartup failed: %s", wsa_strerror(r));
|
||||
#endif
|
||||
|
||||
info.buf = ldns_buffer_new(65553);
|
||||
if(!info.buf) fatal_exit("out of memory");
|
||||
@@ -609,6 +638,9 @@ int main(int argc, char* argv[])
|
||||
perfmain(&info);
|
||||
|
||||
ldns_buffer_free(info.buf);
|
||||
#ifdef USE_WINSOCK
|
||||
WSACleanup();
|
||||
#endif
|
||||
checklock_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,6 @@ replay_moment_read(char* remain, FILE* in, const char* name, int* lineno,
|
||||
remain++;
|
||||
if(strlen(remain) > 0) /* remove \n */
|
||||
remain[strlen(remain)-1] = 0;
|
||||
printf("remain '%s'\n", remain);
|
||||
if(!extstrtoaddr(remain, &mom->addr, &mom->addrlen)) {
|
||||
log_err("line %d: could not parse ADDRESS: %s",
|
||||
*lineno, remain);
|
||||
|
||||
+99
-27
@@ -54,13 +54,15 @@ void usage(char* argv[])
|
||||
printf("usage: %s [options] name type class ...\n", argv[0]);
|
||||
printf(" sends the name-type-class queries over TCP.\n");
|
||||
printf("-f server what ipaddr@portnr to send the queries to\n");
|
||||
printf("-u use UDP. No retries are attempted.\n");
|
||||
printf("-n do not wait for an answer.\n");
|
||||
printf("-h this help text\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/** open TCP socket to svr */
|
||||
static int
|
||||
open_svr(char* svr)
|
||||
open_svr(char* svr, int udp)
|
||||
{
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t addrlen;
|
||||
@@ -71,13 +73,21 @@ open_svr(char* svr)
|
||||
exit(1);
|
||||
}
|
||||
fd = socket(addr_is_ip6(&addr, addrlen)?PF_INET6:PF_INET,
|
||||
SOCK_STREAM, 0);
|
||||
udp?SOCK_DGRAM:SOCK_STREAM, 0);
|
||||
if(fd == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
perror("socket() error");
|
||||
#else
|
||||
printf("socket: %s\n", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
if(connect(fd, (struct sockaddr*)&addr, addrlen) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
perror("connect() error");
|
||||
#else
|
||||
printf("connect: %s\n", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
return fd;
|
||||
@@ -85,7 +95,7 @@ open_svr(char* svr)
|
||||
|
||||
/** write a query over the TCP fd */
|
||||
static void
|
||||
write_q(int fd, ldns_buffer* buf, int id,
|
||||
write_q(int fd, int udp, ldns_buffer* buf, int id,
|
||||
char* strname, char* strtype, char* strclass)
|
||||
{
|
||||
struct query_info qinfo;
|
||||
@@ -113,15 +123,26 @@ write_q(int fd, ldns_buffer* buf, int id,
|
||||
ldns_buffer_write_u16_at(buf, 2, BIT_RD);
|
||||
|
||||
/* send it */
|
||||
len = (uint16_t)ldns_buffer_limit(buf);
|
||||
len = htons(len);
|
||||
if(write(fd, &len, sizeof(len)) < (ssize_t)sizeof(len)) {
|
||||
perror("write() len failed");
|
||||
exit(1);
|
||||
if(!udp) {
|
||||
len = (uint16_t)ldns_buffer_limit(buf);
|
||||
len = htons(len);
|
||||
if(send(fd, (void*)&len, sizeof(len), 0)<(ssize_t)sizeof(len)){
|
||||
#ifndef USE_WINSOCK
|
||||
perror("send() len failed");
|
||||
#else
|
||||
printf("send len: %s\n",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(write(fd, ldns_buffer_begin(buf), ldns_buffer_limit(buf)) <
|
||||
if(send(fd, ldns_buffer_begin(buf), ldns_buffer_limit(buf), 0) <
|
||||
(ssize_t)ldns_buffer_limit(buf)) {
|
||||
perror("write() data failed");
|
||||
#ifndef USE_WINSOCK
|
||||
perror("send() data failed");
|
||||
#else
|
||||
printf("send data: %s\n", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -130,21 +151,48 @@ write_q(int fd, ldns_buffer* buf, int id,
|
||||
|
||||
/** receive DNS datagram over TCP and print it */
|
||||
static void
|
||||
recv_one(int fd, ldns_buffer* buf)
|
||||
recv_one(int fd, int udp, ldns_buffer* buf)
|
||||
{
|
||||
uint16_t len;
|
||||
ldns_pkt* pkt;
|
||||
ldns_status status;
|
||||
if(read(fd, &len, sizeof(len)) < (ssize_t)sizeof(len)) {
|
||||
perror("read() len failed");
|
||||
exit(1);
|
||||
}
|
||||
len = ntohs(len);
|
||||
ldns_buffer_clear(buf);
|
||||
ldns_buffer_set_limit(buf, len);
|
||||
if(read(fd, ldns_buffer_begin(buf), len) < (ssize_t)len) {
|
||||
perror("read() data failed");
|
||||
exit(1);
|
||||
if(!udp) {
|
||||
if(recv(fd, (void*)&len, sizeof(len), 0)<(ssize_t)sizeof(len)){
|
||||
#ifndef USE_WINSOCK
|
||||
perror("read() len failed");
|
||||
#else
|
||||
printf("read len: %s\n",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
len = ntohs(len);
|
||||
ldns_buffer_clear(buf);
|
||||
ldns_buffer_set_limit(buf, len);
|
||||
if(recv(fd, ldns_buffer_begin(buf), len, 0) < (ssize_t)len) {
|
||||
#ifndef USE_WINSOCK
|
||||
perror("read() data failed");
|
||||
#else
|
||||
printf("read data: %s\n",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
ssize_t l;
|
||||
ldns_buffer_clear(buf);
|
||||
if((l=recv(fd, ldns_buffer_begin(buf),
|
||||
ldns_buffer_capacity(buf), 0)) < 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
perror("read() data failed");
|
||||
#else
|
||||
printf("read data: %s\n",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
ldns_buffer_set_limit(buf, (size_t)l);
|
||||
len = (size_t)l;
|
||||
}
|
||||
printf("\nnext received packet\n");
|
||||
log_buf(0, "data", buf);
|
||||
@@ -162,17 +210,18 @@ recv_one(int fd, ldns_buffer* buf)
|
||||
|
||||
/** send the TCP queries and print answers */
|
||||
static void
|
||||
send_em(char* svr, int num, char** qs)
|
||||
send_em(char* svr, int udp, int noanswer, int num, char** qs)
|
||||
{
|
||||
ldns_buffer* buf = ldns_buffer_new(65553);
|
||||
int fd = open_svr(svr);
|
||||
int fd = open_svr(svr, udp);
|
||||
int i;
|
||||
if(!buf) fatal_exit("out of memory");
|
||||
for(i=0; i<num; i+=3) {
|
||||
printf("\nNext query is %s %s %s\n", qs[i], qs[i+1], qs[i+2]);
|
||||
write_q(fd, buf, i, qs[i], qs[i+1], qs[i+2]);
|
||||
write_q(fd, udp, buf, i, qs[i], qs[i+1], qs[i+2]);
|
||||
/* print at least one result */
|
||||
recv_one(fd, buf);
|
||||
if(!noanswer)
|
||||
recv_one(fd, udp, buf);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
@@ -180,6 +229,7 @@ send_em(char* svr, int num, char** qs)
|
||||
printf("orderly exit\n");
|
||||
}
|
||||
|
||||
#ifdef SIGPIPE
|
||||
/** SIGPIPE handler */
|
||||
static RETSIGTYPE sigh(int sig)
|
||||
{
|
||||
@@ -190,6 +240,7 @@ static RETSIGTYPE sigh(int sig)
|
||||
printf("Got unhandled signal %d\n", sig);
|
||||
exit(1);
|
||||
}
|
||||
#endif /* SIGPIPE */
|
||||
|
||||
/** getopt global, in case header files fail to declare it. */
|
||||
extern int optind;
|
||||
@@ -201,25 +252,43 @@ int main(int argc, char** argv)
|
||||
{
|
||||
int c;
|
||||
char* svr = "127.0.0.1";
|
||||
int udp = 0;
|
||||
int noanswer = 0;
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
WSADATA wsa_data;
|
||||
if(WSAStartup(MAKEWORD(2,2), &wsa_data) != 0) {
|
||||
printf("WSAStartup failed\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* lock debug start (if any) */
|
||||
log_init(0, 0, 0);
|
||||
checklock_start();
|
||||
|
||||
#ifdef SIGPIPE
|
||||
if(signal(SIGPIPE, &sigh) == SIG_ERR) {
|
||||
perror("could not install signal handler");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* command line options */
|
||||
if(argc == 1) {
|
||||
usage(argv);
|
||||
}
|
||||
while( (c=getopt(argc, argv, "f:h")) != -1) {
|
||||
while( (c=getopt(argc, argv, "f:hnu")) != -1) {
|
||||
switch(c) {
|
||||
case 'f':
|
||||
svr = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
noanswer = 1;
|
||||
break;
|
||||
case 'u':
|
||||
udp = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
@@ -233,7 +302,10 @@ int main(int argc, char** argv)
|
||||
printf("queries must be multiples of name,type,class\n");
|
||||
return 1;
|
||||
}
|
||||
send_em(svr, argc, argv);
|
||||
send_em(svr, udp, noanswer, argc, argv);
|
||||
checklock_stop();
|
||||
#ifdef USE_WINSOCK
|
||||
WSACleanup();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -127,8 +127,13 @@ setup_config(FILE* in, char* configfile, int* lineno,
|
||||
char line[MAX_LINE_LEN];
|
||||
char* parse;
|
||||
FILE* cfg;
|
||||
#ifdef USE_WINSOCK
|
||||
snprintf(configfile, MAX_LINE_LEN, "testbound_cfg_%u.tmp",
|
||||
(unsigned)getpid());
|
||||
#else
|
||||
snprintf(configfile, MAX_LINE_LEN, "/tmp/testbound_cfg_%u.tmp",
|
||||
(unsigned)getpid());
|
||||
#endif
|
||||
add_opts("-c", pass_argc, pass_argv);
|
||||
add_opts(configfile, pass_argc, pass_argv);
|
||||
cfg = fopen(configfile, "w");
|
||||
@@ -172,7 +177,7 @@ setup_playback(const char* filename, char* configfile,
|
||||
int lineno = 0;
|
||||
|
||||
if(filename) {
|
||||
FILE *in = fopen(filename, "r");
|
||||
FILE *in = fopen(filename, "rb");
|
||||
if(!in) {
|
||||
perror(filename);
|
||||
exit(1);
|
||||
|
||||
+20
-4
@@ -319,6 +319,7 @@ infra_test()
|
||||
struct infra_host_key* k;
|
||||
struct infra_host_data* d;
|
||||
int init = 376;
|
||||
int dlame, alame, olame;
|
||||
|
||||
slab = infra_create(cfg);
|
||||
unit_assert( infra_host(slab, (struct sockaddr_storage*)&one,
|
||||
@@ -343,15 +344,30 @@ infra_test()
|
||||
unit_assert( vs == 0 && to == init );
|
||||
|
||||
unit_assert( infra_set_lame(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0) );
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0,
|
||||
LDNS_RR_TYPE_A) );
|
||||
unit_assert( (d=infra_lookup_host(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), 0, now, &k)) );
|
||||
unit_assert( d->ttl == now+cfg->host_ttl );
|
||||
unit_assert( d->edns_version == 0 );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now)==1 );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now,
|
||||
&dlame, &alame, &olame) );
|
||||
unit_assert(!dlame && alame && !olame);
|
||||
unit_assert( !infra_lookup_lame(d, zone, zonelen,
|
||||
now+cfg->lame_ttl+10) );
|
||||
unit_assert( !infra_lookup_lame(d, (uint8_t*)"\000", 1, now) );
|
||||
now+cfg->lame_ttl+10, &dlame, &alame, &olame) );
|
||||
unit_assert( !infra_lookup_lame(d, (uint8_t*)"\000", 1, now,
|
||||
&dlame, &alame, &olame) );
|
||||
lock_rw_unlock(&k->entry.lock);
|
||||
|
||||
/* test merge of data */
|
||||
unit_assert( infra_set_lame(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), zone, zonelen, now, 0,
|
||||
LDNS_RR_TYPE_AAAA) );
|
||||
unit_assert( (d=infra_lookup_host(slab, (struct sockaddr_storage*)&one,
|
||||
(socklen_t)sizeof(int), 0, now, &k)) );
|
||||
unit_assert( infra_lookup_lame(d, zone, zonelen, now,
|
||||
&dlame, &alame, &olame) );
|
||||
unit_assert(!dlame && alame && olame);
|
||||
lock_rw_unlock(&k->entry.lock);
|
||||
|
||||
infra_delete(slab);
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
; config options
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test double cname in reply.
|
||||
; this is in response to an error report from Robert Edmonds,
|
||||
; about resolution of images-na.ssl-images-amazon.com.
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.next.com. IN A
|
||||
SECTION AUTHORITY
|
||||
next.com. IN NS ns.next.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.next.com. IN A 1.2.3.5
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
; two CNAMEs for one name?
|
||||
www.example.com. IN CNAME www.next.com.
|
||||
www.example.com. IN CNAME www.next.com.
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.next.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.5
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA
|
||||
SECTION QUESTION
|
||||
www.next.com. IN A
|
||||
SECTION ANSWER
|
||||
www.next.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN CNAME www.next.com.
|
||||
www.next.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+135
@@ -0,0 +1,135 @@
|
||||
; config options
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test iterator lameness detection of AAAA-only lameness
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN AAAA
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN AAAA
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
|
||||
; response to AAAA query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
. 3600000 IN NS a.root-servers.net.
|
||||
. 3600000 IN NS b.root-servers.net.
|
||||
. 3600000 IN NS c.root-servers.net.
|
||||
. 3600000 IN NS d.root-servers.net.
|
||||
. 3600000 IN NS e.root-servers.net.
|
||||
. 3600000 IN NS f.root-servers.net.
|
||||
. 3600000 IN NS g.root-servers.net.
|
||||
. 3600000 IN NS h.root-servers.net.
|
||||
. 3600000 IN NS i.root-servers.net.
|
||||
. 3600000 IN NS j.root-servers.net.
|
||||
. 3600000 IN NS k.root-servers.net.
|
||||
. 3600000 IN NS l.root-servers.net.
|
||||
. 3600000 IN NS m.root-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.root-servers.net. 3600000 IN A 198.41.0.4
|
||||
b.root-servers.net. 3600000 IN A 128.9.0.107
|
||||
c.root-servers.net. 3600000 IN A 192.33.4.12
|
||||
ENTRY_END
|
||||
|
||||
; response to A query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN A
|
||||
SECTION ANSWER
|
||||
example.com. 120 IN A 204.14.213.188
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH TCP
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
example.com. IN AAAA
|
||||
ENTRY_END
|
||||
|
||||
; this fails; it is LAME
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA SERVFAIL
|
||||
SECTION QUESTION
|
||||
example.com. IN AAAA
|
||||
SECTION ANSWER
|
||||
ENTRY_END
|
||||
|
||||
; Now try the A type, which works, and is not LAME.
|
||||
STEP 20 QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH TCP
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; this fails; it is LAME
|
||||
STEP 30 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN A
|
||||
SECTION ANSWER
|
||||
example.com. 120 IN A 204.14.213.188
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+150
@@ -0,0 +1,150 @@
|
||||
; config options
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test lame detection if AA bit is omitted
|
||||
; the query is answered with a reply that has
|
||||
; no AA bit
|
||||
; no SOA record
|
||||
; noanswer/noerror
|
||||
; NS record in there which is not a down delegation (==).
|
||||
; the query is not sent to a forward zone
|
||||
|
||||
STEP 10 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; root prime is sent
|
||||
STEP 20 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
STEP 30 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
; query sent to root server
|
||||
STEP 40 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 50 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
; query sent to .com server
|
||||
STEP 60 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 70 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns2.example.com. IN A 168.192.3.3
|
||||
ENTRY_END
|
||||
|
||||
; no matter which one the iterator tries first, we present it as 'lame'
|
||||
; query to ns1.example.com or ns2.example.com.
|
||||
STEP 80 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 90 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
; This is the BROKEN ANSWER here.
|
||||
; it is lame. A delegation to example.com. itself.
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns2.example.com. IN A 168.192.3.3
|
||||
ENTRY_END
|
||||
|
||||
; iterator should try again and ask the other nameserver.
|
||||
STEP 100 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 110 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns2.example.com. IN A 168.192.3.3
|
||||
ENTRY_END
|
||||
|
||||
; is the final answer correct?
|
||||
STEP 200 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns2.example.com. IN A 168.192.3.3
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+137
@@ -0,0 +1,137 @@
|
||||
; config options
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test scrub of CNAME in answer section
|
||||
|
||||
STEP 10 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; root prime is sent
|
||||
STEP 20 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
STEP 30 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
; query sent to root server
|
||||
STEP 40 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 50 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
; query sent to .com server
|
||||
STEP 60 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 70 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; this query reply has to be scrubbed
|
||||
STEP 80 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 90 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN CNAME next.example.com.
|
||||
next.example.com. IN A 10.20.30.0
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; iterator should try again and ask the other nameserver.
|
||||
STEP 100 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
next.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 110 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
next.example.com. IN A
|
||||
SECTION ANSWER
|
||||
next.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; is the final answer correct?
|
||||
STEP 200 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN CNAME next.example.com.
|
||||
next.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+206
@@ -0,0 +1,206 @@
|
||||
; config options
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test scrub of insecure DNAME in answer section
|
||||
|
||||
STEP 10 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; root prime is sent
|
||||
STEP 20 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
STEP 30 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
; query sent to root server
|
||||
STEP 40 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 50 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
; query sent to .com server
|
||||
STEP 60 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 70 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
STEP 80 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 90 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
x.y.example.com. IN CNAME x.z.example.com.
|
||||
x.z.example.com. IN A 10.20.30.0
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
STEP 100 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.z.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 110 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
x.z.example.com. IN A
|
||||
SECTION ANSWER
|
||||
x.z.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; answer to first query (simply puts DNAME in cache)
|
||||
STEP 120 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
x.y.example.com. IN CNAME x.z.example.com.
|
||||
x.z.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; now, DNAME insecure from cache should not be used.
|
||||
; new query
|
||||
STEP 200 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 210 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 220 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
other.y.example.com. IN CNAME other.z.example.com.
|
||||
other.z.example.com. IN A 50.60.70.0
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
STEP 230 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
other.z.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 240 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
other.z.example.com. IN A
|
||||
SECTION ANSWER
|
||||
other.z.example.com. IN A 50.60.70.80
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
STEP 250 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
other.y.example.com. IN CNAME other.z.example.com.
|
||||
other.z.example.com. IN A 50.60.70.80
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
; config options
|
||||
server:
|
||||
trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
|
||||
trust-anchor: "example.net. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}"
|
||||
val-override-date: "20070916134226"
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test scrub of secure DNAME in answer section
|
||||
|
||||
STEP 10 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; root prime is sent
|
||||
STEP 20 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
STEP 30 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
; query sent to root server
|
||||
STEP 40 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 50 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
|
||||
; query sent to .com server
|
||||
STEP 60 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 70 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ENTRY_END
|
||||
|
||||
; query sent to example.com. server
|
||||
STEP 80 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 90 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
y.example.com. 3600 IN RRSIG DNAME 3 3 3600 20070926134150 20070829134150 2854 example.com. ALCQdkXflwgQVKCFeYgCAx3ipuoPsGJVZjNeUriXE4nd94h50zJWDJ4= ;{id = 2854}
|
||||
x.y.example.com. IN CNAME x.z.example.com.
|
||||
x.z.example.com. IN A 10.20.30.0
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. AA3IkI13XbKFU5NSqBVA9oM1WiyEKCy4DYFOAdihDf6uHps9lce3kEc= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns1.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. AKcUlwrSz2xYKnQ7b7oMblRa0rKjfUNT900bIkGjLKLWDUGc8mKZE2M= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
STEP 100 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
x.z.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 110 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
x.z.example.com. IN A
|
||||
SECTION ANSWER
|
||||
x.z.example.com. IN A 10.20.30.40
|
||||
x.z.example.com. 3600 IN RRSIG A 3 4 3600 20070926134150 20070829134150 2854 example.com. ADZ12PiZGEjVUyLLYkct/SBE2WT4D5IkMOKdcl0dzQ0XRAC5y/0bS7A= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. ADesKDqTIOswg5QC6eTIQvGu3DHsPMz1htpHLcDJwE8IpURTnMuD0Mw= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns1.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. ACYkeSRNcLVXeL+R9AM9e1GbxTwXNXpy1M5hcyuVkhkY2d5jGrkye7I= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; DNSKEY prime
|
||||
STEP 115 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
ENTRY_END
|
||||
STEP 116 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
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}
|
||||
example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
|
||||
; answer to first query (simply puts DNAME in cache)
|
||||
STEP 120 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD DO
|
||||
SECTION QUESTION
|
||||
x.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
y.example.com. 3600 IN RRSIG DNAME 3 3 3600 20070926134150 20070829134150 2854 example.com. ALCQdkXflwgQVKCFeYgCAx3ipuoPsGJVZjNeUriXE4nd94h50zJWDJ4= ;{id = 2854}
|
||||
x.y.example.com. IN CNAME x.z.example.com.
|
||||
x.z.example.com. IN A 10.20.30.40
|
||||
x.z.example.com. 3600 IN RRSIG A 3 4 3600 20070926134150 20070829134150 2854 example.com. ADZ12PiZGEjVUyLLYkct/SBE2WT4D5IkMOKdcl0dzQ0XRAC5y/0bS7A= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. ADesKDqTIOswg5QC6eTIQvGu3DHsPMz1htpHLcDJwE8IpURTnMuD0Mw= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns1.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. ACYkeSRNcLVXeL+R9AM9e1GbxTwXNXpy1M5hcyuVkhkY2d5jGrkye7I= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; now, DNAME is secure and can be used from cache.
|
||||
; new query
|
||||
STEP 200 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 230 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
other.z.example.com. IN A
|
||||
ENTRY_END
|
||||
STEP 240 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
other.z.example.com. IN A
|
||||
SECTION ANSWER
|
||||
other.z.example.com. IN A 50.60.70.80
|
||||
other.z.example.com. 3600 IN RRSIG A 3 4 3600 20070926134150 20070829134150 2854 example.com. AAp6G89oAvkyAaeF2d35AJNlzMhedGo0Bcppl0IOyF3HRzoc51vjJoU= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. ADesKDqTIOswg5QC6eTIQvGu3DHsPMz1htpHLcDJwE8IpURTnMuD0Mw= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns1.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. ACYkeSRNcLVXeL+R9AM9e1GbxTwXNXpy1M5hcyuVkhkY2d5jGrkye7I= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
STEP 250 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD DO
|
||||
SECTION QUESTION
|
||||
other.y.example.com. IN A
|
||||
SECTION ANSWER
|
||||
y.example.com. DNAME z.example.com.
|
||||
y.example.com. 3600 IN RRSIG DNAME 3 3 3600 20070926134150 20070829134150 2854 example.com. ALCQdkXflwgQVKCFeYgCAx3ipuoPsGJVZjNeUriXE4nd94h50zJWDJ4= ;{id = 2854}
|
||||
other.y.example.com. IN CNAME other.z.example.com.
|
||||
other.z.example.com. IN A 50.60.70.80
|
||||
other.z.example.com. 3600 IN RRSIG A 3 4 3600 20070926134150 20070829134150 2854 example.com. AAp6G89oAvkyAaeF2d35AJNlzMhedGo0Bcppl0IOyF3HRzoc51vjJoU= ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. ADesKDqTIOswg5QC6eTIQvGu3DHsPMz1htpHLcDJwE8IpURTnMuD0Mw= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns1.example.com. IN A 168.192.2.2
|
||||
ns1.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. ACYkeSRNcLVXeL+R9AM9e1GbxTwXNXpy1M5hcyuVkhkY2d5jGrkye7I= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
BIN
Binary file not shown.
Vendored
-2
@@ -89,8 +89,6 @@ ENTRY_BEGIN
|
||||
bla.example.com. IN A 10.20.30.140
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
example.com. IN NS ns.eeeek.com.
|
||||
example.com. IN NS ns2.eeeek.com.
|
||||
ENTRY_END
|
||||
|
||||
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+16
-47
@@ -73,11 +73,25 @@ MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
qqq.example.com. IN A
|
||||
xxx.example.com. IN A
|
||||
SECTION ANSWER
|
||||
xxx.example.com. IN CNAME yyy.example.com.
|
||||
yyy.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
yyy.example.com. IN A
|
||||
SECTION ANSWER
|
||||
yyy.example.com. IN A 10.20.30.42
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
@@ -102,52 +116,7 @@ www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN CNAME xxx.example.com.
|
||||
xxx.example.com. IN CNAME yyy.example.com.
|
||||
yyy.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
; This query creates and overwrites the cache
|
||||
STEP 20 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
qqq.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 21 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
qqq.example.com. IN A
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
yyy.example.com. IN A 10.20.30.42
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
|
||||
; get it again from cache.
|
||||
STEP 30 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 31 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN CNAME xxx.example.com.
|
||||
xxx.example.com. IN CNAME yyy.example.com.
|
||||
;;; did not trust the remainder of the CNAME chain!
|
||||
yyy.example.com. IN A 10.20.30.42
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
|
||||
Vendored
+195
@@ -0,0 +1,195 @@
|
||||
; config options
|
||||
; The island of trust is at example.com
|
||||
server:
|
||||
trust-anchor: "sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3"
|
||||
val-override-date: "20070916134226"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test validator with DS query and a bad anchor
|
||||
; The anchor is the wrong side of the zone cut; no parent anchor.
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
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}
|
||||
example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response to DS query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.sub.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
; response to DNSKEY priming query
|
||||
; sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
|
||||
sub.example.com. 3600 IN RRSIG DNSKEY 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. uNGp99iznjD7oOX02XnQbDnbg75UwBHRvZSKYUorTKvPUnCWMHKdRsQ+mf+Fx3GZ+Fz9BVjoCmQqpnfgXLEYqw== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
|
||||
ENTRY_END
|
||||
|
||||
; response to query of interest
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.sub.example.com. IN A 11.11.11.11
|
||||
www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+194
@@ -0,0 +1,194 @@
|
||||
; config options
|
||||
; The island of trust is at example.com
|
||||
server:
|
||||
trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
|
||||
val-override-date: "20070916134226"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test validator with DS query and one anchor
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
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}
|
||||
example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response to DS query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.sub.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
; response to DNSKEY priming query
|
||||
; sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
|
||||
sub.example.com. 3600 IN RRSIG DNSKEY 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. uNGp99iznjD7oOX02XnQbDnbg75UwBHRvZSKYUorTKvPUnCWMHKdRsQ+mf+Fx3GZ+Fz9BVjoCmQqpnfgXLEYqw== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
|
||||
ENTRY_END
|
||||
|
||||
; response to query of interest
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.sub.example.com. IN A 11.11.11.11
|
||||
www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+195
@@ -0,0 +1,195 @@
|
||||
; config options
|
||||
; The island of trust is at example.com
|
||||
server:
|
||||
trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
|
||||
trust-anchor: "sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3"
|
||||
val-override-date: "20070916134226"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test validator with DS query and two anchors
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
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}
|
||||
example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response to DS query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.sub.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
; response to DNSKEY priming query
|
||||
; sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
|
||||
sub.example.com. 3600 IN RRSIG DNSKEY 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. uNGp99iznjD7oOX02XnQbDnbg75UwBHRvZSKYUorTKvPUnCWMHKdRsQ+mf+Fx3GZ+Fz9BVjoCmQqpnfgXLEYqw== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. 3600 IN RRSIG NS 5 3 3600 20070926134150 20070829134150 30899 sub.example.com. wcpHeBILHfo8C9uxMhcW03gcURZeUffiKdSTb50ZjzTHgMNhRyMfpcvSpXEd9548A9UTmWKeLZChfr5Z/glONw== ;{id = 30899}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ns.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. UF7shD/gt1FOp2UHgLTNbPzVykklSXFMEtJ1xD+Hholwf/PIzd7zoaIttIYibNa4fUXCqMg22H9P7MRhfmFe6g== ;{id = 30899}
|
||||
ENTRY_END
|
||||
|
||||
; response to query of interest
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.sub.example.com. IN A 11.11.11.11
|
||||
www.sub.example.com. 3600 IN RRSIG A 5 4 3600 20070926134150 20070829134150 30899 sub.example.com. 0DqqRfRtm7VSEQ4mmBbzrKRqQAay3JAE8DPDGmjtokrrjN9F1G/HxozDV7bjdIh2EChlQea8FPwf/GepJMUVxg== ;{id = 30899}
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
sub.example.com. 3600 IN DS 30899 RSASHA1 1 f7ed618f24d5e5202927e1d27bc2e84a141cb4b3
|
||||
sub.example.com. 3600 IN RRSIG DS 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFCW3ix0GD4BSvNLWIbROCJt5DAW9AhRt/kg9kBKJ20UBUdumrBUHqnskdA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Vendored
+170
@@ -0,0 +1,170 @@
|
||||
; config options
|
||||
; The island of trust is at example.com
|
||||
server:
|
||||
trust-anchor: "example.com. 3600 IN DS 2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
|
||||
val-override-date: "20070916134226"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test validator with insecure delegation and qtype DS.
|
||||
|
||||
; K.ROOT-SERVERS.NET.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 193.0.14.129
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
SECTION ANSWER
|
||||
. IN NS K.ROOT-SERVERS.NET.
|
||||
SECTION ADDITIONAL
|
||||
K.ROOT-SERVERS.NET. IN A 193.0.14.129
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
com. IN NS a.gtld-servers.net.
|
||||
SECTION ADDITIONAL
|
||||
a.gtld-servers.net. IN A 192.5.6.30
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; a.gtld-servers.net.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 192.5.6.30
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; ns.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.4
|
||||
|
||||
; response to DNSKEY priming query
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
example.com. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
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}
|
||||
example.com. 3600 IN RRSIG DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
|
||||
SECTION AUTHORITY
|
||||
example.com. IN NS ns.example.com.
|
||||
example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 1.2.3.4
|
||||
ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
|
||||
ENTRY_END
|
||||
|
||||
; query for missing DS record.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
example.com. IN SOA ns.example.com. h.example.com. 2007090504 1800 1800 2419200 7200
|
||||
example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFC5uwIHSehZtetK2CMNXttSFUB0XAhROFDAgy/FaxR8zFXJzyPdpQG93Sw== ;{id = 2854}
|
||||
sub.example.com. IN NSEC www.example.com. NS RRSIG NSEC
|
||||
sub.example.com. 3600 IN RRSIG NSEC 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFDCaiDM6G+glwNW276HWdH+McmjgAhRSwF5OfimNQCqkWgnYotLOwUghKQ== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
; response for delegation to sub.example.com.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN NS ns.sub.example.com.
|
||||
sub.example.com. IN NSEC www.example.com. NS RRSIG NSEC
|
||||
sub.example.com. 3600 IN RRSIG NSEC 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFDCaiDM6G+glwNW276HWdH+McmjgAhRSwF5OfimNQCqkWgnYotLOwUghKQ== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ns.sub.example.com. IN A 1.2.3.6
|
||||
ENTRY_END
|
||||
|
||||
|
||||
RANGE_END
|
||||
|
||||
; ns.sub.example.com.
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 1.2.3.6
|
||||
|
||||
; response to query of interest
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
www.sub.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.sub.example.com. IN A 11.11.11.11
|
||||
SECTION AUTHORITY
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
|
||||
; query for missing DS record. on wrong side of zone cut.
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR AA NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
sub.example.com. IN SOA ns.sub.example.com. h.sub.example.com. 2007090504 1800 1800 2419200 7200
|
||||
ENTRY_END
|
||||
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD NOERROR
|
||||
SECTION QUESTION
|
||||
sub.example.com. IN DS
|
||||
SECTION ANSWER
|
||||
SECTION AUTHORITY
|
||||
example.com. IN SOA ns.example.com. h.example.com. 2007090504 1800 1800 2419200 7200
|
||||
example.com. 3600 IN RRSIG SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFC5uwIHSehZtetK2CMNXttSFUB0XAhROFDAgy/FaxR8zFXJzyPdpQG93Sw== ;{id = 2854}
|
||||
sub.example.com. IN NSEC www.example.com. NS RRSIG NSEC
|
||||
sub.example.com. 3600 IN RRSIG NSEC 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFDCaiDM6G+glwNW276HWdH+McmjgAhRSwF5OfimNQCqkWgnYotLOwUghKQ== ;{id = 2854}
|
||||
SECTION ADDITIONAL
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
+7
-1
@@ -82,7 +82,11 @@ config_create()
|
||||
cfg->do_udp = 1;
|
||||
cfg->do_tcp = 1;
|
||||
cfg->use_syslog = 1;
|
||||
#ifndef USE_WINSOCK
|
||||
cfg->outgoing_num_ports = 256;
|
||||
#else
|
||||
cfg->outgoing_num_ports = 16; /* windows is limited in num fds */
|
||||
#endif
|
||||
cfg->outgoing_num_tcp = 10;
|
||||
cfg->incoming_num_tcp = 10;
|
||||
cfg->msg_buffer_size = 65552; /* 64 k + a small margin */
|
||||
@@ -101,8 +105,10 @@ config_create()
|
||||
if(!(cfg->outgoing_avail_ports = (int*)calloc(65536, sizeof(int))))
|
||||
goto error_exit;
|
||||
init_outgoing_availports(cfg->outgoing_avail_ports, 65536);
|
||||
if(!(cfg->username = strdup("unbound"))) goto error_exit;
|
||||
if(!(cfg->username = strdup(UB_USERNAME))) goto error_exit;
|
||||
#ifdef HAVE_CHROOT
|
||||
if(!(cfg->chrootdir = strdup(CHROOT_DIR))) goto error_exit;
|
||||
#endif
|
||||
if(!(cfg->directory = strdup(RUN_DIR))) goto error_exit;
|
||||
if(!(cfg->logfile = strdup(""))) goto error_exit;
|
||||
if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit;
|
||||
|
||||
+162
-119
@@ -9,7 +9,7 @@
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 33
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
@@ -94,11 +94,12 @@ typedef unsigned int flex_uint32_t;
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
#if __STDC__
|
||||
/* C99 requires __STDC__ to be defined as 1. */
|
||||
#if defined (__STDC__)
|
||||
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* __STDC__ */
|
||||
#endif /* defined (__STDC__) */
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef YY_USE_CONST
|
||||
@@ -178,14 +179,9 @@ extern FILE *yyin, *yyout;
|
||||
|
||||
#define unput(c) yyunput( c, (yytext_ptr) )
|
||||
|
||||
/* The following is because we cannot portably get our hands on size_t
|
||||
* (without autoconf's help, which isn't available because we want
|
||||
* flex-generated scanners to compile on their own).
|
||||
*/
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef unsigned int yy_size_t;
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
@@ -1117,8 +1113,6 @@ char *yytext;
|
||||
#include "util/configparser.h"
|
||||
void ub_c_error(const char *message);
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
#if 0
|
||||
#define LEXOUT(s) printf s /* used ONLY when debugging */
|
||||
#else
|
||||
@@ -1181,8 +1175,16 @@ static void config_end_include(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define YY_NO_INPUT 1
|
||||
#line 88 "util/configlexer.lex"
|
||||
#ifndef YY_NO_UNPUT
|
||||
#define YY_NO_UNPUT 1
|
||||
#endif
|
||||
#ifndef YY_NO_INPUT
|
||||
#define YY_NO_INPUT 1
|
||||
#endif
|
||||
|
||||
#line 1185 "<stdout>"
|
||||
#line 1187 "<stdout>"
|
||||
|
||||
#define INITIAL 0
|
||||
#define quotedstring 1
|
||||
@@ -1204,6 +1206,35 @@ static void config_end_include(void)
|
||||
|
||||
static int yy_init_globals (void );
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int yylex_destroy (void );
|
||||
|
||||
int yyget_debug (void );
|
||||
|
||||
void yyset_debug (int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE yyget_extra (void );
|
||||
|
||||
void yyset_extra (YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *yyget_in (void );
|
||||
|
||||
void yyset_in (FILE * in_str );
|
||||
|
||||
FILE *yyget_out (void );
|
||||
|
||||
void yyset_out (FILE * out_str );
|
||||
|
||||
int yyget_leng (void );
|
||||
|
||||
char *yyget_text (void );
|
||||
|
||||
int yyget_lineno (void );
|
||||
|
||||
void yyset_lineno (int line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
@@ -1244,7 +1275,7 @@ static int input (void );
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
|
||||
#define ECHO fwrite( yytext, yyleng, 1, yyout )
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
@@ -1255,7 +1286,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
size_t n; \
|
||||
unsigned n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@@ -1337,9 +1368,9 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 99 "util/configlexer.lex"
|
||||
#line 107 "util/configlexer.lex"
|
||||
|
||||
#line 1342 "<stdout>"
|
||||
#line 1373 "<stdout>"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@@ -1430,383 +1461,383 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 100 "util/configlexer.lex"
|
||||
#line 108 "util/configlexer.lex"
|
||||
{ LEXOUT(("SP ")); /* ignore */ }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 101 "util/configlexer.lex"
|
||||
#line 109 "util/configlexer.lex"
|
||||
{ LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 102 "util/configlexer.lex"
|
||||
#line 110 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_SERVER;}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 103 "util/configlexer.lex"
|
||||
#line 111 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_NUM_THREADS;}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 104 "util/configlexer.lex"
|
||||
#line 112 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VERBOSITY;}
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 105 "util/configlexer.lex"
|
||||
#line 113 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_PORT;}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 106 "util/configlexer.lex"
|
||||
#line 114 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_OUTGOING_RANGE;}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 107 "util/configlexer.lex"
|
||||
#line 115 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_OUTGOING_PORT_PERMIT;}
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 108 "util/configlexer.lex"
|
||||
#line 116 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_OUTGOING_PORT_AVOID;}
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 109 "util/configlexer.lex"
|
||||
#line 117 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_OUTGOING_NUM_TCP;}
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 110 "util/configlexer.lex"
|
||||
#line 118 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INCOMING_NUM_TCP;}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 111 "util/configlexer.lex"
|
||||
#line 119 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_IP4;}
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 112 "util/configlexer.lex"
|
||||
#line 120 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_IP6;}
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 113 "util/configlexer.lex"
|
||||
#line 121 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_UDP;}
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 114 "util/configlexer.lex"
|
||||
#line 122 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_TCP;}
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 115 "util/configlexer.lex"
|
||||
#line 123 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_DAEMONIZE;}
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 116 "util/configlexer.lex"
|
||||
#line 124 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INTERFACE;}
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 117 "util/configlexer.lex"
|
||||
#line 125 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_OUTGOING_INTERFACE;}
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 118 "util/configlexer.lex"
|
||||
#line 126 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INTERFACE_AUTOMATIC;}
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 119 "util/configlexer.lex"
|
||||
#line 127 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_CHROOT;}
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 120 "util/configlexer.lex"
|
||||
#line 128 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_USERNAME;}
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 121 "util/configlexer.lex"
|
||||
#line 129 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DIRECTORY;}
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 122 "util/configlexer.lex"
|
||||
#line 130 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_LOGFILE;}
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 123 "util/configlexer.lex"
|
||||
#line 131 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_PIDFILE;}
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 124 "util/configlexer.lex"
|
||||
#line 132 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_ROOT_HINTS;}
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 125 "util/configlexer.lex"
|
||||
#line 133 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_MSG_BUFFER_SIZE;}
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 126 "util/configlexer.lex"
|
||||
#line 134 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_MSG_CACHE_SIZE;}
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 127 "util/configlexer.lex"
|
||||
#line 135 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_MSG_CACHE_SLABS;}
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 128 "util/configlexer.lex"
|
||||
#line 136 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_RRSET_CACHE_SIZE;}
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 129 "util/configlexer.lex"
|
||||
#line 137 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_RRSET_CACHE_SLABS;}
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 130 "util/configlexer.lex"
|
||||
#line 138 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_CACHE_MAX_TTL;}
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 131 "util/configlexer.lex"
|
||||
#line 139 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INFRA_HOST_TTL;}
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 132 "util/configlexer.lex"
|
||||
#line 140 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INFRA_LAME_TTL;}
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 133 "util/configlexer.lex"
|
||||
#line 141 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INFRA_CACHE_SLABS;}
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 134 "util/configlexer.lex"
|
||||
#line 142 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;}
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 135 "util/configlexer.lex"
|
||||
#line 143 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_INFRA_CACHE_LAME_SIZE;}
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 136 "util/configlexer.lex"
|
||||
#line 144 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_NUM_QUERIES_PER_THREAD;}
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 137 "util/configlexer.lex"
|
||||
#line 145 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_TARGET_FETCH_POLICY;}
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 138 "util/configlexer.lex"
|
||||
#line 146 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HARDEN_SHORT_BUFSIZE;}
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 139 "util/configlexer.lex"
|
||||
#line 147 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HARDEN_LARGE_QUERIES;}
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 140 "util/configlexer.lex"
|
||||
#line 148 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HARDEN_GLUE;}
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 141 "util/configlexer.lex"
|
||||
#line 149 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HARDEN_DNNSEC_STRIPPED;}
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 142 "util/configlexer.lex"
|
||||
#line 150 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_USE_CAPS_FOR_ID;}
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 143 "util/configlexer.lex"
|
||||
#line 151 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_STUB_ZONE;}
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 144 "util/configlexer.lex"
|
||||
#line 152 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_NAME;}
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 145 "util/configlexer.lex"
|
||||
#line 153 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_STUB_ADDR;}
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 146 "util/configlexer.lex"
|
||||
#line 154 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_STUB_HOST;}
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 147 "util/configlexer.lex"
|
||||
#line 155 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_FORWARD_ZONE;}
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 148 "util/configlexer.lex"
|
||||
#line 156 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_FORWARD_ADDR;}
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 149 "util/configlexer.lex"
|
||||
#line 157 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_FORWARD_HOST;}
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 150 "util/configlexer.lex"
|
||||
#line 158 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_NOT_QUERY_ADDRESS;}
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 151 "util/configlexer.lex"
|
||||
#line 159 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_DO_NOT_QUERY_LOCALHOST;}
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 152 "util/configlexer.lex"
|
||||
#line 160 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_ACCESS_CONTROL;}
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 153 "util/configlexer.lex"
|
||||
#line 161 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HIDE_IDENTITY;}
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 154 "util/configlexer.lex"
|
||||
#line 162 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_HIDE_VERSION;}
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 155 "util/configlexer.lex"
|
||||
#line 163 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_IDENTITY;}
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 156 "util/configlexer.lex"
|
||||
#line 164 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VERSION;}
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 157 "util/configlexer.lex"
|
||||
#line 165 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_MODULE_CONF;}
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 158 "util/configlexer.lex"
|
||||
#line 166 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_TRUST_ANCHOR_FILE;}
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 159 "util/configlexer.lex"
|
||||
#line 167 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_TRUSTED_KEYS_FILE;}
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 160 "util/configlexer.lex"
|
||||
#line 168 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_TRUST_ANCHOR;}
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 161 "util/configlexer.lex"
|
||||
#line 169 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VAL_OVERRIDE_DATE;}
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 162 "util/configlexer.lex"
|
||||
#line 170 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_BOGUS_TTL;}
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 163 "util/configlexer.lex"
|
||||
#line 171 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VAL_CLEAN_ADDITIONAL;}
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 164 "util/configlexer.lex"
|
||||
#line 172 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VAL_PERMISSIVE_MODE;}
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 165 "util/configlexer.lex"
|
||||
#line 173 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_KEY_CACHE_SIZE;}
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 166 "util/configlexer.lex"
|
||||
#line 174 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_KEY_CACHE_SLABS;}
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 167 "util/configlexer.lex"
|
||||
#line 175 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_VAL_NSEC3_KEYSIZE_ITERATIONS;}
|
||||
YY_BREAK
|
||||
case 69:
|
||||
YY_RULE_SETUP
|
||||
#line 168 "util/configlexer.lex"
|
||||
#line 176 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_USE_SYSLOG;}
|
||||
YY_BREAK
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 169 "util/configlexer.lex"
|
||||
#line 177 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_LOCAL_ZONE;}
|
||||
YY_BREAK
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 170 "util/configlexer.lex"
|
||||
#line 178 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_LOCAL_DATA;}
|
||||
YY_BREAK
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 171 "util/configlexer.lex"
|
||||
#line 179 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_STATISTICS_INTERVAL;}
|
||||
YY_BREAK
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 172 "util/configlexer.lex"
|
||||
#line 180 "util/configlexer.lex"
|
||||
{ YDOUT; return VAR_STATISTICS_CUMULATIVE;}
|
||||
YY_BREAK
|
||||
case 74:
|
||||
/* rule 74 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 173 "util/configlexer.lex"
|
||||
#line 181 "util/configlexer.lex"
|
||||
{ LEXOUT(("NL\n")); cfg_parser->line++;}
|
||||
YY_BREAK
|
||||
/* Quoted strings. Strip leading and ending quotes */
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 176 "util/configlexer.lex"
|
||||
#line 184 "util/configlexer.lex"
|
||||
{ BEGIN(quotedstring); LEXOUT(("QS ")); }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(quotedstring):
|
||||
#line 177 "util/configlexer.lex"
|
||||
#line 185 "util/configlexer.lex"
|
||||
{
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
@@ -1814,18 +1845,18 @@ case YY_STATE_EOF(quotedstring):
|
||||
YY_BREAK
|
||||
case 76:
|
||||
YY_RULE_SETUP
|
||||
#line 181 "util/configlexer.lex"
|
||||
#line 189 "util/configlexer.lex"
|
||||
{ LEXOUT(("STR(%s) ", yytext)); yymore(); }
|
||||
YY_BREAK
|
||||
case 77:
|
||||
/* rule 77 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 182 "util/configlexer.lex"
|
||||
#line 190 "util/configlexer.lex"
|
||||
{ cfg_parser->line++; yymore(); }
|
||||
YY_BREAK
|
||||
case 78:
|
||||
YY_RULE_SETUP
|
||||
#line 183 "util/configlexer.lex"
|
||||
#line 191 "util/configlexer.lex"
|
||||
{
|
||||
LEXOUT(("QE "));
|
||||
BEGIN(INITIAL);
|
||||
@@ -1839,11 +1870,11 @@ YY_RULE_SETUP
|
||||
/* Single Quoted strings. Strip leading and ending quotes */
|
||||
case 79:
|
||||
YY_RULE_SETUP
|
||||
#line 194 "util/configlexer.lex"
|
||||
#line 202 "util/configlexer.lex"
|
||||
{ BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(singlequotedstr):
|
||||
#line 195 "util/configlexer.lex"
|
||||
#line 203 "util/configlexer.lex"
|
||||
{
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
@@ -1851,18 +1882,18 @@ case YY_STATE_EOF(singlequotedstr):
|
||||
YY_BREAK
|
||||
case 80:
|
||||
YY_RULE_SETUP
|
||||
#line 199 "util/configlexer.lex"
|
||||
#line 207 "util/configlexer.lex"
|
||||
{ LEXOUT(("STR(%s) ", yytext)); yymore(); }
|
||||
YY_BREAK
|
||||
case 81:
|
||||
/* rule 81 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 200 "util/configlexer.lex"
|
||||
#line 208 "util/configlexer.lex"
|
||||
{ cfg_parser->line++; yymore(); }
|
||||
YY_BREAK
|
||||
case 82:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "util/configlexer.lex"
|
||||
#line 209 "util/configlexer.lex"
|
||||
{
|
||||
LEXOUT(("SQE "));
|
||||
BEGIN(INITIAL);
|
||||
@@ -1876,11 +1907,11 @@ YY_RULE_SETUP
|
||||
/* include: directive */
|
||||
case 83:
|
||||
YY_RULE_SETUP
|
||||
#line 212 "util/configlexer.lex"
|
||||
#line 220 "util/configlexer.lex"
|
||||
{ LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(include):
|
||||
#line 213 "util/configlexer.lex"
|
||||
#line 221 "util/configlexer.lex"
|
||||
{
|
||||
yyerror("EOF inside include directive");
|
||||
BEGIN(INITIAL);
|
||||
@@ -1888,23 +1919,23 @@ case YY_STATE_EOF(include):
|
||||
YY_BREAK
|
||||
case 84:
|
||||
YY_RULE_SETUP
|
||||
#line 217 "util/configlexer.lex"
|
||||
#line 225 "util/configlexer.lex"
|
||||
{ LEXOUT(("ISP ")); /* ignore */ }
|
||||
YY_BREAK
|
||||
case 85:
|
||||
/* rule 85 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 218 "util/configlexer.lex"
|
||||
#line 226 "util/configlexer.lex"
|
||||
{ LEXOUT(("NL\n")); cfg_parser->line++;}
|
||||
YY_BREAK
|
||||
case 86:
|
||||
YY_RULE_SETUP
|
||||
#line 219 "util/configlexer.lex"
|
||||
#line 227 "util/configlexer.lex"
|
||||
{ LEXOUT(("IQS ")); BEGIN(include_quoted); }
|
||||
YY_BREAK
|
||||
case 87:
|
||||
YY_RULE_SETUP
|
||||
#line 220 "util/configlexer.lex"
|
||||
#line 228 "util/configlexer.lex"
|
||||
{
|
||||
LEXOUT(("Iunquotedstr(%s) ", yytext));
|
||||
config_start_include(yytext);
|
||||
@@ -1912,7 +1943,7 @@ YY_RULE_SETUP
|
||||
}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(include_quoted):
|
||||
#line 225 "util/configlexer.lex"
|
||||
#line 233 "util/configlexer.lex"
|
||||
{
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
@@ -1920,18 +1951,18 @@ case YY_STATE_EOF(include_quoted):
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 229 "util/configlexer.lex"
|
||||
#line 237 "util/configlexer.lex"
|
||||
{ LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
|
||||
YY_BREAK
|
||||
case 89:
|
||||
/* rule 89 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 230 "util/configlexer.lex"
|
||||
#line 238 "util/configlexer.lex"
|
||||
{ cfg_parser->line++; yymore(); }
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
#line 231 "util/configlexer.lex"
|
||||
#line 239 "util/configlexer.lex"
|
||||
{
|
||||
LEXOUT(("IQE "));
|
||||
yytext[yyleng - 1] = '\0';
|
||||
@@ -1940,7 +1971,7 @@ YY_RULE_SETUP
|
||||
}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
#line 237 "util/configlexer.lex"
|
||||
#line 245 "util/configlexer.lex"
|
||||
{
|
||||
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
|
||||
if (config_include_stack_ptr == 0) {
|
||||
@@ -1953,16 +1984,16 @@ case YY_STATE_EOF(INITIAL):
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
#line 247 "util/configlexer.lex"
|
||||
#line 255 "util/configlexer.lex"
|
||||
{ LEXOUT(("unquotedstr(%s) ", yytext));
|
||||
yylval.str = strdup(yytext); return STRING; }
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
#line 250 "util/configlexer.lex"
|
||||
#line 258 "util/configlexer.lex"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1965 "<stdout>"
|
||||
#line 1996 "<stdout>"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
@@ -2191,7 +2222,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
||||
(yy_n_chars), num_to_read );
|
||||
(yy_n_chars), (size_t) num_to_read );
|
||||
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
||||
}
|
||||
@@ -2215,6 +2246,14 @@ static int yy_get_next_buffer (void)
|
||||
else
|
||||
ret_val = EOB_ACT_CONTINUE_SCAN;
|
||||
|
||||
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
||||
/* Extend the array by 50%, plus the number we really need. */
|
||||
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
|
||||
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
||||
}
|
||||
|
||||
(yy_n_chars) += number_to_move;
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
|
||||
@@ -2593,7 +2632,9 @@ static void yyensure_buffer_stack (void)
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
|
||||
if ( ! (yy_buffer_stack) )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
||||
|
||||
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
(yy_buffer_stack_max) = num_to_alloc;
|
||||
@@ -2611,6 +2652,8 @@ static void yyensure_buffer_stack (void)
|
||||
((yy_buffer_stack),
|
||||
num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
if ( ! (yy_buffer_stack) )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
||||
|
||||
/* zero only the new slots.*/
|
||||
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
|
||||
@@ -2655,7 +2698,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
|
||||
|
||||
/** Setup the input buffer state to scan a string. The next call to yylex() will
|
||||
* scan from a @e copy of @a str.
|
||||
* @param str a NUL-terminated string to scan
|
||||
* @param yystr a NUL-terminated string to scan
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
* @note If you want to scan bytes that may contain NUL values, then use
|
||||
@@ -2909,7 +2952,7 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 250 "util/configlexer.lex"
|
||||
#line 258 "util/configlexer.lex"
|
||||
|
||||
|
||||
|
||||
|
||||
+10
-2
@@ -19,8 +19,6 @@
|
||||
#include "util/configparser.h"
|
||||
void ub_c_error(const char *message);
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
|
||||
#if 0
|
||||
#define LEXOUT(s) printf s /* used ONLY when debugging */
|
||||
#else
|
||||
@@ -83,6 +81,16 @@ static void config_end_include(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
%}
|
||||
%option noinput
|
||||
%option nounput
|
||||
%{
|
||||
#ifndef YY_NO_UNPUT
|
||||
#define YY_NO_UNPUT 1
|
||||
#endif
|
||||
#ifndef YY_NO_INPUT
|
||||
#define YY_NO_INPUT 1
|
||||
#endif
|
||||
%}
|
||||
|
||||
SPACE [ \t]
|
||||
|
||||
@@ -330,7 +330,7 @@ compress_any_dname(uint8_t* dname, ldns_buffer* pkt, int labs,
|
||||
struct regional* region, struct compress_tree_node** tree)
|
||||
{
|
||||
struct compress_tree_node* p;
|
||||
struct compress_tree_node** insertpt;
|
||||
struct compress_tree_node** insertpt = NULL;
|
||||
size_t pos = ldns_buffer_position(pkt);
|
||||
if((p = compress_tree_lookup(tree, dname, labs, &insertpt))) {
|
||||
if(!write_compressed_dname(pkt, dname, labs, p))
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
#include "util/data/packed_rrset.h"
|
||||
#include "util/storage/slabhash.h"
|
||||
#include "util/locks.h"
|
||||
#include "testcode/checklocks.h"
|
||||
#include "daemon/acl_list.h"
|
||||
#include "libunbound/libworker.h"
|
||||
#include "libunbound/context.h"
|
||||
|
||||
@@ -290,4 +290,22 @@ int fptr_whitelist_mod_get_mem(size_t (*fptr)(struct module_env* env, int id));
|
||||
*/
|
||||
int fptr_whitelist_alloc_cleanup(void (*fptr)(void*));
|
||||
|
||||
/** Due to module breakage by fptr wlist, these test app declarations
|
||||
* are presented here */
|
||||
/**
|
||||
* compare two order_ids from lock-verify test app
|
||||
* @param e1: first order_id
|
||||
* @param e2: second order_id
|
||||
* @return compare code -1, 0, +1 (like memcmp).
|
||||
*/
|
||||
int order_lock_cmp(const void* e1, const void* e2);
|
||||
|
||||
/**
|
||||
* compare two codeline structs for rbtree from memstats test app
|
||||
* @param a: codeline
|
||||
* @param b: codeline
|
||||
* @return compare code -1, 0, +1 (like memcmp).
|
||||
*/
|
||||
int codeline_cmp(const void* a, const void* b);
|
||||
|
||||
#endif /* UTIL_FPTR_WLIST_H */
|
||||
|
||||
@@ -3685,6 +3685,8 @@
|
||||
4081,
|
||||
4082,
|
||||
4083,
|
||||
4084,
|
||||
4086,
|
||||
4089,
|
||||
4090,
|
||||
4091,
|
||||
@@ -3831,6 +3833,7 @@
|
||||
4405,
|
||||
4406,
|
||||
4426,
|
||||
4441,
|
||||
4442,
|
||||
4443,
|
||||
4444,
|
||||
@@ -3868,6 +3871,7 @@
|
||||
4567,
|
||||
4568,
|
||||
4569,
|
||||
4592,
|
||||
4593,
|
||||
4594,
|
||||
4595,
|
||||
@@ -3954,10 +3958,12 @@
|
||||
4869,
|
||||
4870,
|
||||
4871,
|
||||
4884,
|
||||
4885,
|
||||
4894,
|
||||
4899,
|
||||
4900,
|
||||
4914,
|
||||
4940,
|
||||
4941,
|
||||
4942,
|
||||
@@ -4025,6 +4031,7 @@
|
||||
5083,
|
||||
5084,
|
||||
5085,
|
||||
5092,
|
||||
5093,
|
||||
5099,
|
||||
5100,
|
||||
@@ -4094,6 +4101,7 @@
|
||||
5316,
|
||||
5343,
|
||||
5344,
|
||||
5349,
|
||||
5350,
|
||||
5351,
|
||||
5352,
|
||||
@@ -4382,6 +4390,7 @@
|
||||
6628,
|
||||
6669,
|
||||
6670,
|
||||
6671,
|
||||
6672,
|
||||
6673,
|
||||
6701,
|
||||
@@ -4621,7 +4630,9 @@
|
||||
8207,
|
||||
8208,
|
||||
8230,
|
||||
8243,
|
||||
8276,
|
||||
8280,
|
||||
8292,
|
||||
8294,
|
||||
8300,
|
||||
@@ -4702,6 +4713,7 @@
|
||||
9025,
|
||||
9026,
|
||||
9080,
|
||||
9085,
|
||||
9086,
|
||||
9087,
|
||||
9088,
|
||||
@@ -4765,6 +4777,7 @@
|
||||
9397,
|
||||
9400,
|
||||
9401,
|
||||
9402,
|
||||
9418,
|
||||
9443,
|
||||
9500,
|
||||
@@ -4976,6 +4989,7 @@
|
||||
19539,
|
||||
19540,
|
||||
19541,
|
||||
19999,
|
||||
20000,
|
||||
20001,
|
||||
20002,
|
||||
@@ -5034,6 +5048,7 @@
|
||||
24249,
|
||||
24321,
|
||||
24386,
|
||||
24465,
|
||||
24554,
|
||||
24677,
|
||||
24678,
|
||||
|
||||
+126
-2
@@ -42,12 +42,15 @@
|
||||
#include "config.h"
|
||||
#include "util/locks.h"
|
||||
#include <signal.h>
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
/** block all signals, masks them away. */
|
||||
void
|
||||
ub_thread_blocksigs()
|
||||
{
|
||||
#if defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS) || defined(HAVE_SIGPROCMASK)
|
||||
int err;
|
||||
sigset_t sigset;
|
||||
sigfillset(&sigset);
|
||||
@@ -64,11 +67,13 @@ ub_thread_blocksigs()
|
||||
fatal_exit("sigprocmask: %s", strerror(errno));
|
||||
# endif /* HAVE_SOLARIS_THREADS */
|
||||
#endif /* HAVE_PTHREAD */
|
||||
#endif /* have signal stuff */
|
||||
}
|
||||
|
||||
/** unblock one signal, so we can catch it */
|
||||
void ub_thread_sig_unblock(int sig)
|
||||
{
|
||||
#if defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS) || defined(HAVE_SIGPROCMASK)
|
||||
int err;
|
||||
sigset_t sigset;
|
||||
sigemptyset(&sigset);
|
||||
@@ -86,9 +91,12 @@ void ub_thread_sig_unblock(int sig)
|
||||
fatal_exit("sigprocmask: %s", strerror(errno));
|
||||
# endif /* HAVE_SOLARIS_THREADS */
|
||||
#endif /* HAVE_PTHREAD */
|
||||
#else
|
||||
(void)sig;
|
||||
#endif /* have signal stuff */
|
||||
}
|
||||
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS) && !defined(HAVE_WINDOWS_THREADS)
|
||||
/**
|
||||
* No threading available: fork a new process.
|
||||
* This means no shared data structure, and no locking.
|
||||
@@ -128,7 +136,7 @@ void ub_thr_fork_wait(ub_thread_t thread)
|
||||
log_warn("process %d abnormal exit with status %d",
|
||||
(int)thread, status);
|
||||
}
|
||||
#endif /* !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS) */
|
||||
#endif /* !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS) && !defined(HAVE_WINDOWS_THREADS) */
|
||||
|
||||
#ifdef HAVE_SOLARIS_THREADS
|
||||
void* ub_thread_key_get(ub_thread_key_t key)
|
||||
@@ -138,3 +146,119 @@ void* ub_thread_key_get(ub_thread_key_t key)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_THREADS
|
||||
/** log a windows GetLastError message */
|
||||
static void log_win_err(const char* str, DWORD err)
|
||||
{
|
||||
LPTSTR buf;
|
||||
if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||
NULL, err, 0, (LPTSTR)&buf, 0, NULL) == 0) {
|
||||
/* could not format error message */
|
||||
log_err("%s, GetLastError=%d", str, (int)err);
|
||||
return;
|
||||
}
|
||||
log_err("%s, (err=%d): %s", str, (int)err, buf);
|
||||
LocalFree(buf);
|
||||
}
|
||||
|
||||
void lock_basic_init(lock_basic_t* lock)
|
||||
{
|
||||
*lock = CreateMutex(NULL, /* security attrs NULL, not process inherit*/
|
||||
0, /* false, we do not hold the lock initially */
|
||||
NULL); /* create anonymous mutex */
|
||||
if(*lock == NULL) {
|
||||
log_win_err("CreateMutex failed", GetLastError());
|
||||
fatal_exit("lock init failed");
|
||||
}
|
||||
}
|
||||
|
||||
void lock_basic_destroy(lock_basic_t* lock)
|
||||
{
|
||||
if(!CloseHandle(*lock)) {
|
||||
log_win_err("CloseHandle(Mutex) failed", GetLastError());
|
||||
}
|
||||
*lock = NULL;
|
||||
}
|
||||
|
||||
void lock_basic_lock(lock_basic_t* lock)
|
||||
{
|
||||
DWORD ret = WaitForSingleObject(*lock, INFINITE);
|
||||
if(ret == WAIT_FAILED) {
|
||||
log_win_err("WaitForSingleObject(Mutex):WAIT_FAILED",
|
||||
GetLastError());
|
||||
} else if(ret == WAIT_TIMEOUT) {
|
||||
log_win_err("WaitForSingleObject(Mutex):WAIT_TIMEOUT",
|
||||
GetLastError());
|
||||
}
|
||||
/* both WAIT_ABANDONED and WAIT_OBJECT_0 mean we have the lock */
|
||||
}
|
||||
|
||||
void lock_basic_unlock(lock_basic_t* lock)
|
||||
{
|
||||
if(!ReleaseMutex(*lock)) {
|
||||
log_win_err("ReleaseMutex failed", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
void ub_thread_key_create(ub_thread_key_t* key, void* f)
|
||||
{
|
||||
*key = TlsAlloc();
|
||||
if(*key == TLS_OUT_OF_INDEXES) {
|
||||
*key = 0;
|
||||
log_win_err("TlsAlloc Failed(OUT_OF_INDEXES)", GetLastError());
|
||||
}
|
||||
else ub_thread_key_set(*key, f);
|
||||
}
|
||||
|
||||
void ub_thread_key_set(ub_thread_key_t key, void* v)
|
||||
{
|
||||
if(!TlsSetValue(key, v)) {
|
||||
log_win_err("TlsSetValue failed", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
void* ub_thread_key_get(ub_thread_key_t key)
|
||||
{
|
||||
void* ret = (void*)TlsGetValue(key);
|
||||
if(ret == NULL && GetLastError() != ERROR_SUCCESS) {
|
||||
log_win_err("TlsGetValue failed", GetLastError());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ub_thread_create(ub_thread_t* thr, void* (*func)(void*), void* arg)
|
||||
{
|
||||
*thr = CreateThread(NULL, /* default security (no inherit handle) */
|
||||
0, /* default stack size */
|
||||
(LPTHREAD_START_ROUTINE)func, arg,
|
||||
0, /* default flags, run immediately */
|
||||
NULL); /* do not store thread identifier anywhere */
|
||||
if(*thr == NULL) {
|
||||
log_win_err("CreateThread failed", GetLastError());
|
||||
fatal_exit("thread create failed");
|
||||
}
|
||||
}
|
||||
|
||||
ub_thread_t ub_thread_self(void)
|
||||
{
|
||||
return GetCurrentThread();
|
||||
}
|
||||
|
||||
void ub_thread_join(ub_thread_t thr)
|
||||
{
|
||||
DWORD ret = WaitForSingleObject(thr, INFINITE);
|
||||
if(ret == WAIT_FAILED) {
|
||||
log_win_err("WaitForSingleObject(Thread):WAIT_FAILED",
|
||||
GetLastError());
|
||||
} else if(ret == WAIT_TIMEOUT) {
|
||||
log_win_err("WaitForSingleObject(Thread):WAIT_TIMEOUT",
|
||||
GetLastError());
|
||||
}
|
||||
/* and close the handle to the thread */
|
||||
if(!CloseHandle(thr)) {
|
||||
log_win_err("CloseHandle(Thread) failed", GetLastError());
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_WINDOWS_THREADS */
|
||||
|
||||
@@ -195,9 +195,48 @@ typedef thread_key_t ub_thread_key_t;
|
||||
#define ub_thread_key_set(key, v) LOCKRET(thr_setspecific(key, v))
|
||||
void* ub_thread_key_get(ub_thread_key_t key);
|
||||
|
||||
|
||||
#else /* we do not HAVE_SOLARIS_THREADS and no PTHREADS */
|
||||
/******************* WINDOWS THREADS ************************/
|
||||
#ifdef HAVE_WINDOWS_THREADS
|
||||
#include <windows.h>
|
||||
|
||||
/* Use a mutex */
|
||||
typedef HANDLE lock_rw_t;
|
||||
#define lock_rw_init(lock) lock_basic_init(lock)
|
||||
#define lock_rw_destroy(lock) lock_basic_destroy(lock)
|
||||
#define lock_rw_rdlock(lock) lock_basic_lock(lock)
|
||||
#define lock_rw_wrlock(lock) lock_basic_lock(lock)
|
||||
#define lock_rw_unlock(lock) lock_basic_unlock(lock)
|
||||
|
||||
/** the basic lock is a mutex, implemented opaquely, for error handling. */
|
||||
typedef HANDLE lock_basic_t;
|
||||
void lock_basic_init(lock_basic_t* lock);
|
||||
void lock_basic_destroy(lock_basic_t* lock);
|
||||
void lock_basic_lock(lock_basic_t* lock);
|
||||
void lock_basic_unlock(lock_basic_t* lock);
|
||||
|
||||
/** on windows no spinlock, use mutex too. */
|
||||
typedef HANDLE lock_quick_t;
|
||||
#define lock_quick_init(lock) lock_basic_init(lock)
|
||||
#define lock_quick_destroy(lock) lock_basic_destroy(lock)
|
||||
#define lock_quick_lock(lock) lock_basic_lock(lock)
|
||||
#define lock_quick_unlock(lock) lock_basic_unlock(lock)
|
||||
|
||||
/** Thread creation, create a default thread. */
|
||||
typedef HANDLE ub_thread_t;
|
||||
void ub_thread_create(ub_thread_t* thr, void* (*func)(void*), void* arg);
|
||||
ub_thread_t ub_thread_self(void);
|
||||
void ub_thread_join(ub_thread_t thr);
|
||||
typedef DWORD ub_thread_key_t;
|
||||
void ub_thread_key_create(ub_thread_key_t* key, void* f);
|
||||
void ub_thread_key_set(ub_thread_key_t key, void* v);
|
||||
void* ub_thread_key_get(ub_thread_key_t key);
|
||||
|
||||
#else /* we do not HAVE_SOLARIS_THREADS, PTHREADS or WINDOWS_THREADS */
|
||||
|
||||
/******************* NO THREADS ************************/
|
||||
#define THREADS_DISABLED 1
|
||||
/** In case there is no thread support, define locks to do nothing */
|
||||
typedef int lock_rw_t;
|
||||
#define lock_rw_init(lock) /* nop */
|
||||
@@ -235,6 +274,7 @@ typedef void* ub_thread_key_t;
|
||||
#define ub_thread_key_set(key, v) (key) = (v)
|
||||
#define ub_thread_key_get(key) (key)
|
||||
|
||||
#endif /* HAVE_WINDOWS_THREADS */
|
||||
#endif /* HAVE_SOLARIS_THREADS */
|
||||
#endif /* HAVE_PTHREAD */
|
||||
#endif /* USE_THREAD_DEBUG */
|
||||
|
||||
+110
-1
@@ -242,7 +242,7 @@ log_hex(const char* msg, void* data, size_t length)
|
||||
uint8_t* data8 = (uint8_t*)data;
|
||||
const char* hexchar = "0123456789ABCDEF";
|
||||
char buf[1024+1]; /* alloc blocksize hex chars + \0 */
|
||||
const size_t blocksize = 1024;
|
||||
const size_t blocksize = 512;
|
||||
size_t len;
|
||||
|
||||
if(length == 0) {
|
||||
@@ -270,3 +270,112 @@ void log_buf(enum verbosity_value level, const char* msg, ldns_buffer* buf)
|
||||
return;
|
||||
log_hex(msg, ldns_buffer_begin(buf), ldns_buffer_limit(buf));
|
||||
}
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
char* wsa_strerror(DWORD err)
|
||||
{
|
||||
static char unknown[32];
|
||||
|
||||
switch(err) {
|
||||
case WSA_INVALID_HANDLE: return "Specified event object handle is invalid.";
|
||||
case WSA_NOT_ENOUGH_MEMORY: return "Insufficient memory available.";
|
||||
case WSA_INVALID_PARAMETER: return "One or more parameters are invalid.";
|
||||
case WSA_OPERATION_ABORTED: return "Overlapped operation aborted.";
|
||||
case WSA_IO_INCOMPLETE: return "Overlapped I/O event object not in signaled state.";
|
||||
case WSA_IO_PENDING: return "Overlapped operations will complete later.";
|
||||
case WSAEINTR: return "Interrupted function call.";
|
||||
case WSAEBADF: return "File handle is not valid.";
|
||||
case WSAEACCES: return "Permission denied.";
|
||||
case WSAEFAULT: return "Bad address.";
|
||||
case WSAEINVAL: return "Invalid argument.";
|
||||
case WSAEMFILE: return "Too many open files.";
|
||||
case WSAEWOULDBLOCK: return "Resource temporarily unavailable.";
|
||||
case WSAEINPROGRESS: return "Operation now in progress.";
|
||||
case WSAEALREADY: return "Operation already in progress.";
|
||||
case WSAENOTSOCK: return "Socket operation on nonsocket.";
|
||||
case WSAEDESTADDRREQ: return "Destination address required.";
|
||||
case WSAEMSGSIZE: return "Message too long.";
|
||||
case WSAEPROTOTYPE: return "Protocol wrong type for socket.";
|
||||
case WSAENOPROTOOPT: return "Bad protocol option.";
|
||||
case WSAEPROTONOSUPPORT: return "Protocol not supported.";
|
||||
case WSAESOCKTNOSUPPORT: return "Socket type not supported.";
|
||||
case WSAEOPNOTSUPP: return "Operation not supported.";
|
||||
case WSAEPFNOSUPPORT: return "Protocol family not supported.";
|
||||
case WSAEAFNOSUPPORT: return "Address family not supported by protocol family.";
|
||||
case WSAEADDRINUSE: return "Address already in use.";
|
||||
case WSAEADDRNOTAVAIL: return "Cannot assign requested address.";
|
||||
case WSAENETDOWN: return "Network is down.";
|
||||
case WSAENETUNREACH: return "Network is unreachable.";
|
||||
case WSAENETRESET: return "Network dropped connection on reset.";
|
||||
case WSAECONNABORTED: return "Software caused connection abort.";
|
||||
case WSAECONNRESET: return "Connection reset by peer.";
|
||||
case WSAENOBUFS: return "No buffer space available.";
|
||||
case WSAEISCONN: return "Socket is already connected.";
|
||||
case WSAENOTCONN: return "Socket is not connected.";
|
||||
case WSAESHUTDOWN: return "Cannot send after socket shutdown.";
|
||||
case WSAETOOMANYREFS: return "Too many references.";
|
||||
case WSAETIMEDOUT: return "Connection timed out.";
|
||||
case WSAECONNREFUSED: return "Connection refused.";
|
||||
case WSAELOOP: return "Cannot translate name.";
|
||||
case WSAENAMETOOLONG: return "Name too long.";
|
||||
case WSAEHOSTDOWN: return "Host is down.";
|
||||
case WSAEHOSTUNREACH: return "No route to host.";
|
||||
case WSAENOTEMPTY: return "Directory not empty.";
|
||||
case WSAEPROCLIM: return "Too many processes.";
|
||||
case WSAEUSERS: return "User quota exceeded.";
|
||||
case WSAEDQUOT: return "Disk quota exceeded.";
|
||||
case WSAESTALE: return "Stale file handle reference.";
|
||||
case WSAEREMOTE: return "Item is remote.";
|
||||
case WSASYSNOTREADY: return "Network subsystem is unavailable.";
|
||||
case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range.";
|
||||
case WSANOTINITIALISED: return "Successful WSAStartup not yet performed.";
|
||||
case WSAEDISCON: return "Graceful shutdown in progress.";
|
||||
case WSAENOMORE: return "No more results.";
|
||||
case WSAECANCELLED: return "Call has been canceled.";
|
||||
case WSAEINVALIDPROCTABLE: return "Procedure call table is invalid.";
|
||||
case WSAEINVALIDPROVIDER: return "Service provider is invalid.";
|
||||
case WSAEPROVIDERFAILEDINIT: return "Service provider failed to initialize.";
|
||||
case WSASYSCALLFAILURE: return "System call failure.";
|
||||
case WSASERVICE_NOT_FOUND: return "Service not found.";
|
||||
case WSATYPE_NOT_FOUND: return "Class type not found.";
|
||||
case WSA_E_NO_MORE: return "No more results.";
|
||||
case WSA_E_CANCELLED: return "Call was canceled.";
|
||||
case WSAEREFUSED: return "Database query was refused.";
|
||||
case WSAHOST_NOT_FOUND: return "Host not found.";
|
||||
case WSATRY_AGAIN: return "Nonauthoritative host not found.";
|
||||
case WSANO_RECOVERY: return "This is a nonrecoverable error.";
|
||||
case WSANO_DATA: return "Valid name, no data record of requested type.";
|
||||
case WSA_QOS_RECEIVERS: return "QOS receivers.";
|
||||
case WSA_QOS_SENDERS: return "QOS senders.";
|
||||
case WSA_QOS_NO_SENDERS: return "No QOS senders.";
|
||||
case WSA_QOS_NO_RECEIVERS: return "QOS no receivers.";
|
||||
case WSA_QOS_REQUEST_CONFIRMED: return "QOS request confirmed.";
|
||||
case WSA_QOS_ADMISSION_FAILURE: return "QOS admission error.";
|
||||
case WSA_QOS_POLICY_FAILURE: return "QOS policy failure.";
|
||||
case WSA_QOS_BAD_STYLE: return "QOS bad style.";
|
||||
case WSA_QOS_BAD_OBJECT: return "QOS bad object.";
|
||||
case WSA_QOS_TRAFFIC_CTRL_ERROR: return "QOS traffic control error.";
|
||||
case WSA_QOS_GENERIC_ERROR: return "QOS generic error.";
|
||||
case WSA_QOS_ESERVICETYPE: return "QOS service type error.";
|
||||
case WSA_QOS_EFLOWSPEC: return "QOS flowspec error.";
|
||||
case WSA_QOS_EPROVSPECBUF: return "Invalid QOS provider buffer.";
|
||||
case WSA_QOS_EFILTERSTYLE: return "Invalid QOS filter style.";
|
||||
case WSA_QOS_EFILTERTYPE: return "Invalid QOS filter type.";
|
||||
case WSA_QOS_EFILTERCOUNT: return "Incorrect QOS filter count.";
|
||||
case WSA_QOS_EOBJLENGTH: return "Invalid QOS object length.";
|
||||
case WSA_QOS_EFLOWCOUNT: return "Incorrect QOS flow count.";
|
||||
/*case WSA_QOS_EUNKOWNPSOBJ: return "Unrecognized QOS object.";*/
|
||||
case WSA_QOS_EPOLICYOBJ: return "Invalid QOS policy object.";
|
||||
case WSA_QOS_EFLOWDESC: return "Invalid QOS flow descriptor.";
|
||||
case WSA_QOS_EPSFLOWSPEC: return "Invalid QOS provider-specific flowspec.";
|
||||
case WSA_QOS_EPSFILTERSPEC: return "Invalid QOS provider-specific filterspec.";
|
||||
case WSA_QOS_ESDMODEOBJ: return "Invalid QOS shape discard mode object.";
|
||||
case WSA_QOS_ESHAPERATEOBJ: return "Invalid QOS shaping rate object.";
|
||||
case WSA_QOS_RESERVED_PETYPE: return "Reserved policy QOS element type.";
|
||||
default:
|
||||
snprintf(unknown, sizeof(unknown),
|
||||
"unknown WSA error code %d", (int)err);
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
#endif /* USE_WINSOCK */
|
||||
|
||||
@@ -180,4 +180,13 @@ void log_vmsg(int pri, const char* type, const char* format, va_list args);
|
||||
# define log_assert(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
/**
|
||||
* Convert WSA error into string.
|
||||
* @param err: from WSAGetLastError()
|
||||
* @return: string.
|
||||
*/
|
||||
char* wsa_strerror(DWORD err);
|
||||
#endif /* USE_WINSOCK */
|
||||
|
||||
#endif /* UTIL_LOG_H */
|
||||
|
||||
+11
-7
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_MINI_EVENT
|
||||
#if defined(USE_MINI_EVENT) && !defined(USE_WINSOCK)
|
||||
#include <signal.h>
|
||||
#include "util/mini_event.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
@@ -295,10 +295,12 @@ int event_add(struct event* ev, struct timeval* tv)
|
||||
return -1;
|
||||
if( (ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
|
||||
ev->ev_base->fds[ev->ev_fd] = ev;
|
||||
if(ev->ev_events&EV_READ)
|
||||
FD_SET(ev->ev_fd, &ev->ev_base->reads);
|
||||
if(ev->ev_events&EV_WRITE)
|
||||
FD_SET(ev->ev_fd, &ev->ev_base->writes);
|
||||
if(ev->ev_events&EV_READ) {
|
||||
FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->reads);
|
||||
}
|
||||
if(ev->ev_events&EV_WRITE) {
|
||||
FD_SET(FD_SET_T ev->ev_fd, &ev->ev_base->writes);
|
||||
}
|
||||
if(ev->ev_fd > ev->ev_base->maxfd)
|
||||
ev->ev_base->maxfd = ev->ev_fd;
|
||||
}
|
||||
@@ -327,8 +329,8 @@ int event_del(struct event* ev)
|
||||
(void)rbtree_delete(ev->ev_base->times, &ev->node);
|
||||
if((ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
|
||||
ev->ev_base->fds[ev->ev_fd] = NULL;
|
||||
FD_CLR(ev->ev_fd, &ev->ev_base->reads);
|
||||
FD_CLR(ev->ev_fd, &ev->ev_base->writes);
|
||||
FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->reads);
|
||||
FD_CLR(FD_SET_T ev->ev_fd, &ev->ev_base->writes);
|
||||
}
|
||||
ev->added = 0;
|
||||
return 0;
|
||||
@@ -374,8 +376,10 @@ int signal_del(struct event* ev)
|
||||
}
|
||||
|
||||
#else /* USE_MINI_EVENT */
|
||||
#ifndef USE_WINSOCK
|
||||
int mini_ev_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* not USE_WINSOCK */
|
||||
#endif /* USE_MINI_EVENT */
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@
|
||||
#ifndef MINI_EVENT_H
|
||||
#define MINI_EVENT_H
|
||||
|
||||
#ifdef USE_MINI_EVENT
|
||||
#if defined(USE_MINI_EVENT) && !defined(USE_WINSOCK)
|
||||
|
||||
#ifndef HAVE_EVENT_BASE_FREE
|
||||
#define HAVE_EVENT_BASE_FREE
|
||||
@@ -124,7 +124,7 @@ struct event {
|
||||
void *ev_arg;
|
||||
};
|
||||
|
||||
/* function prototypes as they appear in event.h */
|
||||
/* function prototypes (some are as they appear in event.h) */
|
||||
/** create event base */
|
||||
void *event_init(uint32_t* time_secs, struct timeval* time_tv);
|
||||
/** get version */
|
||||
@@ -159,7 +159,7 @@ int signal_add(struct event *, struct timeval *);
|
||||
/** remove signal handler */
|
||||
int signal_del(struct event *);
|
||||
|
||||
#endif /* USE_MINI_EVENT */
|
||||
#endif /* USE_MINI_EVENT and not USE_WINSOCK */
|
||||
|
||||
/** compare events in tree, based on timevalue, ptr for uniqueness */
|
||||
int mini_ev_cmp(const void* a, const void* b);
|
||||
|
||||
+16
-15
@@ -82,6 +82,7 @@ write_socket(int s, const void *buf, size_t size)
|
||||
int
|
||||
fd_set_nonblock(int s)
|
||||
{
|
||||
#ifdef HAVE_FCNTL
|
||||
int flag;
|
||||
if((flag = fcntl(s, F_GETFL)) == -1) {
|
||||
log_err("can't fcntl F_GETFL: %s", strerror(errno));
|
||||
@@ -92,12 +93,20 @@ fd_set_nonblock(int s)
|
||||
log_err("can't fcntl F_SETFL: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
#elif defined(HAVE_IOCTLSOCKET)
|
||||
unsigned long on = 1;
|
||||
if(ioctlsocket(s, FIONBIO, &on) != 0) {
|
||||
log_err("can't ioctlsocket FIONBIO on: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
fd_set_block(int s)
|
||||
{
|
||||
#ifdef HAVE_FCNTL
|
||||
int flag;
|
||||
if((flag = fcntl(s, F_GETFL)) == -1) {
|
||||
log_err("cannot fcntl F_GETFL: %s", strerror(errno));
|
||||
@@ -108,6 +117,13 @@ fd_set_block(int s)
|
||||
log_err("cannot fcntl F_SETFL: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
#elif defined(HAVE_IOCTLSOCKET)
|
||||
unsigned long off = 0;
|
||||
if(ioctlsocket(s, FIONBIO, &off) != 0) {
|
||||
log_err("can't ioctlsocket FIONBIO off: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -118,21 +134,6 @@ is_pow2(size_t num)
|
||||
return (num & (num-1)) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
write_iov_buffer(ldns_buffer* buffer, struct iovec* iov, size_t iovlen)
|
||||
{
|
||||
size_t i;
|
||||
size_t s = 0;
|
||||
ldns_buffer_clear(buffer);
|
||||
for(i=0; i<iovlen; i++) {
|
||||
log_assert(ldns_buffer_position(buffer)+iov[i].iov_len
|
||||
<= ldns_buffer_capacity(buffer));
|
||||
s += iov[i].iov_len;
|
||||
ldns_buffer_write(buffer, iov[i].iov_base, iov[i].iov_len);
|
||||
}
|
||||
ldns_buffer_flip(buffer);
|
||||
}
|
||||
|
||||
void*
|
||||
memdup(void* data, size_t len)
|
||||
{
|
||||
|
||||
@@ -127,14 +127,6 @@ int fd_set_block(int s);
|
||||
*/
|
||||
int is_pow2(size_t num);
|
||||
|
||||
/**
|
||||
* Write iov vector into a buffer.
|
||||
* @param buffer: to write data into.
|
||||
* @param iov: iov vector
|
||||
* @param iovlen: length of iov vector
|
||||
*/
|
||||
void write_iov_buffer(ldns_buffer* buffer, struct iovec* iov, size_t iovlen);
|
||||
|
||||
/**
|
||||
* Allocate memory and copy over contents.
|
||||
* @param data: what to copy over.
|
||||
|
||||
+124
-19
@@ -54,11 +54,15 @@
|
||||
/* We define libevent structures here to hide the libevent stuff. */
|
||||
|
||||
#ifdef USE_MINI_EVENT
|
||||
#include "util/mini_event.h"
|
||||
#else
|
||||
/* we use libevent */
|
||||
#include <event.h>
|
||||
#endif
|
||||
# ifdef USE_WINSOCK
|
||||
# include "util/winsock_event.h"
|
||||
# else
|
||||
# include "util/mini_event.h"
|
||||
# endif /* USE_WINSOCK */
|
||||
#else /* USE_MINI_EVENT */
|
||||
/* we use libevent */
|
||||
# include <event.h>
|
||||
#endif /* USE_MINI_EVENT */
|
||||
|
||||
/**
|
||||
* The internal event structure for keeping libevent info for the event.
|
||||
@@ -218,7 +222,12 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet,
|
||||
ldns_buffer_remaining(packet), 0,
|
||||
addr, addrlen);
|
||||
if(sent == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
verbose(VERB_OPS, "sendto failed: %s", strerror(errno));
|
||||
#else
|
||||
verbose(VERB_OPS, "sendto failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(VERB_OPS, "remote address is",
|
||||
(struct sockaddr_storage*)addr, addrlen);
|
||||
return 0;
|
||||
@@ -238,7 +247,7 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet,
|
||||
/** print debug ancillary info */
|
||||
void p_ancil(const char* str, struct comm_reply* r)
|
||||
{
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO)
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO) && (defined(HAVE_RECVMSG) || defined(HAVE_SENDMSG))
|
||||
if(r->srctype != 4 && r->srctype != 6) {
|
||||
log_info("%s: unknown srctype %d", str, r->srctype);
|
||||
return;
|
||||
@@ -287,7 +296,7 @@ int
|
||||
comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
|
||||
struct sockaddr* addr, socklen_t addrlen, struct comm_reply* r)
|
||||
{
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO)
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_SENDMSG)
|
||||
ssize_t sent;
|
||||
struct msghdr msg;
|
||||
struct iovec iov[1];
|
||||
@@ -372,7 +381,7 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
|
||||
void
|
||||
comm_point_udp_ancil_callback(int fd, short event, void* arg)
|
||||
{
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO)
|
||||
#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
|
||||
struct comm_reply rep;
|
||||
struct msghdr msg;
|
||||
struct iovec iov[1];
|
||||
@@ -487,9 +496,16 @@ comm_point_udp_callback(int fd, short event, void* arg)
|
||||
ldns_buffer_remaining(rep.c->buffer), 0,
|
||||
(struct sockaddr*)&rep.addr, &rep.addrlen);
|
||||
if(recv == -1) {
|
||||
if(errno != EAGAIN && errno != EINTR) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno != EAGAIN && errno != EINTR)
|
||||
log_err("recvfrom failed: %s", strerror(errno));
|
||||
}
|
||||
#else
|
||||
if(WSAGetLastError() != WSAEINPROGRESS &&
|
||||
WSAGetLastError() != WSAECONNRESET &&
|
||||
WSAGetLastError()!= WSAEWOULDBLOCK)
|
||||
log_err("recvfrom failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
ldns_buffer_skip(rep.c->buffer, recv);
|
||||
@@ -541,16 +557,31 @@ comm_point_tcp_accept_callback(int fd, short event, void* arg)
|
||||
new_fd = accept(fd, (struct sockaddr*)&c_hdl->repinfo.addr,
|
||||
&c_hdl->repinfo.addrlen);
|
||||
if(new_fd == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
/* EINTR is signal interrupt. others are closed connection. */
|
||||
if( errno != EINTR
|
||||
#ifdef EWOULDBLOCK
|
||||
&& errno != EWOULDBLOCK
|
||||
#endif
|
||||
#ifdef ECONNABORTED
|
||||
&& errno != ECONNABORTED
|
||||
#endif
|
||||
#ifdef EPROTO
|
||||
&& errno != EPROTO
|
||||
#endif /* EPROTO */
|
||||
)
|
||||
return;
|
||||
log_err("accept failed: %s", strerror(errno));
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAECONNRESET)
|
||||
return;
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_READ);
|
||||
return ;
|
||||
}
|
||||
log_err("accept failed: %s", wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "remote address is", &c_hdl->repinfo.addr,
|
||||
c_hdl->repinfo.addrlen);
|
||||
return;
|
||||
@@ -629,16 +660,31 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok)
|
||||
log_assert(fd != -1);
|
||||
if(c->tcp_byte_count < sizeof(uint16_t)) {
|
||||
/* read length bytes */
|
||||
r = read(fd, ldns_buffer_at(c->buffer, c->tcp_byte_count),
|
||||
sizeof(uint16_t)-c->tcp_byte_count);
|
||||
r = recv(fd, ldns_buffer_at(c->buffer, c->tcp_byte_count),
|
||||
sizeof(uint16_t)-c->tcp_byte_count, 0);
|
||||
if(r == 0)
|
||||
return 0;
|
||||
else if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EINTR || errno == EAGAIN)
|
||||
return 1;
|
||||
#ifdef ECONNRESET
|
||||
if(errno == ECONNRESET && verbosity < 2)
|
||||
return 0; /* silence reset by peer */
|
||||
#endif
|
||||
log_err("read (in tcp s): %s", strerror(errno));
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() == WSAECONNRESET)
|
||||
return 0;
|
||||
if(WSAGetLastError() == WSAEINPROGRESS)
|
||||
return 1;
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_READ);
|
||||
return 1;
|
||||
}
|
||||
log_err("read (in tcp s): %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "remote address is", &c->repinfo.addr,
|
||||
c->repinfo.addrlen);
|
||||
return 0;
|
||||
@@ -663,14 +709,27 @@ comm_point_tcp_handle_read(int fd, struct comm_point* c, int short_ok)
|
||||
}
|
||||
|
||||
log_assert(ldns_buffer_remaining(c->buffer) > 0);
|
||||
r = read(fd, ldns_buffer_current(c->buffer),
|
||||
ldns_buffer_remaining(c->buffer));
|
||||
r = recv(fd, ldns_buffer_current(c->buffer),
|
||||
ldns_buffer_remaining(c->buffer), 0);
|
||||
if(r == 0) {
|
||||
return 0;
|
||||
} else if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EINTR || errno == EAGAIN)
|
||||
return 1;
|
||||
log_err("read (in tcp r): %s", strerror(errno));
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() == WSAECONNRESET)
|
||||
return 0;
|
||||
if(WSAGetLastError() == WSAEINPROGRESS)
|
||||
return 1;
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_READ);
|
||||
return 1;
|
||||
}
|
||||
log_err("read (in tcp r): %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "remote address is", &c->repinfo.addr,
|
||||
c->repinfo.addrlen);
|
||||
return 0;
|
||||
@@ -701,11 +760,19 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
||||
/* from Stevens, unix network programming, vol1, 3rd ed, p450*/
|
||||
int error = 0;
|
||||
socklen_t len = (socklen_t)sizeof(error);
|
||||
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0){
|
||||
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&error,
|
||||
&len) < 0){
|
||||
#ifndef USE_WINSOCK
|
||||
error = errno; /* on solaris errno is error */
|
||||
#else /* USE_WINSOCK */
|
||||
error = WSAGetLastError();
|
||||
#endif
|
||||
}
|
||||
#ifndef USE_WINSOCK
|
||||
#if defined(EINPROGRESS) && defined(EWOULDBLOCK)
|
||||
if(error == EINPROGRESS || error == EWOULDBLOCK)
|
||||
return 1; /* try again later */
|
||||
#endif
|
||||
#ifdef ECONNREFUSED
|
||||
else if(error == ECONNREFUSED && verbosity < 2)
|
||||
return 0; /* silence 'connection refused' */
|
||||
@@ -716,6 +783,18 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
||||
#endif
|
||||
else if(error != 0) {
|
||||
log_err("tcp connect: %s", strerror(error));
|
||||
#else /* USE_WINSOCK */
|
||||
/* examine error */
|
||||
if(error == WSAEINPROGRESS)
|
||||
return 1;
|
||||
else if(error == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_WRITE);
|
||||
return 1;
|
||||
} else if(error == WSAECONNREFUSED || error == WSAEHOSTUNREACH)
|
||||
return 0;
|
||||
else if(error != 0) {
|
||||
log_err("tcp connect: %s", wsa_strerror(error));
|
||||
#endif /* USE_WINSOCK */
|
||||
log_addr(0, "remote address is", &c->repinfo.addr,
|
||||
c->repinfo.addrlen);
|
||||
return 0;
|
||||
@@ -724,6 +803,7 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
||||
|
||||
if(c->tcp_byte_count < sizeof(uint16_t)) {
|
||||
uint16_t len = htons(ldns_buffer_limit(c->buffer));
|
||||
#ifdef HAVE_WRITEV
|
||||
struct iovec iov[2];
|
||||
iov[0].iov_base = (uint8_t*)&len + c->tcp_byte_count;
|
||||
iov[0].iov_len = sizeof(uint16_t) - c->tcp_byte_count;
|
||||
@@ -732,10 +812,24 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
||||
log_assert(iov[0].iov_len > 0);
|
||||
log_assert(iov[1].iov_len > 0);
|
||||
r = writev(fd, iov, 2);
|
||||
#else /* HAVE_WRITEV */
|
||||
r = send(fd, (void*)&len, sizeof(uint16_t), 0);
|
||||
#endif /* HAVE_WRITEV */
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EINTR || errno == EAGAIN)
|
||||
return 1;
|
||||
log_err("tcp writev: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEINPROGRESS)
|
||||
return 1;
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_WRITE);
|
||||
return 1;
|
||||
}
|
||||
log_err("tcp send s: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "remote address is", &c->repinfo.addr,
|
||||
c->repinfo.addrlen);
|
||||
return 0;
|
||||
@@ -747,16 +841,27 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
||||
sizeof(uint16_t));
|
||||
if(ldns_buffer_remaining(c->buffer) == 0) {
|
||||
tcp_callback_writer(c);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
log_assert(ldns_buffer_remaining(c->buffer) > 0);
|
||||
r = write(fd, ldns_buffer_current(c->buffer),
|
||||
ldns_buffer_remaining(c->buffer));
|
||||
r = send(fd, ldns_buffer_current(c->buffer),
|
||||
ldns_buffer_remaining(c->buffer), 0);
|
||||
if(r == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
if(errno == EINTR || errno == EAGAIN)
|
||||
return 1;
|
||||
log_err("tcp write: %s", strerror(errno));
|
||||
log_err("tcp send r: %s", strerror(errno));
|
||||
#else
|
||||
if(WSAGetLastError() == WSAEINPROGRESS)
|
||||
return 1;
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
winsock_tcp_wouldblock(&c->ev->ev, EV_WRITE);
|
||||
return 1;
|
||||
}
|
||||
log_err("tcp send r: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
#endif
|
||||
log_addr(0, "remote address is", &c->repinfo.addr,
|
||||
c->repinfo.addrlen);
|
||||
return 0;
|
||||
|
||||
+2
-1
@@ -122,7 +122,8 @@ ub_initstate(unsigned int seed, struct ub_randstate* from)
|
||||
ERR_get_error());
|
||||
return NULL;
|
||||
}
|
||||
verbose(VERB_OPS, "openssl has no entropy, seeding with time");
|
||||
verbose(VERB_OPS, "openssl has no entropy, seeding with time"
|
||||
" and pid");
|
||||
}
|
||||
ub_arc4random_stir(s, from);
|
||||
return s;
|
||||
|
||||
@@ -48,7 +48,7 @@ void
|
||||
bin_init(struct lruhash_bin* array, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
#ifdef THREADS_DISABLED
|
||||
(void)array;
|
||||
#endif
|
||||
for(i=0; i<size; i++) {
|
||||
@@ -122,7 +122,7 @@ bin_split(struct lruhash* table, struct lruhash_bin* newa,
|
||||
/* move entries to new table. Notice that since hash x is mapped to
|
||||
* bin x & mask, and new mask uses one more bit, so all entries in
|
||||
* one bin will go into the old bin or bin | newbit */
|
||||
#if defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)
|
||||
#ifndef THREADS_DISABLED
|
||||
int newbit = newmask - table->size_mask;
|
||||
#endif
|
||||
/* so, really, this task could also be threaded, per bin. */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user