]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tcp] Discard packets that lie immediately before the receive window
authorMichael Brown <mcb30@ipxe.org>
Fri, 9 Jan 2026 13:18:20 +0000 (13:18 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 9 Jan 2026 13:18:20 +0000 (13:18 +0000)
We will currently enqueue (rather than discard) retransmitted packets
that lie immediately before the current receive window.  These packets
will be harmlessly discarded when the receive queue is processed
immediately afterwards, but cause confusion when attempting to debug
TCP performance issues.

Fix by adjusting the comparison so that packets that lie immediately
before the receive window will be discarded immediately and never
enqueued.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/tcp.c

index 2a98221f673682d36bded752decf90f6f1ba1408..d47196ba54b95a12ef66d4ebbdd74ea38b5389e9 100644 (file)
@@ -1317,7 +1317,7 @@ static void tcp_rx_enqueue ( struct tcp_connection *tcp, uint32_t seq,
         */
        if ( ( ! ( tcp->tcp_state & TCP_STATE_RCVD ( TCP_SYN ) ) ) ||
             ( tcp_cmp ( seq, tcp->rcv_ack + tcp->rcv_win ) >= 0 ) ||
-            ( tcp_cmp ( nxt, tcp->rcv_ack ) < 0 ) ||
+            ( tcp_cmp ( nxt, tcp->rcv_ack ) <= 0 ) ||
             ( seq_len == 0 ) ) {
                free_iob ( iobuf );
                return;