struct tcp_options options;
size_t hlen;
uint16_t csum;
+ uint32_t start_seq;
uint32_t seq;
uint32_t ack;
uint32_t win;
/* Parse parameters from header and strip header */
tcp = tcp_demux ( ntohs ( tcphdr->dest ) );
- seq = ntohl ( tcphdr->seq );
+ seq = start_seq = ntohl ( tcphdr->seq );
ack = ntohl ( tcphdr->ack );
win = ntohs ( tcphdr->win );
flags = tcphdr->flags;
goto discard;
}
- /* Update timestamp, if applicable */
- if ( options.tsopt && tcp_in_window ( tcp->rcv_ack, seq, seq_len ) )
- tcp->ts_recent = ntohl ( options.tsopt->tsval );
-
/* Handle ACK, if present */
if ( flags & TCP_ACK ) {
if ( ( rc = tcp_rx_ack ( tcp, ack, win ) ) != 0 ) {
goto discard;
}
+ /* Update timestamp, if applicable */
+ if ( options.tsopt &&
+ tcp_in_window ( tcp->rcv_ack, start_seq, seq_len ) ) {
+ tcp->ts_recent = ntohl ( options.tsopt->tsval );
+ }
+
/* Enqueue received data */
tcp_rx_enqueue ( tcp, seq, flags, iob_disown ( iobuf ) );