upstream commit

pass packet state down to some of the channels function
(more to come...); ok markus@

Upstream-ID: d8ce7a94f4059d7ac1e01fb0eb01de0c4b36c81b
This commit is contained in:
djm@openbsd.org 2017-08-30 03:59:08 +00:00 committed by Damien Miller
parent 6227fe5b36
commit 71e5a536ec
4 changed files with 21 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.365 2017/05/31 08:58:52 deraadt Exp $ */ /* $OpenBSD: channels.c,v 1.366 2017/08/30 03:59:08 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1996,8 +1996,8 @@ channel_garbage_collect(Channel *c)
} }
static void static void
channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset, channel_handler(struct ssh *ssh, chan_fn *ftab[],
time_t *unpause_secs) fd_set *readset, fd_set *writeset, time_t *unpause_secs)
{ {
static int did_init = 0; static int did_init = 0;
u_int i, oalloc; u_int i, oalloc;
@ -2052,8 +2052,8 @@ channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset,
* select bitmasks. * select bitmasks.
*/ */
void void
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, channel_prepare_select(struct ssh *ssh, fd_set **readsetp, fd_set **writesetp,
u_int *nallocp, time_t *minwait_secs, int rekeying) int *maxfdp, u_int *nallocp, time_t *minwait_secs)
{ {
u_int n, sz, nfdset; u_int n, sz, nfdset;
@ -2075,8 +2075,8 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
memset(*readsetp, 0, sz); memset(*readsetp, 0, sz);
memset(*writesetp, 0, sz); memset(*writesetp, 0, sz);
if (!rekeying) if (!ssh_packet_is_rekeying(ssh))
channel_handler(channel_pre, *readsetp, *writesetp, channel_handler(ssh, channel_pre, *readsetp, *writesetp,
minwait_secs); minwait_secs);
} }
@ -2085,9 +2085,9 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
* events pending. * events pending.
*/ */
void void
channel_after_select(fd_set *readset, fd_set *writeset) channel_after_select(struct ssh *ssh, fd_set *readset, fd_set *writeset)
{ {
channel_handler(channel_post, readset, writeset, NULL); channel_handler(ssh, channel_post, readset, writeset, NULL);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: channels.h,v 1.126 2017/05/30 14:23:52 markus Exp $ */ /* $OpenBSD: channels.h,v 1.127 2017/08/30 03:59:08 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -249,9 +249,9 @@ int channel_input_status_confirm(int, u_int32_t, struct ssh *);
/* file descriptor handling (read/write) */ /* file descriptor handling (read/write) */
void channel_prepare_select(fd_set **, fd_set **, int *, u_int*, void channel_prepare_select(struct ssh *, fd_set **, fd_set **, int *,
time_t*, int); u_int*, time_t*);
void channel_after_select(fd_set *, fd_set *); void channel_after_select(struct ssh *, fd_set *, fd_set *);
void channel_output_poll(void); void channel_output_poll(void);
int channel_not_very_much_buffered_data(void); int channel_not_very_much_buffered_data(void);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.c,v 1.301 2017/07/14 03:18:21 dtucker Exp $ */ /* $OpenBSD: clientloop.c,v 1.302 2017/08/30 03:59:08 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -506,8 +506,8 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
int ret; int ret;
/* Add any selections by the channel mechanism. */ /* Add any selections by the channel mechanism. */
channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, channel_prepare_select(active_state, readsetp, writesetp, maxfdp,
&minwait_secs, rekeying); nallocp, &minwait_secs);
/* channel_prepare_select could have closed the last channel */ /* channel_prepare_select could have closed the last channel */
if (session_closed && !channel_still_open() && if (session_closed && !channel_still_open() &&
@ -1353,7 +1353,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
/* Do channel operations unless rekeying in progress. */ /* Do channel operations unless rekeying in progress. */
if (!ssh_packet_is_rekeying(active_state)) if (!ssh_packet_is_rekeying(active_state))
channel_after_select(readset, writeset); channel_after_select(active_state, readset, writeset);
/* Buffer input from the connection. */ /* Buffer input from the connection. */
client_process_net_input(readset); client_process_net_input(readset);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: serverloop.c,v 1.195 2017/08/11 04:16:35 dtucker Exp $ */ /* $OpenBSD: serverloop.c,v 1.196 2017/08/30 03:59:08 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -207,8 +207,8 @@ wait_until_can_do_something(int connection_in, int connection_out,
static time_t last_client_time; static time_t last_client_time;
/* Allocate and update select() masks for channel descriptors. */ /* Allocate and update select() masks for channel descriptors. */
channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, channel_prepare_select(active_state, readsetp, writesetp, maxfdp,
&minwait_secs, 0); nallocp, &minwait_secs);
/* XXX need proper deadline system for rekey/client alive */ /* XXX need proper deadline system for rekey/client alive */
if (minwait_secs != 0) if (minwait_secs != 0)
@ -411,7 +411,7 @@ server_loop2(Authctxt *authctxt)
collect_children(); collect_children();
if (!ssh_packet_is_rekeying(active_state)) if (!ssh_packet_is_rekeying(active_state))
channel_after_select(readset, writeset); channel_after_select(active_state, readset, writeset);
if (process_input(readset, connection_in) < 0) if (process_input(readset, connection_in) < 0)
break; break;
process_output(writeset, connection_out); process_output(writeset, connection_out);