From: Wouter Wijngaards Date: Mon, 5 Jan 2009 15:05:33 +0000 (+0000) Subject: - added L.ROOT-SERVERS.NET. AAAA 2001:500:3::42 to builtin root hints. X-Git-Tag: release-1.2.0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33ae9fd843ee1d582c63d13d1ff58680b4177389;p=thirdparty%2Funbound.git - 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. git-svn-id: file:///svn/unbound/trunk@1406 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index 24ce31bd8..90c9cbb5a 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure b/configure index cb93da9d5..027766ebd 100755 --- 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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 diff --git a/configure.ac b/configure.ac index 759428330..3b8479643 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/daemon/daemon.c b/daemon/daemon.c index d0a3c8bb5..5ee5b3d63 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -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. */ diff --git a/daemon/worker.c b/daemon/worker.c index 2fe4f127e..86ef6950a 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -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); diff --git a/doc/Changelog b/doc/Changelog index 8553f86ec..2000841af 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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 diff --git a/iterator/iter_hints.c b/iterator/iter_hints.c index 4a0ded079..b45e57f03 100644 --- a/iterator/iter_hints.c +++ b/iterator/iter_hints.c @@ -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; diff --git a/libunbound/libworker.c b/libunbound/libworker.c index c4f68b984..b18d55514 100644 --- a/libunbound/libworker.c +++ b/libunbound/libworker.c @@ -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; diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 47a9a271d..ae80c5704 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -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*) diff --git a/util/netevent.c b/util/netevent.c index b6038d5f5..1538e5129 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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; diff --git a/util/netevent.h b/util/netevent.h index 9cbe38886..9b0b579e0 100644 --- a/util/netevent.h +++ b/util/netevent.h @@ -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.