aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2016-01-27 00:45:46 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2016-01-27 00:45:46 +0000
commit57a78e3baeb583a817195e5aee153f6387b9b2b0 (patch)
treedd0b39d31460d52fec634711ce845f26d7406828 /sys/netinet/tcp_syncache.c
parent2027d8784f8376de9f24d93495cb879349ab1220 (diff)
Notes
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 940d3de237ce..45e00e97083a 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -351,6 +351,7 @@ syncache_insert(struct syncache *sc, struct syncache_head *sch)
SCH_UNLOCK(sch);
+ TCPSTAT_INC(tcps_states[TCPS_SYN_RECEIVED]);
TCPSTAT_INC(tcps_sc_added);
}
@@ -364,6 +365,7 @@ syncache_drop(struct syncache *sc, struct syncache_head *sch)
SCH_LOCK_ASSERT(sch);
+ TCPSTAT_DEC(tcps_states[TCPS_SYN_RECEIVED]);
TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash);
sch->sch_length--;
@@ -992,7 +994,16 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
goto failed;
}
} else {
- /* Pull out the entry to unlock the bucket row. */
+ /*
+ * Pull out the entry to unlock the bucket row.
+ *
+ * NOTE: We must decrease TCPS_SYN_RECEIVED count here, not
+ * tcp_state_change(). The tcpcb is not existent at this
+ * moment. A new one will be allocated via syncache_socket->
+ * sonewconn->tcp_usr_attach in TCPS_CLOSED state, then
+ * syncache_socket() will change it to TCPS_SYN_RECEIVED.
+ */
+ TCPSTAT_DEC(tcps_states[TCPS_SYN_RECEIVED]);
TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash);
sch->sch_length--;
#ifdef TCP_OFFLOAD