1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

fix process_ips()

This commit is contained in:
OniriCorpe 2023-12-31 02:04:04 +01:00
parent 5bec155503
commit 515b371a7d

View file

@ -73,19 +73,22 @@ process_ips(){
local ips="$1" local ips="$1"
local processed_ips="" local processed_ips=""
for i in $(seq "$(echo "$ips" | wc -w)" -1 1); do # remove the 'inet6' and 'inet' from the IP
ip=$(echo "$ips" | awk "{print \$$i}") ips="$(echo "$ips" | sed "s/inet6//g ; s/inet//g")"
# check if the so-called IP really is one
if [ "$(ynh_validate_ip4 --ip_address="$ip")" ] || [ "$(ynh_validate_ip6 --ip_address="$ip")" ] ; then # for each IP
# don't process if the IP is public and the port 53 closed for ip in $ips; do
if [ "$(is_public_ip "$ip")" == 0 ] && [ "$open_port_53" == "false" ] ; then # check if the so-called IP really is one
# don't add this IP (do nothing) if [ "$(ynh_validate_ip4 --ip_address="$ip")" ] || [ "$(ynh_validate_ip6 --ip_address="$ip")" ] ; then
: # don't process if the IP is public and the port 53 closed
else if [ "$(is_public_ip "$ip")" == 0 ] && [ "$open_port_53" == "false" ] ; then
# add this IP and a space as IP delimiter # don't add this IP (do nothing)
processed_ips+="$ip " :
fi else
# add this IP and a space as IP delimiter
processed_ips+="$ip "
fi fi
fi
done done
echo "${processed_ips:-}" echo "${processed_ips:-}"