]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- added L.ROOT-SERVERS.NET. AAAA 2001:500:3::42 to builtin root hints.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Jan 2009 15:05:33 +0000 (15:05 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Jan 2009 15:05:33 +0000 (15:05 +0000)
- fixup so it works with libev-3.51 from http://dist.schmorp.de/libev/
- comm_timer_set performs base_set operation after event_add.

git-svn-id: file:///svn/unbound/trunk@1406 be551aaa-1e26-0410-a405-d3ace91eadb9

config.h.in
configure
configure.ac
daemon/daemon.c
daemon/worker.c
doc/Changelog
iterator/iter_hints.c
libunbound/libworker.c
testcode/fake_event.c
util/netevent.c
util/netevent.h

index 24ce31bd81cd2094cf4e7e0e5fdee13aa976b89e..90c9cbb5acae56ea989f393fe37c6389508ebd01 100644 (file)
@@ -52,6 +52,9 @@
 /* Define to 1 if you have the `EVP_sha512' function. */
 #undef HAVE_EVP_SHA512
 
+/* Define to 1 if you have the `ev_loop' function. */
+#undef HAVE_EV_LOOP
+
 /* Define to 1 if you have the `fcntl' function. */
 #undef HAVE_FCNTL
 
index cb93da9d56b1072098887cf92ebe1bf843b870dc..027766ebd5ed6a7b2b850797fe190d25a62a9cb2 100755 (executable)
--- a/configure
+++ b/configure
@@ -23235,6 +23235,100 @@ _ACEOF
 fi
 done
  # only in libevent 1.4.3 and later
+
+for ac_func in ev_loop
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+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.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+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_link") 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_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+ # only in libev. (tested on 3.51)
        if test -n "$BAK_LDFLAGS"; then
                LDFLAGS="$BAK_LDFLAGS"
        fi
index 7594283308a04a250ae7b62f458302ed01ae426c..3b84796435e95032117a4d715ceed9c6c5ccab4d 100644 (file)
@@ -705,6 +705,7 @@ large outgoing port ranges.  ])
        AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
        AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4? and later
        AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
+       AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
        if test -n "$BAK_LDFLAGS"; then
                LDFLAGS="$BAK_LDFLAGS"
        fi
index d0a3c8bb5dc0bf316efc9ca2936be0ffbecf29a3..5ee5b3d63ec8bc82f4a621b024c3f0ede827a385 100644 (file)
@@ -409,6 +409,12 @@ daemon_fork(struct daemon* daemon)
         * them to the newly created threads. 
         */
        daemon_create_workers(daemon);
+
+#ifdef HAVE_EV_LOOP
+       /* in libev the first inited base gets signals */
+       if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
+               fatal_exit("Could not initialize main thread");
+#endif
        
        /* Now create the threads and init the workers.
         * By the way, this is thread #0 (the main thread).
@@ -418,8 +424,11 @@ daemon_fork(struct daemon* daemon)
        /* Special handling for the main thread. This is the thread
         * that handles signals and remote control.
         */
+#ifndef HAVE_EV_LOOP
+       /* libevent has the last inited base get signals (or any base) */
        if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
                fatal_exit("Could not initialize main thread");
+#endif
        signal_handling_playback(daemon->workers[0]);
 
        /* Start resolver service on main thread. */
index 2fe4f127e6bc35fd5fddd557752ab69a711ae1a0..86ef6950a396e2019c2459df2e666dd4d0fdf2a1 100644 (file)
@@ -984,7 +984,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
 {
        unsigned int seed;
        worker->need_to_exit = 0;
-       worker->base = comm_base_create();
+       worker->base = comm_base_create(do_sigs);
        if(!worker->base) {
                log_err("could not create event handling base");
                worker_delete(worker);
index 8553f86ec6d78f0f21ea5c7d8e065e2df36202d6..2000841afa3efc0d26134c64e684d9b3d4a534aa 100644 (file)
@@ -1,5 +1,8 @@
 5 January 2009: Wouter
        - fixup getaddrinfo failure handling for remote control port.
+       - added L.ROOT-SERVERS.NET. AAAA 2001:500:3::42 to builtin root hints.
+       - fixup so it works with libev-3.51 from http://dist.schmorp.de/libev/
+       - comm_timer_set performs base_set operation after event_add.
 
 18 December 2008: Wouter
        - fixed bug reported by Duane Wessels: error in DLV lookup, would make
index 4a0ded07917b5d40357239345203a55763f5661a..b45e57f03765dd1107f545102f57178439736ebf 100644 (file)
@@ -133,6 +133,7 @@ compile_time_root_prime(struct regional* r, int do_ip4, int do_ip6)
        if(!ah(dp, r, "H.ROOT-SERVERS.NET.", "2001:500:1::803f:235")) return 0;
        if(!ah(dp, r, "J.ROOT-SERVERS.NET.", "2001:503:c27::2:30")) return 0;
        if(!ah(dp, r, "K.ROOT-SERVERS.NET.", "2001:7fd::1")) return 0;
+       if(!ah(dp, r, "L.ROOT-SERVERS.NET.", "2001:500:3::42")) return 0;
        if(!ah(dp, r, "M.ROOT-SERVERS.NET.", "2001:dc3::35")) return 0;
       }
        return dp;
index c4f68b984d33c39fe316a78ee6c5f3e1614e9a37..b18d555148748d063ee4ee04fce86207f6703f44 100644 (file)
@@ -141,7 +141,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
        }
        seed = 0;
 
-       w->base = comm_base_create();
+       w->base = comm_base_create(0);
        if(!w->base) {
                libworker_delete(w);
                return NULL;
index 47a9a271d391c6c95ca2f1f8416658f6abbf4d7e..ae80c5704567538e195f47a41aaeb6de9a03804f 100644 (file)
@@ -596,7 +596,7 @@ listen_delete(struct listen_dnsport* listen)
 }
 
 struct comm_base* 
-comm_base_create()
+comm_base_create(int ATTR_UNUSED(sigs))
 {
        /* we return the runtime structure instead. */
        struct replay_runtime* runtime = (struct replay_runtime*)
index b6038d5f585a8dc1559d7ac6f3fe2e15e202ed84..1538e51296a6febd0ad11a993cc5c21795a0fe79 100644 (file)
@@ -136,7 +136,7 @@ comm_base_now(struct comm_base* b)
 #endif /* USE_MINI_EVENT */
 
 struct comm_base* 
-comm_base_create()
+comm_base_create(int sigs)
 {
        struct comm_base* b = (struct comm_base*)calloc(1,
                sizeof(struct comm_base));
@@ -151,7 +151,16 @@ comm_base_create()
        /* use mini event time-sharing feature */
        b->eb->base = event_init(&b->eb->secs, &b->eb->now);
 #else
+#  ifdef HAVE_EV_LOOP
+       /* libev */
+       if(sigs)
+               b->eb->base=(struct event_base *)ev_default_loop(EVFLAG_AUTO);
+       else
+               b->eb->base=(struct event_base *)ev_loop_new(EVFLAG_AUTO);
+#  else
+       (void)sigs;
        b->eb->base = event_init();
+#  endif
 #endif
        if(!b->eb->base) {
                free(b->eb);
@@ -1553,6 +1562,9 @@ comm_timer_set(struct comm_timer* timer, struct timeval* tv)
                comm_timer_disable(timer);
        event_set(&timer->ev_timer->ev, -1, EV_PERSIST|EV_TIMEOUT,
                comm_timer_callback, timer);
+       if(event_base_set(timer->ev_timer->base->eb->base, 
+               &timer->ev_timer->ev) != 0)
+               log_err("comm_timer_set: set_base failed.");
        if(evtimer_add(&timer->ev_timer->ev, tv) != 0)
                log_err("comm_timer_set: evtimer_add failed.");
        timer->ev_timer->enabled = 1;
index 9cbe388867e0d86340e27ad2053b10d638843c8f..9b0b579e08cbc4eb3eb1280d3ab1f4ea173860fa 100644 (file)
@@ -260,9 +260,11 @@ struct comm_signal {
 
 /**
  * Create a new comm base.
+ * @param sigs: if true it attempts to create a default loop for 
+ *   signal handling.
  * @return: the new comm base. NULL on error.
  */
-struct comm_base* comm_base_create();
+struct comm_base* comm_base_create(int sigs);
 
 /**
  * Destroy a comm base.