@@ -204,7 +204,7 @@ MAX_SOCKET_FAIL=${MAX_SOCKET_FAIL:-2} # If this many failures for TCP socket c
204204MAX_OSSL_FAIL=${MAX_OSSL_FAIL:-2} # If this many failures for s_client connects are reached we terminate
205205MAX_STARTTLS_FAIL=${MAX_STARTTLS_FAIL:-2} # max number of STARTTLS handshake failures in plaintext phase
206206MAX_HEADER_FAIL=${MAX_HEADER_FAIL:-2} # If this many failures for HTTP GET are encountered we don't try again to get the header
207- MAX_WAITSOCK=${MAX_WAITSOCK:-10 } # waiting at max 10 seconds for socket reply. There shouldn't be any reason to change this.
207+ MAX_WAITSOCK=${MAX_WAITSOCK:-5 } # waiting at max 5 seconds for socket reply. There shouldn't be any reason to change this.
208208QUIC_WAIT=${QUIC_WAIT:-3} # QUIC is UDP. Thus we run the connect in the background. This is how long to wait
209209CCS_MAX_WAITSOCK=${CCS_MAX_WAITSOCK:-5} # for the two CCS payload (each). There shouldn't be any reason to change this.
210210HEARTBLEED_MAX_WAITSOCK=${HEARTBLEED_MAX_WAITSOCK:-8} # for the heartbleed payload. There shouldn't be any reason to change this.
@@ -22376,24 +22376,26 @@ get_txt_record() {
2237622376# sets IPv6_OK if it works -- or not
2237722377#
2237822378shouldwedo_ipv6() {
22379- local i=0
22380-
2238122379 "$do_ipv4_only" && return 0
22382- while true; do
22380+ bash -c "exec 5<>/dev/tcp/$1/$PORT" &>/dev/null &
22381+ wait_kill $! $MAX_WAITSOCK
22382+ if [[ $? -eq 3 ]]; then
22383+ # was killed, so this got stuck
22384+ IPv6_OK=false
22385+ "$do_ipv6_only" && connectivity_problem 1 1 "" "IPv6 connect got stuck when IPv6-only scan requested"
22386+ do_ipv6_only=false # this ensures we have round brackets and we don't try IPv6 anymore
22387+ else
22388+ # we're trying in the foreground again, only to get the return code
2238322389 bash -c "exec 5<>/dev/tcp/$1/$PORT" &>/dev/null
2238422390 if [[ $? -eq 0 ]]; then
2238522391 IPv6_OK=true
22386- break
22387- fi
22388- sleep 1
22389- ((i++))
22390- [[ $i -ge $MAX_SOCKET_FAIL ]] && break
22391- done
22392- if ! "$IPv6_OK"; then
22393- if "$do_ipv6_only"; then
22394- connectivity_problem $i $MAX_SOCKET_FAIL "IPv6 connect problem" "repeated IPv6 connect problems when IPv6-only scan requested"
2239522392 else
2239622393 IPv6_OK=false
22394+ if "$do_ipv6_only"; then
22395+ connectivity_problem 2 2 $MAX_SOCKET_FAIL "" "repeated IPv6 connect problems when IPv6-only scan requested"
22396+ else
22397+ do_ipv6_only=false #FIXME: wrong variable. It ensures we have round brackets enclosing IPv6 addresses + we don't try it anymore
22398+ fi
2239722399 fi
2239822400 fi
2239922401}
0 commit comments