1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Fix error when checking if IP address is valid

During install in `valid_ip`, we split up the IP address into octets to verify it is valid (each is <= 255).

This validation was broken in #2743 when a variable usage was quoted where it should have stayed unquoted:
```
./automated install/basic-install.sh: line 942: [[: 192.241.211.120: syntax error: invalid arithmetic operator (error token is ".241.211.120")
```

Due to this error, `127.0.0.1` would be used instead of the requested IP address. Also, this prevented the user from entering a custom DNS server as it would be marked as an invalid IP address.

Signed-off-by: Mark Drobnak <mark.drobnak@gmail.com>
This commit is contained in:
Mark Drobnak 2019-07-10 19:42:51 -07:00 committed by GitHub
parent 9641e268ea
commit fa8751f9ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -934,7 +934,7 @@ valid_ip() {
# and set the new one to a dot (period) # and set the new one to a dot (period)
IFS='.' IFS='.'
# Put the IP into an array # Put the IP into an array
ip=("${ip}") ip=(${ip})
# Restore the IFS to what it was # Restore the IFS to what it was
IFS=${OIFS} IFS=${OIFS}
## Evaluate each octet by checking if it's less than or equal to 255 (the max for each octet) ## Evaluate each octet by checking if it's less than or equal to 255 (the max for each octet)