1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Use iptables-legacy instead of iptables

This commit is contained in:
Ycarus (Yannick Chabanois) 2022-09-25 19:02:32 +02:00
parent ca45d952c2
commit 827a93c478
10 changed files with 233 additions and 132 deletions

View file

@ -4,6 +4,13 @@
name=$0
basename="$(basename $0)"
if [ -f /usr/sbin/iptables-legacy ]; then
IPTABLES="/usr/sbin/iptables-legacy"
else
IPTABLES="/usr/sbin/iptables"
fi
_log() {
logger -p daemon.info -t "${basename}" "$@"
}
@ -75,7 +82,7 @@ while true; do
uci -q set openmptcprouter.omr.v2ray="up"
uci -q commit openmptcprouter.omr
}
if [ -z "$(iptables -w -t nat -L -n | grep v2r)" ]; then
if [ -z "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep v2r)" ]; then
_log "Reload V2Ray rules"
/etc/init.d/v2ray rules_up 2> /dev/null
_get_ip
@ -86,7 +93,7 @@ while true; do
last=$((last + 1 ))
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
[ "${last}" -ge "${retry}" ] && {
if [ -n "$(iptables -w -t nat -L -n | grep v2r)" ]; then
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep v2r)" ]; then
_log "V2Ray is down (can't contact via http ${nocontact})"
uci -q set openmptcprouter.omr.v2ray="down"
uci -q commit openmptcprouter.omr