summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index d2a28c8..d77ab59 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1637,6 +1637,7 @@ tcp_twstart(tp)
tw->snd_nxt = tp->snd_nxt;
tw->rcv_nxt = tp->rcv_nxt;
+ tw->iss = tp->iss;
tw->cc_recv = tp->cc_recv;
tw->cc_send = tp->cc_send;
tw->t_starttime = tp->t_starttime;
@@ -1671,6 +1672,24 @@ tcp_twstart(tp)
INP_UNLOCK(inp);
}
+/*
+ * Determine if the ISN we will generate has advanced beyond the last
+ * sequence number used by the previous connection. If so, indicate
+ * that it is safe to recycle this tw socket by returning 1.
+ */
+int
+tcp_twrecycleable(struct tcptw *tw)
+{
+ tcp_seq new_isn = tw->iss;
+
+ new_isn += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
+
+ if (SEQ_GT(new_isn, tw->snd_nxt))
+ return 1;
+ else
+ return 0;
+}
+
struct tcptw *
tcp_twclose(struct tcptw *tw, int reuse)
{
OpenPOWER on IntegriCloud