]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Automatically detect IPv6 support master anongit/master
authordtucker@openbsd.org <dtucker@openbsd.org>
Wed, 22 Jul 2026 00:37:24 +0000 (00:37 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Wed, 22 Jul 2026 01:35:18 +0000 (11:35 +1000)
and test IPv6 parsing if found. This should always be enabled on OpenBSD,
but allows us to use the same test in Portable without modifications
that make syncs harder.

OpenBSD-Regress-ID: 80dce2465e9414695d878a9af18a3d75711f7861

regress/cfgparse.sh

index dac33f56ef2e02b146724bd982228ea02f7ecdce..55ce3ed5b3a13c1165ff14cfc713e7edc6201624 100644 (file)
@@ -1,21 +1,8 @@
-#      $OpenBSD: cfgparse.sh,v 1.11 2026/07/21 23:43:15 dtucker Exp $
+#      $OpenBSD: cfgparse.sh,v 1.12 2026/07/22 00:37:24 dtucker Exp $
 #      Placed in the Public Domain.
 
 tid="sshd config parse"
 
 #      Placed in the Public Domain.
 
 tid="sshd config parse"
 
-# This is a reasonable proxy for IPv6 support.
-if ! config_defined HAVE_STRUCT_IN6_ADDR ; then
-       SKIP_IPV6=yes
-
-# Some variables for the IPv6 addresses.  This allows Portable to skip
-# these on platorms without IPv6 support without having diffs within the
-# tests themselves.
-LISTENADDRESS_IPV6_LOOPBACK="listenaddress ::1"
-LISTENADDRESS_IPV6_LOOPBACK_1234="listenaddress [::1]:1234"
-LISTENADDRESS_IPV6_LOOPBACK_5678="listenaddress [::1]:5678"
-
-fi
-
 # We need to use the keys generated for the regression test because sshd -T
 # will fail if we're not running with SUDO (no permissions for real keys) or
 # if we are running tests on a system that has never had sshd installed
 # We need to use the keys generated for the regression test because sshd -T
 # will fail if we're not running with SUDO (no permissions for real keys) or
 # if we are running tests on a system that has never had sshd installed
@@ -34,6 +21,18 @@ verbose "reparse regress config"
  $SUDO ${SSHD} -T -f $OBJ/sshd_config.1 >$OBJ/sshd_config.2 &&
  diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse regress config"
 
  $SUDO ${SSHD} -T -f $OBJ/sshd_config.1 >$OBJ/sshd_config.2 &&
  diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse regress config"
 
+# Detect IPv6 support and if found, define variables for the needed
+# config lines.  This allows tests to also work on Portable platforms
+# lacking IPv6 support without having diffs that make syncs harder.
+if $SUDO ${SSHD} -tq -f $OBJ/sshd_config_minimal -oListenAddress=::1 ; then
+       trace "IPv6 support detected"
+       LISTENADDRESS_IPV6_LOOPBACK="listenaddress ::1"
+       LISTENADDRESS_IPV6_LOOPBACK_1234="listenaddress [::1]:1234"
+       LISTENADDRESS_IPV6_LOOPBACK_5678="listenaddress [::1]:5678"
+else
+       trace "IPv6 support NOT detected"
+fi
+
 verbose "listenaddress order"
 # expected output
 egrep -v '^$' > $OBJ/sshd_config.0 <<EOD
 verbose "listenaddress order"
 # expected output
 egrep -v '^$' > $OBJ/sshd_config.0 <<EOD