Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: crm by andrew from 
      ([email protected])
   2. Linux-HA CVS: heartbeat by davidlee from 
      ([email protected])
   3. Linux-HA CVS: heartbeat by davidlee from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Jan 2006 05:05:15 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : crm

Dir     : linux-ha/crm/cib


Modified Files:
        primatives.c 


Log Message:


Logging

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/primatives.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- primatives.c        10 Jan 2006 13:49:04 -0000      1.29
+++ primatives.c        26 Jan 2006 12:05:14 -0000      1.30
@@ -1,4 +1,4 @@
-/* $Id: primatives.c,v 1.29 2006/01/10 13:49:04 andrew Exp $ */
+/* $Id: primatives.c,v 1.30 2006/01/26 12:05:14 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -318,7 +318,7 @@
        }
        object_id = crm_element_value(delete_spec, XML_ATTR_ID);
 
-       crm_debug_2("Processing: <%s id=%s>",
+       crm_debug_3("Processing: <%s id=%s>",
                    crm_str(object_name), crm_str(object_id));
        
        if(delete_spec == NULL) {
@@ -377,6 +377,9 @@
        }
        object_id = crm_element_value(new_obj, XML_ATTR_ID);
 
+       crm_debug_3("Processing: <%s id=%s>",
+                   crm_str(object_name), crm_str(object_id));
+       
        if(new_obj == NULL) {
                result = cib_NOOBJECT;
 
@@ -427,6 +430,9 @@
        CRM_DEV_ASSERT(object_name != NULL);
        if(crm_assert_failed) { return cib_NOOBJECT; }
 
+       crm_debug_3("Processing: <%s id=%s>",
+                   crm_str(object_name), crm_str(object_id));
+       
        if(object_id == NULL) {
                /*  placeholder object */
                target = find_xml_node(parent, object_name, FALSE);




------------------------------

Message: 2
Date: Thu, 26 Jan 2006 05:59:15 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by davidlee from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : davidlee
Host    : 
Project : linux-ha
Module  : heartbeat

Dir     : linux-ha/heartbeat


Modified Files:
        findif.c 


Log Message:
Handle: 'mask: default' from 'route get ...'
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/findif.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- findif.c    9 Nov 2005 16:03:22 -0000       1.50
+++ findif.c    26 Jan 2006 12:59:14 -0000      1.51
@@ -1,4 +1,4 @@
-/* $Id: findif.c,v 1.50 2005/11/09 16:03:22 davidlee Exp $ */
+/* $Id: findif.c,v 1.51 2006/01/26 12:59:14 davidlee Exp $ */
 /*
  * findif.c:   Finds an interface which can route a given address
  *
@@ -96,6 +96,23 @@
 
 #define DEBUG 0
 
+/*
+ * "route -n get iii.jjj.kkk.lll" can, on Solaris at least,
+ * return the word "default" as the value from "mask" and "dest",
+ * typically if the host is remote, reached over a default route. 
+ * We should probably treat such a mask as "0.0.0.0".
+ *
+ * Define "MASK_DEFAULT_TO_ZERO" to enable this interpretation.
+ *
+ * This is better for Solaris and is probably suitable (or irrelevant)
+ * for others OSes also.  But if it breaks another OS, then reduce the
+ * "hash-if 1" below to exclude that OS. 
+ * (David Lee, Jan 2006)
+ */
+#if 1
+# define MASK_DEFAULT_TO_ZERO
+#endif
+
 int    OutputInCIDR=0;
 
 void ConvertQuadToInt (char *dest, int destlen);
@@ -367,6 +384,26 @@
        if (strnlen(mask, sizeof(mask)) == 0) {
                strncpy (mask, "255.255.255.255", sizeof(mask));
        }
+
+       /*
+        * Solaris (at least) can return the word "default" for mask and dest.
+        * For the moment, let's interpret this pair as:
+        *      mask: 0.0.0.0
+        *      destination: <original IP>
+        * (Does "dest" ever get used?)
+        * This was manifesting itself under "BasicSanityCheck", which tries
+        * to use a remote IP number; these typically use the "default" route.
+        * Better schemes are warmly invited...
+        */
+#ifdef MASK_DEFAULT_TO_ZERO
+       if (strncmp(mask, "default", sizeof("default")) == 0) {
+               strncpy (mask, "0.0.0.0", sizeof(mask));
+       }
+       if (strncmp(dest, "default", sizeof("default")) == 0) {
+               strncpy (dest, address, sizeof(dest));
+       }
+#endif
+
        ConvertQuadToInt  (dest, sizeof(dest));
        ConvertBitsToMask (mask, sizeof(mask));
 /*
@@ -879,6 +916,9 @@
 
 /* 
  * $Log: findif.c,v $
+ * Revision 1.51  2006/01/26 12:59:14  davidlee
+ * Handle: 'mask: default' from 'route get ...'
+ *
  * Revision 1.50  2005/11/09 16:03:22  davidlee
  * For 'ctype' macros/functions, some platforms warn if argument is not of 
type (int)
  *




------------------------------

Message: 3
Date: Thu, 26 Jan 2006 09:46:59 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by davidlee from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : davidlee
Host    : 
Project : linux-ha
Module  : heartbeat

Dir     : linux-ha/heartbeat


Modified Files:
        findif.c 


Log Message:
'ConvertBitsToMask()' was buggy.  Remove, replacing with call to OS-native 
'inet_pton()'.
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/findif.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- findif.c    26 Jan 2006 12:59:14 -0000      1.51
+++ findif.c    26 Jan 2006 16:46:59 -0000      1.52
@@ -1,4 +1,4 @@
-/* $Id: findif.c,v 1.51 2006/01/26 12:59:14 davidlee Exp $ */
+/* $Id: findif.c,v 1.52 2006/01/26 16:46:59 davidlee Exp $ */
 /*
  * findif.c:   Finds an interface which can route a given address
  *
@@ -117,8 +117,6 @@
 
 void ConvertQuadToInt (char *dest, int destlen);
 
-void ConvertBitsToMask (char *mask, int masklen);
-
 /*
  * Different OSes offer different mechnisms to obtain this information.
  * Not all this can be determined at configure-time; need a run-time element.
@@ -203,57 +201,6 @@
        snprintf (dest, destlen, "%ld", intdest);
 }
 
-void
-ConvertBitsToMask (char *mask, int masklen)
-{
-       int maskbits;
-       unsigned long int maskflag = 0x1;
-       unsigned long int longmask = 0;
-       int i;
-       int count;
-       char *p;
-       char *lastp=mask+masklen;
-       char maskwithoutdots[12];
-
-       /*
-        * Are there '.'s inside ?
-        * (like from the output of the "route get" command)
-        */
-       if ((p = strtok(mask, ".")) != NULL) {
-               i = strnlen(p, masklen);
-
-               strncpy(maskwithoutdots, p, (i <= 3 ? i : 3));
-
-               for (count=0; count < 3; count++) {
-                       p=strtok(NULL, ".");
-                       if (p != NULL) {
-                               i = strnlen(p, lastp-p);
-                               strncat(maskwithoutdots, p
-                               ,       (i <= 3 && p != NULL ? i : 3));
-                       }
-                       else {
-                               count = 3;
-                       }
-               }
-
-               maskbits = atoi(maskwithoutdots);
-
-       }else{
-               maskbits = atoi(mask);
-       }
-
-       for (i = 0; i < 32; i++) {
-               if (i <  maskbits) {
-                       longmask |= maskflag;
-               }
-               /* printf ("%d:%x:%x\n", i, longmask, maskflag); */
-               maskflag = maskflag << 1;
-       }
-
-       /* printf ("longmask: %u (%X)\n", longmask, longmask); */
-       snprintf (mask, masklen, "%ld", longmask);
-}
-
 static int
 SearchUsingProcRoute (char *address, struct in_addr *in
 ,      struct in_addr *addr_out, char *best_if, size_t best_iflen
@@ -323,6 +270,7 @@
        char  *cp, *sp;
        int done = 0;
        FILE *routefd = NULL;
+       uint32_t maskbits;
 
        
        /* Open route and get the information */
@@ -368,6 +316,7 @@
                        done++;
                }
        }
+       fclose(routefd);
 
        /*
         * Check to see if mask isn't available.  It may not be
@@ -404,11 +353,14 @@
        }
 #endif
 
+       /* FIXME ... is this used at all?  Delete? */
        ConvertQuadToInt  (dest, sizeof(dest));
-       ConvertBitsToMask (mask, sizeof(mask));
-/*
-       ConvertMaskToInt (mask);
-*/
+
+       if (inet_pton(AF_INET, mask, &maskbits) <= 0) {
+               snprintf(errmsg, errmsglen,
+                 "mask [%s] not valid.", mask);
+               return(1);
+       }
 
        if (inet_pton(AF_INET, address, addr_out) <= 0) {
                snprintf(errmsg, errmsglen
@@ -417,13 +369,12 @@
                return(1);
        }
 
-       if ((in->s_addr & atoi(mask)) == (addr_out->s_addr & atoi(mask))) {
+       if ((in->s_addr & maskbits) == (addr_out->s_addr & maskbits)) {
                best_metric = 0;
-               *best_netmask = atoi(mask);
+               *best_netmask = maskbits;
                strncpy(best_if, interface, best_iflen);
        }
 
-       fclose(routefd);
        if (best_metric == INT_MAX) {
                snprintf(errmsg, errmsglen, "No route to %s\n", address);
                return(1);
@@ -916,6 +867,9 @@
 
 /* 
  * $Log: findif.c,v $
+ * Revision 1.52  2006/01/26 16:46:59  davidlee
+ * 'ConvertBitsToMask()' was buggy.  Remove, replacing with call to OS-native 
'inet_pton()'.
+ *
  * Revision 1.51  2006/01/26 12:59:14  davidlee
  * Handle: 'mask: default' from 'route get ...'
  *




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 26, Issue 60
********************************************

Reply via email to