[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] ccs_tool: readd IPv6 support to update operations



A couple of days ago i submitted (and applied with Patrick ACK) a patch to fix
ccs daemon cluster_base_port to listen and accept connections on IPv6.
https://www.redhat.com/archives/cluster-devel/2007-May/msg00052.html

This is the ccs_tool counter part to make everything working.

Please apply or acknowledge and I will apply.

Thanks
Fabio

-- 
I'm going to make him an offer he can't refuse.
#! /bin/sh /usr/share/dpatch/dpatch-run
## 001_ccs.dpatch by  <fabbione gordian int fabbione net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad redhat-cluster-suite-2.20070502~/ccs/ccs_tool/update.c redhat-cluster-suite-2.20070502/ccs/ccs_tool/update.c
--- redhat-cluster-suite-2.20070502~/ccs/ccs_tool/update.c	2007-05-03 07:29:48.000000000 +0200
+++ redhat-cluster-suite-2.20070502/ccs/ccs_tool/update.c	2007-05-03 07:46:53.000000000 +0200
@@ -20,6 +20,12 @@
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
 
+#ifdef DEBUG
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#endif
+
 #include "comm_headers.h"
 #include "ccs.h"
 #include "libcman.h"
@@ -659,12 +665,43 @@
 static int ccs_open(cman_node_t node, uint16_t port, int timeout)
 {
   struct in_addr *addr;
-  int fd;
+  struct in6_addr *addr6;
+  int fd, family;
+#ifdef DEBUG
+  char buf[INET6_ADDRSTRLEN];
 
-  addr = &(((struct sockaddr_in *)&(node.cn_address.cna_address))->sin_addr);
+  memset(buf, 0, sizeof(buf));
+  fprintf(stderr, "Processing node: %s\n", node.cn_name);
+#endif
+
+  family = ((struct sockaddr *)&(node.cn_address.cna_address))->sa_family;
+
+  if (family == AF_INET6) {
+
+    addr6 = &(((struct sockaddr_in6 *)&(node.cn_address.cna_address))->sin6_addr);
+
+#ifdef DEBUG
+    inet_ntop(family, addr6, buf, sizeof(buf));
+    fprintf(stderr, " family: ipv6\n address: %s\n", buf);
+#endif
+
+    if ((fd = ipv6_connect(addr6, port, timeout)) < 0) {
+      return -1;
+    }
+
+  } else {
+
+    addr = &(((struct sockaddr_in *)&(node.cn_address.cna_address))->sin_addr);
+
+#ifdef DEBUG
+    inet_ntop(family, addr, buf, sizeof(buf));
+    fprintf(stderr, " family: ipv4\n address: %s\n", buf);
+#endif
+
+    if ((fd = ipv4_connect(addr, port, timeout)) < 0) {
+      return -1;
+    }
 
-  if ((fd = ipv4_connect(addr, port, timeout)) < 0) {
-    return -1;
   }
 
   return fd;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]