From 527302c4fe0326287ea2b3f0ccca41226fb74a0b Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 21 Jun 2001 08:26:27 +0000 Subject: [PATCH] BIND 8.3.0-T1A sync --- lib/bind/Makefile.in | 6 +- lib/bind/bsd/strerror.c | 16 ++--- lib/bind/include/arpa/nameser.h | 8 +-- lib/bind/include/isc/logging.h | 2 +- lib/bind/include/isc/misc.h | 10 ++- lib/bind/include/netdb.h | 4 +- lib/bind/include/resolv.h | 21 +++++- lib/bind/inet/inet_data.c | 16 +---- lib/bind/irs/dns_ho.c | 10 +-- lib/bind/irs/getnameinfo.c | 47 +++++++------ lib/bind/irs/irs_data.c | 5 +- lib/bind/irs/lcl_sv.c | 4 +- lib/bind/isc/Makefile.in | 10 +-- lib/bind/isc/hex.c | 116 ++++++++++++++++++++++++++++++++ lib/bind/isc/ip6.c | 17 ----- lib/bind/isc/logging.c | 4 +- lib/bind/isc/memcluster.c | 10 +-- lib/bind/nameser/ns_parse.c | 39 +++++------ lib/bind/nameser/ns_print.c | 4 +- lib/bind/port_after.h.in | 2 + lib/bind/resolv/herror.c | 3 +- lib/bind/resolv/res_debug.c | 62 ++++++++++++++++- lib/bind/resolv/res_init.c | 105 +++++++++++++++++++++++++++-- lib/bind/resolv/res_private.h | 9 +-- lib/bind/resolv/res_send.c | 60 +---------------- lib/bind/resolv/res_update.c | 20 +++--- 26 files changed, 412 insertions(+), 198 deletions(-) create mode 100644 lib/bind/isc/hex.c delete mode 100644 lib/bind/isc/ip6.c diff --git a/lib/bind/Makefile.in b/lib/bind/Makefile.in index 5790f9ea62..6c1464df3e 100644 --- a/lib/bind/Makefile.in +++ b/lib/bind/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.5 2001/05/31 05:53:57 marka Exp $ +# $Id: Makefile.in,v 1.6 2001/06/21 08:25:56 marka Exp $ DAEMON_OBJS=bsd/daemon.@O@ STRSEP_OBJS=bsd/strsep.@O@ @@ -66,8 +66,8 @@ WANT_IRS_THREADSGR_OBJS=irs/getgrent_r.@O@ ISCOBJS= isc/assertions.@O@ isc/base64.@O@ isc/bitncmp.@O@ isc/ctl_clnt.@O@ \ isc/ctl_p.@O@ isc/ctl_srvr.@O@ isc/ev_connects.@O@ isc/ev_files.@O@ \ isc/ev_streams.@O@ isc/ev_timers.@O@ isc/ev_waits.@O@ \ - isc/eventlib.@O@ isc/heap.@O@ isc/logging.@O@ \ - isc/memcluster.@O@ isc/movefile.@O@ isc/tree.@O@ isc/ip6.@O@ + isc/eventlib.@O@ isc/heap.@O@ isc/hex.@O@ isc/logging.@O@ \ + isc/memcluster.@O@ isc/movefile.@O@ isc/tree.@O@ NAMESEROBJS= nameser/ns_date.@O@ nameser/ns_name.@O@ nameser/ns_netint.@O@ \ nameser/ns_parse.@O@ nameser/ns_print.@O@ nameser/ns_samedomain.@O@ \ diff --git a/lib/bind/bsd/strerror.c b/lib/bind/bsd/strerror.c index bd13487a81..975f6b34f3 100644 --- a/lib/bind/bsd/strerror.c +++ b/lib/bind/bsd/strerror.c @@ -1,6 +1,6 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: strerror.c,v 1.2 2001/05/08 07:06:01 marka Exp $"; +static const char rcsid[] = "$Id: strerror.c,v 1.3 2001/06/21 08:25:59 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -49,21 +49,21 @@ static const char rcsid[] = "$Id: strerror.c,v 1.2 2001/05/08 07:06:01 marka Exp int __strerror_unneeded__; #else -extern int sys_nerr; -extern char *sys_errlist[]; - const char * -strerror(int num) { +isc_strerror(int num) { #define UPREFIX "Unknown error: " static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ u_int errnum; char *p, *t; + const char *ret; char tmp[40]; +#undef strerror + ret = strerror(num); /* call strerror() in libc */ + if (ret != NULL) + return(ret); + errnum = num; /* convert to unsigned */ - if (errnum < sys_nerr) - return (sys_errlist[errnum]); - /* Do this by hand, so we don't include stdio(3). */ t = tmp; do { diff --git a/lib/bind/include/arpa/nameser.h b/lib/bind/include/arpa/nameser.h index 9934a28d19..ed485eba03 100644 --- a/lib/bind/include/arpa/nameser.h +++ b/lib/bind/include/arpa/nameser.h @@ -49,7 +49,7 @@ */ /* - * $Id: nameser.h,v 1.1 2001/03/29 06:31:35 marka Exp $ + * $Id: nameser.h,v 1.2 2001/06/21 08:26:03 marka Exp $ */ #ifndef _ARPA_NAMESER_H_ @@ -119,7 +119,7 @@ typedef struct __ns_msg { const u_char *_sections[ns_s_max]; ns_sect _sect; int _rrnum; - const u_char *_ptr; + const u_char *_msg_ptr; } ns_msg; /* Private data structure - do not use from outside library. */ @@ -429,7 +429,7 @@ typedef enum __ns_cert_types { * Inline versions of get/put short/long. Pointer is advanced. */ #define NS_GET16(s, cp) do { \ - register const u_char *t_cp = (cp); \ + register const u_char *t_cp = (const u_char *)(cp); \ (s) = ((u_int16_t)t_cp[0] << 8) \ | ((u_int16_t)t_cp[1]) \ ; \ @@ -437,7 +437,7 @@ typedef enum __ns_cert_types { } while (0) #define NS_GET32(l, cp) do { \ - register const u_char *t_cp = (cp); \ + register const u_char *t_cp = (const u_char *)(cp); \ (l) = ((u_int32_t)t_cp[0] << 24) \ | ((u_int32_t)t_cp[1] << 16) \ | ((u_int32_t)t_cp[2] << 8) \ diff --git a/lib/bind/include/isc/logging.h b/lib/bind/include/isc/logging.h index b3435ff7b2..d544ee1303 100644 --- a/lib/bind/include/isc/logging.h +++ b/lib/bind/include/isc/logging.h @@ -90,7 +90,7 @@ int log_remove_channel(log_context, int, log_channel); int log_option(log_context, int, int); int log_category_is_active(log_context, int); log_channel log_new_syslog_channel(unsigned int, int, int); -log_channel log_new_file_channel(unsigned int, int, char *, +log_channel log_new_file_channel(unsigned int, int, const char *, FILE *, unsigned int, unsigned long); int log_set_file_owner(log_channel, uid_t, gid_t); diff --git a/lib/bind/include/isc/misc.h b/lib/bind/include/isc/misc.h index 5799316f12..b75121d4d2 100644 --- a/lib/bind/include/isc/misc.h +++ b/lib/bind/include/isc/misc.h @@ -16,16 +16,24 @@ */ /* - * $Id: misc.h,v 1.1 2001/03/29 06:31:36 marka Exp $ + * $Id: misc.h,v 1.2 2001/06/21 08:26:05 marka Exp $ */ #ifndef _ISC_MISC_H #define _ISC_MISC_H +#include + #define bitncmp __bitncmp /*#define isc_movefile __isc_movefile */ extern int bitncmp(const void *l, const void *r, int n); extern int isc_movefile(const char *, const char *); +extern int isc_gethexstring(unsigned char *, size_t, int, FILE *, + int *); +extern void isc_puthexstring(FILE *, const unsigned char *, size_t, + size_t, size_t, const char *); +extern void isc_tohex(const unsigned char *, size_t, char *); + #endif /*_ISC_MISC_H*/ diff --git a/lib/bind/include/netdb.h b/lib/bind/include/netdb.h index 8432353ac1..b9d9b779db 100644 --- a/lib/bind/include/netdb.h +++ b/lib/bind/include/netdb.h @@ -86,7 +86,7 @@ /* * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * $Id: netdb.h,v 1.4 2001/05/10 07:33:30 marka Exp $ + * $Id: netdb.h,v 1.5 2001/06/21 08:26:00 marka Exp $ */ #ifndef _NETDB_H_ @@ -118,10 +118,10 @@ #define _PATH_SERVICES "/etc/services" #endif -#ifdef _REENTRANT __BEGIN_DECLS extern int * __h_errno __P((void)); __END_DECLS +#ifdef _REENTRANT #define h_errno (*__h_errno()) #else extern int h_errno; diff --git a/lib/bind/include/resolv.h b/lib/bind/include/resolv.h index a297dad2ce..06025f5d1f 100644 --- a/lib/bind/include/resolv.h +++ b/lib/bind/include/resolv.h @@ -50,7 +50,7 @@ /* * @(#)resolv.h 8.1 (Berkeley) 6/2/93 - * $Id: resolv.h,v 1.5 2001/05/28 08:38:20 marka Exp $ + * $Id: resolv.h,v 1.6 2001/06/21 08:26:01 marka Exp $ */ #ifndef _RESOLV_H_ @@ -190,6 +190,15 @@ struct __res_state { typedef struct __res_state *res_state; +union res_sockaddr_union { + struct sockaddr_in sin; +#ifdef IN6ADDR_ANY_INIT + struct sockaddr_in6 sin6; +#endif + int64_t __align; /* 64bit alignment */ + char __space[128]; /* max size */ +}; + /* * Resolver flags (used to be discrete per-module statics ints). */ @@ -358,6 +367,10 @@ extern const struct res_sym __p_rcode_syms[]; #define sym_ston __sym_ston #define res_nopt __res_nopt #define res_ndestroy __res_ndestroy +#define res_nametoclass __res_nametoclass +#define res_nametotype __res_nametotype +#define res_setservers __res_setservers +#define res_getservers __res_getservers __BEGIN_DECLS int res_hnok __P((const char *)); int res_ownok __P((const char *)); @@ -435,6 +448,12 @@ void res_buildprotolist __P((void)); const char * res_get_nibblesuffix __P((res_state)); const char * res_get_bitstringsuffix __P((res_state)); void res_ndestroy __P((res_state)); +u_int16_t res_nametoclass __P((const char *buf, int *success)); +u_int16_t res_nametotype __P((const char *buf, int *success)); +void res_setservers __P((res_state, + const union res_sockaddr_union *, int)); +int res_getservers __P((res_state, + union res_sockaddr_union *, int)); __END_DECLS #endif /* !_RESOLV_H_ */ diff --git a/lib/bind/inet/inet_data.c b/lib/bind/inet/inet_data.c index 197ee67661..54977d1844 100644 --- a/lib/bind/inet/inet_data.c +++ b/lib/bind/inet/inet_data.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id: inet_data.c,v 1.1 2001/03/29 06:31:37 marka Exp $"; +static char rcsid[] = "$Id: inet_data.c,v 1.2 2001/06/21 08:26:06 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -40,15 +40,5 @@ static char rcsid[] = "$Id: inet_data.c,v 1.1 2001/03/29 06:31:37 marka Exp $"; #include "port_after.h" -#ifndef IN6ADDR_ANY_INIT -#define IN6ADDR_ANY_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} -#endif -#ifndef IN6ADDR_LOOPBACK_INIT -#define IN6ADDR_LOOPBACK_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}} -#endif - - -#ifndef HAS_INET6_STRUCTS -const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; -const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; -#endif +const struct in6_addr isc_in6addr_any = IN6ADDR_ANY_INIT; +const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT; diff --git a/lib/bind/irs/dns_ho.c b/lib/bind/irs/dns_ho.c index 864d026595..645c9b3aaa 100644 --- a/lib/bind/irs/dns_ho.c +++ b/lib/bind/irs/dns_ho.c @@ -52,7 +52,7 @@ /* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: dns_ho.c,v 1.3 2001/05/22 22:53:24 marka Exp $"; +static const char rcsid[] = "$Id: dns_ho.c,v 1.4 2001/06/21 08:26:08 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports. */ @@ -662,7 +662,7 @@ ar_head(cp, count, msg, eom, pvt, name_ok) int (*name_ok)(const char *); { int n; - u_char buf[1024]; /* XXX */ + char buf[1024]; /* XXX */ while (count-- > 0 && cp < eom) { n = dn_expand(msg, eom, cp, buf, sizeof(buf)); @@ -693,7 +693,7 @@ a6_expand(const u_char *ansbuf, const u_char *a6p, int n, pbyte, plen1, pbyte1, error = 0; const u_char *cp; struct addrinfo sentinel, *cur; - u_char pname[1024], buf[1024]; /* XXX */ + char pname[1024], buf[1024]; /* XXX */ *errorp = NETDB_SUCCESS; memset(&sentinel, 0, sizeof(sentinel)); @@ -1382,7 +1382,9 @@ gethostans(struct irs_ho *this, /* make addrinfo. don't overwrite constant PAI */ ai = *pai; ai.ai_family = (type == T_AAAA) ? AF_INET6 : AF_INET; - cur->ai_next = addr2addrinfo((const struct addrinfo *)&ai, cp); + cur->ai_next = addr2addrinfo( + (const struct addrinfo *)&ai, + (const char *)cp); if (cur->ai_next == NULL) had_error++; diff --git a/lib/bind/irs/getnameinfo.c b/lib/bind/irs/getnameinfo.c index 2ab45ba615..0e86cc1523 100644 --- a/lib/bind/irs/getnameinfo.c +++ b/lib/bind/irs/getnameinfo.c @@ -81,7 +81,9 @@ struct sockinet { static int ip6_parsenumeric __P((const struct sockaddr *, const char *, char *, size_t, int)); +#ifdef HAVE_SIN6_SCOPE_ID static int ip6_sa2str __P((const struct sockaddr_in6 *, char *, size_t, int)); +#endif int getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) @@ -135,7 +137,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) * the caller does not want the result. */ } else if (flags & NI_NUMERICSERV) { - snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); + sprintf(numserv, "%d", ntohs(port)); if (strlen(numserv) > servlen) return EAI_MEMORY; strcpy(serv, numserv); @@ -208,16 +210,17 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) } static int -ip6_parsenumeric(sa, addr, host, hostlen, flags) - const struct sockaddr *sa; - const char *addr; - char *host; - size_t hostlen; - int flags; +ip6_parsenumeric(const struct sockaddr *sa, const char *addr, char *host, + size_t hostlen, int flags) { size_t numaddrlen; char numaddr[512]; +#ifndef HAVE_SIN6_SCOPE_ID + UNUSED(sa); + UNUSED(flags); +#endif + if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL) return EAI_SYSTEM; @@ -250,26 +253,28 @@ ip6_parsenumeric(sa, addr, host, hostlen, flags) return 0; } +#ifdef HAVE_SIN6_SCOPE_ID /* ARGSUSED */ static int -ip6_sa2str(sa6, buf, bufsiz, flags) - const struct sockaddr_in6 *sa6; - char *buf; - size_t bufsiz; - int flags; +ip6_sa2str(const struct sockaddr_in6 *sa6, char *buf, + size_t bufsiz, int flags) { #ifdef USE_IFNAMELINKID unsigned int ifindex = (unsigned int)sa6->sin6_scope_id; const struct in6_addr *a6 = &sa6->sin6_addr; #endif + char tmp[64]; -#ifdef HAVE_SIN6_SCOPE_ID #ifdef NI_NUMERICSCOPE if (flags & NI_NUMERICSCOPE) { - return(snprintf(buf, bufsiz, "%d", sa6->sin6_scope_id)); + sprintf(tmp, "%u", sa6->sin6_scope_id); + if (bufsiz != 0) { + strncpy(buf, tmp, bufsiz - 1); + buf[bufsiz - 1] = '\0'; + } + return(strlen(tmp)); } #endif -#endif #ifdef USE_IFNAMELINKID /* @@ -292,9 +297,11 @@ ip6_sa2str(sa6, buf, bufsiz, flags) #endif /* last resort */ -#ifdef HAVE_SIN6_SCOPE_ID - return(snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id)); -#else - return(snprintf(buf, bufsiz, "0")); /* no scope */ -#endif + sprintf(tmp, "%u", sa6->sin6_scope_id); + if (bufsiz != 0) { + strncpy(buf, tmp, bufsiz - 1); + buf[bufsiz - 1] = '\0'; + } + return(strlen(tmp)); } +#endif diff --git a/lib/bind/irs/irs_data.c b/lib/bind/irs/irs_data.c index 16609a40fe..b3c5b17685 100644 --- a/lib/bind/irs/irs_data.c +++ b/lib/bind/irs/irs_data.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irs_data.c,v 1.1 2001/03/29 06:31:50 marka Exp $"; +static const char rcsid[] = "$Id: irs_data.c,v 1.2 2001/06/21 08:26:10 marka Exp $"; #endif #include "port_before.h" @@ -30,6 +30,7 @@ static const char rcsid[] = "$Id: irs_data.c,v 1.1 2001/03/29 06:31:50 marka Exp #include #include +#include #include #ifdef DO_PTHREADS @@ -165,6 +166,7 @@ net_data_minimize(struct net_data *net_data) { res_nclose(net_data->res); } +#ifdef _REENTRANT struct __res_state * __res_state(void) { /* NULL param here means use the default config file. */ @@ -174,6 +176,7 @@ __res_state(void) { return (&_res); } +#endif int * __h_errno(void) { diff --git a/lib/bind/irs/lcl_sv.c b/lib/bind/irs/lcl_sv.c index b83ce9ac09..f26616f649 100644 --- a/lib/bind/irs/lcl_sv.c +++ b/lib/bind/irs/lcl_sv.c @@ -49,7 +49,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: lcl_sv.c,v 1.1 2001/03/29 06:31:51 marka Exp $"; +static const char rcsid[] = "$Id: lcl_sv.c,v 1.2 2001/06/21 08:26:12 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* extern */ @@ -394,7 +394,7 @@ sv_db_rec(struct lcl_sv *sv, DBT *key, DBT *data) { return (NULL); sv->serv.s_port = ((u_short *)key->data)[1]; n = strlen(p) + 1; - if (n > sizeof(sv->line)) { + if ((size_t)n > sizeof(sv->line)) { n = sizeof(sv->line); } memcpy(sv->line, p, n); diff --git a/lib/bind/isc/Makefile.in b/lib/bind/isc/Makefile.in index 289ea6f8b0..81986578ef 100644 --- a/lib/bind/isc/Makefile.in +++ b/lib/bind/isc/Makefile.in @@ -13,17 +13,17 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.4 2001/05/31 05:54:04 marka Exp $ +# $Id: Makefile.in,v 1.5 2001/06/21 08:26:13 marka Exp $ OBJS= assertions.@O@ base64.@O@ bitncmp.@O@ ctl_clnt.@O@ ctl_p.@O@ \ ctl_srvr.@O@ ev_connects.@O@ ev_files.@O@ ev_streams.@O@ \ - ev_timers.@O@ ev_waits.@O@ eventlib.@O@ heap.@O@ logging.@O@ \ - memcluster.@O@ movefile.@O@ tree.@O@ ip6.@O@ + ev_timers.@O@ ev_waits.@O@ eventlib.@O@ heap.@O@ hex.@O@ \ + logging.@O@ memcluster.@O@ movefile.@O@ tree.@O@ SRCS= assertions.c base64.c bitncmp.c ctl_clnt.c ctl_p.c \ ctl_srvr.c ev_connects.c ev_files.c ev_streams.c \ - ev_timers.c ev_waits.c eventlib.c heap.c logging.c \ - memcluster.c movefile.c tree.c ip6.c + ev_timers.c ev_waits.c eventlib.c heap.c hex.c logging.c \ + memcluster.c movefile.c tree.c TARGETS= ${OBJS} diff --git a/lib/bind/isc/hex.c b/lib/bind/isc/hex.c new file mode 100644 index 0000000000..2239796298 --- /dev/null +++ b/lib/bind/isc/hex.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2001 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include + +static const char hex[17] = "0123456789abcdef"; + +int +isc_gethexstring(unsigned char *buf, size_t len, int count, FILE *fp, + int *multiline) +{ + int c, n; + unsigned char x; + char *s; + int result = count; + + x = 0; /* silence compiler */ + n = 0; + while (count > 0) { + c = fgetc(fp); + + if ((c == EOF) || + (c == '\n' && !*multiline) || + (c == '(' && *multiline) || + (c == ')' && !*multiline)) + goto formerr; + /* comment */ + if (c == ';') { + while ((c = fgetc(fp)) != EOF && c != '\n') + /* empty */ + if (c == '\n' && *multiline) + continue; + goto formerr; + } + /* white space */ + if (c == ' ' || c == '\t' || c == '\n' || c == '\r') + continue; + /* multiline */ + if ('(' == c || c == ')') { + *multiline = (c == '(' /*)*/); + continue; + } + if ((s = strchr(hex, tolower(c))) == NULL) + goto formerr; + x = (x<<4) | (s - hex); + if (++n == 2) { + if (len > 0) { + *buf++ = x; + len--; + } else + result = -1; + count--; + n = 0; + } + } + return (result); + + formerr: + if (c == '\n') + ungetc(c, fp); + return (-1); +} + +void +isc_puthexstring(FILE *fp, const unsigned char *buf, size_t buflen, + size_t len1, size_t len2, const char *sep) +{ + size_t i = 0; + + if (len1 < 4) + len1 = 4; + if (len2 < 4) + len2 = 4; + while (buflen > 0) { + fputc(hex[(buf[0]>>4)&0xf], fp); + fputc(hex[buf[0]&0xf], fp); + i += 2; + buflen--; + buf++; + if (i >= len1 && sep != NULL) { + fputs(sep, fp); + i = 0; + len1 = len2; + } + } +} + +void +isc_tohex(const unsigned char *buf, size_t buflen, char *t) { + while (buflen > 0) { + *t++ = hex[(buf[0]>>4)&0xf]; + *t++ = hex[buf[0]&0xf]; + buf++; + buflen--; + } + *t = '\0'; +} diff --git a/lib/bind/isc/ip6.c b/lib/bind/isc/ip6.c deleted file mode 100644 index 82f48590d8..0000000000 --- a/lib/bind/isc/ip6.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include -#include -#if (!defined(BSD)) || (BSD < 199306) -#include -#endif -#include -#include - -/* - * Make sure we don't cause linkage problems. - */ -const struct in6_addr isc_in6addr_any = IN6ADDR_ANY_INIT; -#if 0 -const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT; -#endif diff --git a/lib/bind/isc/logging.c b/lib/bind/isc/logging.c index a08c413b6f..cf1911410e 100644 --- a/lib/bind/isc/logging.c +++ b/lib/bind/isc/logging.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: logging.c,v 1.2 2001/05/28 08:38:28 marka Exp $"; +static const char rcsid[] = "$Id: logging.c,v 1.3 2001/06/21 08:26:15 marka Exp $"; #endif /* not lint */ #include "port_before.h" @@ -596,7 +596,7 @@ log_new_syslog_channel(unsigned int flags, int level, int facility) { log_channel log_new_file_channel(unsigned int flags, int level, - char *name, FILE *stream, unsigned int versions, + const char *name, FILE *stream, unsigned int versions, unsigned long max_size) { log_channel chan; diff --git a/lib/bind/isc/memcluster.c b/lib/bind/isc/memcluster.c index cd2c0523a4..0c0223d92f 100644 --- a/lib/bind/isc/memcluster.c +++ b/lib/bind/isc/memcluster.c @@ -24,7 +24,7 @@ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: memcluster.c,v 1.2 2001/05/28 08:38:29 marka Exp $"; +static const char rcsid[] = "$Id: memcluster.c,v 1.3 2001/06/21 08:26:16 marka Exp $"; #endif /* not lint */ #include "port_before.h" @@ -67,7 +67,7 @@ typedef struct { const char * file; int line; #endif - int size; + size_t size; fence_t fencepost; #endif } memcluster_element; @@ -343,7 +343,7 @@ __memput_record(void *mem, size_t size, const char *file, int line) { #ifdef MEMCLUSTER_RECORD memcluster_element *prev; #endif - int fp; + fence_t fp; char *p; #endif @@ -484,7 +484,7 @@ memstats(FILE *out) { for (i = 1; i <= max_size; i++) { if ((e = activelists[i]) != NULL) while (e != NULL) { - fprintf(out, "%s:%d %#p:%d\n", + fprintf(out, "%s:%d %p:%d\n", e->file != NULL ? e->file : "", e->line, (char *)e + sizeof *e, e->size); @@ -538,7 +538,7 @@ quantize(size_t size) { #if defined(DEBUGGING_MEMCLUSTER) static void check(unsigned char *a, int value, size_t len) { - int i; + size_t i; for (i = 0; i < len; i++) INSIST(a[i] == value); } diff --git a/lib/bind/nameser/ns_parse.c b/lib/bind/nameser/ns_parse.c index dab0b711ad..6b591d1453 100644 --- a/lib/bind/nameser/ns_parse.c +++ b/lib/bind/nameser/ns_parse.c @@ -16,20 +16,13 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_parse.c,v 1.2 2001/04/11 08:13:11 marka Exp $"; +static const char rcsid[] = "$Id: ns_parse.c,v 1.3 2001/06/21 08:26:18 marka Exp $"; #endif /* Import. */ #include "port_before.h" -/* - * force stdio.h to be included before arpa/nameser.h as it - * #defines _ptr __ptr on HPUX - */ - -#include - #include #include @@ -154,38 +147,38 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { if (rrnum < handle->_rrnum) setsection(handle, section); if (rrnum > handle->_rrnum) { - b = ns_skiprr(handle->_ptr, handle->_eom, section, + b = ns_skiprr(handle->_msg_ptr, handle->_eom, section, rrnum - handle->_rrnum); if (b < 0) return (-1); - handle->_ptr += b; + handle->_msg_ptr += b; handle->_rrnum = rrnum; } /* Do the parse. */ b = dn_expand(handle->_msg, handle->_eom, - handle->_ptr, rr->name, NS_MAXDNAME); + handle->_msg_ptr, rr->name, NS_MAXDNAME); if (b < 0) return (-1); - handle->_ptr += b; - if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom) + handle->_msg_ptr += b; + if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom) RETERR(EMSGSIZE); - NS_GET16(rr->type, handle->_ptr); - NS_GET16(rr->rr_class, handle->_ptr); + NS_GET16(rr->type, handle->_msg_ptr); + NS_GET16(rr->rr_class, handle->_msg_ptr); if (section == ns_s_qd) { rr->ttl = 0; rr->rdlength = 0; rr->rdata = NULL; } else { - if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) + if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) RETERR(EMSGSIZE); - NS_GET32(rr->ttl, handle->_ptr); - NS_GET16(rr->rdlength, handle->_ptr); - if (handle->_ptr + rr->rdlength > handle->_eom) + NS_GET32(rr->ttl, handle->_msg_ptr); + NS_GET16(rr->rdlength, handle->_msg_ptr); + if (handle->_msg_ptr + rr->rdlength > handle->_eom) RETERR(EMSGSIZE); - rr->rdata = handle->_ptr; - handle->_ptr += rr->rdlength; + rr->rdata = handle->_msg_ptr; + handle->_msg_ptr += rr->rdlength; } if (++handle->_rrnum > handle->_counts[(int)section]) setsection(handle, (ns_sect)((int)section + 1)); @@ -201,9 +194,9 @@ setsection(ns_msg *msg, ns_sect sect) { msg->_sect = sect; if (sect == ns_s_max) { msg->_rrnum = -1; - msg->_ptr = NULL; + msg->_msg_ptr = NULL; } else { msg->_rrnum = 0; - msg->_ptr = msg->_sections[(int)sect]; + msg->_msg_ptr = msg->_sections[(int)sect]; } } diff --git a/lib/bind/nameser/ns_print.c b/lib/bind/nameser/ns_print.c index 03efb0cba0..0eaf2b98e9 100644 --- a/lib/bind/nameser/ns_print.c +++ b/lib/bind/nameser/ns_print.c @@ -16,7 +16,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_print.c,v 1.2 2001/05/28 08:38:30 marka Exp $"; +static const char rcsid[] = "$Id: ns_print.c,v 1.3 2001/06/21 08:26:19 marka Exp $"; #endif /* Import. */ @@ -709,7 +709,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, int n, m; char *p; - len = SPRINTF((tmp, "\\#(\t\t; %s", comment)); + len = SPRINTF((tmp, "\\# %u (\t; %s", edata - rdata, comment)); T(addstr(tmp, len, &buf, &buflen)); while (rdata < edata) { p = tmp; diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index 1f651864f9..8ec7f772a2 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -291,4 +291,6 @@ void endpwent_r(void); int setpassent(int stayopen); #endif +int isc__gettimeofday(struct timeval *tp, struct timezone *tzp); + #endif diff --git a/lib/bind/resolv/herror.c b/lib/bind/resolv/herror.c index e7e060d9d5..cca113fffa 100644 --- a/lib/bind/resolv/herror.c +++ b/lib/bind/resolv/herror.c @@ -50,7 +50,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: herror.c,v 1.1 2001/03/29 06:31:58 marka Exp $"; +static const char rcsid[] = "$Id: herror.c,v 1.2 2001/06/21 08:26:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -89,7 +89,6 @@ int h_errno; void herror(const char *s) { struct iovec iov[4], *v = iov; - extern int * __h_errno(); char *t; if (s != NULL && *s != '\0') { diff --git a/lib/bind/resolv/res_debug.c b/lib/bind/resolv/res_debug.c index 8c4b85e7cb..be33c03943 100644 --- a/lib/bind/resolv/res_debug.c +++ b/lib/bind/resolv/res_debug.c @@ -95,7 +95,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_debug.c,v 1.2 2001/04/03 13:46:25 marka Exp $"; +static const char rcsid[] = "$Id: res_debug.c,v 1.3 2001/06/21 08:26:22 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -536,7 +536,17 @@ sym_ntop(const struct res_sym *syms, int number, int *success) { */ const char * p_type(int type) { - return (sym_ntos(__p_type_syms, type, (int *)0)); + int success; + const char *result; + static char typebuf[20]; + + result = sym_ntos(__p_type_syms, type, &success); + if (success) + return (result); + if (type < 0 || type > 0xfff) + return ("BADTYPE"); + sprintf(typebuf, "TYPE%d", type); + return (typebuf); } /* @@ -562,7 +572,17 @@ p_section(int section, int opcode) { */ const char * p_class(int class) { - return (sym_ntos(__p_class_syms, class, (int *)0)); + int success; + const char *result; + static char classbuf[20]; + + result = sym_ntos(__p_class_syms, class, &success); + if (success) + return (result); + if (class < 0 || class > 0xfff) + return ("BADCLASS"); + sprintf(classbuf, "CLASS%d", class); + return (classbuf); } /* @@ -1061,3 +1081,39 @@ p_secstodate (u_long secs) { time->tm_hour, time->tm_min, time->tm_sec); return (output); } + +u_int16_t +res_nametoclass(const char *buf, int *success) { + unsigned long result; + char *endptr; + + result = sym_ston(__p_class_syms, buf, success); + if (success) + return (result); + + if (strncasecmp(buf, "CLASS", 5) != 0 || + !isdigit((unsigned char)buf[5])) + return (result); + result = strtoul(buf, &endptr, 10); + if (*endptr == '\0' && result <= 0xffff) + *success = 1; + return (result); +} + +u_int16_t +res_nametotype(const char *buf, int *success) { + unsigned long result; + char *endptr; + + result = sym_ston(__p_type_syms, buf, success); + if (success) + return (result); + + if (strncasecmp(buf, "type", 4) != 0 || + !isdigit((unsigned char)buf[4])) + return (result); + result = strtoul(buf, &endptr, 10); + if (*endptr == '\0' && result <= 0xffff) + *success = 1; + return (result); +} diff --git a/lib/bind/resolv/res_init.c b/lib/bind/resolv/res_init.c index aa380913ae..9f8a82533c 100644 --- a/lib/bind/resolv/res_init.c +++ b/lib/bind/resolv/res_init.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static const char rcsid[] = "$Id: res_init.c,v 1.6 2001/05/28 08:38:32 marka Exp $"; +static const char rcsid[] = "$Id: res_init.c,v 1.7 2001/06/21 08:26:23 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -85,7 +85,6 @@ static const char rcsid[] = "$Id: res_init.c,v 1.6 2001/05/28 08:38:32 marka Exp #include #include -#include #include #include #include @@ -93,6 +92,10 @@ static const char rcsid[] = "$Id: res_init.c,v 1.6 2001/05/28 08:38:32 marka Exp #include #include "port_after.h" + +/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */ +#include + #include "res_private.h" /* Options. Should all be left alone. */ @@ -314,7 +317,7 @@ __res_vinit(res_state statp, int preinit) { hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; - snprintf(sbuf, sizeof(sbuf), "%u", NAMESERVER_PORT); + sprintf(sbuf, "%u", NAMESERVER_PORT); if (getaddrinfo(cp, sbuf, &hints, &ai) == 0 && ai->ai_addrlen <= minsiz) { if (statp->_u._ext.ext != NULL) { @@ -382,8 +385,7 @@ __res_vinit(res_state statp, int preinit) { continue; } } - - if (nserv > 1) + if (nserv > 1) statp->nscount = nserv; #ifdef RESOLVSORT statp->nsort = nsort; @@ -617,3 +619,96 @@ res_get_bitstringsuffix(res_state statp) { return (statp->_u._ext.ext->bsuffix); return ("ip6.arpa"); } + +void +res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) { + int i, nserv; + size_t size; + + /* close open servers */ + res_nclose(statp); + + /* cause rtt times to be forgotten */ + statp->_u._ext.nscount = 0; + + nserv = 0; + for (i = 0; i < cnt && nserv < MAXNS; i++) { + switch (set->sin.sin_family) { + case AF_INET: + size = sizeof(set->sin); + if (statp->_u._ext.ext) + memcpy(&statp->_u._ext.ext->nsaddrs[nserv], + &set->sin, size); + if (size <= sizeof(statp->nsaddr_list[nserv])) + memcpy(&statp->nsaddr_list[nserv], + &set->sin, size); + else + statp->nsaddr_list[nserv].sin_family = 0; + nserv++; + break; + + case AF_INET6: + size = sizeof(set->sin6); + if (statp->_u._ext.ext) + memcpy(&statp->_u._ext.ext->nsaddrs[nserv], + &set->sin6, size); + if (size <= sizeof(statp->nsaddr_list[nserv])) + memcpy(&statp->nsaddr_list[nserv], + &set->sin6, size); + else + statp->nsaddr_list[nserv].sin_family = 0; + nserv++; + break; + + default: + break; + } + set++; + } + statp->nscount = nserv; + +} + +int +res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { + int i; + size_t size; + u_int16_t family; + + for (i = 0; i < statp->nscount && i < cnt; i++) { + if (statp->_u._ext.ext) + family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family; + else + family = statp->nsaddr_list[i].sin_family; + + switch (family) { + case AF_INET: + size = sizeof(set->sin); + if (statp->_u._ext.ext) + memcpy(&set->sin, + &statp->_u._ext.ext->nsaddrs[i], + size); + else + memcpy(&set->sin, &statp->nsaddr_list[i], + size); + break; + + case AF_INET6: + size = sizeof(set->sin6); + if (statp->_u._ext.ext) + memcpy(&set->sin6, + &statp->_u._ext.ext->nsaddrs[i], + size); + else + memcpy(&set->sin6, &statp->nsaddr_list[i], + size); + break; + + default: + set->sin.sin_family = 0; + break; + } + set++; + } + return (statp->nscount); +} diff --git a/lib/bind/resolv/res_private.h b/lib/bind/resolv/res_private.h index 028c553557..2c7fa5e2a8 100644 --- a/lib/bind/resolv/res_private.h +++ b/lib/bind/resolv/res_private.h @@ -1,15 +1,8 @@ #ifndef res_private_h #define res_private_h -union __res_sockaddr_union { - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - int64_t __align; /* 64bit alignment */ - char __space[128]; /* max size */ -}; - struct __res_state_ext { - union __res_sockaddr_union nsaddrs[MAXNS]; + union res_sockaddr_union nsaddrs[MAXNS]; struct sort_list { int af; union { diff --git a/lib/bind/resolv/res_send.c b/lib/bind/resolv/res_send.c index 4445be3b63..d9145c4bbe 100644 --- a/lib/bind/resolv/res_send.c +++ b/lib/bind/resolv/res_send.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_send.c,v 1.3 2001/05/14 07:59:46 marka Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 1.4 2001/06/21 08:26:26 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -132,9 +132,7 @@ static int pselect(int, void *, void *, void *, #endif void res_pquery(const res_state, const u_char *, int, FILE *); -#ifdef INET6 static const int niflags = NI_NUMERICHOST | NI_NUMERICSERV; -#endif /* Public. */ @@ -276,9 +274,7 @@ res_nsend(res_state statp, const u_char *buf, int buflen, u_char *ans, int anssiz) { int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; -#ifdef INET6 char abuf[NI_MAXHOST]; -#endif if (statp->nscount == 0) { errno = ESRCH; @@ -300,11 +296,7 @@ res_nsend(res_state statp, */ if (EXT(statp).nscount != 0) { int needclose = 0; -#ifdef INET6 struct sockaddr_storage peer; -#else - struct sockaddr peer; -#endif int peerlen; if (EXT(statp).nscount != statp->nscount) @@ -359,35 +351,27 @@ res_nsend(res_state statp, */ if ((statp->options & RES_ROTATE) != 0 && (statp->options & RES_BLAST) == 0) { -#ifdef INET6 - union __res_sockaddr_union inu; -#endif + union res_sockaddr_union inu; struct sockaddr_in ina; int lastns = statp->nscount - 1; int fd; u_int16_t nstime; -#ifdef INET6 if (EXT(statp).ext != NULL) inu = EXT(statp).ext->nsaddrs[0]; -#endif ina = statp->nsaddr_list[0]; fd = EXT(statp).nssocks[0]; nstime = EXT(statp).nstimes[0]; for (ns = 0; ns < lastns; ns++) { -#ifdef INET6 if (EXT(statp).ext != NULL) EXT(statp).ext->nsaddrs[ns] = EXT(statp).ext->nsaddrs[ns + 1]; -#endif statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1]; EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1]; EXT(statp).nstimes[ns] = EXT(statp).nstimes[ns + 1]; } -#ifdef INET6 if (EXT(statp).ext != NULL) EXT(statp).ext->nsaddrs[lastns] = inu; -#endif statp->nsaddr_list[lastns] = ina; EXT(statp).nssocks[lastns] = fd; EXT(statp).nstimes[lastns] = nstime; @@ -433,18 +417,11 @@ res_nsend(res_state statp, } while (!done); } -#ifdef INET6 Dprint(((statp->options & RES_DEBUG) && getnameinfo(nsap, nsaplen, abuf, sizeof(abuf), NULL, 0, niflags) == 0), (stdout, ";; Querying server (# %d) address = %s\n", ns + 1, abuf)); -#else - Dprint(statp->options & RES_DEBUG, - (stdout, ";; Querying server (# %d) address = %s\n", - ns + 1, - inet_ntoa(((struct sockaddr_in *)nsap)->sin_addr))); -#endif if (v_circuit) { @@ -477,7 +454,7 @@ res_nsend(res_state statp, DprintQ((statp->options & RES_DEBUG) || (statp->pfcode & RES_PRF_REPLY), - (stdout, ""), + (stdout, "%s", ""), ans, (resplen > anssiz) ? anssiz : resplen); /* @@ -551,10 +528,8 @@ get_salen(sa) if (sa->sa_family == AF_INET) return sizeof(struct sockaddr_in); -#ifdef INET6 else if (sa->sa_family == AF_INET) return sizeof(struct sockaddr_in6); -#endif else return 0; /* unknown, die on connect */ } @@ -568,7 +543,6 @@ get_nsaddr(statp, n) size_t n; { -#ifdef INET6 if (!statp->nsaddr_list[n].sin_family && EXT(statp).ext) { /* * - EXT(statp).ext->nsaddrs[n] holds an address that is larger @@ -584,9 +558,6 @@ get_nsaddr(statp, n) */ return (struct sockaddr *)(void *)&statp->nsaddr_list[n]; } -#else - return (struct sockaddr *)(void *)&statp->nsaddr_list[n]; -#endif } static int @@ -613,11 +584,7 @@ send_vc(res_state statp, /* Are we still talking to whom we want to talk to? */ if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) { -#ifdef INET6 struct sockaddr_storage peer; -#else - struct sockaddr_in peer; -#endif int size = sizeof peer; if (getpeername(statp->_vcsock, @@ -778,11 +745,7 @@ send_dg(res_state statp, int nsaplen; struct timespec now, timeout, finish; fd_set dsmask; -#ifdef INET6 struct sockaddr_storage from; -#else - struct sockaddr_in from; -#endif int fromlen, resplen, seconds, n, s; nsap = get_nsaddr(statp, ns); @@ -980,18 +943,12 @@ Aerror(const res_state statp, FILE *file, const char *string, int error, const struct sockaddr *address, int alen) { int save = errno; -#ifdef INET6 char hbuf[NI_MAXHOST]; char sbuf[NI_MAXSERV]; -#else - char hbuf[sizeof "255.255.255.255"]; - char sbuf[sizeof "65535"]; -#endif alen = alen; if ((statp->options & RES_DEBUG) != 0) { -#ifdef INET6 if (getnameinfo(address, alen, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), niflags)) { strncpy(hbuf, "?", sizeof(hbuf) - 1); @@ -999,13 +956,6 @@ Aerror(const res_state statp, FILE *file, const char *string, int error, strncpy(sbuf, "?", sizeof(sbuf) - 1); sbuf[sizeof(sbuf) - 1] = '\0'; } -#else - inet_ntop(AF_INET, - &((const struct sockaddr_in *)address)->sin_addr, - hbuf, sizeof hbuf), - snprintf(sbuf, sizeof(sbuf), "%u", - ntohs(((const struct sockaddr_in *)address)->sin_port)); -#endif fprintf(file, "res_send: %s ([%s].%s): %s\n", string, hbuf, sbuf, strerror(error)); } @@ -1025,9 +975,7 @@ Perror(const res_state statp, FILE *file, const char *string, int error) { static int sock_eq(struct sockaddr *a, struct sockaddr *b) { struct sockaddr_in *a4, *b4; -#ifdef INET6 struct sockaddr_in6 *a6, *b6; -#endif if (a->sa_family != b->sa_family) return 0; @@ -1037,7 +985,6 @@ sock_eq(struct sockaddr *a, struct sockaddr *b) { b4 = (struct sockaddr_in *)b; return a4->sin_port == b4->sin_port && a4->sin_addr.s_addr == b4->sin_addr.s_addr; -#ifdef INET6 case AF_INET6: a6 = (struct sockaddr_in6 *)a; b6 = (struct sockaddr_in6 *)b; @@ -1046,7 +993,6 @@ sock_eq(struct sockaddr *a, struct sockaddr *b) { a6->sin6_scope_id == b6->sin6_scope_id && #endif IN6_ARE_ADDR_EQUAL(&a6->sin6_addr, &b6->sin6_addr); -#endif default: return 0; } diff --git a/lib/bind/resolv/res_update.c b/lib/bind/resolv/res_update.c index 8e7b010763..630fbc5498 100644 --- a/lib/bind/resolv/res_update.c +++ b/lib/bind/resolv/res_update.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_update.c,v 1.3 2001/05/28 06:25:42 marka Exp $"; +static const char rcsid[] = "$Id: res_update.c,v 1.4 2001/06/21 08:26:27 marka Exp $"; #endif /* not lint */ /* @@ -37,7 +37,6 @@ static const char rcsid[] = "$Id: res_update.c,v 1.3 2001/05/28 06:25:42 marka E #include #include #include -#include #include #include #include @@ -45,6 +44,7 @@ static const char rcsid[] = "$Id: res_update.c,v 1.3 2001/05/28 06:25:42 marka E #include #include +#include #include "port_after.h" #include "res_private.h" @@ -66,7 +66,7 @@ static const char rcsid[] = "$Id: res_update.c,v 1.3 2001/05/28 06:25:42 marka E struct zonegrp { char z_origin[MAXDNAME]; ns_class z_class; - union __res_sockaddr_union z_nsaddrs[MAXNS]; + union res_sockaddr_union z_nsaddrs[MAXNS]; int z_nscount; int z_flags; LIST(ns_updrec) z_rrlist; @@ -77,9 +77,9 @@ struct zonegrp { /* Forward. */ -static int nscopy(union __res_sockaddr_union *, - const union __res_sockaddr_union *, int); -static int nsprom(union __res_sockaddr_union *, const struct in_addr *, int); +static int nscopy(union res_sockaddr_union *, + const union res_sockaddr_union *, int); +static int nsprom(union res_sockaddr_union *, const struct in_addr *, int); static void dprintf(const char *, ...); /* Macros. */ @@ -99,7 +99,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) { struct zonegrp *zptr, tgrp; LIST(struct zonegrp) zgrps; int nzones = 0, nscount = 0, n; - union __res_sockaddr_union nsaddrs[MAXNS]; + union res_sockaddr_union nsaddrs[MAXNS]; /* Thread all of the updates onto a list of groups. */ INIT_LIST(zgrps); @@ -206,7 +206,9 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) { /* Private. */ static int -nscopy(union __res_sockaddr_union *dst, const union __res_sockaddr_union *src, int n) { +nscopy(union res_sockaddr_union *dst, const union res_sockaddr_union *src, + int n) +{ int i; for (i = 0; i < n; i++) @@ -215,7 +217,7 @@ nscopy(union __res_sockaddr_union *dst, const union __res_sockaddr_union *src, i } static int -nsprom(union __res_sockaddr_union *dst, const struct in_addr *src, int n) { +nsprom(union res_sockaddr_union *dst, const struct in_addr *src, int n) { int i; for (i = 0; i < n; i++) {