summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2020-06-25 15:59:42 +0200
committerStefan Metzmacher <metze@samba.org>2020-07-08 15:54:41 +0000
commit79eaa196dc8549ac4676ac055543bf0bfa542264 (patch)
tree7cb0488388a6d21a6218aeec8444295d46b98677
parentaf51b75c6118787ce8b4b1fcc8198ff15397788b (diff)
downloadsamba-79eaa196dc8549ac4676ac055543bf0bfa542264.tar.gz
s3:smbd: disconnect the all client connections if a ctdb public ip dropped
For now we keep it simple and any disconnect on a connection that used a ctdb public address, will disconnect all other remaining connections. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11898 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/process.c19
-rw-r--r--source3/smbd/smb2_server.c16
3 files changed, 36 insertions, 0 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 968a6a5cab8..fcf33a699c6 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -361,6 +361,7 @@ struct smbXsrv_connection {
const struct tsocket_address *local_address;
const struct tsocket_address *remote_address;
const char *remote_hostname;
+ bool has_ctdb_public_ip;
enum protocol_types protocol;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 011d8702291..2bff5bf5a8f 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2802,6 +2802,25 @@ static NTSTATUS smbd_register_ips(struct smbXsrv_connection *xconn,
return NT_STATUS_NO_MEMORY;
}
+ if (xconn->client->server_multi_channel_enabled) {
+ struct ctdb_public_ip_list_old *ips = NULL;
+
+ ret = ctdbd_control_get_public_ips(cconn,
+ 0, /* flags */
+ state,
+ &ips);
+ if (ret != 0) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ xconn->has_ctdb_public_ip = ctdbd_find_in_public_ips(ips, srv);
+ TALLOC_FREE(ips);
+ if (xconn->has_ctdb_public_ip) {
+ DBG_DEBUG("CTDB public ip on %s\n",
+ smbXsrv_connection_dbg(xconn));
+ }
+ }
+
ret = ctdbd_register_ips(cconn, srv, clnt, release_ip, state);
if (ret != 0) {
return map_nt_error_from_unix(ret);
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 20ac3da34c6..cf9de185c1f 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1635,6 +1635,22 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn,
smbXsrv_connection_dbg(xconn), num_ok,
reason, location);
+ if (xconn->has_ctdb_public_ip) {
+ /*
+ * If the connection has a ctdb public address
+ * we disconnect all client connections,
+ * as the public address might be moved to
+ * a different node.
+ *
+ * In future we may recheck which node currently
+ * holds this address, but for now we keep it simple.
+ */
+ smbd_server_disconnect_client_ex(xconn->client,
+ reason,
+ location);
+ return;
+ }
+
if (num_ok != 0) {
struct tevent_req *subreq = NULL;