From: Richard Levitte Date: Thu, 7 Sep 2023 05:34:33 +0000 (+0200) Subject: Fix 80-test_cmp_http.t to be more flexible regarding IP versions X-Git-Tag: openssl-3.2.0-alpha2~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=769e47ecddd1ca4292ffa792f45998629447d743;p=thirdparty%2Fopenssl.git Fix 80-test_cmp_http.t to be more flexible regarding IP versions Because apps/lib/http_server.c had a hard coded "[::]" for the accept host, 80-test_cmp_http.t assumed that it would always get a CMP server on an IPv6 address, and tested for that. With the fix in apps/lib/http_server.c, that test was of course doomed to fail. Since CMP should be about IP version testing, 80-test_cmp_http.t is adapted to allow the Mock server to accept connections on either IP version, and the test for IPv6 is removed. Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21989) --- diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 6cfdcaedfd1..bd4df0dd0dc 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -299,16 +299,19 @@ sub start_server { } print "$server_name server PID=$pid\n"; - if ($server_port == 0) { - # Find out the actual server port and possibly different PID + if ($server_host eq '*' || $server_port == 0) { + # Find out the actual server host and port and possibly different PID $pid = 0; while (<$server_fh>) { print "$server_name server output: $_"; next if m/using section/; s/\R$//; # Better chomp - ($server_port, $pid) = ($1, $2) if /^ACCEPT\s.*:(\d+) PID=(\d+)$/; + ($server_host, $server_port, $pid) = ($1, $2, $3) + if /^ACCEPT\s(.*?):(\d+) PID=(\d+)$/; last; # Do not loop further to prevent hangs on server misbehavior } + $server_host = "[::1]" if $server_host eq "[::]"; + $server_host = "127.0.0.1" if $server_host eq "0.0.0.0"; } unless ($server_port > 0) { stop_server($server_name, $pid); diff --git a/test/recipes/80-test_cmp_http_data/test_connection.csv b/test/recipes/80-test_cmp_http_data/test_connection.csv index 3c0a598d11c..202eb223c49 100644 --- a/test/recipes/80-test_cmp_http_data/test_connection.csv +++ b/test/recipes/80-test_cmp_http_data/test_connection.csv @@ -3,7 +3,6 @@ expected,description, -section,val, -server,val, -proxy,val, -no_proxy,val, -tls ,,,,,,,,,,,,,,,,,,, 1,default config, -section,,,,,,,,BLANK,,,,BLANK,,BLANK,,BLANK, 1,server domain name, -section,, -server,localhost:_SERVER_PORT,,,,,,,,,,,,,, -1,server IPv6 address, -section,, -server,[::1]:_SERVER_PORT,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,, 0,wrong server, -section,, -server,xn--rksmrgs-5wao1o.example.com:_SERVER_PORT,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK, 0,wrong server port, -section,, -server,_SERVER_HOST:99,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK,