merge 2 patches from unbound trunk:

- fixup BSD port for infra host storage. It hashed wrongly.
- do not reopen syslog to avoid dev/log dependency.
This commit is contained in:
jakob 2008-12-30 10:40:13 +00:00
parent 8e34aac87a
commit 5d8b62cb1c
3 changed files with 51 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.6 2008/12/15 22:41:38 sthen Exp $
# $OpenBSD: Makefile,v 1.7 2008/12/30 10:40:13 jakob Exp $
COMMENT= validating DNS resolver
DISTNAME= unbound-1.1.1
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= net

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-daemon_unbound_c,v 1.3 2008/12/30 10:40:13 jakob Exp $
--- daemon/unbound.c.orig Thu Dec 18 22:53:27 2008
+++ daemon/unbound.c Thu Dec 18 22:54:57 2008
@@ -345,8 +345,6 @@ perform_setup(struct daemon* daemon, struct config_fil
* a fork error could not be printed since daemonize closed stderr.*/
if(cfg->use_syslog) {
log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
- /* but syslog is not really opened by glibc until first msg */
- log_info("open syslog, startup in progress");
}
/* if using a logfile, we cannot open it because the logfile would
* be created with the wrong permissions, we cannot chown it because
@@ -516,7 +514,11 @@ run_daemon(const char* cfgfile, int cmdline_verbose, i
if(!done_setup) {
perform_setup(daemon, cfg, debug_mode, &cfgfile);
done_setup = 1;
- } else log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
+ } else {
+ /* reopen log after HUP to facilitate log rotation */
+ if(!cfg->use_syslog)
+ log_init(cfg->logfile, 0, cfg->chrootdir);
+ }
/* work */
daemon_fork(daemon);

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-services_cache_infra_c,v 1.1 2008/12/30 10:40:13 jakob Exp $
--- services/cache/infra.c.orig Thu Dec 18 22:42:50 2008
+++ services/cache/infra.c Thu Dec 18 22:44:44 2008
@@ -136,8 +136,18 @@ static hashvalue_t
hash_addr(struct sockaddr_storage* addr, socklen_t addrlen)
{
hashvalue_t h = 0xab;
- h = hashlittle(&addrlen, sizeof(addrlen), h);
- h = hashlittle(addr, addrlen, h);
+ /* select the pieces to hash, some OS have changing data inside */
+ if(addr_is_ip6(addr, addrlen)) {
+ struct sockaddr_in6* in6 = (struct sockaddr_in6*)addr;
+ h = hashlittle(&in6->sin6_family, sizeof(in6->sin6_family), h);
+ h = hashlittle(&in6->sin6_port, sizeof(in6->sin6_port), h);
+ h = hashlittle(&in6->sin6_addr, INET6_SIZE, h);
+ } else {
+ struct sockaddr_in* in = (struct sockaddr_in*)addr;
+ h = hashlittle(&in->sin_family, sizeof(in->sin_family), h);
+ h = hashlittle(&in->sin_port, sizeof(in->sin_port), h);
+ h = hashlittle(&in->sin_addr, INET_SIZE, h);
+ }
return h;
}