|
@ -422,25 +422,21 @@ f_envcheck() |
|
|
|
|
|
|
|
|
# check volatile uhttpd instance configuration |
|
|
# check volatile uhttpd instance configuration |
|
|
# |
|
|
# |
|
|
check="$(pgrep -f "uhttpd -h /www/adblock")" |
|
|
|
|
|
if [ -z "${check}" ] |
|
|
|
|
|
|
|
|
if [ -n "${adb_wanif4}" ] && [ -n "${adb_wanif6}" ] |
|
|
then |
|
|
then |
|
|
if [ -n "${adb_wanif4}" ] && [ -n "${adb_wanif6}" ] |
|
|
|
|
|
then |
|
|
|
|
|
f_uhttpd "adbIPv4+6_80" "1" "-p ${adb_ipv4}:${adb_nullport} -p [${adb_ipv6}]:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv4+6_443" "0" "-p ${adb_ipv4}:${adb_nullportssl} -p [${adb_ipv6}]:${adb_nullportssl}" |
|
|
|
|
|
elif [ -n "${adb_wanif4}" ] |
|
|
|
|
|
then |
|
|
|
|
|
f_uhttpd "adbIPv4_80" "1" "-p ${adb_ipv4}:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv4_443" "0" "-p ${adb_ipv4}:${adb_nullportssl}" |
|
|
|
|
|
else |
|
|
|
|
|
f_uhttpd "adbIPv6_80" "1" "-p [${adb_ipv6}]:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv6_443" "0" "-p [${adb_ipv6}]:${adb_nullportssl}" |
|
|
|
|
|
fi |
|
|
|
|
|
if [ "${uhttpd_ok}" = "true" ] |
|
|
|
|
|
then |
|
|
|
|
|
f_log "created volatile uhttpd instances" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
f_uhttpd "adbIPv4+6_80" "1" "-p ${adb_ipv4}:${adb_nullport} -p [${adb_ipv6}]:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv4+6_443" "0" "-p ${adb_ipv4}:${adb_nullportssl} -p [${adb_ipv6}]:${adb_nullportssl}" |
|
|
|
|
|
elif [ -n "${adb_wanif4}" ] |
|
|
|
|
|
then |
|
|
|
|
|
f_uhttpd "adbIPv4_80" "1" "-p ${adb_ipv4}:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv4_443" "0" "-p ${adb_ipv4}:${adb_nullportssl}" |
|
|
|
|
|
else |
|
|
|
|
|
f_uhttpd "adbIPv6_80" "1" "-p [${adb_ipv6}]:${adb_nullport}" |
|
|
|
|
|
f_uhttpd "adbIPv6_443" "0" "-p [${adb_ipv6}]:${adb_nullportssl}" |
|
|
|
|
|
fi |
|
|
|
|
|
if [ "${uhttpd_ok}" = "true" ] |
|
|
|
|
|
then |
|
|
|
|
|
f_log "created volatile uhttpd instances" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# check whitelist entries |
|
|
# check whitelist entries |
|
@ -471,7 +467,6 @@ f_depend() |
|
|
elif [ -z "${check}" ] |
|
|
elif [ -z "${check}" ] |
|
|
then |
|
|
then |
|
|
rc=-1 |
|
|
rc=-1 |
|
|
package_ok="false" |
|
|
|
|
|
f_log "package '${package}' not found" |
|
|
f_log "package '${package}' not found" |
|
|
f_exit |
|
|
f_exit |
|
|
fi |
|
|
fi |
|
@ -490,7 +485,6 @@ f_firewall() |
|
|
local chpos="${5}" |
|
|
local chpos="${5}" |
|
|
local notes="adb-${6}" |
|
|
local notes="adb-${6}" |
|
|
local rules="${7}" |
|
|
local rules="${7}" |
|
|
firewall_ok="true" |
|
|
|
|
|
|
|
|
|
|
|
# select appropriate iptables executable for IPv6 |
|
|
# select appropriate iptables executable for IPv6 |
|
|
# |
|
|
# |
|
@ -528,9 +522,10 @@ f_firewall() |
|
|
then |
|
|
then |
|
|
"${ipt}" -w -t "${table}" -I "${chain}" "${chpos}" -m comment --comment "${notes}" ${rules} |
|
|
"${ipt}" -w -t "${table}" -I "${chain}" "${chpos}" -m comment --comment "${notes}" ${rules} |
|
|
rc=${?} |
|
|
rc=${?} |
|
|
if [ $((rc)) -ne 0 ] |
|
|
|
|
|
|
|
|
if [ $((rc)) -eq 0 ] |
|
|
then |
|
|
then |
|
|
firewall_ok="false" |
|
|
|
|
|
|
|
|
firewall_ok="true" |
|
|
|
|
|
else |
|
|
f_log "failed to initialize volatile ${proto} firewall rule '${notes}'" |
|
|
f_log "failed to initialize volatile ${proto} firewall rule '${notes}'" |
|
|
f_exit |
|
|
f_exit |
|
|
fi |
|
|
fi |
|
@ -541,18 +536,23 @@ f_firewall() |
|
|
# |
|
|
# |
|
|
f_uhttpd() |
|
|
f_uhttpd() |
|
|
{ |
|
|
{ |
|
|
|
|
|
local check |
|
|
local realm="${1}" |
|
|
local realm="${1}" |
|
|
local timeout="${2}" |
|
|
local timeout="${2}" |
|
|
local ports="${3}" |
|
|
local ports="${3}" |
|
|
uhttpd_ok="true" |
|
|
|
|
|
|
|
|
|
|
|
uhttpd -h "/www/adblock" -N 25 -T "${timeout}" -r "${realm}" -k 0 -t 0 -R -D -S -E "/index.html" ${ports} |
|
|
|
|
|
rc=${?} |
|
|
|
|
|
if [ $((rc)) -ne 0 ] |
|
|
|
|
|
|
|
|
check="$(pgrep -f "uhttpd -h /www/adblock -N 25 -T ${timeout} -r ${realm}")" |
|
|
|
|
|
if [ -z "${check}" ] |
|
|
then |
|
|
then |
|
|
uhttpd_ok="false" |
|
|
|
|
|
f_log "failed to initialize volatile uhttpd instance (${realm})" |
|
|
|
|
|
f_exit |
|
|
|
|
|
|
|
|
uhttpd -h "/www/adblock" -N 25 -T "${timeout}" -r "${realm}" -k 0 -t 0 -R -D -S -E "/index.html" ${ports} |
|
|
|
|
|
rc=${?} |
|
|
|
|
|
if [ $((rc)) -eq 0 ] |
|
|
|
|
|
then |
|
|
|
|
|
uhttpd_ok="true" |
|
|
|
|
|
else |
|
|
|
|
|
f_log "failed to initialize volatile uhttpd instance (${realm})" |
|
|
|
|
|
f_exit |
|
|
|
|
|
fi |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -570,8 +570,6 @@ f_space() |
|
|
then |
|
|
then |
|
|
space_ok="false" |
|
|
space_ok="false" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
|
|
|
space_ok="false" |
|
|
|
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|