aboutgitcodebugslistschat
diff options
context:
space:
mode:
-rw-r--r--tcp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index ea545b0..9390e5b 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1494,7 +1494,10 @@ static bool tcp_tap_window_update(const struct ctx *c,
struct tcp_tap_conn *conn, unsigned wnd,
const struct timespec *now)
{
- wnd = MIN(MAX_WINDOW, wnd << conn->ws_from_tap);
+ /* SEQ_*() only handles sequence differences strictly less than
+ * MAX_WINDOW, so clamp to MAX_WINDOW - 1.
+ */
+ wnd = MIN(MAX_WINDOW - 1, wnd << conn->ws_from_tap);
/* Work-around for bug introduced in peer kernel code, commit
* e2142825c120 ("net: tcp: send zero-window ACK when no memory"): don't