[openssh-commits] [openssh] 02/03: upstream: Also show the duration of the current session through the

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Apr 20 09:38:32 AEST 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit ca19b95ab6cd4efe5f2d8a08a377a2ac0b9caca1
Author: job at openbsd.org <job at openbsd.org>
AuthorDate: Mon Apr 13 08:18:33 2026 +0000

    upstream: Also show the duration of the current session through the
    
    ~I escape
    
    OK dtucker@
    
    OpenBSD-Commit-ID: 695c1a09c4cc8b417a1bd3eb207b0cc7fa831c7a
---
 packet.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/packet.c b/packet.c
index 190a579d1..8c1d313c2 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.334 2026/03/03 09:57:25 dtucker Exp $ */
+/* $OpenBSD: packet.c,v 1.335 2026/04/13 08:18:33 job Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -161,6 +161,9 @@ struct session_state {
 	/* Flag indicating whether this module has been initialized. */
 	int initialized;
 
+	/* Monotonic clock timestamp when the connection was started. */
+	time_t start_time;
+
 	/* Set to true if the connection is interactive. */
 	int interactive_mode;
 
@@ -312,6 +315,7 @@ ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out)
 		return NULL;
 	}
 	state = ssh->state;
+	state->start_time = monotime();
 	state->connection_in = fd_in;
 	state->connection_out = fd_out;
 	if ((r = cipher_init(&state->send_context, none,
@@ -3079,6 +3083,7 @@ connection_info_message(struct ssh *ssh)
 
 	xasprintf(&ret, "Connection information for %s pid %lld\r\n"
 	    "%s"
+	    "  duration %s\r\n"
 	    "  kexalgorithm %s\r\n  hostkeyalgorithm %s\r\n"
 	    "  cipher %s\r\n  mac %s\r\n  compression %s\r\n"
 	    "  rekey %s %s\r\n"
@@ -3086,6 +3091,7 @@ connection_info_message(struct ssh *ssh)
 	    "%s",
 	    thishost, (long long)getpid(),
 	    tcp_info,
+	    fmt_timeframe(monotime() - state->start_time),
 	    kex->name, kex->hostkey_alg,
 	    cipher, mac, comp,
 	    rekey_volume, rekey_time,

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list