From: Jan Lentfer Date: Fri, 27 Nov 2009 09:02:05 +0000 (+0100) Subject: bind - Applied DragonFly specific patches for 9.5.2 X-Git-Tag: v2.7.1~369^2~1^2~3 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/f1ae1fae4d76ba4763566f7724c2deaba1b7e438 bind - Applied DragonFly specific patches for 9.5.2 --- diff --git a/contrib/bind-9.5.2/lib/bind/include/isc/list.h b/contrib/bind-9.5.2/lib/bind/include/isc/list.h index c85c6676b5..32222409c7 100644 --- a/contrib/bind-9.5.2/lib/bind/include/isc/list.h +++ b/contrib/bind-9.5.2/lib/bind/include/isc/list.h @@ -17,8 +17,12 @@ #ifndef LIST_H #define LIST_H 1 +#ifdef _LIBC +#include +#define INSIST(cond) assert(cond) +#else #include - +#endif #define LIST(type) struct { type *head, *tail; } #define INIT_LIST(list) \ do { (list).head = NULL; (list).tail = NULL; } while (0) diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_addr.c b/contrib/bind-9.5.2/lib/bind/inet/inet_addr.c index 56270ffa3a..b532873043 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_addr.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_addr.c @@ -89,7 +89,7 @@ static const char rcsid[] = "$Id: inet_addr.c,v 1.5 2005/04/27 04:56:19 sra Exp * Ascii internet address interpretation routine. * The value returned is in network order. */ -u_long +in_addr_t inet_addr(const char *cp) { struct in_addr val; @@ -205,4 +205,14 @@ inet_aton(const char *cp, struct in_addr *addr) { return (1); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_addr +__weak_reference(__inet_addr, inet_addr); +#undef inet_aton +__weak_reference(__inet_aton, inet_aton); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_cidr_pton.c b/contrib/bind-9.5.2/lib/bind/inet/inet_cidr_pton.c index 07652af463..1d3ce8ee89 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_cidr_pton.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_cidr_pton.c @@ -27,7 +27,12 @@ static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.6 2005/04/27 04:56:19 sra #include #include +#ifdef _LIBC +#include +#define INSIST(x) assert(x) +#else #include +#endif #include #include #include diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_lnaof.c b/contrib/bind-9.5.2/lib/bind/inet/inet_lnaof.c index 70ac409512..e4be6f72ee 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_lnaof.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_lnaof.c @@ -48,11 +48,11 @@ static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93"; * internet address; handles class a/b/c network * number formats. */ -u_long +in_addr_t inet_lnaof(in) struct in_addr in; { - register u_long i = ntohl(in.s_addr); + in_addr_t i = ntohl(in.s_addr); if (IN_CLASSA(i)) return ((i)&IN_CLASSA_HOST); @@ -62,4 +62,12 @@ inet_lnaof(in) return ((i)&IN_CLASSC_HOST); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_lnaof +__weak_reference(__inet_lnaof, inet_lnaof); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_makeaddr.c b/contrib/bind-9.5.2/lib/bind/inet/inet_makeaddr.c index c56cb3eaeb..f41b98df99 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_makeaddr.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_makeaddr.c @@ -49,7 +49,7 @@ static const char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93"; */ struct in_addr inet_makeaddr(net, host) - u_long net, host; + in_addr_t net, host; { struct in_addr a; @@ -65,4 +65,12 @@ inet_makeaddr(net, host) return (a); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_makeaddr +__weak_reference(__inet_makeaddr, inet_makeaddr); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_net_ntop.c b/contrib/bind-9.5.2/lib/bind/inet/inet_net_ntop.c index fb28e3cbe5..5d4cea65a8 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_net_ntop.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_net_ntop.c @@ -276,4 +276,12 @@ emsgsize: return (NULL); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_ntop +__weak_reference(__inet_net_ntop, inet_net_ntop); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_net_pton.c b/contrib/bind-9.5.2/lib/bind/inet/inet_net_pton.c index b0ee27a45e..a55cc11168 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_net_pton.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_net_pton.c @@ -27,7 +27,12 @@ static const char rcsid[] = "$Id: inet_net_pton.c,v 1.8.672.1 2008/08/26 04:42:3 #include #include +#ifdef _LIBC +#include +#define INSIST(cond) assert(cond) +#else #include +#endif #include #include #include @@ -404,4 +409,12 @@ inet_net_pton(int af, const char *src, void *dst, size_t size) { } } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_pton +__weak_reference(__inet_net_pton, inet_net_pton); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_neta.c b/contrib/bind-9.5.2/lib/bind/inet/inet_neta.c index 63a6c201a4..95d6c88723 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_neta.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_neta.c @@ -51,7 +51,7 @@ static const char rcsid[] = "$Id: inet_neta.c,v 1.3 2005/04/27 04:56:20 sra Exp */ char * inet_neta(src, dst, size) - u_long src; + in_addr_t src; char *dst; size_t size; { @@ -86,4 +86,12 @@ inet_neta(src, dst, size) return (NULL); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_neta +__weak_reference(__inet_neta, inet_neta); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_netof.c b/contrib/bind-9.5.2/lib/bind/inet/inet_netof.c index c228e3d818..c4f11fa354 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_netof.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_netof.c @@ -47,12 +47,12 @@ static const char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93"; * Return the network number from an internet * address; handles class a/b/c network #'s. */ -u_long +in_addr_t inet_netof(in) struct in_addr in; { - register u_long i = ntohl(in.s_addr); - + in_addr_t i = ntohl(in.s_addr); + if (IN_CLASSA(i)) return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); else if (IN_CLASSB(i)) @@ -61,4 +61,12 @@ inet_netof(in) return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_netof +__weak_reference(__inet_netof, inet_netof); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_network.c b/contrib/bind-9.5.2/lib/bind/inet/inet_network.c index 47976cff68..84e751901c 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_network.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_network.c @@ -49,15 +49,14 @@ static const char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; * The library routines call this routine to interpret * network numbers. */ -u_long +in_addr_t inet_network(cp) - register const char *cp; + const char *cp; { - register u_long val, base, n, i; - register char c; - u_long parts[4], *pp = parts; - int digit; - + in_addr_t val, base, n; + char c; + in_addr_t parts[4], *pp = parts; + int i, digit; again: val = 0; base = 10; digit = 0; if (*cp == '0') @@ -103,4 +102,12 @@ again: return (val); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_network +__weak_reference(__inet_network, inet_network); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_ntoa.c b/contrib/bind-9.5.2/lib/bind/inet/inet_ntoa.c index 983121e89d..67b04cb398 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_ntoa.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_ntoa.c @@ -61,4 +61,21 @@ inet_ntoa(struct in_addr in) { return (ret); } +#ifdef _LIBC +char * +inet_ntoa_r(struct in_addr in, char *buf, socklen_t size) +{ + + inet_ntop(AF_INET, &in, buf, size); + return (buf); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . +*/ +#undef inet_ntoa +__weak_reference(__inet_ntoa, inet_ntoa); +__weak_reference(__inet_ntoa_r, inet_ntoa_r); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_ntop.c b/contrib/bind-9.5.2/lib/bind/inet/inet_ntop.c index 114ca5d506..b1a49b5c60 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_ntop.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_ntop.c @@ -26,7 +26,7 @@ static const char rcsid[] = "$Id: inet_ntop.c,v 1.5 2005/11/03 22:59:52 marka Ex #include #include -#include +#include "arpa/inet.h" #include #include @@ -204,4 +204,12 @@ inet_ntop6(src, dst, size) return (dst); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_ntop +__weak_reference(__inet_ntop, inet_ntop); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/inet_pton.c b/contrib/bind-9.5.2/lib/bind/inet/inet_pton.c index 2c516c798a..6444bb593c 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/inet_pton.c +++ b/contrib/bind-9.5.2/lib/bind/inet/inet_pton.c @@ -220,4 +220,12 @@ inet_pton6(src, dst) return (1); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_pton +__weak_reference(__inet_pton, inet_pton); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/inet/nsap_addr.c b/contrib/bind-9.5.2/lib/bind/inet/nsap_addr.c index b6432e1e49..05cfabfbfc 100644 --- a/contrib/bind-9.5.2/lib/bind/inet/nsap_addr.c +++ b/contrib/bind-9.5.2/lib/bind/inet/nsap_addr.c @@ -31,7 +31,7 @@ static const char rcsid[] = "$Id: nsap_addr.c,v 1.5 2005/07/28 06:51:48 marka Ex #include #include -#include +#include "resolv_mt.h" #include "port_after.h" @@ -108,4 +108,14 @@ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) { return (start); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_nsap_addr +__weak_reference(__inet_nsap_addr, inet_nsap_addr); +#undef inet_nsap_ntoa +__weak_reference(__inet_nsap_ntoa, inet_nsap_ntoa); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/irs/getnetgrent.c b/contrib/bind-9.5.2/lib/bind/irs/getnetgrent.c index 697de4bd80..4400fd4aba 100644 --- a/contrib/bind-9.5.2/lib/bind/irs/getnetgrent.c +++ b/contrib/bind-9.5.2/lib/bind/irs/getnetgrent.c @@ -77,7 +77,7 @@ innetgr(INNETGR_ARGS) { int getnetgrent(NGR_R_CONST char **host, NGR_R_CONST char **user, - NGR_R_CONST char **domain) + NGR_R_CONST char **domain) { struct net_data *net_data = init(); const char *ch, *cu, *cd; diff --git a/contrib/bind-9.5.2/lib/bind/isc/ev_streams.c b/contrib/bind-9.5.2/lib/bind/isc/ev_streams.c index 5dad36d04a..eefebf424c 100644 --- a/contrib/bind-9.5.2/lib/bind/isc/ev_streams.c +++ b/contrib/bind-9.5.2/lib/bind/isc/ev_streams.c @@ -24,24 +24,30 @@ static const char rcsid[] = "$Id: ev_streams.c,v 1.5 2005/04/27 04:56:36 sra Exp #endif #include "port_before.h" +#ifndef _LIBC #include "fd_setsize.h" +#endif #include #include #include -#include +#include "isc/eventlib.h" +#ifndef _LIBC #include +#endif #include "eventlib_p.h" #include "port_after.h" +#ifndef _LIBC static int copyvec(evStream *str, const struct iovec *iov, int iocnt); static void consume(evStream *str, size_t bytes); static void done(evContext opaqueCtx, evStream *str); static void writable(evContext opaqueCtx, void *uap, int fd, int evmask); static void readable(evContext opaqueCtx, void *uap, int fd, int evmask); +#endif struct iovec evConsIovec(void *buf, size_t cnt) { @@ -53,6 +59,7 @@ evConsIovec(void *buf, size_t cnt) { return (ret); } +#ifndef _LIBC int evWrite(evContext opaqueCtx, int fd, const struct iovec *iov, int iocnt, evStreamFunc func, void *uap, evStreamID *id) @@ -304,5 +311,6 @@ readable(evContext opaqueCtx, void *uap, int fd, int evmask) { if (str->ioDone <= 0 || str->ioDone == str->ioTotal) done(opaqueCtx, str); } +#endif /* !_LIBC */ /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/isc/ev_timers.c b/contrib/bind-9.5.2/lib/bind/isc/ev_timers.c index 12ac2cebca..735e0e3044 100644 --- a/contrib/bind-9.5.2/lib/bind/isc/ev_timers.c +++ b/contrib/bind-9.5.2/lib/bind/isc/ev_timers.c @@ -26,12 +26,16 @@ static const char rcsid[] = "$Id: ev_timers.c,v 1.6 2005/04/27 04:56:36 sra Exp /* Import. */ #include "port_before.h" +#ifndef _LIBC #include "fd_setsize.h" +#endif #include +#ifndef _LIBC #include -#include +#endif +#include "isc/eventlib.h" #include "eventlib_p.h" #include "port_after.h" @@ -42,7 +46,9 @@ static const char rcsid[] = "$Id: ev_timers.c,v 1.6 2005/04/27 04:56:36 sra Exp #define BILLION 1000000000 /* Forward. */ - +#ifdef _LIBC +static int __evOptMonoTime; +#else static int due_sooner(void *, void *); static void set_index(void *, int); static void free_timer(void *, void *); @@ -58,7 +64,7 @@ typedef struct { struct timespec max_idle; evTimer * timer; } idle_timer; - +#endif /* Public. */ struct timespec @@ -138,12 +144,14 @@ evUTCTime() { return (evTimeSpec(now)); } +#ifndef _LIBC struct timespec evLastEventTime(evContext opaqueCtx) { evContext_p *ctx = opaqueCtx.opaque; return (ctx->lastEventTime); } +#endif struct timespec evTimeSpec(struct timeval tv) { @@ -153,7 +161,7 @@ evTimeSpec(struct timeval tv) { ts.tv_nsec = tv.tv_usec * 1000; return (ts); } - +#if !defined(USE_KQUEUE) || !defined(_LIBC) struct timeval evTimeVal(struct timespec ts) { struct timeval tv; @@ -162,7 +170,9 @@ evTimeVal(struct timespec ts) { tv.tv_usec = ts.tv_nsec / 1000; return (tv); } +#endif +#ifndef _LIBC int evSetTimer(evContext opaqueCtx, evTimerFunc func, @@ -495,5 +505,6 @@ idle_timeout(evContext opaqueCtx, this->timer->inter = evSubTime(this->max_idle, idle); } } +#endif /* !_LIBC */ /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/isc/eventlib_p.h b/contrib/bind-9.5.2/lib/bind/isc/eventlib_p.h index 0a3614ab23..f060b0663e 100644 --- a/contrib/bind-9.5.2/lib/bind/isc/eventlib_p.h +++ b/contrib/bind-9.5.2/lib/bind/isc/eventlib_p.h @@ -39,9 +39,11 @@ #include #include +#ifndef _LIBC #include #include #include +#endif #define EV_MASK_ALL (EV_READ | EV_WRITE | EV_EXCEPT) #define EV_ERR(e) return (errno = (e), -1) @@ -86,6 +88,7 @@ typedef struct evConn { struct evConn * next; } evConn; +#ifndef _LIBC typedef struct evAccept { int fd; union { @@ -175,6 +178,7 @@ typedef struct evEvent_p { struct { const void *placeholder; } null; } u; } evEvent_p; +#endif /* !_LIBC */ #ifdef USE_POLL typedef struct { @@ -210,6 +214,7 @@ extern void __fd_set(int fd, __evEmulMask *maskp); #endif /* USE_POLL */ +#ifndef _LIBC typedef struct { /* Global. */ const evEvent_p *cur; @@ -274,8 +279,11 @@ void evDestroyTimers(const evContext_p *); /* ev_waits.c */ #define evFreeWait __evFreeWait evWait *evFreeWait(evContext_p *ctx, evWait *old); +#endif /* !_LIBC */ /* Global options */ +#ifndef _LIBC extern int __evOptMonoTime; +#endif /* !_LIBC */ #endif /*_EVENTLIB_P_H*/ diff --git a/contrib/bind-9.5.2/lib/bind/nameser/ns_print.c b/contrib/bind-9.5.2/lib/bind/nameser/ns_print.c index 6a23e9add6..4dc20dcfc9 100644 --- a/contrib/bind-9.5.2/lib/bind/nameser/ns_print.c +++ b/contrib/bind-9.5.2/lib/bind/nameser/ns_print.c @@ -30,8 +30,13 @@ static const char rcsid[] = "$Id: ns_print.c,v 1.10 2005/04/27 04:56:40 sra Exp #include #include +#ifdef _LIBC +#include +#define INSIST(cond) assert(cond) +#else #include #include +#endif #include #include #include @@ -454,7 +459,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen, goto formerr; /* Key flags, Protocol, Algorithm. */ +#ifndef _LIBC key_id = dst_s_dns_key_id(rdata, edata-rdata); +#else + key_id = 0; +#endif keyflags = ns_get16(rdata); rdata += NS_INT16SZ; protocol = *rdata++; algorithm = *rdata++; diff --git a/contrib/bind-9.5.2/lib/bind/nameser/ns_samedomain.c b/contrib/bind-9.5.2/lib/bind/nameser/ns_samedomain.c index 5e9f5cab54..ee890090b8 100644 --- a/contrib/bind-9.5.2/lib/bind/nameser/ns_samedomain.c +++ b/contrib/bind-9.5.2/lib/bind/nameser/ns_samedomain.c @@ -141,13 +141,17 @@ ns_samedomain(const char *a, const char *b) { return (strncasecmp(cp, b, lb) == 0); } -/*% +#ifndef _LIBC +/* + * int + * ns_subdomain(a, b) * is "a" a subdomain of "b"? */ int ns_subdomain(const char *a, const char *b) { return (ns_samename(a, b) != 1 && ns_samedomain(a, b)); } +#endif /*% * make a canonical copy of domain name "src" diff --git a/contrib/bind-9.5.2/lib/bind/resolv/herror.c b/contrib/bind-9.5.2/lib/bind/resolv/herror.c index 703ab8fe4d..a3422379c6 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/herror.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/herror.c @@ -55,6 +55,10 @@ static const char rcsid[] = "$Id: herror.c,v 1.4 2005/04/27 04:56:41 sra Exp $"; #include "port_before.h" +#ifdef _LIBC +#include "namespace.h" +#endif + #include #include #include @@ -66,7 +70,11 @@ static const char rcsid[] = "$Id: herror.c,v 1.4 2005/04/27 04:56:41 sra Exp $"; #include #include #include +#ifndef _LIBC #include +#else +#include "un-namespace.h" +#endif #include "port_after.h" @@ -110,7 +118,11 @@ herror(const char *s) { DE_CONST("\n", t); v->iov_base = t; v->iov_len = 1; +#ifndef _LIBC writev(STDERR_FILENO, iov, (v - iov) + 1); +#else + _writev(STDERR_FILENO, iov, (v - iov) + 1); +#endif } /*% diff --git a/contrib/bind-9.5.2/lib/bind/resolv/mtctxres.c b/contrib/bind-9.5.2/lib/bind/resolv/mtctxres.c index 635bbd4400..6f9f586b4b 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/mtctxres.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/mtctxres.c @@ -1,13 +1,18 @@ #include #ifdef DO_PTHREADS #include +#ifdef _LIBC +#include +#endif #endif #include #include #include #include -#include +#include "resolv_mt.h" +#ifndef _LIBC #include +#endif #include #ifdef DO_PTHREADS @@ -40,6 +45,7 @@ _mtctxres_init(void) { } #endif +#ifndef _LIBC /* * To support binaries that used the private MT-safe interface in * Solaris 8, we still need to provide the __res_enable_mt() @@ -49,6 +55,7 @@ int __res_enable_mt(void) { return (-1); } +#endif int __res_disable_mt(void) { @@ -99,6 +106,12 @@ ___mtctxres(void) { #ifdef DO_PTHREADS mtctxres_t *mt; +#ifdef _LIBC + if (pthread_main_np() != 0) + return (&sharedctx); +#endif + + /* * This if clause should only be executed if we are linking * statically. When linked dynamically _mtctxres_init() should diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_comp.c b/contrib/bind-9.5.2/lib/bind/resolv/res_comp.c index 08a66b21c5..af182eec3c 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_comp.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_comp.c @@ -262,4 +262,14 @@ u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); } #endif /*__ultrix__*/ #endif /*BIND_4_COMPAT*/ +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef dn_comp +__weak_reference(__dn_comp, dn_comp); +#undef dn_expand +__weak_reference(__dn_expand, dn_expand); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_data.c b/contrib/bind-9.5.2/lib/bind/resolv/res_data.c index be5a12529d..d301872df1 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_data.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_data.c @@ -40,6 +40,10 @@ static const char rcsid[] = "$Id: res_data.c,v 1.5 2007/09/14 05:32:25 marka Exp #include #include "port_after.h" +#ifndef _LIBC +#undef _res +#endif + const char *_res_opcodes[] = { "QUERY", @@ -71,11 +75,13 @@ const char *_res_sectioncodes[] = { #undef _res #ifndef __BIND_NOSTATIC +#ifndef _LIBC struct __res_state _res # if defined(__BIND_RES_TEXT) = { RES_TIMEOUT, } /*%< Motorola, et al. */ # endif ; +#endif /* !_LIBC */ #if defined(DO_PTHREADS) || defined(__linux) #define _res (*__res_state()) @@ -111,7 +117,11 @@ res_init(void) { if (!_res.retrans) _res.retrans = RES_TIMEOUT; if (!_res.retry) +#ifndef _LIBC _res.retry = 4; +#else + _res.retry = RES_DFLRETRY; +#endif if (!(_res.options & RES_INIT)) _res.options = RES_DEFAULT; @@ -185,6 +195,7 @@ res_query(const char *name, /*!< domain name */ return (res_nquery(&_res, name, class, type, answer, anslen)); } +#ifndef _LIBC void res_send_setqhook(res_send_qhook hook) { _res.qhook = hook; @@ -194,6 +205,7 @@ void res_send_setrhook(res_send_rhook hook) { _res.rhook = hook; } +#endif int res_isourserver(const struct sockaddr_in *inp) { @@ -210,6 +222,7 @@ res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) { return (res_nsend(&_res, buf, buflen, ans, anssiz)); } +#ifndef _LIBC int res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key, u_char *ans, int anssiz) @@ -221,6 +234,7 @@ res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key, return (res_nsendsigned(&_res, buf, buflen, key, ans, anssiz)); } +#endif void res_close(void) { @@ -268,6 +282,14 @@ res_querydomain(const char *name, answer, anslen)); } +#ifdef _LIBC +int +res_opt(int n0, u_char *buf, int buflen, int anslen) +{ + return (res_nopt(&_res, n0, buf, buflen, anslen)); +} +#endif + const char * hostalias(const char *name) { static char abuf[MAXDNAME]; @@ -292,6 +314,28 @@ local_hostname_length(const char *hostname) { } #endif /*ultrix*/ +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef res_init +__weak_reference(__res_init, res_init); +#undef p_query +__weak_reference(__p_query, p_query); +#undef res_mkquery +__weak_reference(__res_mkquery, res_mkquery); +#undef res_query +__weak_reference(__res_query, res_query); +#undef res_send +__weak_reference(__res_send, res_send); +#undef res_close +__weak_reference(__res_close, _res_close); +#undef res_search +__weak_reference(__res_search, res_search); +#undef res_querydomain +__weak_reference(__res_querydomain, res_querydomain); +#endif + #endif - /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_debug.c b/contrib/bind-9.5.2/lib/bind/resolv/res_debug.c index 100133e2cf..abe5726e8c 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_debug.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_debug.c @@ -113,7 +113,7 @@ static const char rcsid[] = "$Id: res_debug.c,v 1.15.574.1 2008/04/03 02:12:21 m #include #include #include -#include +#include "resolv_mt.h" #include #include #include @@ -1209,4 +1209,24 @@ res_nametotype(const char *buf, int *successp) { return (result); } +#ifdef _LIBC +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef fp_resstat +__weak_reference(__fp_resstat, fp_resstat); +#undef p_fqnname +__weak_reference(__p_fqnname, p_fqnname); +#undef sym_ston +__weak_reference(__sym_ston, sym_ston); +#undef sym_ntos +__weak_reference(__sym_ntos, sym_ntos); +#undef sym_ntop +__weak_reference(__sym_ntop, sym_ntop); +#undef dn_count_labels +__weak_reference(__dn_count_labels, dn_count_labels); +#undef p_secstodate +__weak_reference(__p_secstodate, p_secstodate); +#endif /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_findzonecut.c b/contrib/bind-9.5.2/lib/bind/resolv/res_findzonecut.c index 933169e3ab..ea778dbb29 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_findzonecut.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_findzonecut.c @@ -39,7 +39,7 @@ static const char rcsid[] = "$Id: res_findzonecut.c,v 1.10 2005/10/11 00:10:16 m #include #include -#include +#include "isc/list.h" #include "port_after.h" @@ -150,6 +150,7 @@ static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2); * keep going. for the NS and A queries this means we just give up. */ +#ifndef _LIBC int res_findzonecut(res_state statp, const char *dname, ns_class class, int opts, char *zname, size_t zsize, struct in_addr *addrs, int naddrs) @@ -174,7 +175,7 @@ res_findzonecut(res_state statp, const char *dname, ns_class class, int opts, free(u); return (result); } - +#endif int res_findzonecut2(res_state statp, const char *dname, ns_class class, int opts, char *zname, size_t zsize, union res_sockaddr_union *addrs, diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_init.c b/contrib/bind-9.5.2/lib/bind/resolv/res_init.c index d88d10d0fb..4f79115a52 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_init.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_init.c @@ -75,6 +75,9 @@ static const char rcsid[] = "$Id: res_init.c,v 1.23 2007/07/09 01:43:23 marka Ex #include "port_before.h" +#ifdef _LIBC +#include "namespace.h" +#endif #include #include #include @@ -90,6 +93,9 @@ static const char rcsid[] = "$Id: res_init.c,v 1.23 2007/07/09 01:43:23 marka Ex #include #include #include +#ifdef _LIBC +#include "un-namespace.h" +#endif #include "port_after.h" @@ -506,7 +512,9 @@ res_setoptions(res_state statp, const char *options, const char *source) { const char *cp = options; int i; +#ifndef _LIBC struct __res_state_ext *ext = statp->_u._ext.ext; +#endif #ifdef DEBUG if (statp->options & RES_DEBUG) @@ -591,6 +599,7 @@ res_setoptions(res_state statp, const char *options, const char *source) statp->options |= RES_USE_EDNS0; } #endif +#ifndef _LIBC else if (!strncmp(cp, "dname", sizeof("dname") - 1)) { statp->options |= RES_USE_DNAME; } @@ -620,10 +629,13 @@ res_setoptions(res_state statp, const char *options, const char *source) ~RES_NO_NIBBLE2; } } +#endif else { /* XXX - print a warning here? */ } +#ifndef _LIBC skip: +#endif /* skip to next run of spaces */ while (*cp && *cp != ' ' && *cp != '\t') cp++; @@ -665,14 +677,22 @@ void res_nclose(res_state statp) { int ns; - if (statp->_vcsock >= 0) { + if (statp->_vcsock >= 0) { +#ifndef _LIBC (void) close(statp->_vcsock); +#else + _close(statp->_vcsock); +#endif statp->_vcsock = -1; statp->_flags &= ~(RES_F_VC | RES_F_CONN); } for (ns = 0; ns < statp->_u._ext.nscount; ns++) { if (statp->_u._ext.nssocks[ns] != -1) { +#ifndef _LIBC (void) close(statp->_u._ext.nssocks[ns]); +#else + _close(statp->_u._ext.nssocks[ns]); +#endif statp->_u._ext.nssocks[ns] = -1; } } @@ -687,6 +707,7 @@ res_ndestroy(res_state statp) { statp->_u._ext.ext = NULL; } +#ifndef _LIBC const char * res_get_nibblesuffix(res_state statp) { if (statp->_u._ext.ext) @@ -700,6 +721,7 @@ res_get_nibblesuffix2(res_state statp) { return (statp->_u._ext.ext->nsuffix2); return ("ip6.int"); } +#endif void res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) { @@ -797,5 +819,4 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { } return (statp->nscount); } - /*! \file */ diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_mkupdate.c b/contrib/bind-9.5.2/lib/bind/resolv/res_mkupdate.c index d04a4b1b04..e9b317ac5a 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_mkupdate.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_mkupdate.c @@ -45,6 +45,9 @@ static const char rcsid[] = "$Id: res_mkupdate.c,v 1.8 2005/10/14 05:44:26 marka #include #include +#ifdef _LIBC +#include "isc/list.h" +#endif #include "port_after.h" /* Options. Leave them on. */ @@ -59,8 +62,13 @@ static int getstr_str(char *, int, u_char **, u_char *); #define ShrinkBuffer(x) if ((buflen -= x) < 0) return (-2); /* Forward. */ - +#ifdef _LIBC +static +#endif int res_protocolnumber(const char *); +#ifdef _LIBC +static +#endif int res_servicenumber(const char *); /*% @@ -92,7 +100,10 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { u_int16_t rtype, rclass; u_int32_t n1, rttl; u_char *dnptrs[20], **dpp, **lastdnptr; - int siglen, keylen, certlen; +#ifndef _LIBC + int siglen; +#endif + int keylen, certlen; /* * Initialize header fields. @@ -448,6 +459,9 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { return (-1); break; case ns_t_sig: +#ifdef _LIBC + return (-1); +#else { int sig_type, success, dateerror; u_int32_t exptime, timesigned; @@ -538,6 +552,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) { cp += siglen; break; } +#endif case ns_t_key: /* flags */ n = gethexnum_str(&startp, endp); @@ -984,6 +999,7 @@ res_buildservicelist() { endservent(); } +#ifndef _LIBC void res_destroyservicelist() { struct valuelist *slp, *slp_next; @@ -996,6 +1012,7 @@ res_destroyservicelist() { } servicelist = (struct valuelist *)0; } +#endif void res_buildprotolist(void) { @@ -1026,6 +1043,7 @@ res_buildprotolist(void) { endprotoent(); } +#ifndef _LIBC void res_destroyprotolist(void) { struct valuelist *plp, *plp_next; @@ -1037,6 +1055,7 @@ res_destroyprotolist(void) { } protolist = (struct valuelist *)0; } +#endif static int findservice(const char *s, struct valuelist **list) { @@ -1063,6 +1082,9 @@ findservice(const char *s, struct valuelist **list) { /*% * Convert service name or (ascii) number to int. */ +#ifdef _LIBC +static +#endif int res_servicenumber(const char *p) { if (servicelist == (struct valuelist *)0) @@ -1073,6 +1095,9 @@ res_servicenumber(const char *p) { /*% * Convert protocol name or (ascii) number to int. */ +#ifdef _LIBC +static +#endif int res_protocolnumber(const char *p) { if (protolist == (struct valuelist *)0) @@ -1080,6 +1105,7 @@ res_protocolnumber(const char *p) { return (findservice(p, &protolist)); } +#ifndef _LIBC static struct servent * cgetservbyport(u_int16_t port, const char *proto) { /*%< Host byte order. */ struct valuelist **list = &servicelist; @@ -1160,3 +1186,4 @@ res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */ } return (ss->s_name); } +#endif /* !_LIBC */ diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_send.c b/contrib/bind-9.5.2/lib/bind/resolv/res_send.c index f578016183..9900dc6e36 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_send.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_send.c @@ -79,8 +79,13 @@ static const char rcsid[] = "$Id: res_send.c,v 1.18.10.1 2008/01/27 02:06:46 mar */ #include "port_before.h" +#ifndef USE_KQUEUE #include "fd_setsize.h" +#endif +#ifdef _LIBC +#include "namespace.h" +#endif #include #include #include @@ -100,9 +105,12 @@ static const char rcsid[] = "$Id: res_send.c,v 1.18.10.1 2008/01/27 02:06:46 mar #include #include -#include +#include "isc/eventlib.h" #include "port_after.h" +#ifdef USE_KQUEUE +#include +#else #ifdef USE_POLL #ifdef HAVE_STROPTS_H @@ -110,6 +118,11 @@ static const char rcsid[] = "$Id: res_send.c,v 1.18.10.1 2008/01/27 02:06:46 mar #endif #include #endif /* USE_POLL */ +#endif + +#ifdef _LIBC +#include "un-namespace.h" +#endif /* Options. Leave them on. */ #define DEBUG @@ -118,7 +131,7 @@ static const char rcsid[] = "$Id: res_send.c,v 1.18.10.1 2008/01/27 02:06:46 mar #define EXT(res) ((res)->_u._ext) -#ifndef USE_POLL +#if !defined(USE_POLL) && !defined(USE_KQUEUE) static const int highestFD = FD_SETSIZE - 1; #else static int highestFD = 0; @@ -130,14 +143,18 @@ static int get_salen __P((const struct sockaddr *)); static struct sockaddr * get_nsaddr __P((res_state, size_t)); static int send_vc(res_state, const u_char *, int, u_char *, int, int *, int); -static int send_dg(res_state, const u_char *, int, +static int send_dg(res_state, +#ifdef USE_KQUEUE + int, +#endif + const u_char *, int, u_char *, int, int *, int, int, int *, int *); static void Aerror(const res_state, FILE *, const char *, int, const struct sockaddr *, int); static void Perror(const res_state, FILE *, const char *, int); static int sock_eq(struct sockaddr *, struct sockaddr *); -#if defined(NEED_PSELECT) && !defined(USE_POLL) +#if defined(NEED_PSELECT) && !defined(USE_POLL) && !defined(USE_KQUEUE) static int pselect(int, void *, void *, void *, struct timespec *, const sigset_t *); @@ -294,9 +311,12 @@ res_nsend(res_state statp, const u_char *buf, int buflen, u_char *ans, int anssiz) { int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n; +#ifdef USE_KQUEUE + int kq; +#endif char abuf[NI_MAXHOST]; -#ifdef USE_POLL +#ifdef USE_POLL highestFD = sysconf(_SC_OPEN_MAX) - 1; #endif @@ -315,6 +335,13 @@ res_nsend(res_state statp, gotsomewhere = 0; terrno = ETIMEDOUT; +#ifdef USE_KQUEUE + if ((kq = kqueue()) < 0) { + Perror(statp, stderr, "kqueue", errno); + return (-1); + } +#endif + /* * If the ns_addr_list in the resolver context has changed, then * invalidate our cached copy and the associated timing data. @@ -338,7 +365,11 @@ res_nsend(res_state statp, if (EXT(statp).nssocks[ns] == -1) continue; peerlen = sizeof(peer); +#ifndef _LIBC if (getsockname(EXT(statp).nssocks[ns], +#else + if (_getsockname(EXT(statp).nssocks[ns], +#endif (struct sockaddr *)&peer, &peerlen) < 0) { needclose++; break; @@ -430,6 +461,9 @@ res_nsend(res_state statp, res_nclose(statp); goto next_ns; case res_done: +#ifdef USE_KQUEUE + _close(kq); +#endif return (resplen); case res_modified: /* give the hook another try */ @@ -463,8 +497,12 @@ res_nsend(res_state statp, resplen = n; } else { /* Use datagrams. */ - n = send_dg(statp, buf, buflen, ans, anssiz, &terrno, - ns, tries, &v_circuit, &gotsomewhere); + n = send_dg(statp, +#ifdef USE_KQUEUE + kq, +#endif + buf, buflen, ans, anssiz, &terrno, + ns, tries, &v_circuit, &gotsomewhere); if (n < 0) goto fail; if (n == 0) @@ -522,11 +560,17 @@ res_nsend(res_state statp, } while (!done); } +#ifdef USE_KQUEUE + _close(kq); +#endif return (resplen); next_ns: ; } /*foreach ns*/ } /*foreach retry*/ res_nclose(statp); +#ifdef USE_KQUEUE + _close(kq); +#endif if (!v_circuit) { if (!gotsomewhere) errno = ECONNREFUSED; /*%< no nameservers found */ @@ -616,8 +660,11 @@ send_vc(res_state statp, if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) { struct sockaddr_storage peer; ISC_SOCKLEN_T size = sizeof peer; - +#ifndef _LIBC if (getpeername(statp->_vcsock, +#else + if (_getpeername(statp->_vcsock, +#endif (struct sockaddr *)&peer, &size) < 0 || !sock_eq((struct sockaddr *)&peer, nsap)) { res_nclose(statp); @@ -628,12 +675,17 @@ send_vc(res_state statp, if (statp->_vcsock < 0 || (statp->_flags & RES_F_VC) == 0) { if (statp->_vcsock >= 0) res_nclose(statp); - +#ifndef _LIBC statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0); +#else + statp->_vcsock = _socket(nsap->sa_family, SOCK_STREAM, 0); +#endif +#if !defined(USE_POLL) && !defined(USE_KQUEUE) if (statp->_vcsock > highestFD) { res_nclose(statp); errno = ENOTSOCK; } +#endif if (statp->_vcsock < 0) { switch (errno) { case EPROTONOSUPPORT: @@ -661,7 +713,11 @@ send_vc(res_state statp, sizeof(on)); #endif errno = 0; +#ifndef _LIBC if (connect(statp->_vcsock, nsap, nsaplen) < 0) { +#else + if (_connect(statp->_vcsock, nsap, nsaplen) < 0) { +#endif *terrno = errno; Aerror(statp, stderr, "connect/vc", errno, nsap, nsaplen); @@ -678,7 +734,11 @@ send_vc(res_state statp, iov[0] = evConsIovec(&len, INT16SZ); DE_CONST(buf, tmp); iov[1] = evConsIovec(tmp, buflen); +#ifndef _LIBC if (writev(statp->_vcsock, iov, 2) != (INT16SZ + buflen)) { +#else + if (_writev(statp->_vcsock, iov, 2) != (INT16SZ + buflen)) { +#endif *terrno = errno; Perror(statp, stderr, "write failed", errno); res_nclose(statp); @@ -690,7 +750,11 @@ send_vc(res_state statp, read_len: cp = ans; len = INT16SZ; +#ifndef _LIBC while ((n = read(statp->_vcsock, (char *)cp, (int)len)) > 0) { +#else + while ((n = _read(statp->_vcsock, (char *)cp, (int)len)) > 0) { +#endif cp += n; if ((len -= n) == 0) break; @@ -736,7 +800,11 @@ send_vc(res_state statp, return (0); } cp = ans; +#ifndef _LIBC while (len != 0 && (n = read(statp->_vcsock, (char *)cp, (int)len)) > 0){ +#else + while (len != 0 && (n = _read(statp->_vcsock, (char *)cp, (int)len)) > 0){ +#endif cp += n; len -= n; } @@ -755,7 +823,11 @@ send_vc(res_state statp, while (len != 0) { char junk[PACKETSZ]; +#ifndef _LIBC n = read(statp->_vcsock, junk, +#else + n = _read(statp->_vcsock, junk, +#endif (len > sizeof junk) ? sizeof junk : len); if (n > 0) len -= n; @@ -786,7 +858,11 @@ send_vc(res_state statp, } static int -send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, +send_dg(res_state statp, +#ifdef USE_KQUEUE + int kq, +#endif + const u_char *buf, int buflen, u_char *ans, int anssiz, int *terrno, int ns, int tries, int *v_circuit, int *gotsomewhere) { @@ -798,21 +874,31 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, struct sockaddr_storage from; ISC_SOCKLEN_T fromlen; int resplen, seconds, n, s; +#ifdef USE_KQUEUE + struct kevent kv; +#else #ifdef USE_POLL int polltimeout; struct pollfd pollfd; #else fd_set dsmask; +#endif #endif nsap = get_nsaddr(statp, ns); nsaplen = get_salen(nsap); if (EXT(statp).nssocks[ns] == -1) { +#ifndef _LIBC EXT(statp).nssocks[ns] = socket(nsap->sa_family, SOCK_DGRAM, 0); +#else + EXT(statp).nssocks[ns] = _socket(nsap->sa_family, SOCK_DGRAM, 0); +#endif +#if !defined(USE_POLL) && !defined(USE_KQUEUE) if (EXT(statp).nssocks[ns] > highestFD) { res_nclose(statp); errno = ENOTSOCK; } +#endif if (EXT(statp).nssocks[ns] < 0) { switch (errno) { case EPROTONOSUPPORT: @@ -839,8 +925,21 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, * socket operation, and select returns if the * error message is received. We can thus detect * the absence of a nameserver without timing out. - */ - if (connect(EXT(statp).nssocks[ns], nsap, nsaplen) < 0) { + * + * + * When the option "insecure1" is specified, we'd + * rather expect to see responses from an "unknown" + * address. In order to let the kernel accept such + * responses, do not connect the socket here. + * XXX: or do we need an explicit option to disable + * connecting? + */ + if (!(statp->options & RES_INSECURE1) && +#ifndef _LIBC + connect(EXT(statp).nssocks[ns], nsap, nsaplen) < 0) { +#else + _connect(EXT(statp).nssocks[ns], nsap, nsaplen) < 0) { +#endif Aerror(statp, stderr, "connect(dg)", errno, nsap, nsaplen); res_nclose(statp); @@ -852,13 +951,28 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, } s = EXT(statp).nssocks[ns]; #ifndef CANNOT_CONNECT_DGRAM - if (send(s, (const char*)buf, buflen, 0) != buflen) { + if (statp->options & RES_INSECURE1) { +#ifndef _LIBC + if (sendto(s, +#else + if (_sendto(s, +#endif + (const char*)buf, buflen, 0, nsap, nsaplen) != buflen) { + Aerror(statp, stderr, "sendto", errno, nsap, nsaplen); + res_nclose(statp); + return (0); + } + } else if (send(s, (const char*)buf, buflen, 0) != buflen) { Perror(statp, stderr, "send", errno); res_nclose(statp); return (0); } #else /* !CANNOT_CONNECT_DGRAM */ +#ifndef _LIBC if (sendto(s, (const char*)buf, buflen, 0, nsap, nsaplen) != buflen) +#else + if (_sendto(s, (const char*)buf, buflen, 0, nsap, nsaplen) != buflen) +#endif { Aerror(statp, stderr, "sendto", errno, nsap, nsaplen); res_nclose(statp); @@ -882,13 +996,18 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, now = evNowTime(); nonow: #ifndef USE_POLL - FD_ZERO(&dsmask); - FD_SET(s, &dsmask); if (evCmpTime(finish, now) > 0) timeout = evSubTime(finish, now); else timeout = evConsTime(0, 0); +#ifdef USE_KQUEUE + EV_SET(&kv, s, EVFILT_READ, EV_ADD | EV_ONESHOT, 0, 0, 0); + n = _kevent(kq, &kv, 1, &kv, 1, &timeout); +#else + FD_ZERO(&dsmask); + FD_SET(s, &dsmask); n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL); +#endif #else timeout = evSubTime(finish, now); if (timeout.tv_sec < 0) @@ -908,17 +1027,29 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, if (n < 0) { if (errno == EINTR) goto wait; +#ifdef USE_KQUEUE + Perror(statp, stderr, "kevent", errno); +#else #ifndef USE_POLL Perror(statp, stderr, "select", errno); #else Perror(statp, stderr, "poll", errno); #endif /* USE_POLL */ +#endif res_nclose(statp); return (0); } +#ifdef USE_KQUEUE + if (kv.ident != s) + goto wait; +#endif errno = 0; fromlen = sizeof(from); +#ifndef _LIBC resplen = recvfrom(s, (char*)ans, anssiz,0, +#else + resplen = _recvfrom(s, (char*)ans, anssiz,0, +#endif (struct sockaddr *)&from, &fromlen); if (resplen <= 0) { Perror(statp, stderr, "recvfrom", errno); @@ -1081,7 +1212,7 @@ sock_eq(struct sockaddr *a, struct sockaddr *b) { } } -#if defined(NEED_PSELECT) && !defined(USE_POLL) +#if defined(NEED_PSELECT) && !defined(USE_POLL) && !defined(USE_KQUEUE) /* XXX needs to move to the porting library. */ static int pselect(int nfds, void *rfds, void *wfds, void *efds, diff --git a/contrib/bind-9.5.2/lib/bind/resolv/res_update.c b/contrib/bind-9.5.2/lib/bind/resolv/res_update.c index 5b2ecb1a35..63259e1c4d 100644 --- a/contrib/bind-9.5.2/lib/bind/resolv/res_update.c +++ b/contrib/bind-9.5.2/lib/bind/resolv/res_update.c @@ -44,7 +44,7 @@ static const char rcsid[] = "$Id: res_update.c,v 1.13 2005/04/27 04:56:43 sra Ex #include #include -#include +#include "isc/list.h" #include #include "port_after.h" @@ -168,8 +168,16 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) { /* Send the update and remember the result. */ if (key != NULL) +#ifdef _LIBC + { + DPRINTF(("TSIG is not supported\n")); + RES_SET_H_ERRNO(statp, NO_RECOVERY); + goto done; + } +#else n = res_nsendsigned(statp, packet, n, key, answer, sizeof answer); +#endif else n = res_nsend(statp, packet, n, answer, sizeof answer); if (n < 0) {