[openssh-commits] [openssh] 02/02: upstream: Try to continue running local I/O for channels in state
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Apr 20 15:09:03 AEST 2022
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit fec014785de198b9a325d1b94e324bb958c5fe7b
Author: djm at openbsd.org <djm at openbsd.org>
Date: Wed Apr 20 04:19:11 2022 +0000
upstream: Try to continue running local I/O for channels in state
OPEN during SSH transport rekeying. The most visible benefit is that it
should make ~-escapes work in the client (e.g. to exit) if the connection
happened to have stalled during a rekey event. Based work by and ok dtucker@
OpenBSD-Commit-ID: a66e8f254e92edd4ce09c9f750883ec8f1ea5f45
---
channels.c | 11 +++++------
clientloop.c | 7 +++----
serverloop.c | 5 ++---
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/channels.c b/channels.c
index d47af791..12f76599 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.416 2022/04/11 22:52:08 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.417 2022/04/20 04:19:11 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -2420,6 +2420,9 @@ channel_handler(struct ssh *ssh, int table, time_t *unpause_secs)
c = sc->channels[i];
if (c == NULL)
continue;
+ /* Try to keep IO going while rekeying */
+ if (ssh_packet_is_rekeying(ssh) && c->type != SSH_CHANNEL_OPEN)
+ continue;
if (c->delayed) {
if (table == CHAN_PRE)
c->delayed = 0;
@@ -2610,17 +2613,13 @@ channel_prepare_poll(struct ssh *ssh, struct pollfd **pfdp, u_int *npfd_allocp,
/* Allocate 4x pollfd for each channel (rfd, wfd, efd, sock) */
if (sc->channels_alloc >= (INT_MAX / 4) - npfd_reserved)
fatal_f("too many channels"); /* shouldn't happen */
- if (!ssh_packet_is_rekeying(ssh))
- npfd += sc->channels_alloc * 4;
+ npfd += sc->channels_alloc * 4;
if (npfd > *npfd_allocp) {
*pfdp = xrecallocarray(*pfdp, *npfd_allocp,
npfd, sizeof(**pfdp));
*npfd_allocp = npfd;
}
*npfd_activep = npfd_reserved;
- if (ssh_packet_is_rekeying(ssh))
- return;
-
oalloc = sc->channels_alloc;
channel_handler(ssh, CHAN_PRE, minwait_secs);
diff --git a/clientloop.c b/clientloop.c
index f8350e67..1d80683c 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.378 2022/01/22 00:49:34 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.379 2022/04/20 04:19:11 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1348,9 +1348,8 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
if (quit_pending)
break;
- /* Do channel operations unless rekeying in progress. */
- if (!ssh_packet_is_rekeying(ssh))
- channel_after_poll(ssh, pfd, npfd_active);
+ /* Do channel operations. */
+ channel_after_poll(ssh, pfd, npfd_active);
/* Buffer input from the connection. */
if (conn_in_ready)
diff --git a/serverloop.c b/serverloop.c
index 0541f028..b4c0d82b 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.231 2022/01/22 00:49:34 djm Exp $ */
+/* $OpenBSD: serverloop.c,v 1.232 2022/04/20 04:19:11 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -392,8 +392,7 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
cleanup_exit(255);
}
- if (!ssh_packet_is_rekeying(ssh))
- channel_after_poll(ssh, pfd, npfd_active);
+ channel_after_poll(ssh, pfd, npfd_active);
if (conn_in_ready &&
process_input(ssh, connection_in) < 0)
break;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list