mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 11:01:50 +00:00
Use iintf and ointf for rules
This commit is contained in:
parent
747251f566
commit
efe96abea7
2 changed files with 8 additions and 5 deletions
|
@ -93,7 +93,7 @@ interface_multipath_settings() {
|
|||
ip rule del table $id > /dev/null 2>&1
|
||||
ip route flush $id > /dev/null 2>&1
|
||||
if [ -n "$gateway" ] && [ -n "$network" ]; then
|
||||
ip rule add from $ipaddr table $id
|
||||
ip rule add from $ipaddr iif $iface oif $iface table $id
|
||||
ip route replace $network/$netmask dev $iface scope link table $id
|
||||
ip route replace default via $gateway dev $iface table $id
|
||||
ip route flush $id
|
||||
|
@ -141,7 +141,7 @@ interface_multipath_settings() {
|
|||
ip -6 rule del table 6$id > /dev/null 2>&1
|
||||
ip -6 route flush 6$id > /dev/null 2>&1
|
||||
if [ -n "$ip6addr" ] && [ -n "$gateway6" ] && [ -n "$network6" ]; then
|
||||
ip -6 rule add from $ip6addr table 6$id
|
||||
ip -6 rule add from $ip6addr iif $iface oif $iface table 6$id
|
||||
ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id
|
||||
ip -6 route replace default via $gateway6 dev $iface table 6$id
|
||||
ip -6 route flush 6$id
|
||||
|
|
|
@ -139,7 +139,8 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
|
|||
fi
|
||||
config_load shadowsocks-libev
|
||||
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||
local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
#local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | grep -m 1 "$OMR_TRACKER_DEVICE" | grep -om1 'lookup [[:digit:]]' | awk '{print $2}')
|
||||
ip route del default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric >/dev/null 2>&1
|
||||
config_foreach del_ss_route server $metric
|
||||
else
|
||||
|
@ -247,7 +248,8 @@ if [ "$multipath_config" = "master" ]; then
|
|||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
|
||||
fi
|
||||
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||
local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
#local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | grep -m 1 "$OMR_TRACKER_DEVICE" | grep -om1 'lookup [[:digit:]]' | awk '{print $2}')
|
||||
[ -n "$metric" ] && {
|
||||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric
|
||||
}
|
||||
|
@ -255,7 +257,8 @@ if [ "$multipath_config" = "master" ]; then
|
|||
multipath_config="on"
|
||||
else
|
||||
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||
local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
#local metric=$(ip rule show | grep -m 1 "$OMR_TRACKER_DEVICE_IP" | awk '{print $5}')
|
||||
local metric=$(ip rule show | grep "$OMR_TRACKER_DEVICE_IP" | grep -m 1 "$OMR_TRACKER_DEVICE" | grep -om1 'lookup [[:digit:]]' | awk '{print $2}')
|
||||
[ -n "$metric" ] && {
|
||||
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE metric $metric
|
||||
config_load shadowsocks-libev
|
||||
|
|
Loading…
Reference in a new issue