upstream: Add ssh -Q addressfamily. ok djm@

OpenBSD-Commit-ID: 6f10697b0be025a3ebe9229a35637b5c799e5119
This commit is contained in:
dtucker@openbsd.org authored and Darren Tucker committed 2026-11-02 18:07:31 +11:00
1 parent 511fcdc77d
commit 0887340b43
4 files changed
+28 -6

No files matched your search

+15 -1
View File
@@ -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@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@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)
+2 -1
View File
@@ -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@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 *);
+4 -2
View File
@@ -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
+7 -2
View File
@@ -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@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@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;