Skip to content

Commit

Permalink
Restore topologyUpdater.sh behavior to be valid on IP or Names
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBenson committed Oct 21, 2024
1 parent 46bf717 commit 7528b0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/cnode-helper-scripts/cntools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2202,7 +2202,7 @@ function main {
if [[ -n "${relay_port_enter}" ]]; then
if ! isNumber ${relay_port_enter} || [[ ${relay_port_enter} -lt 1 || ${relay_port_enter} -gt 65535 ]]; then
println ERROR "${FG_RED}ERROR${NC}: invalid port number!"
elif isValidIPv4 "${relay_ip_enter}" && ! isValidHostnameOrDomain "${relay_ip_enter}"; then
elif isValidIPv4 "${relay_ip_enter}" || isValidHostnameOrDomain "${relay_ip_enter}"; then
relay_array+=( "type" "IPv4" "address" "${relay_ip_enter}" "port" "${relay_port_enter}" )
relay_output+="--pool-relay-port ${relay_port_enter} --pool-relay-ipv4 ${relay_ip_enter} "
else
Expand Down
5 changes: 3 additions & 2 deletions scripts/cnode-helper-scripts/topologyUpdater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ if [[ ${TU_FETCH} = "Y" ]]; then
*) echo "ERROR: Invalid Custom Peer definition '${cpeer}'. Please double check CUSTOM_PEERS definition"
exit 1 ;;
esac
if [[ ${addr} = *.* ]]; then
! isValidIPv4 "${addr}" && echo "ERROR: Invalid IPv4 address or hostname '${addr}'. Please check CUSTOM_PEERS definition" && continue
if ! isValidIPv4 "${addr}" && ! isValidHostnameOrDomain "${addr}"; then
echo "ERROR: Invalid IPv4 address or hostname '${addr}'. Please check CUSTOM_PEERS definition"
continue
elif [[ ${addr} = *:* ]]; then
! isValidIPv6 "${addr}" && echo "ERROR: Invalid IPv6 address '${addr}'. Please check CUSTOM_PEERS definition" && continue
fi
Expand Down

0 comments on commit 7528b0f

Please sign in to comment.