/* Define to 1 if you have the <sys/param.h> header file. */
#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. */
#undef HAVE_SYS_SOCKET_H
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
+/* Define to 'int' if not defined */
+#undef rlim_t
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
-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
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
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 $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
if test "${ac_cv_type_socklen_t+set}" = set; then
# 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 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
AC_CHECK_TYPE(int8_t, char)
AC_TYPE_OFF_T
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_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
#!/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 POSIX qw(SEEK_END);
use Storable;
my $logfile = shift or die "Usage: parseunbound.pl --cron unboundlogfile";
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.
my @totalstats = ();
my $inblock = 0;
my @records = ('thread', 'queries', 'cachehits', 'recursions', 'recursionavg',
'outstandingmax', 'outstandingavg', 'outstandingexc',
- 'median25', 'median50', 'median75',
- '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_8192', 'us_16384', 'us_32768', 'us_65536', 'us_131072',
- 'us_262144', 'us_524288', 's_1', 's_2', 's_4', 's_8', 's_16',
- 's_32', 's_64', 's_128', 's_256', 's_512');
+ 'median25', 'median50', 'median75',
+ '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_8192', 'us_16384', 'us_32768', 'us_65536', 'us_131072',
+ 'us_262144', 'us_524288', 's_1', 's_2', 's_4', 's_8', 's_16',
+ 's_32', 's_64', 's_128', 's_256', 's_512');
+
+my $offset = 0;
+while ( !%$stats ) {
-for my $line ( <$in> ) {
+ $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);
#print ">> $line\n";
$stats = {
thread => $1,
queries => $2,
- cachehits => $3,
+ cachehits => $3,
recursions => $4,
};
#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+)/ ) {
$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;
}
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/ ) {
next;
}
- 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->{median50} = int($2 * 1000000);
- $stats->{median75} = int($3 * 1000000);
+ 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->{median50} = int($2 * 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;
}
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 = '';
- if ($fromms > 0) {
- $stats->{'ms_' . int($fromms)} = $counter;
+ if ($froms > 0) {
+ $stats->{'s_' . int($froms)} = $counter;
} else {
$stats->{'us_' . int($fromus)} = $counter;
}
- if ($fromms == '512') {
+ if ($froms == '512') {
$inblock = 0;
#push @totalstats, $stats;
# or print $stats.
else {
#print STDERR "Cannot parse line: $line (unexpected, inblock=$inblock)\n";
}
-}
-
-if ( ! $stats ) {
- die "Couldn't parse stats?!\n";
+ }
}
my @result;
for my $key ( @records ) {
- $stats->{$key} ||= 0;
- print STDERR "$key = " . $stats->{$key} . "\n" if $DEBUG;
+ $stats->{$key} ||= 0;
+ print STDERR "$key = " . $stats->{$key} . "\n" if $DEBUG;
push @result, $stats->{$key};
}
print join("\n", @result), "\n";
/* insert defaults, with '0' to ignore them if they are duplicates */
if(!acl_list_str_cfg(acl, "0.0.0.0/0", "refuse", 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))
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;
+ if(cfg->do_ip6) {
+ if(!acl_list_str_cfg(acl, "::0/0", "refuse", 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);
return 1;
}
#include <signal.h>
#include <fcntl.h>
#include <pwd.h>
-#include <sys/resource.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
#ifdef USE_MINI_EVENT
#include "util/mini_event.h"
16 April 2008: Wouter
- requirements doc, updated clean query returns.
+ - parseunbound.pl update from Kai Storbeck.
+ - sunos4 porting changes.
15 April 2008: Wouter
- fixup default rc.d pidfile location to /usr/local/etc.
early failure, faster on first query, but more traffic.
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 function to get signature data (or whole reply message).
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 in an ipv6 connected only environment unbound cannot use outgoing IP6
to send to ip4to6 mapped hosts, need ip4to6map of NS and disable
V6ONLY socket option.
-o support multiple dns messages in a TCP query stream for the unbound server.
o SIG(0) and TSIG.
o support OPT record placement on recv anywhere in the additional section.
o add local-file: config with authority features.
bits(RD, CD, DO, EDNS-present, AD)query, (Secure, Bogus)reply.
perhaps also see which slow auth servers cause >1sec values.
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,
to make timers in servicedquery independent of udpwait queues.
o 0x20 fallback so it can be enabled without trouble.
if(cfg->donotquery_localhost) {
if(!donotq_str_cfg(dq, "127.0.0.0/8"))
return 0;
- if(!donotq_str_cfg(dq, "::1"))
- return 0;
+ if(cfg->do_ip6) {
+ if(!donotq_str_cfg(dq, "::1"))
+ return 0;
+ }
}
donotq_init_parents(dq);
return 1;
static int
set_recvpktinfo(int s, int family)
{
+#if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IP_PKTINFO)
int on = 1;
+#else
+ (void)s;
+#endif
if(family == AF_INET6) {
# ifdef IPV6_RECVPKTINFO
if(setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO,
buf1, buf2);
#endif
}
+#else
+ (void)str;
+ (void)r;
#endif
}
}
return 1;
#else
+ (void)c;
+ (void)packet;
+ (void)addr;
+ (void)addrlen;
+ (void)r;
log_err("sendmsg: IPV6_PKTINFO not supported");
return 0;
#endif
break;
}
#else
+ (void)fd;
+ (void)event;
+ (void)arg;
fatal_exit("recvmsg: No support for IPV6_PKTINFO. "
"Please disable interface-automatic");
#endif