]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
porting.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 16 Apr 2008 16:09:25 +0000 (16:09 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 16 Apr 2008 16:09:25 +0000 (16:09 +0000)
git-svn-id: file:///svn/unbound/trunk@1056 be551aaa-1e26-0410-a405-d3ace91eadb9

config.h.in
configure
configure.ac
contrib/parseunbound.pl
daemon/acl_list.c
daemon/unbound.c
doc/Changelog
doc/TODO
iterator/iter_donotq.c
services/listen_dnsport.c
util/netevent.c

index dd3f19e4824ce2d3194e476cc958beca94a3f416..419f9d80143c18f2b88c96465b60ed0f4ce8a051 100644 (file)
 /* 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
 
index e66072ab61f08714f9a9112909d5b75fffc5b417..ccd7962757ad31d693ae9b12753439035a6f1e86 100755 (executable)
--- a/configure
+++ b/configure
@@ -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
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -20345,6 +20346,75 @@ _ACEOF
 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
index f77c89ef7fb190c2f8974c82055cad889ad6cf05..800990c31b38c2bb2e20a24f90c25c693e5a4b20 100644 (file)
@@ -349,7 +349,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 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)
@@ -367,6 +367,13 @@ AC_TYPE_PID_T
 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
index 281ffd7ec70958e3cb46219d3433d600b2cb1ef1..cd49739387cbcf954a26467d2cd5e9ede3700cfd 100644 (file)
@@ -1,4 +1,9 @@
 #!/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;
@@ -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 $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 = ();
@@ -30,15 +34,23 @@ my $stats = {};
 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";
 
@@ -48,39 +60,39 @@ for my $line ( <$in> ) {
                $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.
@@ -89,16 +101,13 @@ for my $line ( <$in> ) {
        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";
index 42a58fc02719e5eee9b246a782d47be0ac843638..ab28bb06676efacba2867a77751d542d3570d422 100644 (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 */
        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;
 }
index 7f352696ffeefeae0f136955fe7f0baf60728060..492cc88e5773d111f709bbbedeb0780b98c13515 100644 (file)
 #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"
index f205eef63671d1fa42f8a3e9ac3ef011d315d68b..2046283df4a8c6e545160aadf68078458bdb2f86 100644 (file)
@@ -1,5 +1,7 @@
 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.
index c08879468f7b2d384c354c993c39bc98b6ccd25f..c548f728742ff526932b0d705b1249ef53b885a1 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -28,13 +28,11 @@ o (option) proactively prime root, stubs and trust anchors, feature.
   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.
@@ -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.
        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.
index 352a674a799f860b0338553fd7c37609eced661d..553c5f44b97041dbd1c464747199a8dc9f4ccd88 100644 (file)
@@ -180,8 +180,10 @@ donotq_apply_cfg(struct iter_donotq* dq, struct config_file* cfg)
        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;
index bedcedc45d4aa3060fed40c97b04d3ad0c7e8ab2..5d6e867a1ee095498b78049b6cfa049307f29391 100644 (file)
@@ -262,7 +262,11 @@ port_insert(struct listen_port** list, int s, enum listen_type ftype)
 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,
index 23e15867c0fc15b97d9536e8dbfa9427cc4bd738..21f5dcc7d6e91b5b1ab28a202cfe12fdbea32019 100644 (file)
@@ -276,6 +276,9 @@ void p_ancil(const char* str, struct comm_reply* r)
                        buf1, buf2);
 #endif
        }
+#else
+       (void)str;
+       (void)r;
 #endif
 }
 
@@ -356,6 +359,11 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
        }
        return 1;
 #else
+       (void)c;
+       (void)packet;
+       (void)addr;
+       (void)addrlen;
+       (void)r;
        log_err("sendmsg: IPV6_PKTINFO not supported");
        return 0;
 #endif
@@ -448,6 +456,9 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
                        break;
        }
 #else
+       (void)fd;
+       (void)event;
+       (void)arg;
        fatal_exit("recvmsg: No support for IPV6_PKTINFO. "
                "Please disable interface-automatic");
 #endif