Skip to content

Commit

Permalink
upstream: when connecting via socket (the default case), filter
Browse files Browse the repository at this point in the history
addresses by AddressFamily if one was specified. Fixes the case where, if
CanonicalizeHostname is enabled, ssh may ignore AddressFamily. bz5326; ok
dtucker

OpenBSD-Commit-ID: 6c7d7751f6cd055126b2b268a7b64dcafa447439
  • Loading branch information
djmdjm committed Nov 15, 2023
1 parent 050c335 commit 26f3f3b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sshconnect.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: sshconnect.c,v 1.363 2023/03/10 07:17:08 dtucker Exp $ */
/* $OpenBSD: sshconnect.c,v 1.364 2023/11/15 23:03:38 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Expand Down Expand Up @@ -481,6 +481,14 @@ ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,
errno = oerrno;
continue;
}
if (options.address_family != AF_UNSPEC &&
ai->ai_family != options.address_family) {
debug2_f("skipping address [%s]:%s: "
"wrong address family", ntop, strport);
errno = 0;
continue;
}

debug("Connecting to %.200s [%.100s] port %s.",
host, ntop, strport);

Expand Down

0 comments on commit 26f3f3b

Please sign in to comment.