diff options
-rw-r--r-- | docs-xml/smbdotconf/tuning/smb2maxread.xml | 13 | ||||
-rw-r--r-- | docs-xml/smbdotconf/tuning/smb2maxtrans.xml | 13 | ||||
-rw-r--r-- | docs-xml/smbdotconf/tuning/smb2maxwrite.xml | 13 | ||||
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/param/loadparm.c | 37 | ||||
-rw-r--r-- | source3/smbd/smb2_negprot.c | 6 | ||||
-rw-r--r-- | source3/smbd/smb2_notify.c | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_read.c | 4 | ||||
-rw-r--r-- | source3/smbd/smb2_write.c | 4 |
9 files changed, 87 insertions, 8 deletions
diff --git a/docs-xml/smbdotconf/tuning/smb2maxread.xml b/docs-xml/smbdotconf/tuning/smb2maxread.xml new file mode 100644 index 0000000000..a3abbbc4ca --- /dev/null +++ b/docs-xml/smbdotconf/tuning/smb2maxread.xml @@ -0,0 +1,13 @@ +<samba:parameter name="smb2 max read" + context="G" + advanced="1" developer="1" + xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> +<description> + <para>This sets the maximum read size in bytes for a single SMB2 read request. + It exists to allow the Samba developers to experiment with different + size requests for tuning purposes. + </para> +</description> + +<value type="default">65536</value> +</samba:parameter> diff --git a/docs-xml/smbdotconf/tuning/smb2maxtrans.xml b/docs-xml/smbdotconf/tuning/smb2maxtrans.xml new file mode 100644 index 0000000000..4e6fee0e75 --- /dev/null +++ b/docs-xml/smbdotconf/tuning/smb2maxtrans.xml @@ -0,0 +1,13 @@ +<samba:parameter name="smb2 max trans" + context="G" + advanced="1" developer="1" + xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> +<description> + <para>This sets the maximum read size in bytes for a single SMB2 transact request. + It exists to allow the Samba developers to experiment with different + size requests for tuning purposes. + </para> +</description> + +<value type="default">65536</value> +</samba:parameter> diff --git a/docs-xml/smbdotconf/tuning/smb2maxwrite.xml b/docs-xml/smbdotconf/tuning/smb2maxwrite.xml new file mode 100644 index 0000000000..5085dba435 --- /dev/null +++ b/docs-xml/smbdotconf/tuning/smb2maxwrite.xml @@ -0,0 +1,13 @@ +<samba:parameter name="smb2 max write" + context="G" + advanced="1" developer="1" + xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> +<description> + <para>This sets the maximum read size in bytes for a single SMB2 write request. + It exists to allow the Samba developers to experiment with different + size requests for tuning purposes. + </para> +</description> + +<value type="default">65536</value> +</samba:parameter> diff --git a/source3/include/proto.h b/source3/include/proto.h index 7e45fed76c..7dcdeacb00 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4113,6 +4113,9 @@ int lp_lock_spin_time(void); int lp_usershare_max_shares(void); const char *lp_socket_options(void); int lp_config_backend(void); +int lp_smb2_max_read(void); +int lp_smb2_max_write(void); +int lp_smb2_max_trans(void); char *lp_preexec(int ); char *lp_postexec(int ); char *lp_rootpreexec(int ); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b0f78f98a0..077fc6355f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -362,6 +362,9 @@ struct global { char *szSMBPerfcountModule; bool bMapUntrustedToDomain; bool bAsyncSMBEchoHandler; + int ismb2_max_read; + int ismb2_max_write; + int ismb2_max_trans; }; static struct global Globals; @@ -2587,6 +2590,33 @@ static struct parm_struct parm_table[] = { .enum_list = NULL, .flags = FLAG_ADVANCED | FLAG_GLOBAL, }, + { + .label = "smb2 max read", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_read, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, + { + .label = "smb2 max write", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_write, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, + { + .label = "smb2 max trans", + .type = P_INTEGER, + .p_class = P_GLOBAL, + .ptr = &Globals.ismb2_max_trans, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED, + }, {N_("Printing Options"), P_SEP, P_SEPARATOR}, @@ -5250,6 +5280,10 @@ static void init_globals(bool first_time_only) Globals.iminreceivefile = 0; Globals.bMapUntrustedToDomain = false; + + Globals.ismb2_max_read = 64*1024; + Globals.ismb2_max_write = 64*1024; + Globals.ismb2_max_trans = 64*1024; } /******************************************************************* @@ -5612,6 +5646,9 @@ FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime) FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares) FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions) FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend) +FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read) +FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write) +FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans) FN_LOCAL_STRING(lp_preexec, szPreExec) FN_LOCAL_STRING(lp_postexec, szPostExec) diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c index 5b97c65d79..5a216b27e4 100644 --- a/source3/smbd/smb2_negprot.c +++ b/source3/smbd/smb2_negprot.c @@ -164,9 +164,9 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req) negprot_spnego_blob.data, 16); /* server guid */ SIVAL(outbody.data, 0x18, capabilities); /* capabilities */ - SIVAL(outbody.data, 0x1C, 0x00010000); /* max transact size */ - SIVAL(outbody.data, 0x20, 0x00010000); /* max read size */ - SIVAL(outbody.data, 0x24, 0x00010000); /* max write size */ + SIVAL(outbody.data, 0x1C, lp_smb2_max_trans()); /* max transact size */ + SIVAL(outbody.data, 0x20, lp_smb2_max_read()); /* max read size */ + SIVAL(outbody.data, 0x24, lp_smb2_max_write()); /* max write size */ SBVAL(outbody.data, 0x28, 0); /* system time */ SBVAL(outbody.data, 0x30, 0); /* server start time */ SSVAL(outbody.data, 0x38, diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index fb465abff9..8fa0744319 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -70,7 +70,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req) * 0x00010000 is what Windows 7 uses, * Windows 2008 uses 0x00080000 */ - if (in_output_buffer_length > 0x00010000) { + if (in_output_buffer_length > lp_smb2_max_trans()) { return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 674fa2b71f..aa2805d66a 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -75,9 +75,9 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req) in_remaining_bytes = IVAL(inbody, 0x28); /* check the max read size */ - if (in_length > 0x00010000) { + if (in_length > lp_smb2_max_read()) { DEBUG(0,("here:%s: 0x%08X: 0x%08X\n", - __location__, in_length, 0x00010000)); + __location__, in_length, lp_smb2_max_read())); return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 17d562affa..608cf09e45 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -81,9 +81,9 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req) } /* check the max write size */ - if (in_data_length > 0x00010000) { + if (in_data_length > lp_smb2_max_write()) { DEBUG(0,("here:%s: 0x%08X: 0x%08X\n", - __location__, in_data_length, 0x00010000)); + __location__, in_data_length, lp_smb2_max_write())); return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } |