git-svn-id: file:///svn/unbound/trunk@1056 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-04-16 16:09:25 +00:00
parent a377c6a9d5
commit 30a1d557bd
11 changed files with 153 additions and 40 deletions

View file

@ -133,6 +133,9 @@
/* Define to 1 if you have the <sys/param.h> header file. */ /* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H #undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/socket.h> header file. */ /* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H #undef HAVE_SYS_SOCKET_H
@ -265,6 +268,9 @@
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef pid_t #undef pid_t
/* Define to 'int' if not defined */
#undef rlim_t
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t

72
configure vendored
View file

@ -19428,7 +19428,8 @@ fi
for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h arpa/inet.h syslog.h
for ac_header in stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.h sys/resource.h arpa/inet.h syslog.h
do do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@ -20345,6 +20346,75 @@ _ACEOF
fi fi
{ echo "$as_me:$LINENO: checking for rlim_t" >&5
echo $ECHO_N "checking for rlim_t... $ECHO_C" >&6; }
if test "${ac_cv_type_rlim_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
typedef rlim_t ac__type_new_;
int
main ()
{
if ((ac__type_new_ *) 0)
return 0;
if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_type_rlim_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_rlim_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_type_rlim_t" >&5
echo "${ECHO_T}$ac_cv_type_rlim_t" >&6; }
if test $ac_cv_type_rlim_t = yes; then
:
else
cat >>confdefs.h <<\_ACEOF
#define rlim_t unsigned long
_ACEOF
fi
{ echo "$as_me:$LINENO: checking for socklen_t" >&5 { echo "$as_me:$LINENO: checking for socklen_t" >&5
echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
if test "${ac_cv_type_socklen_t+set}" = set; then if test "${ac_cv_type_socklen_t+set}" = set; then

View file

@ -349,7 +349,7 @@ AC_PROG_LIBTOOL
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([stdarg.h stdbool.h netinet/in.h sys/param.h sys/socket.h sys/uio.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],,, [AC_INCLUDES_DEFAULT])
# check for types # check for types
AC_CHECK_TYPE(int8_t, char) AC_CHECK_TYPE(int8_t, char)
@ -367,6 +367,13 @@ AC_TYPE_PID_T
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_CHECK_TYPE(u_char, unsigned char) AC_CHECK_TYPE(u_char, unsigned char)
AC_CHECK_TYPE(rlim_t, ,
[AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
])
AC_CHECK_TYPE(socklen_t, , AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT AC_INCLUDES_DEFAULT

View file

@ -1,4 +1,9 @@
#!/usr/local/bin/perl -w #!/usr/local/bin/perl -w
#
# Script to gather statistical info from the unbound logfile.
# NB: this script does not support multiple threads.
#
use strict; use strict;
use POSIX qw(SEEK_END); use POSIX qw(SEEK_END);
use Storable; use Storable;
@ -20,7 +25,6 @@ if ( -r UNBOUND_CACHE && -M _ < 3/24/60 && !$run_from_cron ) {
my $logfile = shift or die "Usage: parseunbound.pl --cron unboundlogfile"; my $logfile = shift or die "Usage: parseunbound.pl --cron unboundlogfile";
my $in = new FileHandle $logfile or die "Cannot open $logfile: $!\n"; my $in = new FileHandle $logfile or die "Cannot open $logfile: $!\n";
$in->seek(-2500, SEEK_END) or croak "cannot seek $logfile: $!\n";
# Stats array containing 1 or more stats hashes. # Stats array containing 1 or more stats hashes.
my @totalstats = (); my @totalstats = ();
@ -30,15 +34,23 @@ my $stats = {};
my $inblock = 0; my $inblock = 0;
my @records = ('thread', 'queries', 'cachehits', 'recursions', 'recursionavg', my @records = ('thread', 'queries', 'cachehits', 'recursions', 'recursionavg',
'outstandingmax', 'outstandingavg', 'outstandingexc', 'outstandingmax', 'outstandingavg', 'outstandingexc',
'median25', 'median50', 'median75', 'median25', 'median50', 'median75',
'us_0', 'us_1', 'us_2', 'us_4', 'us_8', 'us_16', 'us_32', 'us_64', 'us_0', 'us_1', 'us_2', 'us_4', 'us_8', 'us_16', 'us_32', 'us_64',
'us_128', 'us_256', 'us_512', 'us_1024', 'us_2048', 'us_4096', 'us_128', 'us_256', 'us_512', 'us_1024', 'us_2048', 'us_4096',
'us_8192', 'us_16384', 'us_32768', 'us_65536', 'us_131072', 'us_8192', 'us_16384', 'us_32768', 'us_65536', 'us_131072',
'us_262144', 'us_524288', 's_1', 's_2', 's_4', 's_8', 's_16', 'us_262144', 'us_524288', 's_1', 's_2', 's_4', 's_8', 's_16',
's_32', 's_64', 's_128', 's_256', 's_512'); 's_32', 's_64', 's_128', 's_256', 's_512');
my $offset = 0;
for my $line ( <$in> ) { while ( !%$stats ) {
$offset += 2500;
if ( $offset > -s $logfile or $offset > 10_000_000 ) {
die "Cannot find stats in $logfile\n";
}
$in->seek(-$offset, SEEK_END) or croak "cannot seek $logfile: $!\n";
for my $line ( <$in> ) {
chomp($line); chomp($line);
#print ">> $line\n"; #print ">> $line\n";
@ -48,39 +60,39 @@ for my $line ( <$in> ) {
$stats = { $stats = {
thread => $1, thread => $1,
queries => $2, queries => $2,
cachehits => $3, cachehits => $3,
recursions => $4, recursions => $4,
}; };
#print STDERR "Parsing stats from thread " . $stats->{thread} . "\n"; #print STDERR "Parsing stats from thread " . $stats->{thread} . "\n";
} }
elsif ( $inblock && $line =~ m/info: server stats for thread (\d+): requestlist max (\d+) avg ([0-9\.]+) exceeded (\d+)/ ) { elsif ( $inblock && $line =~ m/info: server stats for thread (\d+): requestlist max (\d+) avg ([0-9\.]+) exceeded (\d+)/ ) {
$stats->{outstandingmax} = $2; $stats->{outstandingmax} = $2;
$stats->{outstandingavg} = int($3); # This is a float; rrdtool only handles ints. $stats->{outstandingavg} = int($3); # This is a float; rrdtool only handles ints.
$stats->{outstandingexc} = $4; $stats->{outstandingexc} = $4;
} }
if ( $inblock && $line =~ m/info: average recursion processing time ([0-9\.]+) sec/ ) { if ( $inblock && $line =~ m/info: average recursion processing time ([0-9\.]+) sec/ ) {
$stats->{recursionavg} = int($1 * 1000); # change sec to milisec. $stats->{recursionavg} = int($1 * 1000); # change sec to milisec.
} }
if ( $inblock && $line =~ m/info: histogram of recursion processing times/ ) { if ( $inblock && $line =~ m/info: histogram of recursion processing times/ ) {
next; next;
} }
if ( $inblock && $line =~ m/info: \[25%\]=([0-9\.]+) median\[50%\]=([0-9\.]+) \[75%\]=([0-9\.]+)/ ) { if ( $inblock && $line =~ m/info: \[25%\]=([0-9\.]+) median\[50%\]=([0-9\.]+) \[75%\]=([0-9\.]+)/ ) {
$stats->{median25} = int($1 * 1000000); # change seconds to usec $stats->{median25} = int($1 * 1000000); # change seconds to usec
$stats->{median50} = int($2 * 1000000); $stats->{median50} = int($2 * 1000000);
$stats->{median75} = int($3 * 1000000); $stats->{median75} = int($3 * 1000000);
} }
if ( $inblock && $line =~ m/info: lower\(secs\) upper\(secs\) recursions/ ) { if ( $inblock && $line =~ m/info: lower\(secs\) upper\(secs\) recursions/ ) {
next; next;
} }
elsif ( $inblock && $line =~ m/info:\s+(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)/ ) { elsif ( $inblock && $line =~ m/info:\s+(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)/ ) {
my ($fromms, $fromus, $toms, $tous, $counter) = ($1, $2, $3, $4, $5); my ($froms, $fromus, $toms, $tous, $counter) = ($1, $2, $3, $4, $5);
my $prefix = ''; my $prefix = '';
if ($fromms > 0) { if ($froms > 0) {
$stats->{'ms_' . int($fromms)} = $counter; $stats->{'s_' . int($froms)} = $counter;
} else { } else {
$stats->{'us_' . int($fromus)} = $counter; $stats->{'us_' . int($fromus)} = $counter;
} }
if ($fromms == '512') { if ($froms == '512') {
$inblock = 0; $inblock = 0;
#push @totalstats, $stats; #push @totalstats, $stats;
# or print $stats. # or print $stats.
@ -89,16 +101,13 @@ for my $line ( <$in> ) {
else { else {
#print STDERR "Cannot parse line: $line (unexpected, inblock=$inblock)\n"; #print STDERR "Cannot parse line: $line (unexpected, inblock=$inblock)\n";
} }
} }
if ( ! $stats ) {
die "Couldn't parse stats?!\n";
} }
my @result; my @result;
for my $key ( @records ) { for my $key ( @records ) {
$stats->{$key} ||= 0; $stats->{$key} ||= 0;
print STDERR "$key = " . $stats->{$key} . "\n" if $DEBUG; print STDERR "$key = " . $stats->{$key} . "\n" if $DEBUG;
push @result, $stats->{$key}; push @result, $stats->{$key};
} }
print join("\n", @result), "\n"; print join("\n", @result), "\n";

View file

@ -194,14 +194,16 @@ acl_list_apply_cfg(struct acl_list* acl, struct config_file* cfg)
/* insert defaults, with '0' to ignore them if they are duplicates */ /* insert defaults, with '0' to ignore them if they are duplicates */
if(!acl_list_str_cfg(acl, "0.0.0.0/0", "refuse", 0)) if(!acl_list_str_cfg(acl, "0.0.0.0/0", "refuse", 0))
return 0; return 0;
if(!acl_list_str_cfg(acl, "::0/0", "refuse", 0))
return 0;
if(!acl_list_str_cfg(acl, "127.0.0.0/8", "allow", 0)) if(!acl_list_str_cfg(acl, "127.0.0.0/8", "allow", 0))
return 0; return 0;
if(!acl_list_str_cfg(acl, "::1", "allow", 0)) if(cfg->do_ip6) {
return 0; if(!acl_list_str_cfg(acl, "::0/0", "refuse", 0))
if(!acl_list_str_cfg(acl, "::ffff:127.0.0.1", "allow", 0)) return 0;
return 0; if(!acl_list_str_cfg(acl, "::1", "allow", 0))
return 0;
if(!acl_list_str_cfg(acl, "::ffff:127.0.0.1", "allow", 0))
return 0;
}
acl_list_init_parents(acl); acl_list_init_parents(acl);
return 1; return 1;
} }

View file

@ -53,8 +53,10 @@
#include <signal.h> #include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <pwd.h> #include <pwd.h>
#include <sys/resource.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef USE_MINI_EVENT #ifdef USE_MINI_EVENT
#include "util/mini_event.h" #include "util/mini_event.h"

View file

@ -1,5 +1,7 @@
16 April 2008: Wouter 16 April 2008: Wouter
- requirements doc, updated clean query returns. - requirements doc, updated clean query returns.
- parseunbound.pl update from Kai Storbeck.
- sunos4 porting changes.
15 April 2008: Wouter 15 April 2008: Wouter
- fixup default rc.d pidfile location to /usr/local/etc. - fixup default rc.d pidfile location to /usr/local/etc.

View file

@ -28,13 +28,11 @@ o (option) proactively prime root, stubs and trust anchors, feature.
early failure, faster on first query, but more traffic. early failure, faster on first query, but more traffic.
o On Windows use CryptGenRandom() to get random seed for arc4random. o On Windows use CryptGenRandom() to get random seed for arc4random.
o library add convenience functions for A, AAAA, PTR, getaddrinfo, libresolve. o library add convenience functions for A, AAAA, PTR, getaddrinfo, libresolve.
o library add function to get signature data (or whole reply message).
o library add function to validate input from app that is signed. o library add function to validate input from app that is signed.
o add dynamic-update requests (making a dynupd request) to libunbound api. o add dynamic-update requests (making a dynupd request) to libunbound api.
o in an ipv6 connected only environment unbound cannot use outgoing IP6 o in an ipv6 connected only environment unbound cannot use outgoing IP6
to send to ip4to6 mapped hosts, need ip4to6map of NS and disable to send to ip4to6 mapped hosts, need ip4to6map of NS and disable
V6ONLY socket option. V6ONLY socket option.
o support multiple dns messages in a TCP query stream for the unbound server.
o SIG(0) and TSIG. o SIG(0) and TSIG.
o support OPT record placement on recv anywhere in the additional section. o support OPT record placement on recv anywhere in the additional section.
o add local-file: config with authority features. o add local-file: config with authority features.
@ -46,7 +44,7 @@ o (option) for extended statistics. If enabled (not by default) collect print
bits(RD, CD, DO, EDNS-present, AD)query, (Secure, Bogus)reply. bits(RD, CD, DO, EDNS-present, AD)query, (Secure, Bogus)reply.
perhaps also see which slow auth servers cause >1sec values. perhaps also see which slow auth servers cause >1sec values.
stats-file possible with key: value or key=value lines in it. stats-file possible with key: value or key=value lines in it.
stats on SIGUSR1. stats on SIGUSR1. addup stats over threads.
o overhaul outside-network servicedquery to merge with udpwait and tcpwait, o overhaul outside-network servicedquery to merge with udpwait and tcpwait,
to make timers in servicedquery independent of udpwait queues. to make timers in servicedquery independent of udpwait queues.
o 0x20 fallback so it can be enabled without trouble. o 0x20 fallback so it can be enabled without trouble.

View file

@ -180,8 +180,10 @@ donotq_apply_cfg(struct iter_donotq* dq, struct config_file* cfg)
if(cfg->donotquery_localhost) { if(cfg->donotquery_localhost) {
if(!donotq_str_cfg(dq, "127.0.0.0/8")) if(!donotq_str_cfg(dq, "127.0.0.0/8"))
return 0; return 0;
if(!donotq_str_cfg(dq, "::1")) if(cfg->do_ip6) {
return 0; if(!donotq_str_cfg(dq, "::1"))
return 0;
}
} }
donotq_init_parents(dq); donotq_init_parents(dq);
return 1; return 1;

View file

@ -262,7 +262,11 @@ port_insert(struct listen_port** list, int s, enum listen_type ftype)
static int static int
set_recvpktinfo(int s, int family) set_recvpktinfo(int s, int family)
{ {
#if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IP_PKTINFO)
int on = 1; int on = 1;
#else
(void)s;
#endif
if(family == AF_INET6) { if(family == AF_INET6) {
# ifdef IPV6_RECVPKTINFO # ifdef IPV6_RECVPKTINFO
if(setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, if(setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO,

View file

@ -276,6 +276,9 @@ void p_ancil(const char* str, struct comm_reply* r)
buf1, buf2); buf1, buf2);
#endif #endif
} }
#else
(void)str;
(void)r;
#endif #endif
} }
@ -356,6 +359,11 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
} }
return 1; return 1;
#else #else
(void)c;
(void)packet;
(void)addr;
(void)addrlen;
(void)r;
log_err("sendmsg: IPV6_PKTINFO not supported"); log_err("sendmsg: IPV6_PKTINFO not supported");
return 0; return 0;
#endif #endif
@ -448,6 +456,9 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
break; break;
} }
#else #else
(void)fd;
(void)event;
(void)arg;
fatal_exit("recvmsg: No support for IPV6_PKTINFO. " fatal_exit("recvmsg: No support for IPV6_PKTINFO. "
"Please disable interface-automatic"); "Please disable interface-automatic");
#endif #endif