[PATCH] tcp_buf: Always reserve slot for possible duplicate ACK flag in the same batch
To avoid the risk of splitting two repeated ACKs, the second one being
a duplicate one, onto different batches, as it might significantly
worsen recovery time using fast retransmits, we don't check, in
tcp_buf_send_flag(), if we need to flush the current batch of frames
before we can append a duplicate ACK flag.
So we originally kept one reserved slot at the end of it: for example,
tcp_buf_send_flag() calls tcp_payload_flush() if we have less than two
free slots.
However, with the merging of data and flags buffers, not all the
conditions under which we call tcp_payload_flush() were updated:
tcp_data_to_tap() and tcp_buf_data_from_sock() could return without
ensuring that an extra free slot would be available for a duplicate
ACK flag. If this happens, and we coincidentally append a duplicate
ACK flag to the batch right after a call to those functions, we'll
crash (reliably) in tcp_buf_send_flag().
Fix those two paths to also reserve one extra slot for duplicate
ACK flags.
Note that, recently, https://bugs.passt.top/show_bug.cgi?id=224
raised some compliance issues with RFC 5681, so we might need to
reserve more slots once we implement full compliance, and probably,
at that point, it would make more sense to consider a different
approach, instead of wasting all that space.
Analysed-by: Laurent Vivier
participants (1)
-
Stefano Brivio