[Cluster-devel] cluster/ccs/ccs_tool ccs_tool.c update.c
fabbione at sourceware.org
fabbione at sourceware.org
Thu May 3 09:06:40 UTC 2007
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 2007-05-03 09:06:40
Modified files:
ccs/ccs_tool : ccs_tool.c update.c
Log message:
Readd ipv6 support to ccs_tool update and add verbose option
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_tool/ccs_tool.c.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_tool/update.c.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- cluster/ccs/ccs_tool/ccs_tool.c 2006/09/19 13:17:04 1.5
+++ cluster/ccs/ccs_tool/ccs_tool.c 2007/05/03 09:06:39 1.6
@@ -10,6 +10,8 @@
static void print_usage(FILE *stream);
+int globalverbose=0;
+
int main(int argc, char *argv[])
{
optind = 1;
@@ -26,6 +28,10 @@
}
if(optind < argc){
+ if(!strcmp(argv[optind], "-verbose")){
+ optind++;
+ globalverbose=1;
+ }
if(!strcmp(argv[optind], "help")){
print_usage(stdout);
exit(EXIT_SUCCESS);
@@ -106,6 +112,7 @@
" ccs_tool [options] <command>\n"
"\n"
"Options:\n"
+ " -verbose Make some operations print more details.\n"
" -h Print this usage and exit.\n"
" -V Print version information and exit.\n"
"\n"
--- cluster/ccs/ccs_tool/update.c 2007/01/26 22:13:20 1.10
+++ cluster/ccs/ccs_tool/update.c 2007/05/03 09:06:39 1.11
@@ -19,6 +19,9 @@
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include "comm_headers.h"
#include "ccs.h"
@@ -49,6 +52,8 @@
static int ipv6_connect(struct in6_addr *addr, uint16_t port, int timeout);
static int connect_nb(int fd, struct sockaddr *addr, socklen_t len, int timeout);
+extern int globalverbose;
+
int cluster_base_port = 50008;
static int get_doc_version(xmlDocPtr ldoc)
@@ -659,12 +664,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;
+ char buf[INET6_ADDRSTRLEN];
- addr = &(((struct sockaddr_in *)&(node.cn_address.cna_address))->sin_addr);
+ if (globalverbose) {
+ memset(buf, 0, sizeof(buf));
+ printf("Processing node: %s\n", node.cn_name);
+ }
+
+ 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);
+
+ if (globalverbose) {
+ inet_ntop(family, addr6, buf, sizeof(buf));
+ printf(" family: ipv6\n address: %s\n", buf);
+ }
+
+ if ((fd = ipv6_connect(addr6, port, timeout)) < 0) {
+ return -1;
+ }
+
+ } else {
+
+ addr = &(((struct sockaddr_in *)&(node.cn_address.cna_address))->sin_addr);
+
+ if (globalverbose) {
+ inet_ntop(family, addr, buf, sizeof(buf));
+ printf(" family: ipv4\n address: %s\n", buf);
+ }
+
+ if ((fd = ipv4_connect(addr, port, timeout)) < 0) {
+ return -1;
+ }
- if ((fd = ipv4_connect(addr, port, timeout)) < 0) {
- return -1;
}
return fd;
More information about the Cluster-devel
mailing list