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:
parent
ca45d952c2
commit
827a93c478
10 changed files with 233 additions and 132 deletions
|
@ -4,6 +4,16 @@
|
|||
name=$0
|
||||
basename="$(basename $0)"
|
||||
|
||||
if [ -f /usr/sbin/iptables-legacy ]; then
|
||||
IPTABLES="/usr/sbin/iptables-legacy"
|
||||
IPTABLESAVE="/usr/sbin/iptables-legacy-save"
|
||||
else
|
||||
IPTABLES="/usr/sbin/iptables"
|
||||
IPTABLESAVE="/usr/sbin/iptables-save"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
_log() {
|
||||
logger -p daemon.info -t "${basename}" "$@"
|
||||
}
|
||||
|
@ -76,7 +86,7 @@ while true; do
|
|||
uci -q set openmptcprouter.omr.ss_${server}="up"
|
||||
uci -q commit openmptcprouter.omr
|
||||
}
|
||||
if [ -z "$(iptables-save 2>/dev/null | grep :ssr)" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then
|
||||
if [ -z "$($IPTABLESSAVE 2>/dev/null | grep :ssr)" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then
|
||||
_log "Reload Shadowsocks rules"
|
||||
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
|
||||
_get_ip
|
||||
|
@ -87,7 +97,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 ssr)" ]; then
|
||||
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ssr)" ]; then
|
||||
_log "Shadowsocks ${server} is down (can't contact via http ${nocontact})"
|
||||
uci -q set openmptcprouter.omr.ss_${server}="down"
|
||||
uci -q commit openmptcprouter.omr
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue