diff --git a/CHANGES b/CHANGES index 6eb240e8e6..3962f73601 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1218. [port] Compaq Trucluster support. + 1219. [bug] Set AI_ADDRCONFIG when looking up addresses via getaddrinfo() (affects dig, host, nslookup, rndc and nsupdate). diff --git a/acconfig.h b/acconfig.h index a6704457a0..72c406bb3e 100644 --- a/acconfig.h +++ b/acconfig.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: acconfig.h,v 1.36 2001/10/22 22:52:16 gson Exp $ */ +/* $Id: acconfig.h,v 1.37 2002/06/07 00:03:46 marka Exp $ */ /*** *** This file is not to be included by any public header files, because @@ -129,3 +129,6 @@ int sigwait(const unsigned int *set, int *sig); /* define if you have strerror in the C library. */ #undef HAVE_STRERROR + +/* Define if you are running under Compaq TruCluster.. */ +#undef HAVE_TRUCLUSTER diff --git a/configure.in b/configure.in index c0026eba7c..e3d8af84de 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.324 $) +AC_REVISION($Revision: 1.325 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.13) @@ -1564,6 +1564,20 @@ ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"], ]) AC_SUBST(ISC_PLATFORM_RLIMITTYPE) +# +# Compaq TruCluster requires more code for handling cluster IP aliases +# +case "$host" in + *-dec-osf*) + AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS") + AC_CHECK_FUNC(clua_getaliasaddress, + AC_DEFINE(HAVE_TRUCLUSTER, 1, + [Define if running under Compaq TruCluster])) + ;; + *) + ;; +esac + # # Microsoft has their own way of handling shared libraries that requires # additional qualifiers on extern variables. Unix systems don't need it. diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index eccdeb8484..7223fac72d 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_ioctl.c,v 1.28 2002/06/04 23:26:16 marka Exp $ */ +/* $Id: ifiter_ioctl.c,v 1.29 2002/06/07 00:03:50 marka Exp $ */ /* * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. @@ -60,12 +60,20 @@ struct isc_interfaceiter { #endif void *buf; /* Buffer for sysctl data. */ unsigned int bufsize; /* Bytes allocated. */ +#ifdef HAVE_TRUCLUSTER + int clua_context; /* Cluster alias context */ +#endif unsigned int pos; /* Current offset in SIOCGLIFCONF data */ isc_interface_t current; /* Current interface data. */ isc_result_t result; /* Last result code. */ }; +#ifdef HAVE_TRUCLUSTER +#include +#include +#endif + /* * Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system @@ -144,6 +152,9 @@ getbuf4(isc_interfaceiter_t *iter) { unexpected: isc_mem_put(iter->mctx, iter->buf, iter->bufsize); iter->buf = NULL; +#ifdef HAVE_TRUCLUSTER + iter->clua_context = 0; +#endif return (ISC_R_UNEXPECTED); } @@ -300,6 +311,33 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { return (result); } +#ifdef HAVE_TRUCLUSTER +static void +get_inaddr(isc_netaddr_t *dst, struct in_addr *src) { + dst->family = AF_INET; + memcpy(&dst->type.in, src, sizeof(struct in_addr)); +} + +static isc_result_t +internal_current_clusteralias(isc_interfaceiter_t *iter) { + struct sockaddr sa; + struct clua_info ci; + while (clua_getaliasaddress(&sa, &iter->clua_context) == CLUA_SUCCESS) { + if (clua_getaliasinfo(&sa, &ci) != CLUA_SUCCESS) + continue; + memset(&iter->current, 0, sizeof(iter->current)); + iter->current.af = sa.sa_family; + memset(iter->current.name, 0, sizeof(iter->current.name)); + sprintf(iter->current.name, "clua%d", ci.aliasid); + iter->current.flags = INTERFACE_F_UP; + get_inaddr(&iter->current.address, &ci.addr); + get_inaddr(&iter->current.netmask, &ci.netmask); + return (ISC_R_SUCCESS); + } + return (ISC_R_NOMORE); +} +#endif + /* * Get information about the current interface to iter->current. * If successful, return ISC_R_SUCCESS. @@ -658,6 +696,10 @@ internal_next4(isc_interfaceiter_t *iter) { REQUIRE (iter->pos < (unsigned int) iter->ifc.ifc_len); +#ifdef HAVE_TRUCLUSTER + if (internal_current_clusteralias(iter) == ISC_R_SUCCESS) + return (ISC_R_SUCCESS); +#endif ifrp = (struct ifreq *)((char *) iter->ifc.ifc_req + iter->pos); #ifdef ISC_PLATFORM_HAVESALEN