Add an additional check to the tcp_twrecycleable function; I had
previously only considered the send sequence space. Unfortunately, some OSes (windows) still use a random positive increments scheme for their syn-ack ISNs, so I must consider receive sequence space as well. The value of 250000 bytes / second for Microsoft's ISN rate of increase was determined by testing with an XP machine.
This commit is contained in:
parent
03e432ad9c
commit
4bd4fa3fe6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121884
@ -1638,6 +1638,7 @@ tcp_twstart(tp)
|
||||
tw->snd_nxt = tp->snd_nxt;
|
||||
tw->rcv_nxt = tp->rcv_nxt;
|
||||
tw->iss = tp->iss;
|
||||
tw->irs = tp->irs;
|
||||
tw->cc_recv = tp->cc_recv;
|
||||
tw->cc_send = tp->cc_send;
|
||||
tw->t_starttime = tp->t_starttime;
|
||||
@ -1672,6 +1673,16 @@ tcp_twstart(tp)
|
||||
INP_UNLOCK(inp);
|
||||
}
|
||||
|
||||
/*
|
||||
* The appromixate rate of ISN increase of Microsoft TCP stacks;
|
||||
* the actual rate is slightly higher due to the addition of
|
||||
* random positive increments.
|
||||
*
|
||||
* Most other new OSes use semi-randomized ISN values, so we
|
||||
* do not need to worry about them.
|
||||
*/
|
||||
#define MS_ISN_BYTES_PER_SECOND 250000
|
||||
|
||||
/*
|
||||
* Determine if the ISN we will generate has advanced beyond the last
|
||||
* sequence number used by the previous connection. If so, indicate
|
||||
@ -1680,11 +1691,13 @@ tcp_twstart(tp)
|
||||
int
|
||||
tcp_twrecycleable(struct tcptw *tw)
|
||||
{
|
||||
tcp_seq new_isn = tw->iss;
|
||||
tcp_seq new_iss = tw->iss;
|
||||
tcp_seq new_irs = tw->irs;
|
||||
|
||||
new_isn += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
|
||||
new_iss += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
|
||||
new_irs += (ticks - tw->t_starttime) * (MS_ISN_BYTES_PER_SECOND / hz);
|
||||
|
||||
if (SEQ_GT(new_isn, tw->snd_nxt))
|
||||
if (SEQ_GT(new_iss, tw->snd_nxt) && SEQ_GT(new_irs, tw->rcv_nxt))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -1638,6 +1638,7 @@ tcp_twstart(tp)
|
||||
tw->snd_nxt = tp->snd_nxt;
|
||||
tw->rcv_nxt = tp->rcv_nxt;
|
||||
tw->iss = tp->iss;
|
||||
tw->irs = tp->irs;
|
||||
tw->cc_recv = tp->cc_recv;
|
||||
tw->cc_send = tp->cc_send;
|
||||
tw->t_starttime = tp->t_starttime;
|
||||
@ -1672,6 +1673,16 @@ tcp_twstart(tp)
|
||||
INP_UNLOCK(inp);
|
||||
}
|
||||
|
||||
/*
|
||||
* The appromixate rate of ISN increase of Microsoft TCP stacks;
|
||||
* the actual rate is slightly higher due to the addition of
|
||||
* random positive increments.
|
||||
*
|
||||
* Most other new OSes use semi-randomized ISN values, so we
|
||||
* do not need to worry about them.
|
||||
*/
|
||||
#define MS_ISN_BYTES_PER_SECOND 250000
|
||||
|
||||
/*
|
||||
* Determine if the ISN we will generate has advanced beyond the last
|
||||
* sequence number used by the previous connection. If so, indicate
|
||||
@ -1680,11 +1691,13 @@ tcp_twstart(tp)
|
||||
int
|
||||
tcp_twrecycleable(struct tcptw *tw)
|
||||
{
|
||||
tcp_seq new_isn = tw->iss;
|
||||
tcp_seq new_iss = tw->iss;
|
||||
tcp_seq new_irs = tw->irs;
|
||||
|
||||
new_isn += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
|
||||
new_iss += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
|
||||
new_irs += (ticks - tw->t_starttime) * (MS_ISN_BYTES_PER_SECOND / hz);
|
||||
|
||||
if (SEQ_GT(new_isn, tw->snd_nxt))
|
||||
if (SEQ_GT(new_iss, tw->snd_nxt) && SEQ_GT(new_irs, tw->rcv_nxt))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -247,6 +247,7 @@ struct tcptw {
|
||||
tcp_seq snd_nxt;
|
||||
tcp_seq rcv_nxt;
|
||||
tcp_seq iss;
|
||||
tcp_seq irs;
|
||||
tcp_cc cc_recv;
|
||||
tcp_cc cc_send;
|
||||
u_short last_win; /* cached window value */
|
||||
|
Loading…
Reference in New Issue
Block a user