Index: bind8/src/CHANGES diff -u bind8/src/CHANGES:8.1166 bind8/src/CHANGES:8.1177 --- bind8/src/CHANGES:8.1166 Sun Jun 8 22:38:13 2003 +++ bind8/src/CHANGES Mon Jun 16 00:35:55 2003 @@ -1,4 +1,30 @@ + --- 8.4.1-P1 released --- (Sun Jun 15 17:35:10 PDT 2003) + +1558. [port] sunos4 doesn't have msg_control (NO_MSG_CONTROL). + +1557. [port] linux: socket returns EINVAL for unsupported family. + +1556. [bug] reference through NULL pointer. + +1555. [bug] sortlist wasn't being applied to AAAA queries. + +1554. [bug] IPv4 access list elements of the form number/number + (e.g. 127/8) were not correctly defined. + +1553. [bug] getifaddrs*() failed to set ifa_dstaddr for point + to point links (overwrote ifa_addr). + +1552. [bug] buffer overruns in getifaddrs*() if the server has + point to point links. + +1551. [port] freebsd: USE_IFNAMELINKIDS should be conditionally + defined. + +1550. [port] TruCluster support didn't build. + +1549. [port] Solaris 9 has /dev/random. + --- 8.4.1-REL released --- (Sun Jun 8 15:11:32 PDT 2003) 1548. [port] winnt: make recv visible from libbind. Index: bind8/src/Version diff -u bind8/src/Version:8.85 bind8/src/Version:8.86 --- bind8/src/Version:8.85 Sun Jun 8 22:14:59 2003 +++ bind8/src/Version Mon Jun 16 00:35:56 2003 @@ -1 +1 @@ -8.4.1-REL +8.4.1-P1 Index: bind8/src/bin/named/ns_main.c diff -u bind8/src/bin/named/ns_main.c:8.187 bind8/src/bin/named/ns_main.c:8.191 --- bind8/src/bin/named/ns_main.c:8.187 Fri Jun 6 05:37:46 2003 +++ bind8/src/bin/named/ns_main.c Sat Jun 14 11:19:35 2003 @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91"; -static const char rcsid[] = "$Id: ns_main.c,v 8.187 2003/06/06 05:37:46 marka Exp $"; +static const char rcsid[] = "$Id: ns_main.c,v 8.191 2003/06/14 11:19:35 marka Exp $"; #endif /* not lint */ /* @@ -1493,10 +1493,10 @@ memcpy(&lifreq, lifrp, sizeof(lifreq)); switch (lifreq.iflr_addr.sa_family) { case AF_INET: - nsin += 2; + nsin += 3; break; case AF_INET6: - nsin6 += 2; + nsin6 += 3; break; default: continue; @@ -1512,7 +1512,7 @@ memcpy(&ifreq, ifreqp, sizeof(ifreq)); switch (ifreq.ifr_addr.sa_family) { case AF_INET: - nsin += 2; + nsin += 3; break; default: continue; @@ -1588,11 +1588,11 @@ switch (lifreq.iflr_addr.sa_family) { case AF_INET: memcpy(sin, &lifreq.iflr_addr, sizeof(*sin)); - ifa->ifa_addr = (struct sockaddr *)sin++; + ifa->ifa_dstaddr = (struct sockaddr *)sin++; break; case AF_INET6: memcpy(sin6, &lifreq.iflr_addr, sizeof(*sin6)); - ifa->ifa_addr = (struct sockaddr *)sin6++; + ifa->ifa_dstaddr = (struct sockaddr *)sin6++; break; default: continue; @@ -1658,7 +1658,7 @@ continue; } memcpy(sin, &ifreq.ifr_addr, sizeof(*sin)); - ifa->ifa_addr = (struct sockaddr *)sin++; + ifa->ifa_dstaddr = (struct sockaddr *)sin++; getnetmask4: memcpy(&ifreq, ifreqp, sizeof(ifreq)); @@ -1769,10 +1769,10 @@ memcpy(&lifreq, lifrp, sizeof(lifreq)); switch (lifreq.lifr_addr.ss_family) { case AF_INET: - nsin += 2; + nsin += 3; break; case AF_INET6: - nsin6 += 2; + nsin6 += 3; break; default: continue; @@ -1850,11 +1850,11 @@ switch (lifreq.lifr_addr.ss_family) { case AF_INET: memcpy(sin, &lifreq.lifr_addr, sizeof(*sin)); - ifa->ifa_addr = (struct sockaddr *)sin++; + ifa->ifa_dstaddr = (struct sockaddr *)sin++; break; case AF_INET6: memcpy(sin6, &lifreq.lifr_addr, sizeof(*sin6)); - ifa->ifa_addr = (struct sockaddr *)sin6++; + ifa->ifa_dstaddr = (struct sockaddr *)sin6++; break; default: continue; @@ -2028,7 +2028,7 @@ next = (struct ifreq *)(((char*)ifrp) + cpsize); switch (ifreq.ifr_addr.sa_family) { case AF_INET: - nsin += 2; + nsin += 3; break; default: continue; @@ -2039,7 +2039,7 @@ clua_cnt = 0; clua_tot = 0; while (clua_getaliasaddress(&clua_addr, &clua_cnt) == CLUA_SUCCESS) { - clua_tot++ + clua_tot++; entries++; nsin += 2; } @@ -2136,7 +2136,7 @@ continue; } memcpy(sin, &ifreq.ifr_addr, sizeof(*sin)); - ifa->ifa_addr = (struct sockaddr *)sin++; + ifa->ifa_dstaddr = (struct sockaddr *)sin++; getnetmask: memcpy(&ifreq, ifrp, sizeof(ifreq)); @@ -2981,7 +2981,8 @@ prev_ifp[inet6] = NULL; if ((s = socket(sa->sa_family, SOCK_DGRAM, 0)) < 0) { - if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) { + if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT || + errno == EINVAL) { ns_notice(ns_log_default, "%s: address family not supported", inet6 ? "AF_INET6" : "AF_INET"); Index: bind8/src/bin/named/ns_parser.y diff -u bind8/src/bin/named/ns_parser.y:8.84 bind8/src/bin/named/ns_parser.y:8.85 --- bind8/src/bin/named/ns_parser.y:8.84 Mon May 26 04:08:58 2003 +++ bind8/src/bin/named/ns_parser.y Fri Jun 13 04:46:06 2003 @@ -1,6 +1,6 @@ %{ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: ns_parser.y,v 8.84 2003/05/26 04:08:58 marka Exp $"; +static char rcsid[] = "$Id: ns_parser.y,v 8.85 2003/06/13 04:46:06 marka Exp $"; #endif /* not lint */ /* @@ -1471,6 +1471,10 @@ $$ = NULL; } else { memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; +#ifdef HAVE_SA_LEN + sin.sin_len = sizeof(sin); +#endif sin.sin_addr.s_addr = htonl(($1 & 0xff) << 24); $$ = new_ip_match_pattern((struct sockaddr *)&sin, $3); if ($$ == NULL) Index: bind8/src/bin/named/ns_req.c diff -u bind8/src/bin/named/ns_req.c:8.183 bind8/src/bin/named/ns_req.c:8.185 --- bind8/src/bin/named/ns_req.c:8.183 Fri May 30 11:52:14 2003 +++ bind8/src/bin/named/ns_req.c Fri Jun 13 06:32:30 2003 @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91"; -static const char rcsid[] = "$Id: ns_req.c,v 8.183 2003/05/30 11:52:14 marka Exp $"; +static const char rcsid[] = "$Id: ns_req.c,v 8.185 2003/06/13 06:32:30 marka Exp $"; #endif /* not lint */ /* @@ -696,7 +696,8 @@ req->r_to ? "->" : "", sa_ntoa(req->r_from), #ifdef HAVE_SIN6_SCOPE_ID - req->r_to->sa_family == AF_INET6 ? + (req->r_to != NULL && + req->r_to->sa_family == AF_INET6) ? satosin6(req->r_to)->sin6_scope_id : #endif 0, strerror(errno)); @@ -1546,8 +1547,8 @@ return (Return); } - if (count > 1 && type == T_A && !NS_OPTION_P(OPTION_NORECURSE) && - hp->rd) + if (count > 1 && (type == T_A || type == T_AAAA) && + !NS_OPTION_P(OPTION_NORECURSE) && hp->rd) sort_response(answers, *cpp, count, from); fetchns: Index: bind8/src/bin/named/ns_resp.c diff -u bind8/src/bin/named/ns_resp.c:8.197 bind8/src/bin/named/ns_resp.c:8.199 --- bind8/src/bin/named/ns_resp.c:8.197 Fri May 30 11:52:14 2003 +++ bind8/src/bin/named/ns_resp.c Fri Jun 13 06:32:30 2003 @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91"; -static const char rcsid[] = "$Id: ns_resp.c,v 8.197 2003/05/30 11:52:14 marka Exp $"; +static const char rcsid[] = "$Id: ns_resp.c,v 8.199 2003/06/13 06:32:30 marka Exp $"; #endif /* not lint */ /* @@ -1384,7 +1384,7 @@ "resp: foundname=%d, count=%d, founddata=%d, cname=%d", foundname, count, founddata, cname); - if (count > 1 && qtype == T_A) + if (count > 1 && (qtype == T_A || qtype == T_AAAA)) sort_response(answers, cp, count, sstosa(&qp->q_from)); fetch_ns: @@ -2352,7 +2352,8 @@ &satosin6(sstosa(&qp->q_to))->sin6_addr, sizeof(struct in6_addr)); #ifdef HAVE_SIN6_SCOPE_ID - if (IN6_IS_ADDR_LINKLOCAL(&pi->ipi6_addr)) + if (req->r_to != NULL && + IN6_IS_ADDR_LINKLOCAL(&pi->ipi6_addr)) pi->ipi6_ifindex = satosin6(req->r_to)->sin6_scope_id; #endif Index: bind8/src/bin/named/ns_sort.c diff -u bind8/src/bin/named/ns_sort.c:8.9 bind8/src/bin/named/ns_sort.c:8.10 --- bind8/src/bin/named/ns_sort.c:8.9 Tue Apr 8 02:44:25 2003 +++ bind8/src/bin/named/ns_sort.c Fri Jun 13 06:18:12 2003 @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static const char sccsid[] = "@(#)ns_sort.c 4.10 (Berkeley) 3/3/91"; -static const char rcsid[] = "$Id: ns_sort.c,v 8.9 2003/04/08 02:44:25 marka Exp $"; +static const char rcsid[] = "$Id: ns_sort.c,v 8.10 2003/06/13 06:18:12 marka Exp $"; #endif /* not lint */ /* @@ -301,12 +301,18 @@ static int sort_rr(u_char *cp, u_char *eom, int ancount, ip_match_list iml) { - int type, class, dlen, n, c, distance, closest = 0; + int type, class, dlen, n, c, distance; + int distance4 = 0, distance6 = 0; struct sockaddr_storage addr; - u_char *rr1 = NULL, *rrbest = NULL, *cpstart; + u_char *rr4 = NULL, *rr6 = NULL, *cpstart; + int changed; - rr1 = NULL; cpstart = cp; + again: + cp = cpstart; + changed = 0; + rr4 = NULL; + rr6 = NULL; for (c = ancount; c > 0; --c) { n = dn_skipname(cp, eom); if (n < 0) @@ -325,35 +331,65 @@ switch (class) { case C_IN: case C_HS: + memset(&addr, 0, sizeof(addr)); addr.ss_family = AF_INET; #ifdef HAVE_SA_LEN addr.ss_len = sizeof(struct sockaddr_in); #endif - memcpy(sa_addr(sstosa(&addr)), cp, - sa_alen(sstosa(&addr))); - /* Find the address with the minimum distance */ - if (rr1 == NULL) { - rr1 = cp; - rrbest = cp; - closest = distance_of_address(iml, sstosa(&addr)); + memcpy(sa_addr(sstosa(&addr)), cp, INADDRSZ); + if (rr4 == NULL) { + rr4 = cp; + distance4 = distance_of_address(iml, + sstosa(&addr)); } else { - distance = distance_of_address(iml, sstosa(&addr)); - if (distance < closest) { - rrbest = cp; - closest = distance; - } + distance = distance_of_address(iml, + sstosa(&addr)); + if (distance < distance4) { + memcpy(&addr, cp, INADDRSZ); + memcpy(cp, rr4, INADDRSZ); + memcpy(rr4, &addr, INADDRSZ); + changed = 1; + } else + distance4 = distance; + rr4 = cp; } break; } break; + + case T_AAAA: + switch (class) { + case C_IN: + memset(&addr, 0, sizeof(addr)); + addr.ss_family = AF_INET6; +#ifdef HAVE_SA_LEN + addr.ss_len = sizeof(struct sockaddr_in6); +#endif + memcpy(sa_addr(sstosa(&addr)), cp, NS_IN6ADDRSZ); + if (rr6 == NULL) { + rr6 = cp; + distance6 = distance_of_address(iml, + sstosa(&addr)); + } else { + distance = distance_of_address(iml, + sstosa(&addr)); + if (distance < distance6) { + memcpy(&addr, cp, NS_IN6ADDRSZ); + memcpy(cp, rr6, NS_IN6ADDRSZ); + memcpy(rr6, &addr, NS_IN6ADDRSZ); + changed = 1; + } else + distance6 = distance; + rr6 = cp; + } + break; + } + break; } cp += dlen; } - if (rr1 != rrbest && rr1 != NULL) { - memcpy(sa_addr(sstosa(&addr)), rrbest, INADDRSZ); - memcpy(rrbest, rr1, INADDRSZ); - memcpy(rr1, sa_addr(sstosa(&addr)), INADDRSZ); - } + if (changed && --ancount > 1) + goto again; return (0); } Index: bind8/src/port/decunix/TruCluster diff -u bind8/src/port/decunix/TruCluster:1.1 bind8/src/port/decunix/TruCluster:1.2 --- bind8/src/port/decunix/TruCluster:1.1 Tue Feb 11 02:34:19 2003 +++ bind8/src/port/decunix/TruCluster Wed Jun 11 22:18:18 2003 @@ -4,6 +4,9 @@ building. I did not try to turn this on by default because it only works on Tru64/TruCluster 5.x, and it requires the TruCluster base software kit (TCRBASE) be installed (for the include and library files) -to build and run (although it should be possible to build with the -static libclua.a and then run without being in a cluster; that is what I -think HPAQ does with their version of BIND). +to build and run. + +To build with the static libclua.a, use "-noso -lclua -lso_archive -lcfg" +in SYSLIBS. This still requires that TCRBASE be installed during build, +but the resulting binary is not dependent on it to run (and can be run +on a non-TruCluster system). Index: bind8/src/port/freebsd/include/port_after.h diff -u bind8/src/port/freebsd/include/port_after.h:1.32 bind8/src/port/freebsd/include/port_after.h:1.33 --- bind8/src/port/freebsd/include/port_after.h:1.32 Thu Apr 24 03:55:37 2003 +++ bind8/src/port/freebsd/include/port_after.h Thu Jun 12 02:34:20 2003 @@ -11,7 +11,6 @@ #define USE_LOG_CONS #define HAVE_CHROOT #define CAN_CHANGE_ID -#define USE_IFNAMELINKID #if __FreeBSD_version >= 330000 #define HAVE_STRLCPY #define HAVE_STRLCAT @@ -51,6 +50,7 @@ #include #ifdef __KAME__ #define HAS_INET6_STRUCTS +#define USE_IFNAMELINKID #endif #include Index: bind8/src/port/solaris/include/port_after.h diff -u bind8/src/port/solaris/include/port_after.h:1.41 bind8/src/port/solaris/include/port_after.h:1.42 --- bind8/src/port/solaris/include/port_after.h:1.41 Mon Apr 28 09:51:08 2003 +++ bind8/src/port/solaris/include/port_after.h Tue Jun 10 01:58:53 2003 @@ -257,4 +257,12 @@ _u.k = konst; \ var = _u.v; \ } while (0) + +/* + * Solaris 9 has /dev/random. + */ +#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 9)) +#define HAVE_DEV_RANDOM +#endif + #endif /* ! PORT_AFTER_H */ Index: bind8/src/port/sunos/include/port_after.h diff -u bind8/src/port/sunos/include/port_after.h:1.30 bind8/src/port/sunos/include/port_after.h:1.31 --- bind8/src/port/sunos/include/port_after.h:1.30 Sun Apr 28 01:13:07 2002 +++ bind8/src/port/sunos/include/port_after.h Sun Jun 15 00:16:34 2003 @@ -19,6 +19,7 @@ #define HAVE_CHROOT #define CAN_CHANGE_ID #define NEED_SECURE_DIRECTORY +#define NO_MSG_CONTROL #define PORT_NONBLOCK O_NDELAY #define PORT_WOULDBLK EWOULDBLOCK