/*
* If last ACK falls within this segment's sequence numbers,
- * record its timestamp.
- * Fix from Braden, see Stevens p. 870
+ * record its timestamp if it's more recent.
+ * Cf fix from Braden, see Stevens p. 870
*/
if (opti.ts_present && TSTMP_GEQ(opti.ts_val, tp->ts_recent) &&
SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
+ if (SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen +
+ ((tiflags & (TH_SYN|TH_FIN)) != 0)))
+ tp->ts_recent = opti.ts_val;
+ else
+ tp->ts_recent = 0;
tp->ts_recent_age = tcp_now;
- tp->ts_recent = opti.ts_val;
}