[PATCH 2/2] testparm: Add warning for socket options.
Andreas Schneider
asn at samba.org
Mon Nov 4 04:32:46 MST 2013
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source3/utils/testparm.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index ac60cbf..8fe209b 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 "
@@ -133,6 +134,38 @@ static int do_global_checks(void)
}
/*
+ * 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 cause 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.
*/
--
1.8.3.1
More information about the samba-technical
mailing list