Skip to content

Commit 783d8b2

Browse files
authored
Merge pull request #83 from rapier1/release_candidates
Official Release of 18.4.1
2 parents 4aa6f04 + bd7ad03 commit 783d8b2

21 files changed

+107
-167
lines changed

.github/workflows/cifuzz.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
name: CIFuzz
22
on:
33
push:
4-
branches: [master, pre-stage]
4+
branches: [master, dev_minor, dev_major, release_candidates]
55
paths: [ '**.c', '**.h', '**.m4', '**.sh', '.github/**', '**/Makefile.in', 'configure.ac' ]
66
pull_request:
77
paths: [ '**.c', '**.h', '**.m4', '**.sh', '.github/**', '**/Makefile.in', 'configure.ac' ]
88

99
jobs:
1010
Fuzzing:
11-
if: github.repository != 'rapier1/openssh-portable-selfhosted'
11+
if: github.repository != 'rapier1/hpn-ssh-selfhosted'
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Build Fuzzers
1515
id: build
1616
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
1717
with:
18-
oss-fuzz-project-name: 'openssh'
18+
oss-fuzz-project-name: 'hpn-ssh'
1919
dry-run: false
2020
language: c++
2121
- name: Run Fuzzers
2222
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
2323
with:
24-
oss-fuzz-project-name: 'openssh'
24+
oss-fuzz-project-name: 'hpn-ssh'
2525
fuzz-seconds: 600
2626
dry-run: false
2727
language: c++
@@ -30,4 +30,4 @@ jobs:
3030
if: failure() && steps.build.outcome == 'success'
3131
with:
3232
name: artifacts
33-
path: ./out/artifacts
33+
path: ./out/artifacts

channels.c

+11-24
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,16 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
534534
(c->output = sshbuf_new()) == NULL ||
535535
(c->extended = sshbuf_new()) == NULL)
536536
fatal_f("sshbuf_new failed");
537+
538+
/* these buffers are important in terms of tracking channel
539+
* buffer usage so label and type them with descriptive names */
537540
sshbuf_relabel(c->input, "channel input");
541+
sshbuf_type(c->input, BUF_CHANNEL_INPUT);
538542
sshbuf_relabel(c->output, "channel output");
543+
sshbuf_type(c->output, BUF_CHANNEL_OUTPUT);
539544
sshbuf_relabel(c->extended, "channel extended");
545+
sshbuf_type(c->extended, BUF_CHANNEL_EXTENDED);
546+
540547
if ((r = sshbuf_set_max_size(c->input, CHAN_INPUT_MAX)) != 0)
541548
fatal_fr(r, "sshbuf_set_max_size");
542549
c->ostate = CHAN_OUTPUT_OPEN;
@@ -2401,40 +2408,20 @@ channel_check_window(struct ssh *ssh, Channel *c)
24012408
{
24022409
int r;
24032410

2404-
/* going back to a set denominator of 2. Prior versions had a
2405-
* dynamic denominator based on the size of the buffer. This may
2406-
* have been helpful in some situations but it isn't helping in
2407-
* the general case -cjr 6/30/23 */
24082411
if (c->type == SSH_CHANNEL_OPEN &&
24092412
!(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) &&
24102413
((c->local_window_max - c->local_window > c->local_maxpacket*3) ||
24112414
c->local_window < c->local_window_max/2) &&
24122415
c->local_consumed > 0) {
2413-
u_int addition = 0;
2416+
int addition = 0;
24142417
u_int32_t tcpwinsz = channel_tcpwinsz(ssh);
24152418
/* adjust max window size if we are in a dynamic environment
24162419
* and the tcp receive buffer is larger than the ssh window */
24172420
if (c->dynamic_window && (tcpwinsz > c->local_window_max)) {
2418-
if (c->hpn_buffer_limit) {
2419-
/* limit window growth to prevent buffer issues
2420-
* still not sure what is causing the buffer issues
2421-
* but it may be an issue with c->local_consumed not being
2422-
* handled properly in the cases of bottenecked IO to the
2423-
* wfd endpoint. This does have an impact on throughput
2424-
* as we're essentially maxing out local_window_max to
2425-
* half of the window size */
2426-
addition = (tcpwinsz/2 - c->local_window_max);
2427-
}
2428-
else {
2429-
/* aggressively grow the window */
2430-
addition = tcpwinsz - c->local_window_max;
2431-
}
2421+
/* aggressively grow the window */
2422+
addition = tcpwinsz - c->local_window_max;
24322423
c->local_window_max += addition;
2433-
/* doesn't look like we need these
2434-
* sshbuf_set_window_max(c->output, c->local_window_max);
2435-
* sshbuf_set_window_max(c->input, c->local_window_max);
2436-
*/
2437-
debug("Channel %d: Window growth to %d by %d bytes",c->self,
2424+
debug_f("Channel %d: Window growth to %d by %d bytes",c->self,
24382425
c->local_window_max, addition);
24392426
}
24402427
if (!c->have_remote_id)

channels.h

-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ struct Channel {
175175
u_int local_consumed;
176176
u_int local_maxpacket;
177177
int dynamic_window;
178-
int hpn_buffer_limit;
179178
int extended_usage;
180179
int single_connection;
181180
/* u_int tcpwinsz; */

clientloop.c

-5
Original file line numberDiff line numberDiff line change
@@ -2911,11 +2911,6 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
29112911
if ((c = channel_lookup(ssh, id)) == NULL)
29122912
fatal_f("channel %d: unknown channel", id);
29132913

2914-
if (options.hpn_buffer_limit) {
2915-
debug_f("Limiting receive buffer size");
2916-
c->hpn_buffer_limit = 1;
2917-
}
2918-
29192914
ssh_packet_set_interactive(ssh, want_tty,
29202915
options.ip_qos_interactive, options.ip_qos_bulk);
29212916

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -2883,12 +2883,12 @@ if test "x$openssl" = "xyes" ; then
28832883
*) ;; # Assume all other versions are good.
28842884
esac
28852885
;;
2886-
300*)
2886+
300*|301*|302*|303*)
28872887
# OpenSSL 3; we use the 1.1x API
28882888
CPPFLAGS="$CPPFLAGS -DOPENSSL_API_COMPAT=0x10100000L"
28892889
AC_DEFINE([WITH_OPENSSL3], [1], [With OpenSSL3])
28902890
;;
2891-
301*|302*|303*)
2891+
304*)
28922892
# OpenSSL development branch; request 1.1x API
28932893
CPPFLAGS="$CPPFLAGS -DOPENSSL_API_COMPAT=0x10100000L"
28942894
AC_DEFINE([WITH_OPENSSL3], [1], [With OpenSSL3])

hpnssh.1

-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ For full details of the options listed below, and their possible values, see
555555
.It HostKeyAlias
556556
.It Hostname
557557
.It HPNDisabled*
558-
.It HPNBufferLimit*
559558
.It IdentitiesOnly
560559
.It IdentityAgent
561560
.It IdentityFile

hpnssh_config.5

-9
Original file line numberDiff line numberDiff line change
@@ -1081,15 +1081,6 @@ In some situations, such as transfers on a local area network, the impact
10811081
of the HPN code produces a net decrease in performance. In these cases it is
10821082
helpful to disable the HPN functionality. By default HPNDisabled is set to
10831083
.Cm no. HPNSSH only.
1084-
.It Cm HPNBufferLimit
1085-
This option will force the hpnssh receive buffer to grow more slowly and limits
1086-
the growth to one half of the TCP receive buffer. This option can prove useful
1087-
in situation where a high speed path with larger RTTs are writing to a slower
1088-
device or file system. Enabling this option will reduce performance but may provide
1089-
a more stable connection. The option only impacts the receiving side of the connection.
1090-
For example, a client receiving data from a server but not a client sending data.
1091-
By default this option is set to
1092-
.Cm no. HPNSSH only.
10931084
.It Cm IdentitiesOnly
10941085
Specifies that
10951086
.Xr ssh 1

hpnsshd_config.5

-10
Original file line numberDiff line numberDiff line change
@@ -890,16 +890,6 @@ In some situations, such as transfers on a local area network, the impact
890890
of the HPN code produces a net decrease in performance. In these cases it is
891891
helpful to disable the HPN functionality. By default HPNDisabled is set to
892892
.CM no.
893-
.It Cm HPNBufferLimit
894-
This option will force the hpnssh receive buffer to grow more slowly and limits
895-
the growth to one half of the TCP receive buffer. This option can prove useful
896-
in situation where a high speed path with larger RTTs are writing to a slower
897-
device or file system. Enabling this option will reduce performance but may provide
898-
a more stable connection. The option only impacts the receiving side of the connection.
899-
For example, a client receiving data from a server but not a client sending data. If
900-
enabled on a server this will impact all incoming connections.
901-
By default this option is set to
902-
.Cm no. HPNSSH only.
903893
.It Cm IgnoreRhosts
904894
Specifies whether to ignore per-user
905895
.Pa .rhosts

kex.c

+12-3
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,11 @@ patch_list(char * orig)
10411041
int
10421042
kex_ready(struct ssh *ssh, char *proposal[PROPOSAL_MAX])
10431043
{
1044-
int r;
1044+
int r = 0;
10451045

10461046
#ifdef WITH_OPENSSL
1047+
char * orig_ctos = proposal[PROPOSAL_ENC_ALGS_CTOS];
1048+
char * orig_stoc = proposal[PROPOSAL_ENC_ALGS_STOC];
10471049
proposal[PROPOSAL_ENC_ALGS_CTOS] =
10481050
patch_list(proposal[PROPOSAL_ENC_ALGS_CTOS]);
10491051
proposal[PROPOSAL_ENC_ALGS_STOC] =
@@ -1057,11 +1059,18 @@ kex_ready(struct ssh *ssh, char *proposal[PROPOSAL_MAX])
10571059
#endif
10581060

10591061
if ((r = kex_prop2buf(ssh->kex->my, proposal)) != 0)
1060-
return r;
1062+
goto restoreProposal;
10611063
ssh->kex->flags = KEX_INITIAL;
10621064
kex_reset_dispatch(ssh);
10631065
ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
1064-
return 0;
1066+
restoreProposal:
1067+
#ifdef WITH_OPENSSL
1068+
free(proposal[PROPOSAL_ENC_ALGS_CTOS]);
1069+
free(proposal[PROPOSAL_ENC_ALGS_STOC]);
1070+
proposal[PROPOSAL_ENC_ALGS_CTOS] = orig_ctos;
1071+
proposal[PROPOSAL_ENC_ALGS_STOC] = orig_stoc;
1072+
#endif
1073+
return r;
10651074
}
10661075

10671076
int

packet.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,15 @@ ssh_alloc_session_state(void)
257257
(state->incoming_packet = sshbuf_new()) == NULL)
258258
goto fail;
259259
/* these buffers are important in terms of tracking buffer usage
260-
* so we explicitly label them with descriptive names */
260+
* so we explicitly label and type them with descriptive names */
261261
sshbuf_relabel(state->input, "input");
262+
sshbuf_type(state->input, BUF_PACKET_INPUT);
262263
sshbuf_relabel(state->incoming_packet, "inpacket");
264+
sshbuf_type(state->incoming_packet, BUF_PACKET_INCOMING);
263265
sshbuf_relabel(state->output, "output");
266+
sshbuf_type(state->output, BUF_PACKET_OUTPUT);
264267
sshbuf_relabel(state->outgoing_packet, "outpacket");
268+
sshbuf_type(state->outgoing_packet, BUF_PACKET_OUTGOING);
265269

266270
TAILQ_INIT(&state->outgoing);
267271
TAILQ_INIT(&ssh->private_keys);

packet.h

-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ struct ssh {
9797

9898
/* track if we have disabled the mac as well */
9999
int none_mac;
100-
101-
/* use the less agressive window growth option */
102-
int hpn_buffer_limit;
103100
};
104101

105102
typedef int (ssh_packet_hook_fn)(struct ssh *, struct sshbuf *,

readconf.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ typedef enum {
171171
oTunnel, oTunnelDevice,
172172
oLocalCommand, oPermitLocalCommand, oRemoteCommand,
173173
oTcpRcvBufPoll, oHPNDisabled,
174-
oNoneEnabled, oNoneMacEnabled, oNoneSwitch, oHPNBufferLimit,
174+
oNoneEnabled, oNoneMacEnabled, oNoneSwitch,
175175
oMetrics, oMetricsPath, oMetricsInterval, oFallback, oFallbackPort,
176176
oVisualHostKey,
177177
oKexAlgorithms, oIPQoS, oRequestTTY, oSessionType, oStdinNull,
@@ -310,7 +310,6 @@ static struct {
310310
{ "noneenabled", oNoneEnabled },
311311
{ "nonemacenabled", oNoneMacEnabled },
312312
{ "noneswitch", oNoneSwitch },
313-
{ "hpnbufferlimit", oHPNBufferLimit },
314313
{ "metrics", oMetrics },
315314
{ "metricspath", oMetricsPath },
316315
{ "metricsinterval", oMetricsInterval },
@@ -1270,10 +1269,6 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host,
12701269
intptr = &options->nonemac_enabled;
12711270
goto parse_flag;
12721271

1273-
case oHPNBufferLimit:
1274-
intptr = &options->hpn_buffer_limit;
1275-
goto parse_flag;
1276-
12771272
case oMetrics:
12781273
intptr = &options->metrics;
12791274
goto parse_flag;
@@ -2701,7 +2696,6 @@ initialize_options(Options * options)
27012696
options->metrics_path = NULL;
27022697
options->metrics_interval = -1;
27032698
options->hpn_disabled = -1;
2704-
options->hpn_buffer_limit = -1;
27052699
options->fallback = -1;
27062700
options->fallback_port = -1;
27072701
options->tcp_rcv_buf_poll = -1;
@@ -2880,8 +2874,6 @@ fill_default_options(Options * options)
28802874
options->server_alive_count_max = 3;
28812875
if (options->hpn_disabled == -1)
28822876
options->hpn_disabled = 0;
2883-
if (options->hpn_buffer_limit == -1)
2884-
options->hpn_buffer_limit = 0;
28852877
if (options->tcp_rcv_buf_poll == -1)
28862878
options->tcp_rcv_buf_poll = 1;
28872879
if (options->none_switch == -1)

readconf.h

-1
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_limit; /* limit local_window_max to 1/2 receive buffer */
5655
int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */
5756
int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */
5857
SyslogFacility log_facility; /* Facility for system logging. */

servconf.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ initialize_server_options(ServerOptions *options)
192192
options->hpn_disabled = -1;
193193
options->none_enabled = -1;
194194
options->nonemac_enabled = -1;
195-
options->hpn_buffer_limit = -1;
196195
options->ip_qos_interactive = -1;
197196
options->ip_qos_bulk = -1;
198197
options->version_addendum = NULL;
@@ -441,8 +440,6 @@ fill_default_server_options(ServerOptions *options)
441440
}
442441
if (options->hpn_disabled == -1)
443442
options->hpn_disabled = 0;
444-
if (options->hpn_buffer_limit == -1)
445-
options->hpn_buffer_limit = 0;
446443
if (options->ip_qos_interactive == -1)
447444
options->ip_qos_interactive = IPTOS_DSCP_AF21;
448445
if (options->ip_qos_bulk == -1)
@@ -524,8 +521,7 @@ typedef enum {
524521
sKerberosGetAFSToken, sPasswordAuthentication,
525522
sKbdInteractiveAuthentication, sListenAddress, sAddressFamily,
526523
sPrintMotd, sPrintLastLog, sIgnoreRhosts,
527-
sNoneEnabled, sNoneMacEnabled, sHPNBufferLimit,
528-
sTcpRcvBufPoll, sHPNDisabled,
524+
sNoneEnabled, sNoneMacEnabled, sTcpRcvBufPoll, sHPNDisabled,
529525
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost,
530526
sPermitTTY, sStrictModes, sEmptyPasswd, sTCPKeepAlive,
531527
sPermitUserEnvironment, sAllowTcpForwarding, sCompression,
@@ -696,7 +692,6 @@ static struct {
696692
{ "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL },
697693
{ "noneenabled", sNoneEnabled, SSHCFG_ALL },
698694
{ "nonemacenabled", sNoneMacEnabled, SSHCFG_ALL },
699-
{ "hpnbufferlimit", sHPNBufferLimit, SSHCFG_ALL },
700695
{ "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL },
701696
{ "include", sInclude, SSHCFG_ALL },
702697
{ "ipqos", sIPQoS, SSHCFG_ALL },
@@ -1576,10 +1571,6 @@ process_server_config_line_depth(ServerOptions *options, char *line,
15761571
intptr = &options->nonemac_enabled;
15771572
goto parse_flag;
15781573

1579-
case sHPNBufferLimit:
1580-
intptr = &options->hpn_buffer_limit;
1581-
goto parse_flag;
1582-
15831574
case sHostbasedAuthentication:
15841575
intptr = &options->hostbased_authentication;
15851576
goto parse_flag;

servconf.h

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ typedef struct {
202202
int hpn_disabled; /* disable hpn functionality. false by default */
203203
int none_enabled; /* Enable NONE cipher switch */
204204
int nonemac_enabled; /* Enable NONE MAC switch */
205-
int hpn_buffer_limit; /* limit local_window_max to 1/2 receive buffer */
206205

207206
int permit_tun;
208207

serverloop.c

-2
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,6 @@ server_request_session(struct ssh *ssh)
620620
0, "server-session", 1);
621621
if ((options.tcp_rcv_buf_poll) && (!options.hpn_disabled))
622622
c->dynamic_window = 1;
623-
if (options.hpn_buffer_limit)
624-
c->hpn_buffer_limit = 1;
625623
if (session_open(the_authctxt, c->self) != 1) {
626624
debug("session open failed, free channel %d", c->self);
627625
channel_free(ssh, c);

ssh.c

-4
Original file line numberDiff line numberDiff line change
@@ -2238,10 +2238,6 @@ ssh_session2_open(struct ssh *ssh)
22382238
debug("Enabled Dynamic Window Scaling");
22392239
}
22402240

2241-
if (options.hpn_buffer_limit)
2242-
c->hpn_buffer_limit = 1;
2243-
2244-
22452241
debug3_f("channel_new: %d", c->self);
22462242

22472243
channel_send_open(ssh, c->self);

0 commit comments

Comments
 (0)