[openssh-commits] [openssh] 01/05: upstream: add a "ssh -O channels user at host" multiplexing command to

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Dec 22 12:51:39 AEDT 2025


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

djm pushed a commit to branch master
in repository openssh.

commit daf6bdd34b59f640d2af0fd230da69f1cbad33b4
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Mon Dec 22 01:17:31 2025 +0000

    upstream: add a "ssh -O channels user at host" multiplexing command to
    
    get a running mux process to show information about what channels are
    currently open; ok dtucker@ markus@
    
    OpenBSD-Commit-ID: 80bb3953b306a50839f9a4bc5679faebc32e5bb8
---
 clientloop.h |  3 ++-
 mux.c        | 21 ++++++++++++++-------
 ssh.1        |  6 ++++--
 ssh.c        |  4 +++-
 4 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/clientloop.h b/clientloop.h
index 1f550b35c..a2dc8758c 100644
--- a/clientloop.h
+++ b/clientloop.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.h,v 1.39 2025/12/05 06:16:27 dtucker Exp $ */
+/* $OpenBSD: clientloop.h,v 1.40 2025/12/22 01:17:31 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
@@ -76,6 +76,7 @@ void client_expect_confirm(struct ssh *, int, const char *,
 #define SSHMUX_COMMAND_CANCEL_FWD	7	/* Cancel forwarding(s) */
 #define SSHMUX_COMMAND_PROXY		8	/* Open new connection */
 #define SSHMUX_COMMAND_CONNINFO		9	/* Show connection information */
+#define SSHMUX_COMMAND_CHANINFO		10	/* Show channels information */
 
 void	muxserver_listen(struct ssh *);
 int	muxclient(const char *);
diff --git a/mux.c b/mux.c
index 53cbab0fc..bbeb505b4 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.108 2025/12/05 06:16:27 dtucker Exp $ */
+/* $OpenBSD: mux.c,v 1.109 2025/12/22 01:17:31 djm Exp $ */
 /*
  * Copyright (c) 2002-2008 Damien Miller <djm at openbsd.org>
  *
@@ -527,6 +527,10 @@ mux_master_process_ext_info(struct ssh *ssh, u_int rid,
 		if ((msg = connection_info_message(ssh)) == NULL)
 			fatal_f("connection_info_message");
 		status = 1;
+	} else if (strcmp(name, "channels") == 0) {
+		if ((msg = channel_open_message(ssh)) == NULL)
+			fatal_f("channel_open_message");
+		status = 1;
 	} else {
 		msg = xstrdup("info request type not supported");
 	}
@@ -2369,7 +2373,7 @@ muxclient(const char *path)
 	struct sockaddr_un addr;
 	int sock, timeout = options.connection_timeout, timeout_ms = -1;
 	u_int pid;
-	char *conninfo = NULL;
+	char *info = NULL;
 
 	if (muxclient_command == 0) {
 		if (options.stdio_forward_host != NULL)
@@ -2441,12 +2445,15 @@ muxclient(const char *path)
 		fprintf(stderr, "Master running (pid=%u)\r\n", pid);
 		exit(0);
 	case SSHMUX_COMMAND_CONNINFO:
+	case SSHMUX_COMMAND_CHANINFO:
 		if (!(extensions & MUX_EXT_INFO))
-			fatal("mux server does not support conninfo");
-		conninfo = mux_client_request_info(sock, "connection");
-		if (conninfo == NULL)
-			fatal_f("connection info request failed");
-		printf("%s", conninfo);
+			fatal("mux server does not support info request");
+		info = mux_client_request_info(sock,
+		    muxclient_command == SSHMUX_COMMAND_CONNINFO ?
+		    "connection" : "channels");
+		if (info == NULL)
+			fatal_f("info request failed");
+		printf("%s", info);
 		exit(0);
 	case SSHMUX_COMMAND_TERMINATE:
 		mux_client_request_terminate(sock);
diff --git a/ssh.1 b/ssh.1
index ac218cc51..82ae5480c 100644
--- a/ssh.1
+++ b/ssh.1
@@ -33,8 +33,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: ssh.1,v 1.446 2025/12/05 06:16:27 dtucker Exp $
-.Dd $Mdocdate: December 5 2025 $
+.\" $OpenBSD: ssh.1,v 1.447 2025/12/22 01:17:31 djm Exp $
+.Dd $Mdocdate: December 22 2025 $
 .Dt SSH 1
 .Os
 .Sh NAME
@@ -488,6 +488,8 @@ Valid commands are:
 (check that the master process is running),
 .Dq conninfo
 (report information about the master connection),
+.Dq channels
+(report information about open channels),
 .Dq forward
 (request forwardings without command execution),
 .Dq cancel
diff --git a/ssh.c b/ssh.c
index 461b60975..0b1a6e158 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.621 2025/12/05 06:16:27 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.622 2025/12/22 01:17:31 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -819,6 +819,8 @@ main(int ac, char **av)
 				muxclient_command = SSHMUX_COMMAND_ALIVE_CHECK;
 			else if (strcmp(optarg, "conninfo") == 0)
 				muxclient_command = SSHMUX_COMMAND_CONNINFO;
+			else if (strcmp(optarg, "channels") == 0)
+				muxclient_command = SSHMUX_COMMAND_CHANINFO;
 			else if (strcmp(optarg, "forward") == 0)
 				muxclient_command = SSHMUX_COMMAND_FORWARD;
 			else if (strcmp(optarg, "exit") == 0)

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


More information about the openssh-commits mailing list