summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/include/ctdbd_conn.h4
-rw-r--r--source/lib/ctdbd_conn.c30
-rw-r--r--source/smbd/server.c4
3 files changed, 23 insertions, 15 deletions
diff --git a/source/include/ctdbd_conn.h b/source/include/ctdbd_conn.h
index 44c35168a81..d7212353362 100644
--- a/source/include/ctdbd_conn.h
+++ b/source/include/ctdbd_conn.h
@@ -57,8 +57,8 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
void *private_data);
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
- const struct sockaddr *server,
- const struct sockaddr *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);
diff --git a/source/lib/ctdbd_conn.c b/source/lib/ctdbd_conn.c
index 1b07fd407a5..c88622ddc69 100644
--- a/source/lib/ctdbd_conn.c
+++ b/source/lib/ctdbd_conn.c
@@ -1174,13 +1174,22 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
*/
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
- const struct sockaddr *server,
- const struct sockaddr *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 ctdb_control_tcp_vnn p;
+ 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
+ struct ctdb_control_tcp_addr p;
+#endif
TDB_DATA data;
NTSTATUS status;
@@ -1189,15 +1198,19 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
*/
SMB_ASSERT(conn->release_ip_handler == NULL);
- switch (client->sa_family) {
+ switch (sock->sa_family) {
case AF_INET:
- p.dest.ip = *(struct sockaddr_in *)server;
- p.src.ip = *(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
case AF_INET6:
p.dest.ip6 = *(struct sockaddr_in6 *)server;
p.src.ip6 = *(struct sockaddr_in6 *)client;
+ data.dptr = (uint8_t *)&p;
+ data.dsize = sizeof(p);
break;
#endif
default:
@@ -1220,11 +1233,8 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
* can send an extra ack to trigger a reset for our client, so it
* immediately reconnects
*/
- data.dptr = (uint8_t *)&p;
- data.dsize = sizeof(p);
-
return ctdbd_control(conn, CTDB_CURRENT_NODE,
- CTDB_CONTROL_TCP_ADD, 0,
+ CTDB_CONTROL_TCP_CLIENT, 0,
CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL, NULL);
}
diff --git a/source/smbd/server.c b/source/smbd/server.c
index fb6bbff7c72..770de415a83 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -1480,9 +1480,7 @@ extern void build_options(bool screen);
status = ctdbd_register_ips(
messaging_ctdbd_connection(),
- (struct sockaddr *)&srv,
- (struct sockaddr *)&clnt,
- release_ip, NULL);
+ &srv, &clnt, release_ip, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("ctdbd_register_ips failed: %s\n",