summaryrefslogtreecommitdiff
path: root/contrib/unbound/daemon
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2013-09-15 00:36:18 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2013-09-15 00:36:18 +0000
commit04b59eac33bdaaa5080c08e0d01adacc0f20cfc8 (patch)
treedb350d281e6140731c10d0c9e2991b25cb238d39 /contrib/unbound/daemon
parentf41b5392e61945d9c796a5717809ddd5d34d768a (diff)
downloadsrc-test2-04b59eac33bdaaa5080c08e0d01adacc0f20cfc8.tar.gz
src-test2-04b59eac33bdaaa5080c08e0d01adacc0f20cfc8.zip
Numerous fixes to make Unbound compile cleanly:
- cast through void * to silence alignment warnings (presumably false positives resulting from poor API design) - constify a few function arguments - move prototypes for callbacks into a common header - now that the prototypes are in scope, fix instances of function definitions that don't match the prototype or what the caller actually passes - hide a conditionally unused global variable behind the same #ifdef that controls its use Approved by: re (blanket)
Notes
Notes: svn path=/head/; revision=255579
Diffstat (limited to 'contrib/unbound/daemon')
-rw-r--r--contrib/unbound/daemon/cachedump.c2
-rw-r--r--contrib/unbound/daemon/remote.c4
-rw-r--r--contrib/unbound/daemon/remote.h9
-rw-r--r--contrib/unbound/daemon/unbound.c3
-rw-r--r--contrib/unbound/daemon/worker.c15
-rw-r--r--contrib/unbound/daemon/worker.h68
6 files changed, 15 insertions, 86 deletions
diff --git a/contrib/unbound/daemon/cachedump.c b/contrib/unbound/daemon/cachedump.c
index 46c625f061af..9d941d7171ff 100644
--- a/contrib/unbound/daemon/cachedump.c
+++ b/contrib/unbound/daemon/cachedump.c
@@ -299,7 +299,7 @@ copy_msg(struct regional* region, struct lruhash_entry* e,
sizeof(struct ub_packed_rrset_key*) * rep->rrset_count);
if(!*d)
return 0;
- (*d)->rrsets = (struct ub_packed_rrset_key**)(
+ (*d)->rrsets = (struct ub_packed_rrset_key**)(void *)(
(uint8_t*)(&((*d)->ref[0])) +
sizeof(struct rrset_ref) * rep->rrset_count);
*k = (struct query_info*)regional_alloc_init(region,
diff --git a/contrib/unbound/daemon/remote.c b/contrib/unbound/daemon/remote.c
index 5dc05c5fa49f..ba02d7de100f 100644
--- a/contrib/unbound/daemon/remote.c
+++ b/contrib/unbound/daemon/remote.c
@@ -648,7 +648,7 @@ print_thread_stats(SSL* ssl, int i, struct stats_info* s)
/** print long number */
static int
-print_longnum(SSL* ssl, char* desc, size_t x)
+print_longnum(SSL* ssl, const char* desc, size_t x)
{
if(x > 1024*1024*1024) {
/* more than a Gb */
@@ -1380,7 +1380,7 @@ do_flush_name(SSL* ssl, struct worker* w, char* arg)
/** printout a delegation point info */
static int
-ssl_print_name_dp(SSL* ssl, char* str, uint8_t* nm, uint16_t dclass,
+ssl_print_name_dp(SSL* ssl, const char* str, uint8_t* nm, uint16_t dclass,
struct delegpt* dp)
{
char buf[257];
diff --git a/contrib/unbound/daemon/remote.h b/contrib/unbound/daemon/remote.h
index 8d5b41257433..7d922bd7677a 100644
--- a/contrib/unbound/daemon/remote.h
+++ b/contrib/unbound/daemon/remote.h
@@ -157,12 +157,6 @@ void daemon_remote_start_accept(struct daemon_remote* rc);
*/
void daemon_remote_exec(struct worker* worker);
-/** handle remote control accept callbacks */
-int remote_accept_callback(struct comm_point*, void*, int, struct comm_reply*);
-
-/** handle remote control data callbacks */
-int remote_control_callback(struct comm_point*, void*, int, struct comm_reply*);
-
#ifdef HAVE_SSL
/**
* Print fixed line of text over ssl connection in blocking mode
@@ -192,7 +186,4 @@ int ssl_printf(SSL* ssl, const char* format, ...)
int ssl_read_line(SSL* ssl, char* buf, size_t max);
#endif /* HAVE_SSL */
-/** routine to printout option values over SSL */
-void remote_get_opt_ssl(char* line, void* arg);
-
#endif /* DAEMON_REMOTE_H */
diff --git a/contrib/unbound/daemon/unbound.c b/contrib/unbound/daemon/unbound.c
index cd08c9c3f185..4ad6ffd4af3c 100644
--- a/contrib/unbound/daemon/unbound.c
+++ b/contrib/unbound/daemon/unbound.c
@@ -53,6 +53,7 @@
#include "services/listen_dnsport.h"
#include "services/cache/rrset.h"
#include "services/cache/infra.h"
+#include "util/fptr_wlist.h"
#include "util/data/msgreply.h"
#include "util/module.h"
#include "util/net_help.h"
@@ -92,8 +93,10 @@
# include "nss.h"
#endif
+#ifdef HAVE_SBRK
/** global debug value to keep track of heap memory allocation */
void* unbound_start_brk = 0;
+#endif
#if !defined(HAVE_EVENT_BASE_GET_METHOD) && (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP))
static const char* ev_backend2str(int b)
diff --git a/contrib/unbound/daemon/worker.c b/contrib/unbound/daemon/worker.c
index eeb323c8426a..0e5b14d4c0cb 100644
--- a/contrib/unbound/daemon/worker.c
+++ b/contrib/unbound/daemon/worker.c
@@ -70,6 +70,8 @@
#include "iterator/iter_hints.h"
#include "validator/autotrust.h"
#include "validator/val_anchor.h"
+#include "libunbound/context.h"
+#include "libunbound/libworker.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -819,7 +821,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
verbose(VERB_ALGO, "query with bad edns version.");
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
error_encode(c->buffer, EDNS_RCODE_BADVERS&0xf, &qinfo,
- *(uint16_t*)ldns_buffer_begin(c->buffer),
+ *(uint16_t*)(void *)ldns_buffer_begin(c->buffer),
ldns_buffer_read_u16_at(c->buffer, 2), NULL);
attach_edns_record(c->buffer, &edns);
return 1;
@@ -883,7 +885,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
/* answer from cache - we have acquired a readlock on it */
if(answer_from_cache(worker, &qinfo,
(struct reply_info*)e->data,
- *(uint16_t*)ldns_buffer_begin(c->buffer),
+ *(uint16_t*)(void *)ldns_buffer_begin(c->buffer),
ldns_buffer_read_u16_at(c->buffer, 2), repinfo,
&edns)) {
/* prefetch it if the prefetch TTL expired */
@@ -905,7 +907,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
}
if(!LDNS_RD_WIRE(ldns_buffer_begin(c->buffer))) {
if(answer_norec_from_cache(worker, &qinfo,
- *(uint16_t*)ldns_buffer_begin(c->buffer),
+ *(uint16_t*)(void *)ldns_buffer_begin(c->buffer),
ldns_buffer_read_u16_at(c->buffer, 2), repinfo,
&edns)) {
return 1;
@@ -926,8 +928,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
/* grab a work request structure for this new request */
mesh_new_client(worker->env.mesh, &qinfo,
- ldns_buffer_read_u16_at(c->buffer, 2),
- &edns, repinfo, *(uint16_t*)ldns_buffer_begin(c->buffer));
+ ldns_buffer_read_u16_at(c->buffer, 2), &edns, repinfo,
+ *(uint16_t*)(void *)ldns_buffer_begin(c->buffer));
worker_mem_report(worker, NULL);
return 0;
}
@@ -1303,7 +1305,8 @@ struct outbound_entry* libworker_send_query(uint8_t* ATTR_UNUSED(qname),
uint16_t ATTR_UNUSED(qclass), uint16_t ATTR_UNUSED(flags),
int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
struct sockaddr_storage* ATTR_UNUSED(addr),
- socklen_t ATTR_UNUSED(addrlen), struct module_qstate* ATTR_UNUSED(q))
+ socklen_t ATTR_UNUSED(addrlen), uint8_t* ATTR_UNUSED(zone),
+ size_t ATTR_UNUSED(zonelen), struct module_qstate* ATTR_UNUSED(q))
{
log_assert(0);
return 0;
diff --git a/contrib/unbound/daemon/worker.h b/contrib/unbound/daemon/worker.h
index c510ebfd735c..7c763546e9d2 100644
--- a/contrib/unbound/daemon/worker.h
+++ b/contrib/unbound/daemon/worker.h
@@ -158,77 +158,9 @@ void worker_delete(struct worker* worker);
void worker_send_cmd(struct worker* worker, enum worker_commands cmd);
/**
- * Worker signal handler function. User argument is the worker itself.
- * @param sig: signal number.
- * @param arg: the worker (main worker) that handles signals.
- */
-void worker_sighandler(int sig, void* arg);
-
-/**
- * Worker service routine to send serviced queries to authoritative servers.
- * @param qname: query name. (host order)
- * @param qnamelen: length in bytes of qname, including trailing 0.
- * @param qtype: query type. (host order)
- * @param qclass: query class. (host order)
- * @param flags: host order flags word, with opcode and CD bit.
- * @param dnssec: if set, EDNS record will have DO bit set.
- * @param want_dnssec: signatures needed.
- * @param addr: where to.
- * @param addrlen: length of addr.
- * @param zone: wireformat dname of the zone.
- * @param zonelen: length of zone name.
- * @param q: wich query state to reactivate upon return.
- * @return: false on failure (memory or socket related). no query was
- * sent.
- */
-struct outbound_entry* worker_send_query(uint8_t* qname, size_t qnamelen,
- uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec,
- int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen,
- uint8_t* zone, size_t zonelen, struct module_qstate* q);
-
-/**
- * process control messages from the main thread. Frees the control
- * command message.
- * @param tube: tube control message came on.
- * @param msg: message contents. Is freed.
- * @param len: length of message.
- * @param error: if error (NETEVENT_*) happened.
- * @param arg: user argument
- */
-void worker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
- int error, void* arg);
-
-/** handles callbacks from listening event interface */
-int worker_handle_request(struct comm_point* c, void* arg, int error,
- struct comm_reply* repinfo);
-
-/** process incoming replies from the network */
-int worker_handle_reply(struct comm_point* c, void* arg, int error,
- struct comm_reply* reply_info);
-
-/** process incoming serviced query replies from the network */
-int worker_handle_service_reply(struct comm_point* c, void* arg, int error,
- struct comm_reply* reply_info);
-
-/** cleanup the cache to remove all rrset IDs from it, arg is worker */
-void worker_alloc_cleanup(void* arg);
-
-/**
* Init worker stats - includes server_stats_init, outside network and mesh.
* @param worker: the worker to init
*/
void worker_stats_clear(struct worker* worker);
-/** statistics timer callback handler */
-void worker_stat_timer_cb(void* arg);
-
-/** probe timer callback handler */
-void worker_probe_timer_cb(void* arg);
-
-/** start accept callback handler */
-void worker_start_accept(void* arg);
-
-/** stop accept callback handler */
-void worker_stop_accept(void* arg);
-
#endif /* DAEMON_WORKER_H */