[openssh-commits] [openssh] 02/05: upstream: Add ssh -Q addressfamily. ok djm@

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Nov 2 18:32:30 AEDT 2026


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

dtucker pushed a commit to branch master
in repository openssh.

commit 0887340b430f0abb521ce587f27b84612ba988f9
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Mon Nov 2 06:49:42 2026 +0000

    upstream: Add ssh -Q addressfamily. ok djm@
    
    OpenBSD-Commit-ID: 6f10697b0be025a3ebe9229a35637b5c799e5119
---
 readconf.c | 16 +++++++++++++++-
 readconf.h |  3 ++-
 ssh.1      |  6 ++++--
 ssh.c      |  9 +++++++--
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/readconf.c b/readconf.c
index 10da79ff9..e89309e7f 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.423 2026/10/30 08:42:29 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.424 2026/11/02 06:49:42 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -3622,6 +3622,20 @@ parse_ssh_uri(const char *uri, char **userp, char **hostp, int *portp)
 	return r;
 }
 
+char *
+supported_address_family(void)
+{
+	char buf[1024];
+	int i;
+
+	buf[0] = '\0';
+	for (i = 0; multistate_addressfamily[i].key != NULL; i++) {
+		strlcat(buf, multistate_addressfamily[i].key, sizeof(buf));
+		strlcat(buf, "\n", sizeof(buf));
+	}
+	return xstrdup(buf);
+}
+
 /* XXX the following is a near-verbatim copy from servconf.c; refactor */
 static const char *
 fmt_multistate_int(int val, const struct multistate *m)
diff --git a/readconf.h b/readconf.h
index bbbb04f3a..77d79551c 100644
--- a/readconf.h
+++ b/readconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.h,v 1.165 2026/10/30 04:14:37 djm Exp $ */
+/* $OpenBSD: readconf.h,v 1.166 2026/11/02 06:49:42 dtucker Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
@@ -260,6 +260,7 @@ int	 default_ssh_port(void);
 int	 option_clear_or_none(const char *);
 int	 config_has_permitted_cnames(Options *);
 void	 dump_client_config(Options *o, const char *host);
+char	*supported_address_family(void);
 
 void	 add_local_forward(Options *, const struct Forward *);
 void	 add_remote_forward(Options *, const struct Forward *);
diff --git a/ssh.1 b/ssh.1
index 35dd037cb..aaffee96f 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.457 2026/10/13 08:52:06 dtucker Exp $
-.Dd $Mdocdate: October 13 2026 $
+.\" $OpenBSD: ssh.1,v 1.458 2026/11/02 06:49:42 dtucker Exp $
+.Dd $Mdocdate: November 2 2026 $
 .Dt SSH 1
 .Os
 .Sh NAME
@@ -532,6 +532,8 @@ per-host basis in the configuration file.
 Queries for the algorithms supported by one of the following features:
 .Pp
 .Bl -tag -width protocol-version -compact
+.It Cm addressfamily
+supported address families
 .It Cm cipher
 supported symmetric ciphers
 .It Cm cipher-auth
diff --git a/ssh.c b/ssh.c
index cf4937782..64bd9de49 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.646 2026/10/30 08:19:30 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.647 2026/11/02 06:49:42 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -820,6 +820,8 @@ main(int ac, char **av)
 				cp = sshkey_alg_list(0, 1, 1, '\n');
 			else if (strcmp(optarg, "protocol-version") == 0)
 				cp = xstrdup("2");
+			else if (strcasecmp(optarg, "addressfamily") == 0)
+				cp = supported_address_family();
 			else if (strcmp(optarg, "compression") == 0) {
 				cp = xstrdup(compression_alg_list(0));
 				len = strlen(cp);
@@ -828,13 +830,16 @@ main(int ac, char **av)
 						cp[n] = '\n';
 			} else if (strcmp(optarg, "help") == 0) {
 				cp = xstrdup(
+				    "addressfamily\n"
 				    "cipher\ncipher-auth\ncompression\nkex\n"
 				    "key\nkey-cert\nkey-plain\nkey-sig\nmac\n"
 				    "protocol-version\nsig");
 			}
 			if (cp == NULL)
 				fatal("Unsupported query \"%s\"", optarg);
-			printf("%s\n", cp);
+			printf("%s", cp);
+			if ((len = strlen(cp)) == 0 || cp[len-1] != '\n')
+				printf("\n");
 			free(cp);
 			exit(0);
 			break;

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


More information about the openssh-commits mailing list