@@ -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.
@@ -22573,24 +22573,26 @@ get_txt_record() {
2257322573# sets IPv6_OK if it works -- or not
2257422574#
2257522575shouldwedo_ipv6() {
22576- local i=0
22577-
2257822576 "$do_ipv4_only" && return 0
22579- while true; do
22577+ bash -c "exec 5<>/dev/tcp/$1/$PORT" &>/dev/null &
22578+ wait_kill $! $MAX_WAITSOCK
22579+ if [[ $? -eq 3 ]]; then
22580+ # was killed, so this got stuck
22581+ IPv6_OK=false
22582+ "$do_ipv6_only" && connectivity_problem 1 1 "" "IPv6 connect got stuck when IPv6-only scan requested"
22583+ do_ipv6_only=false # Ensures round brackets enclosing IPv6 addresses and we don't try IPv6 anymore
22584+ else
22585+ # we're trying in the foreground again, only to get the return code
2258022586 bash -c "exec 5<>/dev/tcp/$1/$PORT" &>/dev/null
2258122587 if [[ $? -eq 0 ]]; then
2258222588 IPv6_OK=true
22583- break
22584- fi
22585- sleep 1
22586- ((i++))
22587- [[ $i -ge $MAX_SOCKET_FAIL ]] && break
22588- done
22589- if ! "$IPv6_OK"; then
22590- if "$do_ipv6_only"; then
22591- connectivity_problem $i $MAX_SOCKET_FAIL "IPv6 connect problem" "repeated IPv6 connect problems when IPv6-only scan requested"
2259222589 else
2259322590 IPv6_OK=false
22591+ if "$do_ipv6_only"; then
22592+ connectivity_problem 2 2 "" "repeated IPv6 connect problems when IPv6-only scan requested"
22593+ else
22594+ do_ipv6_only=false # Ensures round brackets for IPv6 addresses + we don't try IPv6 anymore. Better other var
22595+ fi
2259422596 fi
2259522597 fi
2259622598}
0 commit comments