Add the timestamp offset to struct tcptw so we can generate proper

ACKs in TIME_WAIT state that don't get dropped by the PAWS check
on the receiver.
This commit is contained in:
Andre Oppermann 2007-05-11 18:29:39 +00:00
parent c6cf3e202a
commit 504abdc6e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169477
3 changed files with 13 additions and 6 deletions

View File

@ -1781,10 +1781,13 @@ tcp_twstart(struct tcpcb *tp)
* Set t_recent if timestamps are used on the connection.
*/
if ((tp->t_flags & (TF_REQ_TSTMP|TF_RCVD_TSTMP|TF_NOOPT)) ==
(TF_REQ_TSTMP|TF_RCVD_TSTMP))
(TF_REQ_TSTMP|TF_RCVD_TSTMP)) {
tw->t_recent = tp->ts_recent;
else
tw->ts_offset = tp->ts_offset;
} else {
tw->t_recent = 0;
tw->ts_offset = 0;
}
tw->snd_nxt = tp->snd_nxt;
tw->rcv_nxt = tp->rcv_nxt;
@ -1986,7 +1989,7 @@ tcp_twrespond(struct tcptw *tw, int flags)
*/
if (tw->t_recent && flags == TH_ACK) {
to.to_flags |= TOF_TS;
to.to_tsval = ticks;
to.to_tsval = ticks + tw->ts_offset;
to.to_tsecr = tw->t_recent;
}
optlen = tcp_addoptions(&to, (u_char *)(th + 1));

View File

@ -1781,10 +1781,13 @@ tcp_twstart(struct tcpcb *tp)
* Set t_recent if timestamps are used on the connection.
*/
if ((tp->t_flags & (TF_REQ_TSTMP|TF_RCVD_TSTMP|TF_NOOPT)) ==
(TF_REQ_TSTMP|TF_RCVD_TSTMP))
(TF_REQ_TSTMP|TF_RCVD_TSTMP)) {
tw->t_recent = tp->ts_recent;
else
tw->ts_offset = tp->ts_offset;
} else {
tw->t_recent = 0;
tw->ts_offset = 0;
}
tw->snd_nxt = tp->snd_nxt;
tw->rcv_nxt = tp->rcv_nxt;
@ -1986,7 +1989,7 @@ tcp_twrespond(struct tcptw *tw, int flags)
*/
if (tw->t_recent && flags == TH_ACK) {
to.to_flags |= TOF_TS;
to.to_tsval = ticks;
to.to_tsval = ticks + tw->ts_offset;
to.to_tsecr = tw->t_recent;
}
optlen = tcp_addoptions(&to, (u_char *)(th + 1));

View File

@ -271,6 +271,7 @@ struct tcptw {
u_short tw_so_options; /* copy of so_options */
struct ucred *tw_cred; /* user credentials */
u_long t_recent;
u_int32_t ts_offset; /* our timestamp offset */
u_long t_starttime;
int tw_time;
TAILQ_ENTRY(tcptw) tw_2msl;