summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2012-02-27 05:57:47 -0800
committerJeremy Allison <jra@samba.org>2012-03-09 16:48:15 -0800
commitbd0ad2bbb5361a92f349ef42171b9bdd1d99b281 (patch)
tree5651b85ae048c960829b71c9df67fcbaf370584a
parent6d128aac119d948f0ecb0dcf6b400b4eb4027fe6 (diff)
downloadsamba-bd0ad2bbb5361a92f349ef42171b9bdd1d99b281.tar.gz
samba-bd0ad2bbb5361a92f349ef42171b9bdd1d99b281.tar.bz2
samba-bd0ad2bbb5361a92f349ef42171b9bdd1d99b281.zip
s3:smb2_server: announce LargeMTU for SMB2.1
Signed-off-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/smbd/smb2_negprot.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index dd27700c7b..cb8e98354a 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -22,6 +22,7 @@
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
+#include "tsocket.h"
/*
* this is the entry point if SMB2 is selected via
@@ -226,14 +227,36 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
}
/*
- * Unless we implement SMB2_CAP_LARGE_MTU,
* 0x10000 (65536) is the maximum allowed message size
+ * for SMB 2.0
*/
max_limit = 0x10000;
- max_trans = MIN(max_limit, max_trans);
- max_read = MIN(max_limit, max_read);
- max_write = MIN(max_limit, max_write);
+ if (protocol >= PROTOCOL_SMB2_10) {
+ /* largeMTU is only available on port 445 */
+ if (TCP_SMB_PORT ==
+ tsocket_address_inet_port(req->sconn->local_address))
+ {
+
+ capabilities |= SMB2_CAP_LARGE_MTU;
+ req->sconn->smb2.supports_multicredit = true;
+
+ /* SMB2.1 has 1 MB of allowed size */
+ max_limit = 0x100000; /* 1MB */
+ }
+ }
+
+ /*
+ * the defaults are 1MB, but we'll limit this to max_limit based on
+ * the dialect (64kb for SMB2.0, 1MB for SMB2.1 with LargeMTU)
+ *
+ * user configured values exceeding the limits will be overwritten,
+ * only smaller values will be accepted
+ */
+
+ max_trans = MIN(max_limit, lp_smb2_max_trans());
+ max_read = MIN(max_limit, lp_smb2_max_read());
+ max_write = MIN(max_limit, lp_smb2_max_write());
security_offset = SMB2_HDR_BODY + 0x40;