diff options
author | Michael Brown | 2007-07-13 12:31:58 +0200 |
---|---|---|
committer | Michael Brown | 2007-07-13 12:31:58 +0200 |
commit | eb530845d4166cd8f980622788517375925b4afe (patch) | |
tree | af7b87c3dbd64c0c1d9250fe1e00029bb2df57bd /src/net/tcp.c | |
parent | Avoid reusing auto-allocated ports after connection close. (diff) | |
download | ipxe-eb530845d4166cd8f980622788517375925b4afe.tar.gz ipxe-eb530845d4166cd8f980622788517375925b4afe.tar.xz ipxe-eb530845d4166cd8f980622788517375925b4afe.zip |
Adjust received length to take into account any already-received data
in tcp_rx_data().
Clarify comments on discarding duplicate or out-of-order data.
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r-- | src/net/tcp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c index 97d9dea1..98db274d 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -689,7 +689,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq, size_t len; int rc; - /* Ignore duplicate data */ + /* Ignore duplicate or out-of-order data */ already_rcvd = ( tcp->rcv_ack - seq ); len = iob_len ( iobuf ); if ( already_rcvd >= len ) { @@ -697,6 +697,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq, return 0; } iob_pull ( iobuf, already_rcvd ); + len -= already_rcvd; /* Deliver data to application */ if ( ( rc = xfer_deliver_iob ( &tcp->xfer, iobuf ) ) != 0 ) @@ -716,7 +717,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq, */ static int tcp_rx_fin ( struct tcp_connection *tcp, uint32_t seq ) { - /* Ignore duplicate FIN */ + /* Ignore duplicate or out-of-order FIN */ if ( ( tcp->rcv_ack - seq ) > 0 ) return 0; |