Skip to content

Commit 4a775bd

Browse files
committed
This gets rid of everything related to hpn_buffer_size
1 parent e903aa1 commit 4a775bd

File tree

10 files changed

+18
-77
lines changed

10 files changed

+18
-77
lines changed

channels.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ static void channel_handler_init(struct ssh_channels *sc);
231231

232232
/* default values to enable hpn and the initial buffer size */
233233
static int hpn_disabled = 0;
234-
static int hpn_buffer_size = 2 * 1024 * 1024;
235234

236235
/* -- channel core */
237236

@@ -3779,11 +3778,10 @@ channel_fwd_bind_addr(struct ssh *ssh, const char *listen_addr, int *wildcardp,
37793778
}
37803779

37813780
void
3782-
channel_set_hpn(int external_hpn_disabled, int external_hpn_buffer_size)
3781+
channel_set_hpn_disabled(int external_hpn_disabled)
37833782
{
37843783
hpn_disabled = external_hpn_disabled;
3785-
hpn_buffer_size = external_hpn_buffer_size;
3786-
debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled, hpn_buffer_size);
3784+
debug("HPN Disabled: %d", hpn_disabled);
37873785
}
37883786

37893787
static int
@@ -3925,10 +3923,8 @@ channel_setup_fwd_listener_tcpip(struct ssh *ssh, int type,
39253923
}
39263924

39273925
/* Allocate a channel number for the socket. */
3928-
/* explicitly test for hpn disabled option. if true use smaller window size */
39293926
c = channel_new(ssh, "port-listener", type, sock, sock, -1,
3930-
hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : hpn_buffer_size,
3931-
CHAN_TCP_PACKET_DEFAULT, 0, "port listener", 1);
3927+
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "port listener", 1);
39323928
c->path = xstrdup(host);
39333929
c->host_port = fwd->connect_port;
39343930
c->listening_addr = addr == NULL ? NULL : xstrdup(addr);
@@ -5096,8 +5092,7 @@ x11_create_display_inet(struct ssh *ssh, int x11_display_offset,
50965092
sock = socks[n];
50975093
nc = channel_new(ssh, "x11-listener",
50985094
SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
5099-
hpn_disabled ? CHAN_X11_WINDOW_DEFAULT : hpn_buffer_size,
5100-
CHAN_X11_PACKET_DEFAULT,
5095+
CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
51015096
0, "X11 inet listener", 1);
51025097
nc->single_connection = single_connection;
51035098
(*chanids)[n] = nc->self;

channels.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,5 @@ void chan_write_failed(struct ssh *, Channel *);
400400
void chan_obuf_empty(struct ssh *, Channel *);
401401

402402
/* hpn handler */
403-
void channel_set_hpn(int, int);
403+
void channel_set_hpn_disabled(int);
404404
#endif

clientloop.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,9 +1825,8 @@ client_request_x11(struct ssh *ssh, const char *request_type, int rchan)
18251825
return NULL;
18261826
c = channel_new(ssh, "x11",
18271827
SSH_CHANNEL_X11_OPEN, sock, sock, -1,
1828-
/* again is this really necessary for X11? */
1829-
options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size,
1830-
CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
1828+
CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
1829+
0, "x11", 1);
18311830
c->force_drain = 1;
18321831
return c;
18331832
}
@@ -1862,8 +1861,7 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan)
18621861

18631862
c = channel_new(ssh, "authentication agent connection",
18641863
SSH_CHANNEL_OPEN, sock, sock, -1,
1865-
options.hpn_disabled ? CHAN_X11_WINDOW_DEFAULT : options.hpn_buffer_size,
1866-
CHAN_TCP_PACKET_DEFAULT, 0,
1864+
CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0,
18671865
"authentication agent connection", 1);
18681866
c->force_drain = 1;
18691867
return c;
@@ -1890,8 +1888,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
18901888
debug_f("Tunnel forwarding using interface %s", ifname);
18911889

18921890
c = channel_new(ssh, "tun", SSH_CHANNEL_OPENING, fd, fd, -1,
1893-
options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size,
1894-
CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
1891+
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
18951892
c->datagram = 1;
18961893

18971894

readconf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ typedef struct {
5252
int tcp_keep_alive; /* Set SO_KEEPALIVE. */
5353
int tcp_rcv_buf_poll; /* Option to poll recv buf every window transfer */
5454
int hpn_disabled; /* Switch to disable HPN buffer management */
55-
int hpn_buffer_size; /* Size of HPN buffer window */
5655
int hpn_buffer_limit; /* limit local_window_max to 1/2 receive buffer */
5756
int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */
5857
int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */

servconf.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,6 @@ void
282282
fill_default_server_options(ServerOptions *options)
283283
{
284284
u_int i;
285-
/* needed for hpn socket tests */
286-
int sock;
287-
int socksize;
288-
int socksizelen = sizeof(int);
289285

290286
/* Portable-specific options */
291287
if (options->use_pam == -1)

servconf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ typedef struct {
200200
int use_pam; /* Enable auth via PAM */
201201
int tcp_rcv_buf_poll; /* poll tcp rcv window in autotuning kernels*/
202202
int hpn_disabled; /* disable hpn functionality. false by default */
203-
int hpn_buffer_size; /* hpn buffer size - default 2MB */
204203
int none_enabled; /* Enable NONE cipher switch */
205204
int nonemac_enabled; /* Enable NONE MAC switch */
206205
int hpn_buffer_limit; /* limit local_window_max to 1/2 receive buffer */

serverloop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ server_request_tun(struct ssh *ssh)
566566
debug("Tunnel forwarding using interface %s", ifname);
567567

568568
c = channel_new(ssh, "tun", SSH_CHANNEL_OPEN, sock, sock, -1,
569-
options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size,
570-
CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
569+
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
570+
0, "tun", 1);
571571
c->datagram = 1;
572572
#if defined(SSH_TUN_FILTER)
573573
if (mode == SSH_TUNMODE_POINTOPOINT)

session.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,8 +2266,7 @@ session_set_fds(struct ssh *ssh, Session *s,
22662266
channel_set_fds(ssh, s->chanid,
22672267
fdout, fdin, fderr,
22682268
ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
2269-
1, is_tty,
2270-
options.hpn_disabled ? CHAN_SES_WINDOW_DEFAULT : options.hpn_buffer_size);
2269+
1, is_tty, CHAN_SES_WINDOW_DEFAULT);
22712270
}
22722271

22732272
/*

ssh.c

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,56 +2133,13 @@ ssh_session2_setup(struct ssh *ssh, int id, int success, void *arg)
21332133
NULL, fileno(stdin), command, environ);
21342134
}
21352135

2136+
/* this used to do a lot more but now it just checks to see
2137+
* if we are disabling hpn */
21362138
static void
21372139
hpn_options_init(struct ssh *ssh)
21382140
{
2139-
/*
2140-
* We need to check to see if what they want to do about buffer
2141-
* sizes here. In a hpn to nonhpn connection we want to limit
2142-
* the window size to something reasonable in case the far side
2143-
* has the large window bug. In hpn to hpn connection we want to
2144-
* use the max window size but allow the user to override it
2145-
* lastly if they disabled hpn then use the ssh std window size.
2146-
*
2147-
* So why don't we just do a getsockopt() here and set the
2148-
* ssh window to that? In the case of a autotuning receive
2149-
* window the window would get stuck at the initial buffer
2150-
* size generally less than 96k. Therefore we need to set the
2151-
* maximum ssh window size to the maximum hpn buffer size
2152-
* unless the user has specifically set the tcprcvbufpoll
2153-
* to no. In which case we *can* just set the window to the
2154-
* minimum of the hpn buffer size and tcp receive buffer size.
2155-
*/
2156-
2157-
if (tty_flag)
2158-
options.hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT;
2159-
else
2160-
options.hpn_buffer_size = (2 * 1024 * 1024);
2161-
2162-
if (ssh->compat & SSH_BUG_LARGEWINDOW) {
2163-
debug("HPN to Non-HPN connection");
2164-
} else {
2165-
debug("HPN to HPN connection");
2166-
if (ssh->compat & SSH_HPNSSH) {
2167-
debug("Using 'hpn' prefixed binaries");
2168-
}
2169-
int sock, socksize;
2170-
socklen_t socksizelen;
2171-
if (options.tcp_rcv_buf_poll <= 0) {
2172-
sock = socket(AF_INET, SOCK_STREAM, 0);
2173-
socksizelen = sizeof(socksize);
2174-
getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
2175-
&socksize, &socksizelen);
2176-
close(sock);
2177-
debug("socksize %d", socksize);
2178-
options.hpn_buffer_size = socksize;
2179-
debug("HPNBufferSize set to TCP RWIN: %d", options.hpn_buffer_size);
2180-
}
2181-
}
2182-
2183-
debug("Final hpn_buffer_size = %d", options.hpn_buffer_size);
2184-
2185-
channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
2141+
channel_set_hpn_disabled(options.hpn_disabled);
2142+
debug_f("HPN disabled: %d", options.hpn_disabled);
21862143
}
21872144

21882145
/* open new channel for a session */
@@ -2203,7 +2160,7 @@ ssh_session2_open(struct ssh *ssh)
22032160
if (in == -1 || out == -1 || err == -1)
22042161
fatal("dup() in/out/err failed");
22052162

2206-
window = options.hpn_buffer_size;
2163+
window = CHAN_SES_WINDOW_DEFAULT;
22072164
packetmax = CHAN_SES_PACKET_DEFAULT;
22082165
if (tty_flag) {
22092166
window = CHAN_SES_WINDOW_DEFAULT;

sshd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,6 @@ listen_on_addrs(struct listenaddr *la)
10681068
getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF,
10691069
&socksize, &socksizelen);
10701070
debug("Server TCP RWIN socket size: %d", socksize);
1071-
debug("HPN Buffer Size: %d", options.hpn_buffer_size);
10721071

10731072
/* Bind the socket to the desired port. */
10741073
if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) == -1) {
@@ -2232,7 +2231,7 @@ main(int ac, char **av)
22322231
free(laddr);
22332232

22342233
/* set the HPN options for the child */
2235-
channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size);
2234+
channel_set_hpn_disabled(options.hpn_disabled);
22362235

22372236
/*
22382237
* We don't want to listen forever unless the other side

0 commit comments

Comments
 (0)