summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2007-07-28 12:20:39 +0000
committerandre <andre@FreeBSD.org>2007-07-28 12:20:39 +0000
commit1d3ef28a993ec9dd3fb8ad8bb8bf94a92a597a51 (patch)
tree8cd4c75d9f5a3515ad698efe3302500a3c8e0345 /sys/netinet/tcp_subr.c
parentff2e8247eed7d7e42d98e8a053fd85ad11406f1d (diff)
downloadFreeBSD-src-1d3ef28a993ec9dd3fb8ad8bb8bf94a92a597a51.zip
FreeBSD-src-1d3ef28a993ec9dd3fb8ad8bb8bf94a92a597a51.tar.gz
Provide a sysctl to toggle reporting of TCP debug logging:
sys.net.inet.tcp.log_debug = 1 It defaults to enabled for the moment and is to be turned off for the next release like other diagnostics from development branches. It is important to note that sysctl sys.net.inet.tcp.log_in_vain uses the same logging function as log_debug. Enabling of the former also causes the latter to engage, but not vice versa. Use consistent terminology in tcp log messages: "ignored" means a segment contains invalid flags/information and is dropped without changing state or issuing a reply. "rejected" means a segments contains invalid flags/information but is causing a reply (usually RST) and may cause a state change. Approved by: re (rwatson)
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 16d4d92..963563d 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -133,6 +133,10 @@ int tcp_do_rfc1323 = 1;
SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_RW,
&tcp_do_rfc1323, 0, "Enable rfc1323 (high performance TCP) extensions");
+static int tcp_log_debug = 1;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW,
+ &tcp_log_debug, 0, "Log errors caused by incoming TCP segments");
+
static int tcp_tcbhashsize = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN,
&tcp_tcbhashsize, 0, "Size of TCP control-block hashtable");
@@ -2094,6 +2098,10 @@ tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
2 * INET_ADDRSTRLEN;
#endif /* INET6 */
+ /* Is logging enabled? */
+ if (tcp_log_debug == 0 && tcp_log_in_vain == 0)
+ return (NULL);
+
s = malloc(size, M_TCPLOG, M_ZERO|M_NOWAIT);
if (s == NULL)
return (NULL);
OpenPOWER on IntegriCloud