[PATCH 1/2] testparm: Add warning for socket options.

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Oct 22 07:06:42 MDT 2013


On Mon, Oct 21, 2013 at 12:45:39PM +0200, Andreas Schneider wrote:
> Signed-off-by: Andreas Schneider <asn at samba.org>
> ---
>  source3/utils/testparm.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
> index a9793ab..c494181 100644
> --- a/source3/utils/testparm.c
> +++ b/source3/utils/testparm.c
> @@ -66,6 +66,7 @@ static int do_global_checks(void)
>  {
>  	int ret = 0;
>  	SMB_STRUCT_STAT st;
> +	const char *socket_options;
>  
>  	if (lp_security() >= SEC_DOMAIN && !lp_encrypted_passwords()) {
>  		fprintf(stderr, "ERROR: in 'security=domain' mode the 'encrypt passwords' parameter must always be set to 'true'.\n");
> @@ -126,6 +127,32 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
>  	}
>  
>  	/*
> +	 * Socket options.
> +	 */
> +	socket_options = lp_socket_options();
> +	if (socket_options != NULL &&
> +	    (strstr(socket_options, "SO_SNDBUF") ||
> +	     strstr(socket_options, "SO_RCVBUF"))) {
> +		fprintf(stderr,
> +			"WARNING: socket options = %s\n"
> +			"Modern server operating systems are tuned for\n"
> +			"high network performance in the majority of situations;\n"
> +			"when you set 'socket options' you are overriding those\n"
> +			"settings.\n"
> +			"Linux in particular has an auto-tuning mechanism for\n"
> +			"buffer sizes that will be disabled if you specify a\n"
> +			"socket buffer size. This can potentially cripple your\n"
> +			"TCP/IP stack!!!\n\n"
> +			"Getting the 'socket options' correct can make a big\n"
> +			"difference to your performance, but getting them wrong\n"
> +			"can degrade it by just as much. As with any other low\n"
> +			"level setting, if you must make changes to it, make\n "
> +			"small changes and test the effect before making any\n"
> +			"large changes.\n\n",
> +			lp_socket_options());
> +	}
> +
> +	/*
>  	 * Password server sanity checks.
>  	 */
>  
> @@ -438,7 +465,9 @@ rameter is ignored when using CUPS libraries.\n",
>  
>  
>  	if (!section_name && !parameter_name) {
> -		fprintf(stderr,"Server role: %s\n", server_role_str(lp_server_role()));
> +		fprintf(stderr,
> +			"Server role: %s\n\n",
> +			server_role_str(lp_server_role()));

The next patch does reformatting, so I'd move this hunk one
down.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list