summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-08-30 03:59:08 +0000
committerDamien Miller <djm@mindrot.org>2017-09-04 09:38:57 +1000
commit71e5a536ec815d542b199f2ae6d646c0db9f1b58 (patch)
treee5b03199a74b43fa69af7a047b2480a132d69e80
parent6227fe5b362239c872b91bbdee4bf63cf85aebc5 (diff)
upstream commit
pass packet state down to some of the channels function (more to come...); ok markus@ Upstream-ID: d8ce7a94f4059d7ac1e01fb0eb01de0c4b36c81b
-rw-r--r--channels.c18
-rw-r--r--channels.h8
-rw-r--r--clientloop.c8
-rw-r--r--serverloop.c8
4 files changed, 21 insertions, 21 deletions
diff --git a/channels.c b/channels.c
index 028d5db20..d9e81b5fa 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.365 2017/05/31 08:58:52 deraadt Exp $ */ 1/* $OpenBSD: channels.c,v 1.366 2017/08/30 03:59:08 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1996,8 +1996,8 @@ channel_garbage_collect(Channel *c)
1996} 1996}
1997 1997
1998static void 1998static void
1999channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset, 1999channel_handler(struct ssh *ssh, chan_fn *ftab[],
2000 time_t *unpause_secs) 2000 fd_set *readset, fd_set *writeset, time_t *unpause_secs)
2001{ 2001{
2002 static int did_init = 0; 2002 static int did_init = 0;
2003 u_int i, oalloc; 2003 u_int i, oalloc;
@@ -2052,8 +2052,8 @@ channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset,
2052 * select bitmasks. 2052 * select bitmasks.
2053 */ 2053 */
2054void 2054void
2055channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, 2055channel_prepare_select(struct ssh *ssh, fd_set **readsetp, fd_set **writesetp,
2056 u_int *nallocp, time_t *minwait_secs, int rekeying) 2056 int *maxfdp, u_int *nallocp, time_t *minwait_secs)
2057{ 2057{
2058 u_int n, sz, nfdset; 2058 u_int n, sz, nfdset;
2059 2059
@@ -2075,8 +2075,8 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
2075 memset(*readsetp, 0, sz); 2075 memset(*readsetp, 0, sz);
2076 memset(*writesetp, 0, sz); 2076 memset(*writesetp, 0, sz);
2077 2077
2078 if (!rekeying) 2078 if (!ssh_packet_is_rekeying(ssh))
2079 channel_handler(channel_pre, *readsetp, *writesetp, 2079 channel_handler(ssh, channel_pre, *readsetp, *writesetp,
2080 minwait_secs); 2080 minwait_secs);
2081} 2081}
2082 2082
@@ -2085,9 +2085,9 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
2085 * events pending. 2085 * events pending.
2086 */ 2086 */
2087void 2087void
2088channel_after_select(fd_set *readset, fd_set *writeset) 2088channel_after_select(struct ssh *ssh, fd_set *readset, fd_set *writeset)
2089{ 2089{
2090 channel_handler(channel_post, readset, writeset, NULL); 2090 channel_handler(ssh, channel_post, readset, writeset, NULL);
2091} 2091}
2092 2092
2093 2093
diff --git a/channels.h b/channels.h
index 36e5363aa..5ecb4d7c0 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.126 2017/05/30 14:23:52 markus Exp $ */ 1/* $OpenBSD: channels.h,v 1.127 2017/08/30 03:59:08 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -249,9 +249,9 @@ int channel_input_status_confirm(int, u_int32_t, struct ssh *);
249 249
250/* file descriptor handling (read/write) */ 250/* file descriptor handling (read/write) */
251 251
252void channel_prepare_select(fd_set **, fd_set **, int *, u_int*, 252void channel_prepare_select(struct ssh *, fd_set **, fd_set **, int *,
253 time_t*, int); 253 u_int*, time_t*);
254void channel_after_select(fd_set *, fd_set *); 254void channel_after_select(struct ssh *, fd_set *, fd_set *);
255void channel_output_poll(void); 255void channel_output_poll(void);
256 256
257int channel_not_very_much_buffered_data(void); 257int channel_not_very_much_buffered_data(void);
diff --git a/clientloop.c b/clientloop.c
index 248c9541f..2934c4763 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.301 2017/07/14 03:18:21 dtucker Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.302 2017/08/30 03:59:08 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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,
506 int ret; 506 int ret;
507 507
508 /* Add any selections by the channel mechanism. */ 508 /* Add any selections by the channel mechanism. */
509 channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, 509 channel_prepare_select(active_state, readsetp, writesetp, maxfdp,
510 &minwait_secs, rekeying); 510 nallocp, &minwait_secs);
511 511
512 /* channel_prepare_select could have closed the last channel */ 512 /* channel_prepare_select could have closed the last channel */
513 if (session_closed && !channel_still_open() && 513 if (session_closed && !channel_still_open() &&
@@ -1353,7 +1353,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1353 1353
1354 /* Do channel operations unless rekeying in progress. */ 1354 /* Do channel operations unless rekeying in progress. */
1355 if (!ssh_packet_is_rekeying(active_state)) 1355 if (!ssh_packet_is_rekeying(active_state))
1356 channel_after_select(readset, writeset); 1356 channel_after_select(active_state, readset, writeset);
1357 1357
1358 /* Buffer input from the connection. */ 1358 /* Buffer input from the connection. */
1359 client_process_net_input(readset); 1359 client_process_net_input(readset);
diff --git a/serverloop.c b/serverloop.c
index 5cc3fc099..bc56709b1 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.195 2017/08/11 04:16:35 dtucker Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.196 2017/08/30 03:59:08 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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,
207 static time_t last_client_time; 207 static time_t last_client_time;
208 208
209 /* Allocate and update select() masks for channel descriptors. */ 209 /* Allocate and update select() masks for channel descriptors. */
210 channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, 210 channel_prepare_select(active_state, readsetp, writesetp, maxfdp,
211 &minwait_secs, 0); 211 nallocp, &minwait_secs);
212 212
213 /* XXX need proper deadline system for rekey/client alive */ 213 /* XXX need proper deadline system for rekey/client alive */
214 if (minwait_secs != 0) 214 if (minwait_secs != 0)
@@ -411,7 +411,7 @@ server_loop2(Authctxt *authctxt)
411 411
412 collect_children(); 412 collect_children();
413 if (!ssh_packet_is_rekeying(active_state)) 413 if (!ssh_packet_is_rekeying(active_state))
414 channel_after_select(readset, writeset); 414 channel_after_select(active_state, readset, writeset);
415 if (process_input(readset, connection_in) < 0) 415 if (process_input(readset, connection_in) < 0)
416 break; 416 break;
417 process_output(writeset, connection_out); 417 process_output(writeset, connection_out);