]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1218. [port] Compaq Trucluster support.
authorMark Andrews <marka@isc.org>
Fri, 7 Jun 2002 00:03:50 +0000 (00:03 +0000)
committerMark Andrews <marka@isc.org>
Fri, 7 Jun 2002 00:03:50 +0000 (00:03 +0000)
CHANGES
acconfig.h
configure.in
lib/isc/unix/ifiter_ioctl.c

diff --git a/CHANGES b/CHANGES
index 6eb240e8e668e7a308984f0b923a51027f44a01f..3962f73601c2f6f2762c32f2877a171e2cad8466 100644 (file)
--- 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).
index a6704457a0d15224368fe9a847e796f1d3548e47..72c406bb3e36b6e526bb10bb24c403874b5f2415 100644 (file)
@@ -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
index c0026eba7c9c0ea930841cc5ebb1998402ccadee..e3d8af84de893464f6352f71e67b0264eb0d4a77 100644 (file)
@@ -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.
index eccdeb84842d6d55180e22d1b8b9a2f94538615c..7223fac72d9d67d77e5f4e9a417b62b5d180ef5f 100644 (file)
@@ -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 <clua/clua.h>
+#include <sys/socket.h>
+#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