mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Parameterize "smb2 max read", "smb2 max write", "smb2 max trans".
Set to 64k by default. Jeremy.
This commit is contained in:
parent
027adf88ea
commit
9c410118cb
13
docs-xml/smbdotconf/tuning/smb2maxread.xml
Normal file
13
docs-xml/smbdotconf/tuning/smb2maxread.xml
Normal file
@ -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>
|
13
docs-xml/smbdotconf/tuning/smb2maxtrans.xml
Normal file
13
docs-xml/smbdotconf/tuning/smb2maxtrans.xml
Normal file
@ -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>
|
13
docs-xml/smbdotconf/tuning/smb2maxwrite.xml
Normal file
13
docs-xml/smbdotconf/tuning/smb2maxwrite.xml
Normal file
@ -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>
|
@ -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 );
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user