mirror of
https://github.com/ipxe/ipxe
synced 2025-12-16 09:32:33 +03:00
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.
This commit is contained in:
@@ -689,7 +689,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
|
|||||||
size_t len;
|
size_t len;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Ignore duplicate data */
|
/* Ignore duplicate or out-of-order data */
|
||||||
already_rcvd = ( tcp->rcv_ack - seq );
|
already_rcvd = ( tcp->rcv_ack - seq );
|
||||||
len = iob_len ( iobuf );
|
len = iob_len ( iobuf );
|
||||||
if ( already_rcvd >= len ) {
|
if ( already_rcvd >= len ) {
|
||||||
@@ -697,6 +697,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iob_pull ( iobuf, already_rcvd );
|
iob_pull ( iobuf, already_rcvd );
|
||||||
|
len -= already_rcvd;
|
||||||
|
|
||||||
/* Deliver data to application */
|
/* Deliver data to application */
|
||||||
if ( ( rc = xfer_deliver_iob ( &tcp->xfer, iobuf ) ) != 0 )
|
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 ) {
|
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 )
|
if ( ( tcp->rcv_ack - seq ) > 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user