summaryrefslogtreecommitdiffstats
path: root/channels.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2023-01-06 02:47:18 +0000
committerDamien Miller <djm@mindrot.org>2023-01-06 16:23:16 +1100
commit2d1ff2b9431393ad99ef496d5e3b9dd0d4f5ac8c (patch)
tree3f244d571a85c08ae82b00c079af13b12e49e462 /channels.h
parent0e34348d0bc0b1522f75d6212a53d6d1d1367980 (diff)
upstream: Implement channel inactivity timeouts
This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8
Diffstat (limited to 'channels.h')
-rw-r--r--channels.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/channels.h b/channels.h
index b8daaea3..c80b55d0 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.h,v 1.146 2023/01/06 02:42:34 djm Exp $ */
+/* $OpenBSD: channels.h,v 1.147 2023/01/06 02:47:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -203,6 +203,13 @@ struct Channel {
void *mux_ctx;
int mux_pause;
int mux_downstream_id;
+
+ /* Inactivity timeouts */
+
+ /* Last traffic seen for OPEN channels */
+ time_t lastused;
+ /* Inactivity timeout deadline in seconds (0 = no timeout) */
+ u_int inactive_deadline;
};
#define CHAN_EXTENDED_IGNORE 0
@@ -299,6 +306,10 @@ void channel_cancel_cleanup(struct ssh *, int);
int channel_close_fd(struct ssh *, Channel *, int *);
void channel_send_window_changes(struct ssh *);
+/* channel inactivity timeouts */
+void channel_add_timeout(struct ssh *, const char *, u_int);
+void channel_clear_timeouts(struct ssh *);
+
/* mux proxy support */
int channel_proxy_downstream(struct ssh *, Channel *mc);