[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4880-gf87f484
Stefan Metzmacher
metze at samba.org
Thu Jan 29 16:57:23 GMT 2009
The branch, v3-3-test has been updated
via f87f4842cc0ffc62d76ee5350b94f7bda735aa71 (commit)
via a7fcaff295c3a36e2b783398ac212500eef33ecb (commit)
from d332da87068cd72489941010a33e372ab53d3bcc (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit f87f4842cc0ffc62d76ee5350b94f7bda735aa71
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jan 28 17:36:36 2009 +0100
s3:configure: autodetect ctdb/cluster support
We need to make sure ctdb has transaction support
and we autodetect ipv6 support.
metze
(cherry picked from commit 11163720e6f30e83f523c5009e1e60b5cf28cda6)
commit a7fcaff295c3a36e2b783398ac212500eef33ecb
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jan 28 18:55:13 2009 +0100
s3:ctdbd_conn: canonicalize ips before sending them to ctdbd
This makes samba work with older ctdb versions.
metze
(cherry picked from commit 7540d13956a8a69d25f6fbbc4f9a3417e91db1d2)
-----------------------------------------------------------------------
Summary of changes:
source/Makefile.in | 1 -
source/configure.in | 119 +++++++++++++++++++++++++++++++++++++++++++++--
source/lib/ctdbd_conn.c | 50 ++++++++++++++++----
source/m4/check_path.m4 | 12 -----
4 files changed, 155 insertions(+), 27 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/Makefile.in b/source/Makefile.in
index 597e01f..ef901ff 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -126,7 +126,6 @@ INSTALLPERMS_DATA = 0644
LOGFILEBASE = @logfilebase@
CONFIGFILE = $(CONFIGDIR)/smb.conf
LMHOSTSFILE = $(CONFIGDIR)/lmhosts
-CTDBDIR = @ctdbdir@
# This is where smbpasswd et al go
PRIVATEDIR = @privatedir@
diff --git a/source/configure.in b/source/configure.in
index 601d1a5..91f55fd 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -5090,17 +5090,128 @@ AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
#################################################
# check for cluster extensions
-AC_MSG_CHECKING(whether to include cluster support)
+CTDB_CFLAGS=""
+AC_SUBST(CTDB_CFLAGS)
+AC_ARG_WITH(ctdb,
+[AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
+[ case "$withval" in
+ yes|no)
+ AC_MSG_WARN([--with-ctdb called without argument])
+ ;;
+ *)
+ CTDB_CPPFLAGS="-I$withval/include"
+ ;;
+ esac])
+
+SAVED_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $CTDB_CPPFLAGS"
+ctdb_broken="missing or broken headers"
+
+AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#define private #error __USED_RESERVED_WORD_private__
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+])
+
+AC_HAVE_DECL(CTDB_CONTROL_TRANS2_COMMIT_RETRY,[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+#include <ctdb_private.h>
+])
+if test x"$ac_cv_have_CTDB_CONTROL_TRANS2_COMMIT_RETRY_decl" = x"yes"; then
+ ctdb_broken=no
+else
+ ctdb_broken="missing transaction support"
+fi
+
+# in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
+AC_CHECK_TYPE(struct ctdb_tcp_client,[
+ AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
+],,[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+#include <ctdb_private.h>
+])
+
+AC_CHECK_TYPE(struct ctdb_control_tcp,[
+ AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
+],[
+ ctdb_broken="missing struct ctdb_control_tcp"
+],[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+#include <ctdb_private.h>
+])
+
+AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
+ AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
+],,[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+#include <ctdb_private.h>
+])
+CPPFLAGS="$SAVED_CPPFLAGS"
+
+AC_MSG_CHECKING(cluster support)
AC_ARG_WITH(cluster-support,
-[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=no)])])
-if test "x$with_cluster_support" = "xyes"; then
+[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
+
+if test x"$with_cluster_support" = x ; then
+ with_cluster_support="auto"
+fi
+
+if test x"$ac_cv_header_ctdb_private_h" != x"yes"; then
+ if test "x$with_cluster_support" = "xyes"; then
+ AC_MSG_ERROR("ctdb_private.h is required for cluster support")
+ fi
+ with_cluster_support=no
+fi
+
+if test x"$ctdb_broken" != x"no"; then
+ if test "x$with_cluster_support" = "xyes"; then
+ AC_MSG_ERROR(["cluster support: $ctdb_broken"])
+ fi
+ with_cluster_support=no
+fi
+
+if test "x$with_cluster_support" != "xno"; then
AC_DEFINE(CLUSTER_SUPPORT,1,[Whether to enable cluster extensions])
+ SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CTDB_CPPFLAGS}"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
-
#################################################
# check for ACL support
diff --git a/source/lib/ctdbd_conn.c b/source/lib/ctdbd_conn.c
index c88622d..7c32d57 100644
--- a/source/lib/ctdbd_conn.c
+++ b/source/lib/ctdbd_conn.c
@@ -1170,45 +1170,75 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
}
/*
+ This is used to canonicalize a ctdb_sock_addr structure.
+*/
+static void smbd_ctdb_canonicalize_ip(const struct sockaddr_storage *in,
+ struct sockaddr_storage *out)
+{
+ memcpy(out, in, sizeof (*out));
+
+#ifdef HAVE_IPV6
+ if (in->ss_family == AF_INET6) {
+ const char prefix[12] = { 0,0,0,0,0,0,0,0,0,0,0xff,0xff };
+ const struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)in;
+ struct sockaddr_in *out4 = (struct sockaddr_in *)out;
+ if (memcmp(&in6->sin6_addr, prefix, 12) == 0) {
+ memset(out, 0, sizeof(*out));
+#ifdef HAVE_SOCK_SIN_LEN
+ out4->sin_len = sizeof(*out);
+#endif
+ out4->sin_family = AF_INET;
+ out4->sin_port = in6->sin6_port;
+ memcpy(&out4->sin_addr, &in6->sin6_addr.s6_addr32[3], 4);
+ }
+ }
+#endif
+}
+
+/*
* Register us as a server for a particular tcp connection
*/
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
- const struct sockaddr_storage *server,
- const struct sockaddr_storage *client,
+ const struct sockaddr_storage *_server,
+ const struct sockaddr_storage *_client,
void (*release_ip_handler)(const char *ip_addr,
void *private_data),
void *private_data)
{
- struct sockaddr *sock = (struct sockaddr *)client;
/*
* we still use ctdb_control_tcp for ipv4
* because we want to work against older ctdb
* versions at runtime
*/
struct ctdb_control_tcp p4;
-#ifdef HAVE_IPV6
+#ifdef HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR
struct ctdb_control_tcp_addr p;
#endif
TDB_DATA data;
NTSTATUS status;
+ struct sockaddr_storage client;
+ struct sockaddr_storage server;
/*
* Only one connection so far
*/
SMB_ASSERT(conn->release_ip_handler == NULL);
- switch (sock->sa_family) {
+ smbd_ctdb_canonicalize_ip(_client, &client);
+ smbd_ctdb_canonicalize_ip(_server, &server);
+
+ switch (client.ss_family) {
case AF_INET:
- p4.dest = *(struct sockaddr_in *)server;
- p4.src = *(struct sockaddr_in *)client;
+ p4.dest = *(struct sockaddr_in *)&server;
+ p4.src = *(struct sockaddr_in *)&client;
data.dptr = (uint8_t *)&p4;
data.dsize = sizeof(p4);
break;
-#ifdef HAVE_IPV6
+#ifdef HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR
case AF_INET6:
- p.dest.ip6 = *(struct sockaddr_in6 *)server;
- p.src.ip6 = *(struct sockaddr_in6 *)client;
+ p.dest.ip6 = *(struct sockaddr_in6 *)&server;
+ p.src.ip6 = *(struct sockaddr_in6 *)&client;
data.dptr = (uint8_t *)&p;
data.dsize = sizeof(p);
break;
diff --git a/source/m4/check_path.m4 b/source/m4/check_path.m4
index 59771b0..38368c9 100644
--- a/source/m4/check_path.m4
+++ b/source/m4/check_path.m4
@@ -165,17 +165,6 @@ AC_ARG_WITH(logfilebase,
#################################################
-# set ctdb source directory location
-AC_ARG_WITH(ctdb,
-[AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
-[ case "$withval" in
- yes|no)
- AC_MSG_WARN([--with-ctdb called without argument])
- ;;
- * )
- ctdbdir="$withval"
- ;;
- esac])
#################################################
# set shared modules (internal lib) directory location
@@ -246,7 +235,6 @@ AC_SUBST(configdir)
AC_SUBST(lockdir)
AC_SUBST(piddir)
AC_SUBST(logfilebase)
-AC_SUBST(ctdbdir)
AC_SUBST(privatedir)
AC_SUBST(swatdir)
AC_SUBST(bindir)
--
Samba Shared Repository
More information about the samba-cvs
mailing list