]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
testrun: explicitly set proper IP address for stunnel listen/connect
authorStefan Eissing <stefan@eissing.org>
Thu, 26 Sep 2024 08:28:38 +0000 (10:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 26 Sep 2024 14:55:52 +0000 (16:55 +0200)
Closes #15051

tests/secureserver.pl

index 087764155d8b9b624f04a70f088a64129a36025c..e5706aba4c2530e03351c4afffad3cf0f1c4120c 100755 (executable)
@@ -201,6 +201,8 @@ $certfile = abs_path($certfile);
 
 my $ssltext = uc($proto) ." SSL/TLS:";
 
+my $host_ip = ($ipvnum == 6)? '::1' : '127.0.0.1';
+
 #***************************************************************************
 # Find out version info for the given stunnel binary
 #
@@ -255,6 +257,8 @@ if($stunnel_version < 400) {
     if($stunnel_version >= 319) {
         $socketopt = "-O a:SO_REUSEADDR=1";
     }
+    # TODO: we do not use $host_ip in this old version. I simply find
+    # no documentation how to. But maybe ipv6 is not available anyway?
     $cmd  = "\"$stunnel\" -p $certfile -P $pidfile ";
     $cmd .= "-d $accept_port -r $target_port -f -D $loglevel ";
     $cmd .= ($socketopt) ? "$socketopt " : "";
@@ -304,8 +308,8 @@ if($stunnel_version >= 400) {
         }
         print $stunconf "\n";
         print $stunconf "[curltest]\n";
-        print $stunconf "accept = $accept_port\n";
-        print $stunconf "connect = $target_port\n";
+        print $stunconf "accept = $host_ip:$accept_port\n";
+        print $stunconf "connect = $host_ip:$target_port\n";
         if(!close($stunconf)) {
             print "$ssltext Error closing file $conffile\n";
             exit 1;
@@ -332,8 +336,8 @@ if($stunnel_version >= 400) {
         }
         print "\n";
         print "[curltest]\n";
-        print "accept = $accept_port\n";
-        print "connect = $target_port\n";
+        print "accept = $host_ip:$accept_port\n";
+        print "connect = $host_ip:$target_port\n";
     }
 }