mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-09 21:42:53 +02:00
Supplying of both -6 and --ip=one results in picking an IPv6 address
... previously it depended on the order of DNS replies otherwise. This was one outcome of discussion in #1026 where it seemed more logical to pick an IPv6 address as opposed to an abitrary (v4/v6) address.
This commit is contained in:
17
testssl.sh
17
testssl.sh
@ -16023,9 +16023,12 @@ determine_ip_addresses() {
|
||||
if [[ -n "$CMDLINE_IP" ]]; then
|
||||
# command line has supplied an IP address or "one"
|
||||
if [[ "$CMDLINE_IP" == one ]]; then
|
||||
# use first IPv4 or IPv6 address
|
||||
CMDLINE_IP="$(head -1 <<< "$ip4")"
|
||||
[[ -z "$CMDLINE_IP" ]] && CMDLINE_IP="$(head -1 <<< "$ip6")"
|
||||
# use first IPv6 or IPv4 address
|
||||
if "$HAS_IPv6" && [[ -n "$ip6" ]]; then
|
||||
CMDLINE_IP="$(head -1 <<< "$ip6")"
|
||||
else
|
||||
CMDLINE_IP="$(head -1 <<< "$ip4")"
|
||||
fi
|
||||
fi
|
||||
NODEIP="$CMDLINE_IP"
|
||||
if is_ipv4addr "$NODEIP"; then
|
||||
@ -16382,14 +16385,14 @@ display_rdns_etc() {
|
||||
outln "$(out_row_aligned_max_width "$further_ip_addrs" " $CORRECT_SPACES" $TERM_WIDTH)"
|
||||
fi
|
||||
if "$LOCAL_A"; then
|
||||
outln " A record via $CORRECT_SPACES /etc/hosts "
|
||||
outln " A record via: $CORRECT_SPACES /etc/hosts "
|
||||
elif "$LOCAL_AAAA"; then
|
||||
outln " AAAA record via $CORRECT_SPACES /etc/hosts "
|
||||
outln " AAAA record via: $CORRECT_SPACES /etc/hosts "
|
||||
elif [[ -n "$CMDLINE_IP" ]]; then
|
||||
if is_ipv6addr $"$CMDLINE_IP"; then
|
||||
outln " AAAA record via $CORRECT_SPACES supplied IP \"$CMDLINE_IP\""
|
||||
outln " AAAA record via: $CORRECT_SPACES supplied IP \"$CMDLINE_IP\""
|
||||
else
|
||||
outln " A record via $CORRECT_SPACES supplied IP \"$CMDLINE_IP\""
|
||||
outln " A record via: $CORRECT_SPACES supplied IP \"$CMDLINE_IP\""
|
||||
fi
|
||||
fi
|
||||
if [[ "$rDNS" =~ instructed ]]; then
|
||||
|
Reference in New Issue
Block a user