tcp: Read SO_SNDBUF unconditionally
Checking it only when the cached value is smaller than the current window of the receiver is not enough: it might shrink further while the receiver window is growing. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
474b8e6fb7
commit
45d9b0000e
1 changed files with 11 additions and 17 deletions
10
tcp.c
10
tcp.c
|
@ -1150,16 +1150,13 @@ static int tcp_send_to_tap(struct ctx *c, struct tcp_tap_conn *conn,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.tcpi_snd_wnd > conn->sndbuf) {
|
|
||||||
sl = sizeof(conn->sndbuf);
|
sl = sizeof(conn->sndbuf);
|
||||||
if (getsockopt(conn->sock, SOL_SOCKET, SO_SNDBUF,
|
if (getsockopt(conn->sock, SOL_SOCKET, SO_SNDBUF,
|
||||||
&conn->sndbuf, &sl))
|
&conn->sndbuf, &sl))
|
||||||
conn->sndbuf = USHRT_MAX;
|
conn->sndbuf = USHRT_MAX;
|
||||||
|
|
||||||
info.tcpi_snd_wnd = MIN(info.tcpi_snd_wnd,
|
info.tcpi_snd_wnd = MIN(info.tcpi_snd_wnd,
|
||||||
conn->sndbuf / 100 * 90);
|
conn->sndbuf * 90 / 100);
|
||||||
}
|
|
||||||
|
|
||||||
conn->tcpi_snd_wnd = info.tcpi_snd_wnd;
|
conn->tcpi_snd_wnd = info.tcpi_snd_wnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1766,15 +1763,12 @@ recvmmsg:
|
||||||
&sl))
|
&sl))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (info.tcpi_snd_wnd > conn->sndbuf) {
|
|
||||||
if (getsockopt(conn->sock, SOL_SOCKET,
|
if (getsockopt(conn->sock, SOL_SOCKET,
|
||||||
SO_SNDBUF, &conn->sndbuf, &sl))
|
SO_SNDBUF, &conn->sndbuf, &sl))
|
||||||
conn->sndbuf = USHRT_MAX;
|
conn->sndbuf = USHRT_MAX;
|
||||||
|
|
||||||
info.tcpi_snd_wnd = MIN(info.tcpi_snd_wnd,
|
info.tcpi_snd_wnd = MIN(info.tcpi_snd_wnd,
|
||||||
conn->sndbuf / 100
|
conn->sndbuf * 90 / 100);
|
||||||
* 90);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->state == ESTABLISHED)
|
if (conn->state == ESTABLISHED)
|
||||||
conn->seq_ack_to_tap = conn->seq_from_tap;
|
conn->seq_ack_to_tap = conn->seq_from_tap;
|
||||||
|
|
Loading…
Reference in a new issue