Skip to content

Commit c398f27

Browse files
committed
Revert "Trying out using the tcpi_rcv_space value from tcp_info instead of"
This should not have been pushed to guthub. This reverts commit 77aaba1.
1 parent 77aaba1 commit c398f27

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

channels.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,43 +1232,29 @@ channel_pre_connecting(struct ssh *ssh, Channel *c)
12321232
c->io_want = SSH_CHAN_IO_SOCK_W;
12331233
}
12341234

1235-
#include <linux/tcp.h>
12361235
static int
12371236
channel_tcpwinsz(struct ssh *ssh)
12381237
{
12391238
u_int32_t tcpwinsz = 0;
1239+
socklen_t optsz = sizeof(tcpwinsz);
12401240
int ret = -1;
12411241

12421242
/* if we aren't on a socket return 128KB */
12431243
if (!ssh_packet_connection_is_on_socket(ssh))
12441244
return 128 * 1024;
12451245

1246-
#ifdef TCP_INFO
1247-
size_t tcpi_len;
1248-
struct tcp_info local_tcp_info;
1249-
tcpi_len = (size_t)sizeof(local_tcp_info);
1250-
ret = getsockopt(ssh_packet_get_connection_in(ssh), IPPROTO_TCP, TCP_INFO,
1251-
(void *)&local_tcp_info, (socklen_t *)&tcpi_len);
1252-
tcpwinsz = local_tcp_info.tcpi_rcv_space;
1253-
#else
1254-
socklen_t optsz = sizeof(tcpwinsz);
12551246
ret = getsockopt(ssh_packet_get_connection_in(ssh),
12561247
SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
1257-
#endif
1258-
12591248
/* return no more than SSHBUF_SIZE_MAX (currently 256MB) */
12601249
if ((ret == 0) && tcpwinsz > SSHBUF_SIZE_MAX)
12611250
tcpwinsz = SSHBUF_SIZE_MAX;
1262-
1263-
debug("RCV SPACE = %d, winsz = %d", local_tcp_info.tcpi_rcv_space, tcpwinsz);
12641251
/* if the remote side is OpenSSH after version 8.8 we need to restrict
12651252
* the size of the advertised window. Now this means that any HPN to non-HPN
12661253
* connection will be window limited to 15MB of receive space. This is a
12671254
* non-optimal solution.
12681255
*/
12691256

1270-
if ((ssh->compat & SSH_RESTRICT_WINDOW) &&
1271-
(tcpwinsz > NON_HPN_WINDOW_MAX))
1257+
if ((ssh->compat & SSH_RESTRICT_WINDOW) && (tcpwinsz > NON_HPN_WINDOW_MAX))
12721258
tcpwinsz = NON_HPN_WINDOW_MAX;
12731259
return (tcpwinsz);
12741260
}

0 commit comments

Comments
 (0)