[SCM] CTDB repository - branch master updated - ctdb-1.0.70b-24-ga6cdf91

Ronnie Sahlberg sahlberg at samba.org
Mon Feb 2 03:09:38 GMT 2009


The branch, master has been updated
       via  a6cdf9106074890b76d2eabe496af244e0134d31 (commit)
       via  2634f1bd216ce18f061a282a53314cb1650dbd05 (commit)
       via  78e7928797e239e71f96eb001460a0dbf943e18f (commit)
       via  25d04bbe9528fafc68751f7beb22daeee3163d34 (commit)
       via  3adf100e7f0c04aaf2da9ae4c6984cdb708c3b57 (commit)
       via  fedc6983f5dee39152e6f400f89a3e07eab57f0c (commit)
       via  7c813406d6ba55f6a7418f80b13b0bc83cb67928 (commit)
       via  7558bca1e99884c02747adb7cbea799d04ee24d5 (commit)
       via  f7be553ed0826d31759812d58db91589ccdf8a8c (commit)
       via  c9a0330989421afc138db6d195acf93f5eeda9fb (commit)
       via  9d12de1ca6107801dada927729e755c0949d73bf (commit)
       via  1461b78c47810073f8637bc4592cacaadcdaf14b (commit)
       via  8b5f1e80e3e2e9ca2198e1baee8af36aa5d6c5b5 (commit)
       via  de71ce2195bb4f6a96b12437a2d4d1424fd1c59c (commit)
       via  e0c70110e241b065c42c1c07f32c3657bac5d98b (commit)
       via  df0afcbf9a0308fcd6ddcce1ac9366f785576f44 (commit)
       via  c412c9e2d69a3f07e195259f6ad5767fa8160a94 (commit)
       via  b74ef95004989bcfca5fc6468a6f978a196116ca (commit)
       via  0dafb869265d0c369bb5ce45fbcabc2232d6fced (commit)
       via  145b85c948603cf977a5c5b53d9d9f63fbdba221 (commit)
       via  5fe84f96f3f79baba1f44ba57ce217f501b3c1f8 (commit)
       via  4cac2a16b70be772e4f1520020762f63c0bf3efe (commit)
       via  56a10594ea9e44e3f034ac11161fd06e5ae46544 (commit)
       via  ab34a9480b59c649a4fc73a466c8ca0975453ed9 (commit)
      from  73a7b611bf2ef87e92d6b18c538a260aa988a2e5 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a6cdf9106074890b76d2eabe496af244e0134d31
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Feb 2 14:04:40 2009 +1100

    new version 1.0.71

commit 2634f1bd216ce18f061a282a53314cb1650dbd05
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 30 18:30:25 2009 +0100

    add a simple test script to test ctdb_check_tcp_ports
    
    Michael

commit 78e7928797e239e71f96eb001460a0dbf943e18f
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 30 18:14:41 2009 +0100

    ctdb_check_tcp_ports: correctly detect listeners on ipv6 :::<port> w/out netcat
    
    The netstat test only grepped for the ipv4 wildcard address.
    Now the ipv6 wildcard listener is correctly detected as well.
    
    Michael

commit 25d04bbe9528fafc68751f7beb22daeee3163d34
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 30 16:41:37 2009 +0100

    ctdb_check_tcp_ports: fail the check if neither netstat nor netcat/nc is found
    
    Michael

commit 3adf100e7f0c04aaf2da9ae4c6984cdb708c3b57
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 30 16:10:05 2009 +0100

    ctdb_check_tcp_ports: cope with multiple locations of netcat or nc
    
    This fixes tcp port monitor events on systems, where netcat or nc
    is not found in /usr/bin/, Debian, for instance.
    
    The patch also separates the process of finding the binaries and
    calling them, moving the detection outside of the loop over the
    ports list.
    
    Michael

commit fedc6983f5dee39152e6f400f89a3e07eab57f0c
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 29 13:22:02 2009 +0100

    remove include <netinet/in.h> from public ctdb.h
    
    This is not portable.
    The ctdb build includes the necessary headers from includes.h.
    And users of ctdb should cope with including the necessary
    prerequisite headers themselves.
    
    Michael

commit 7c813406d6ba55f6a7418f80b13b0bc83cb67928
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 29 11:46:04 2009 +0100

    packaging: add a maketarball script
    
    The script extracts the version number from the spec file.
    It takes an extra argument, that can be appended to the
    version in the tar ball name and directory prefix.
    
    Michael

commit 7558bca1e99884c02747adb7cbea799d04ee24d5
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 28 17:40:24 2009 +0100

    Fix the build on AIX: sys/socket.h needs to be included before ctdb.h
    
    (for struct sockaddr to be defined)
    
    Thanks to William Jojo <w.jojo at hvcc.edu> for reporting.
    
    Michael

commit f7be553ed0826d31759812d58db91589ccdf8a8c
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 29 10:22:02 2009 +0100

    autoconf: Make sure the result of the mkdir_has_mode test gets cached.
    
    This fixes the autoconf 2.63 warning
    "suspicious cache-id, must contain _cv_ to be cached".
    
    Thanks to William Jojo <w.jojo at hvcc.edu> for reporting.
    
    Michael

commit c9a0330989421afc138db6d195acf93f5eeda9fb
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 27 17:17:58 2009 +0100

    events.d/41.httpd: fix a comment typo
    
    Michael

commit 9d12de1ca6107801dada927729e755c0949d73bf
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 15:33:24 2009 +0100

    Fix treatment of link local ipv6 addresses: set the scope id.
    
    metze / Michael
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 1461b78c47810073f8637bc4592cacaadcdaf14b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 14:14:07 2009 +0100

    ctdb_util: use the parse_ip() function - avoid code duplication
    
    Michael
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 8b5f1e80e3e2e9ca2198e1baee8af36aa5d6c5b5
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 19:08:37 2009 +0100

    ctdb_sys_have_ip: fix ipv6 support for aix, too.
    
    Michael
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit de71ce2195bb4f6a96b12437a2d4d1424fd1c59c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jan 19 13:24:09 2009 +0100

    ctdb_sys_have_ip: don't overwrite input data (setting port to 0)
    
    metze
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit e0c70110e241b065c42c1c07f32c3657bac5d98b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 12:02:18 2009 +0100

    Fix verification of IP allocation with ipv6 addresses on Linux.
    
    Set sin_port or sin6_port to 0, depending on sa_family.
    
    Michael
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit df0afcbf9a0308fcd6ddcce1ac9366f785576f44
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 21:22:58 2009 +0100

    events 50.samba: fix control of nmbd without separate nmb service script.
    
    protect all potentially empty $CTDB_SERVICE_* script names
    
    Michael

commit c412c9e2d69a3f07e195259f6ad5767fa8160a94
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 14:46:30 2009 +0100

    packaging(RPM): detect and use ccache if available
    
    Michael

commit b74ef95004989bcfca5fc6468a6f978a196116ca
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 09:42:48 2009 +0100

    Makefile: remove extra "/" in paths
    
    Michael

commit 0dafb869265d0c369bb5ce45fbcabc2232d6fced
Author: Michael Adam <obnox at samba.org>
Date:   Sat Jan 17 16:18:02 2009 +0100

    makerpms: fix detection of support for --rsyncable flag in gzip.
    
    Michael

commit 145b85c948603cf977a5c5b53d9d9f63fbdba221
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 14:01:37 2009 +0100

    ctdb.init: fix typo
    
    Michael

commit 5fe84f96f3f79baba1f44ba57ce217f501b3c1f8
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 13:33:13 2009 +0100

    events 50.samba: also support suse and ubuntu/debain systems
    
    for managing samba and winbind
    
    This uses CTDB_INIT_STYLE as exported by ctdb.init.
    
    suse systems usually have separate init scripts for
    smb for smbd and nmb for nmbd, and the ubuntu/debian
    start script for smbd and nmbd is called samba instead
    of smb (on redhat).
    
    Michael

commit 4cac2a16b70be772e4f1520020762f63c0bf3efe
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 13:31:02 2009 +0100

    funcions: make (nice_)service a noop for empty service name
    
    Michael

commit 56a10594ea9e44e3f034ac11161fd06e5ae46544
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 13:28:19 2009 +0100

    ctdb.init: use detect_init_style() in the init script
    
    and export CTDB_INIT_STYLE, so that event scripts
    as called by ctdbd can use it.
    
    Michael

commit ab34a9480b59c649a4fc73a466c8ca0975453ed9
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 13:26:57 2009 +0100

    functions: add detect_init_style().
    
    Michael

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

Summary of changes:
 Makefile.in                   |    4 +-
 common/ctdb_util.c            |   26 ++++++----------
 common/system_aix.c           |   14 ++++++++-
 common/system_linux.c         |   13 +++++++-
 config/ctdb.init              |   19 +++++-------
 config/events.d/41.httpd      |    2 +-
 config/events.d/50.samba      |   47 +++++++++++++++++++++++++++----
 config/functions              |   62 +++++++++++++++++++++++++++++++++++-----
 include/ctdb.h                |    2 -
 include/ctdb_private.h        |    4 +-
 include/includes.h            |    1 +
 lib/replace/win32.m4          |    8 ++--
 packaging/RPM/ctdb.spec       |   13 +++++++-
 packaging/RPM/makerpms.sh     |    2 +-
 packaging/maketarball.sh      |   42 +++++++++++++++++++++++++++
 server/ctdb_recover.c         |    5 ++-
 server/ctdb_takeover.c        |   12 ++++---
 server/ctdbd.c                |    1 +
 tcp/tcp_connect.c             |    2 +-
 tests/test_check_tcp_ports.sh |   17 +++++++++++
 tools/ctdb.c                  |   10 +++---
 21 files changed, 235 insertions(+), 71 deletions(-)
 create mode 100755 packaging/maketarball.sh
 create mode 100755 tests/test_check_tcp_ports.sh


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index f7b4fb9..0002da5 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -186,8 +186,8 @@ install: all
 	${INSTALLCMD} -m 644 include/ctdb_private.h $(DESTDIR)$(includedir) # for samba3
 	${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb
 	${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb
-	${INSTALLCMD} -m 644 config/events.d/README $(DESTDIR)/$(docdir)/ctdb/README.eventscripts
-	${INSTALLCMD} -m 644 doc/recovery-process.txt $(DESTDIR)/$(docdir)/ctdb/recovery-process.txt
+	${INSTALLCMD} -m 644 config/events.d/README $(DESTDIR)$(docdir)/ctdb/README.eventscripts
+	${INSTALLCMD} -m 644 doc/recovery-process.txt $(DESTDIR)$(docdir)/ctdb/recovery-process.txt
 	${INSTALLCMD} -m 755 config/events.d/00.ctdb $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/10.interface $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/20.multipathd $(DESTDIR)$(etcdir)/ctdb/events.d
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index b5a3508..33d30e2 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -381,7 +381,7 @@ bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin)
 	return true;
 }
 
-static bool parse_ipv6(const char *s, unsigned port, ctdb_sock_addr *saddr)
+static bool parse_ipv6(const char *s, const char *iface, unsigned port, ctdb_sock_addr *saddr)
 {
 	saddr->ip6.sin6_family   = AF_INET6;
 	saddr->ip6.sin6_port     = htons(port);
@@ -393,6 +393,10 @@ static bool parse_ipv6(const char *s, unsigned port, ctdb_sock_addr *saddr)
 		return false;
 	}
 
+	if (iface && IN6_IS_ADDR_LINKLOCAL(&saddr->ip6.sin6_addr)) {
+		saddr->ip6.sin6_scope_id = if_nametoindex(iface);
+	}
+
 	return true;
 }
 /*
@@ -431,12 +435,7 @@ bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
 
 
 	/* now is this a ipv4 or ipv6 address ?*/
-	p = index(s, ':');
-	if (p == NULL) {
-		ret = parse_ipv4(s, port, &saddr->ip);
-	} else {
-		ret = parse_ipv6(s, port, saddr);
-	}
+	ret = parse_ip(s, NULL, addr);
 
 	talloc_free(tmp_ctx);
 	return ret;
@@ -445,7 +444,7 @@ bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
 /*
   parse an ip
  */
-bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
+bool parse_ip(const char *addr, const char *iface, ctdb_sock_addr *saddr)
 {
 	char *p;
 	bool ret;
@@ -455,7 +454,7 @@ bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
 	if (p == NULL) {
 		ret = parse_ipv4(addr, 0, &saddr->ip);
 	} else {
-		ret = parse_ipv6(addr, 0, saddr);
+		ret = parse_ipv6(addr, iface, 0, saddr);
 	}
 
 	return ret;
@@ -464,7 +463,7 @@ bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
 /*
   parse a ip/mask pair
  */
-bool parse_ip_mask(const char *str, ctdb_sock_addr *addr, unsigned *mask)
+bool parse_ip_mask(const char *str, const char *iface, ctdb_sock_addr *addr, unsigned *mask)
 {
 	TALLOC_CTX *tmp_ctx = talloc_new(NULL);
 	char *s, *p;
@@ -497,12 +496,7 @@ bool parse_ip_mask(const char *str, ctdb_sock_addr *addr, unsigned *mask)
 
 
 	/* now is this a ipv4 or ipv6 address ?*/
-	p = index(s, ':');
-	if (p == NULL) {
-		ret = parse_ipv4(s, 0, &addr->ip);
-	} else {
-		ret = parse_ipv6(s, 0, addr);
-	}
+	ret = parse_ip(s, iface, addr);
 
 	talloc_free(tmp_ctx);
 	return ret;
diff --git a/common/system_aix.c b/common/system_aix.c
index 8fe630d..d5ca477 100644
--- a/common/system_aix.c
+++ b/common/system_aix.c
@@ -194,12 +194,22 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
   we try to bind to it, and if that fails then we don't have that IP
   on an interface
  */
-bool ctdb_sys_have_ip(ctdb_sock_addr *addr)
+bool ctdb_sys_have_ip(ctdb_sock_addr *_addr)
 {
 	int s;
 	int ret;
+	ctdb_sock_addr __addr = *_addr;
+	ctdb_sock_addr *addr = &__addr;
 	
-	addr->ip.sin_port = 0;
+	switch (addr->sa.sa_family) {
+	case AF_INET:
+		addr->ip.sin_port = 0;
+		break;
+	case AF_INET6:
+		addr->ip6.sin6_port = 0;
+		break;
+	}
+
 	s = socket(addr->sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
 	if (s == -1) {
 		return false;
diff --git a/common/system_linux.c b/common/system_linux.c
index 1bf4903..0d5ea63 100644
--- a/common/system_linux.c
+++ b/common/system_linux.c
@@ -413,12 +413,21 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
 
   ifname, if non-NULL, will return the name of the interface this ip is tied to
  */
-bool ctdb_sys_have_ip(ctdb_sock_addr *addr)
+bool ctdb_sys_have_ip(ctdb_sock_addr *_addr)
 {
 	int s;
 	int ret;
+	ctdb_sock_addr __addr = *_addr;
+	ctdb_sock_addr *addr = &__addr;
 
-	addr->ip.sin_port = 0;
+	switch (addr->sa.sa_family) {
+	case AF_INET:
+		addr->ip.sin_port = 0;
+		break;
+	case AF_INET6:
+		addr->ip6.sin6_port = 0;
+		break;
+	}
 	s = socket(addr->sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
 	if (s == -1) {
 		return false;
diff --git a/config/ctdb.init b/config/ctdb.init
index 8168b1c..046bc52 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -80,19 +80,16 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
 	CTDB_OPTIONS="$CTDB_OPTIONS --script-log-level=$CTDB_SCRIPT_LOG_LEVEL"
 }
 
-if [ "$CTDB_VALGRIND" = "yes" ]; then
-    init_style="valgrind"
-else if [ -x /sbin/startproc ]; then
-    init_style="suse"
-else if [ -x /sbin/start-stop-daemon ]; then
-	init_style="ubuntu"
-    else
-	init_style="redhat"
-    fi
-fi
+detect_init_style
+export CTDB_INIT_STYLE
+
+if [ "x$CTDB_VALGRIND" = "xyes" ]; then
+	init_style="valgrind"
+else
+	init_style="$CTDB_INIT_STYLE"
 fi
 
-reset_retval() {
+set_retval() {
 	return $1
 }
 
diff --git a/config/events.d/41.httpd b/config/events.d/41.httpd
index fac4bad..038392f 100755
--- a/config/events.d/41.httpd
+++ b/config/events.d/41.httpd
@@ -1,5 +1,5 @@
 #!/bin/sh
-# event strict to manage httpd in a cluster environment
+# event sript to manage httpd in a cluster environment
 
 . $CTDB_BASE/functions
 loadconfig ctdb
diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 9ec5f1c..58df1dc 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -7,6 +7,32 @@ PATH=/bin:/usr/bin:$PATH
 loadconfig ctdb
 loadconfig samba
 
+detect_init_style
+
+case $CTDB_INIT_STYLE in
+	suse)
+		CTDB_SERVICE_SMB="smb"
+		CTDB_SERVICE_NMB="nmb"
+		CTDB_SERVICE_WINBIND="winbind"
+		;;
+	ubuntu)
+		CTDB_SERVICE_SMB="samba"
+		CTDB_SERVICE_NMB=""
+		CTDB_SERVICE_WINBIND="winbind"
+		;;
+	redhat)
+		CTDB_SERVICE_SMB="smb"
+		CTDB_SERVICE_NMB=""
+		CTDB_SERVICE_WINBIND="winbind"
+		;;
+	*)
+		# should not happen, but for now use redhat style as default:
+		CTDB_SERVICE_SMB="smb"
+		CTDB_SERVICE_NMB=""
+		CTDB_SERVICE_WINBIND="winbind"
+		;;
+esac
+
 cmd="$1"
 shift
 
@@ -118,29 +144,37 @@ case $cmd in
 	/bin/mkdir -p $CTDB_BASE/state/samba
 
 	# make sure samba is not already started
-	service smb stop > /dev/null 2>&1
+	service "$CTDB_SERVICE_SMB" stop > /dev/null 2>&1
+	service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
 	killall -0 -q smbd && {
 	    sleep 1
 	    # make absolutely sure samba is dead
 	    killall -q -9 smbd
 	}
 
+	killall -0 -q nmbd && {
+	    sleep 1
+	    # make absolutely sure samba is dead
+	    killall -q -9 nmbd
+	}
+
 	# restart the winbind service
 	check_ctdb_manages_winbind
 	[ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
-		service winbind stop > /dev/null 2>&1
+		service "$CTDB_SERVICE_WINBIND" stop > /dev/null 2>&1
 		killall -0 -q winbindd && {
 		    sleep 1
           	    # make absolutely sure winbindd is dead
 		    killall -q -9 winbindd
 		}
-		service winbind start
+		service "$CTDB_SERVICE_WINBIND" start
 	}
 
 	# start Samba service. Start it reniced, as under very heavy load 
 	# the number of smbd processes will mean that it leaves few cycles for
 	# anything else
-	nice_service smb start
+	nice_service "$CTDB_SERVICE_NMB" start
+	nice_service "$CTDB_SERVICE_SMB" start
 	;;
 	
      takeip)
@@ -158,12 +192,13 @@ case $cmd in
 
      shutdown)
 	# shutdown Samba when ctdb goes down
-	service smb stop
+	service "$CTDB_SERVICE_SMB" stop
+	service "$CTDB_SERVICE_NMB" stop
 
 	# stop the winbind service
 	check_ctdb_manages_winbind
 	[ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
-		service winbind stop
+		service "$CTDB_SERVICE_WINBIND" stop
 	}
 	;;
 
diff --git a/config/functions b/config/functions
index c6295c3..ee48dd2 100644
--- a/config/functions
+++ b/config/functions
@@ -13,12 +13,30 @@ loadconfig() {
     fi
 }
 
+##############################################################
+# determine on what type of system (init style) we are running
+detect_init_style() {
+    # only do detection if not already set:
+    test "x$CTDB_INIT_STYLE" != "x" && return
+
+    if [ -x /sbin/startproc ]; then
+        CTDB_INIT_STYLE="suse"
+    elif [ -x /sbin/start-stop-daemon ]; then
+        CTDB_INIT_STYLE="ubuntu"
+    else
+        CTDB_INIT_STYLE="redhat"
+    fi
+}
 
 ######################################################
 # simulate /sbin/service on platforms that don't have it
 service() { 
   service_name="$1"
   op="$2"
+
+  # do nothing, when no service was specified
+  test "x$service_name" = "x" && return
+
   if [ -x /sbin/service ]; then
       /sbin/service "$service_name" "$op"
   elif [ -x /etc/init.d/$service_name ]; then
@@ -33,6 +51,10 @@ service() {
 nice_service() { 
   service_name="$1"
   op="$2"
+
+  # do nothing, when no service was specified
+  test "x$service_name" = "x" && return
+
   if [ -x /sbin/service ]; then
       nice /sbin/service "$service_name" "$op"
   elif [ -x /etc/init.d/$service_name ]; then
@@ -183,17 +205,41 @@ ctdb_check_tcp_ports() {
   shift
   wait_ports="$*"
   [ -z "$wait_ports" ] && return;
+
+  # check availability of netcat or netstat first
+  NETCAT=""
+  NETSTAT=""
+  if [ -x /usr/bin/netcat ]; then
+      NETCAT=/usr/bin/netcat
+  elif [ -x /bin/netcat ]; then
+      NETCAT=/bin/netcat
+  elif [ -x /usr/bin/nc ]; then
+      NETCAT=/usr/bin/nc
+  elif [ -x /bin/nc ]; then
+      NETCAT=/bin/nc
+  elif [ -x /usr/bin/netstat ]; then
+      NETSTAT=/usr/bin/netstat
+  elif [ -x /bin/netstat ]; then
+      NETSTAT=/bin/netstat
+  fi
+
   for p in $wait_ports; do
       all_ok=1
-      if [ -x /usr/bin/netcat ]; then
-          /usr/bin/netcat -z 127.0.0.1 $p > /dev/null || all_ok=0
-      elif [ -x /usr/bin/nc ]; then
-          /usr/bin/nc -z 127.0.0.1 $p > /dev/null || all_ok=0
-      elif [ -x /usr/bin/netstat ]; then
-          (netstat -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ) || all_ok=0
-      elif [ -x /bin/netstat ]; then
-          (netstat -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ) || all_ok=0
+
+      if [ "x${NETCAT}" != "x" ]; then
+          ${NETCAT} -z 127.0.0.1 $p > /dev/null || all_ok=0
+      elif [ "x${NETSTAT}" != "x" ]; then
+          if ! ${NETSTAT} -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ; then
+              if ! ${NETSTAT} -a -n | egrep ":::$p .*LISTEN" > /dev/null ; then
+                  all_ok=0
+              fi
+          fi
+      else
+          echo "ERROR: neither netcat (or nc) nor netstat found!"
+          echo "ERROR: can't monitor ${service_name} tcp port ${p}"
+          all_ok=0
       fi
+
       [ $all_ok -eq 1 ] || {
 	  echo "ERROR: $service_name tcp port $p is not responding"
 	  exit 1
diff --git a/include/ctdb.h b/include/ctdb.h
index d5aa69f..2ec477f 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -20,8 +20,6 @@
 #ifndef _CTDB_H
 #define _CTDB_H
 
-#include <netinet/in.h>
-
 #define CTDB_IMMEDIATE_MIGRATION	0x00000001
 struct ctdb_call {
 	int call_id;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 49e7a3e..ceac384 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1281,9 +1281,9 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
 
 void ctdb_start_freeze(struct ctdb_context *ctdb);
 
-bool parse_ip_mask(const char *s, ctdb_sock_addr *addr, unsigned *mask);
+bool parse_ip_mask(const char *s, const char *iface, ctdb_sock_addr *addr, unsigned *mask);
 bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
-bool parse_ip(const char *s, ctdb_sock_addr *addr);
+bool parse_ip(const char *s, const char *iface, ctdb_sock_addr *addr);
 bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
  
 
diff --git a/include/includes.h b/include/includes.h
index b1f48b8..744d117 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -3,6 +3,7 @@
 #include "replace.h"
 #include "talloc.h"
 #include "system/wait.h"
+#include "system/network.h"
 #include "tdb.h"
 #include "idtree.h"
 #include "ctdb.h"
diff --git a/lib/replace/win32.m4 b/lib/replace/win32.m4
index 9ac84cd..15ce21a 100644
--- a/lib/replace/win32.m4
+++ b/lib/replace/win32.m4
@@ -2,7 +2,7 @@ AC_CHECK_HEADERS(direct.h windows.h winsock2.h ws2tcpip.h)
 
 #######################################
 # Check for mkdir mode
-AC_CACHE_CHECK( [whether mkdir supports mode], ac_mkdir_has_mode,
+AC_CACHE_CHECK( [whether mkdir supports mode], ac_cv_mkdir_has_mode,
 	AC_TRY_COMPILE([
 		#include <stdio.h>
 		#ifdef HAVE_DIRECT_H
@@ -11,10 +11,10 @@ AC_CACHE_CHECK( [whether mkdir supports mode], ac_mkdir_has_mode,
 			mkdir("foo",0777);
 			return 0;
 	],
-    ac_mkdir_has_mode="yes",
-    ac_mkdir_has_mode="no") )
+    ac_cv_mkdir_has_mode="yes",
+    ac_cv_mkdir_has_mode="no") )
 
-if test "$ac_mkdir_has_mode" = "yes"
+if test "$ac_cv_mkdir_has_mode" = "yes"
 then
     AC_DEFINE(HAVE_MKDIR_MODE, 1, [Define if target mkdir supports mode option])
 fi
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index b662a7d..e31771f 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -4,7 +4,7 @@ Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
-Version: 1.0.70
+Version: 1.0.71
 Release: 1
 Epoch: 0
 License: GNU GPL version 3
@@ -34,7 +34,14 @@ ctdb is the clustered database used by samba
 
 %build
 
-CC="gcc"
+## check for ccache
+if ccache -h >/dev/null 2>&1 ; then
+	CC="ccache gcc"
+else
+	CC="gcc"
+fi
+
+export CC
 
 ## always run autogen.sh
 ./autogen.sh
@@ -121,6 +128,8 @@ fi
 %{_includedir}/ctdb_private.h
 
 %changelog
+* Mon Feb 2 2009 : Version 1.0.71
+ - Additional ipv6 fixes from Michael Adams
 * Fri Jan 16 2009 : Version 1.0.70
  - IPv6 support is completed. this is backward compatible with ipv4-only
    systems. To use IPv6 with samba and ctdb you need current GIT of samba 3.3
diff --git a/packaging/RPM/makerpms.sh b/packaging/RPM/makerpms.sh
index 3735b39..37eca7d 100755
--- a/packaging/RPM/makerpms.sh
+++ b/packaging/RPM/makerpms.sh
@@ -28,7 +28,7 @@ RPMBUILD="rpmbuild"
 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
 RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
 
-if gzip --rsyncable 2>&1 ; then


-- 
CTDB repository


More information about the samba-cvs mailing list