From 03e4037c5ea88e33c448e7fee256d7f11edbe486 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 4 Nov 2013 12:32:46 +0100 Subject: testparm: Add warning for socket options. Signed-off-by: Andreas Schneider Reviewed-by: David Disseldorp Autobuild-User(master): David Disseldorp Autobuild-Date(master): Mon Nov 4 16:52:25 CET 2013 on sn-devel-104 --- source3/utils/testparm.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'source3') diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index ac60cbf990..1c13b52565 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 " @@ -132,6 +133,38 @@ static int do_global_checks(void) "deprecated\n\n"); } + /* + * Socket options. + */ + socket_options = lp_socket_options(); + if (socket_options != NULL && + (strstr(socket_options, "SO_SNDBUF") || + strstr(socket_options, "SO_RCVBUF") || + strstr(socket_options, "SO_SNDLOWAT") || + strstr(socket_options, "SO_RCVLOWAT") || + strstr(socket_options, "TCP_NODELAY"))) { + fprintf(stderr, + "WARNING: socket options = %s\n" + "This warning is printed because you set one of the\n" + "following options: SO_SNDBUF, SO_RCVBUF, SO_SNDLOWAT,\n" + "SO_RCVLOWAT, TCP_NODELAY\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 (SO_SNDBUF, SO_RCVBUF) that will be\n" + "disabled if you specify a socket buffer size. This can\n" + "potentially cripple your 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", + socket_options); + } + /* * Password server sanity checks. */ -- cgit