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

Fix error when adding LAN ip

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-07-26 20:10:53 +02:00
parent 20deac9470
commit c5f192783f

View file

@ -105,28 +105,36 @@ _bypass_lan_ip() {
[ -z "$intf" ] && intf="all" [ -z "$intf" ] && intf="all"
[ -z "$ip" ] && return [ -z "$ip" ] && return
valid_ip4=$( valid_subnet4 $ip)
valid_ip6=$( valid_subnet6 $ip)
if [ "$intf" = "all" ]; then if [ "$intf" = "all" ]; then
iptables-restore --wait=60 --noflush <<-EOF if [ "$valid_ip4" = "ok" ]; then
*mangle iptables-restore --wait=60 --noflush <<-EOF
-A omr-bypass -s $ip -j MARK --set-mark 0x539 *mangle
COMMIT -A omr-bypass -s $ip -j MARK --set-mark 0x539
EOF COMMIT
ip6tables-restore --wait=60 --noflush <<-EOF EOF
*mangle elif [ "$valid_ip6" = "ok" ]; then
-A omr-bypass6 -s $ip -j MARK --set-mark 0x6539 ip6tables-restore --wait=60 --noflush <<-EOF
COMMIT *mangle
EOF -A omr-bypass6 -s $ip -j MARK --set-mark 0x6539
COMMIT
EOF
fi
else else
iptables-restore --wait=60 --noflush <<-EOF if [ "$valid_ip4" = "ok" ]; then
*mangle iptables-restore --wait=60 --noflush <<-EOF
-A omr-bypass -s $ip -j MARK --set-mark 0x539$intfid *mangle
COMMIT -A omr-bypass -s $ip -j MARK --set-mark 0x539$intfid
EOF COMMIT
ip6tables-restore --wait=60 --noflush <<-EOF EOF
*mangle elif [ "$valid_ip6" = "ok" ]; then
-A omr-bypass6 -s $ip -j MARK --set-mark 0x6539$intfid ip6tables-restore --wait=60 --noflush <<-EOF
COMMIT *mangle
EOF -A omr-bypass6 -s $ip -j MARK --set-mark 0x6539$intfid
COMMIT
EOF
fi
fi fi
} }
@ -299,7 +307,6 @@ start_service() {
create omr6_dst_bypass_all hash:net family inet6 hashsize 64 create omr6_dst_bypass_all hash:net family inet6 hashsize 64
EOF EOF
} }
iptables-save --counters | grep -v omr-bypass | iptables-restore --counters iptables-save --counters | grep -v omr-bypass | iptables-restore --counters
iptables-restore --wait=60 --noflush <<-EOF iptables-restore --wait=60 --noflush <<-EOF
*mangle *mangle
@ -315,10 +322,8 @@ start_service() {
COMMIT COMMIT
EOF EOF
config_load network config_load network
config_foreach _intf_rule interface config_foreach _intf_rule interface
local ndpi_rules="" local ndpi_rules=""
config_load openmptcprouter config_load openmptcprouter
config_foreach _bypass_omr_server server config_foreach _bypass_omr_server server