summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2020-06-08 12:23:47 +0200
committerStefan Metzmacher <metze@samba.org>2020-07-08 15:54:40 +0000
commit8b8c5c4154f581c5d79585017443dffc1602bdf6 (patch)
tree8fde6e410e7473aa2df8cf6b2bdf55ca6c902140 /source3
parent3cd775af053f95a35492e66299110d4087c452d0 (diff)
downloadsamba-8b8c5c4154f581c5d79585017443dffc1602bdf6.tar.gz
s3:smbd: force multi-channel to be turned off without FreeBSD/Linux support
For now it's safer to disable multi-channel without having support for TIOCOUTQ/FIONWRITE on tcp sockets. Using a fixed retransmission timeout (rto) of 1 second would be ok, but we better require kernel support for requesting for unacked bytes in the kernel send queue. "force:server multi channel support = yes" can be used to overwrite the compile time restriction (mainly for testing). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/globals.h2
-rw-r--r--source3/smbd/smb2_server.c26
-rw-r--r--source3/smbd/smbXsrv_client.c3
3 files changed, 30 insertions, 1 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 1276ffa0084..176c9053f3a 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -250,6 +250,8 @@ NTSTATUS smbd_smb2_process_negprot(struct smbXsrv_connection *xconn,
DATA_BLOB smbd_smb2_generate_outbody(struct smbd_smb2_request *req, size_t size);
+bool smbXsrv_server_multi_channel_enabled(void);
+
NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
NTSTATUS status,
DATA_BLOB *info,
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 31a5a5f868c..a147f858c91 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -37,9 +37,11 @@
/* SIOCOUTQ TIOCOUTQ are the same */
#define __IOCTL_SEND_QUEUE_SIZE_OPCODE TIOCOUTQ
#define __HAVE_TCP_INFO_RTO 1
+#define __ALLOW_MULTI_CHANNEL_SUPPORT 1
#elif defined(FREEBSD)
#define __IOCTL_SEND_QUEUE_SIZE_OPCODE FIONWRITE
#define __HAVE_TCP_INFO_RTO 1
+#define __ALLOW_MULTI_CHANNEL_SUPPORT 1
#endif
#include "lib/crypto/gnutls_helpers.h"
@@ -1116,6 +1118,30 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req)
return NT_STATUS_OK;
}
+bool smbXsrv_server_multi_channel_enabled(void)
+{
+ bool enabled = lp_server_multi_channel_support();
+#ifndef __ALLOW_MULTI_CHANNEL_SUPPORT
+ bool forced = false;
+ /*
+ * If we don't have support from the kernel
+ * to ask for the un-acked number of bytes
+ * in the socket send queue, we better
+ * don't support multi-channel.
+ */
+ forced = lp_parm_bool(-1, "force", "server multi channel support", false);
+ if (enabled && !forced) {
+ D_NOTICE("'server multi channel support' enabled "
+ "but not supported on %s (%s)\n",
+ SYSTEM_UNAME_SYSNAME, SYSTEM_UNAME_RELEASE);
+ DEBUGADD(DBGLVL_NOTICE, ("Please report this on "
+ "https://bugzilla.samba.org/show_bug.cgi?id=11897\n"));
+ enabled = false;
+ }
+#endif /* ! __ALLOW_MULTI_CHANNEL_SUPPORT */
+ return enabled;
+}
+
static NTSTATUS smbXsrv_connection_get_rto_usecs(struct smbXsrv_connection *xconn,
uint32_t *_rto_usecs)
{
diff --git a/source3/smbd/smbXsrv_client.c b/source3/smbd/smbXsrv_client.c
index c6114d4b8dc..f61ab3da35b 100644
--- a/source3/smbd/smbXsrv_client.c
+++ b/source3/smbd/smbXsrv_client.c
@@ -522,7 +522,8 @@ NTSTATUS smbXsrv_client_create(TALLOC_CTX *mem_ctx,
client->raw_ev_ctx = ev_ctx;
client->msg_ctx = msg_ctx;
- client->server_multi_channel_enabled = lp_server_multi_channel_support();
+ client->server_multi_channel_enabled =
+ smbXsrv_server_multi_channel_enabled();
if (client->server_multi_channel_enabled) {
client->next_channel_id = 1;
}