summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-02-08 04:40:51 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-02-08 04:40:51 +0000
commit250038d786eeb7594fe1d327631930d8e40d9d09 (patch)
tree8324beb138db41ace5d86a5d354f41f0b9889215 /sys/netinet
parentcdda0fb748bdfcc46dd3584806e766d3f073b656 (diff)
Count dropped SYN packets on the tcpstat. They are dropped due to the
listen queue (backlog) limit or the memory shortage in syn-cache. ok henning reyk claudio
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_input.c6
-rw-r--r--sys/netinet/tcp_var.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 96712240d07..ba45329f2fa 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.286 2014/12/19 17:14:40 tedu Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.287 2015/02/08 04:40:50 yasuoka Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -853,8 +853,10 @@ findpcb:
*/
if (so->so_qlen > so->so_qlimit ||
syn_cache_add(&src.sa, &dst.sa, th, iphlen,
- so, m, optp, optlen, &opti, reuse) == -1)
+ so, m, optp, optlen, &opti, reuse) == -1) {
+ tcpstat.tcps_dropsyn++;
goto drop;
+ }
return;
}
}
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index c55c5df6881..3e8ca2bd222 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.106 2015/01/21 22:23:52 deraadt Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.107 2015/02/08 04:40:50 yasuoka Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -408,6 +408,7 @@ struct tcpstat {
u_int32_t tcps_pcbhashmiss; /* input packets missing pcb hash */
u_int32_t tcps_noport; /* no socket on port */
u_int32_t tcps_badsyn; /* SYN packet with src==dst rcv'ed */
+ u_int32_t tcps_dropsyn; /* SYN packet dropped */
u_int32_t tcps_rcvbadsig; /* rcvd bad/missing TCP signatures */
u_int64_t tcps_rcvgoodsig; /* rcvd good TCP signatures */