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

Always use device in priority

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-07-09 18:40:16 +02:00
parent 8aa3927d7c
commit ae8371b2cc
5 changed files with 14 additions and 10 deletions

View file

@ -501,8 +501,8 @@ _intf_rule_v2ray_rules() {
_intf_rule() {
local intf
config_get intf $1 ifname
[ -z "$intf" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$intf" ] && config_get intf $1 ifname
[ -n "$(echo $intf | grep '@')" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
#count=$((count+1))
config_get count $1 metric

View file

@ -18,11 +18,11 @@ omr_intf_check() {
omr_intf_set() {
local device
local ifname
config_get ifname "$1" ifname
config_get device "$1" device
config_get type "$1" type
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$ifname" ] && config_get ifname "$1" ifname
if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
devicepath=$(readlink -f /sys/class/net/${ifname})
@ -56,7 +56,6 @@ omr_set_settings() {
local ifname
local multipath
config_get multipath "$1" multipath
config_get ifname "$1" ifname
config_get device "$1" device
config_get proto "$1" proto
config_get type "$1" type
@ -76,7 +75,8 @@ omr_set_settings() {
[ -z "$addlatency" ] && addlatency=0
devicename=$(echo "$device" | cut -d'/' -f3)
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$ifname" ] && config_get ifname "$1" ifname
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
if [ -n "$ifname" ]; then

View file

@ -1156,7 +1156,7 @@ function interfaces_status()
end
duplicatemac = false
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
if allmac[mac] then
connectivity = "ERROR"
duplicatemac = true

View file

@ -85,9 +85,9 @@ interface_multipath_settings() {
local enabled
config_get enabled "$config" auto "1"
config_get iface "$config" ifname
iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
[ -z "$iface" ] && config_get iface "$config" ifname
config_get txqueuelen "$config" txqueuelen
[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
[ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]')
if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then
count=$((count+1))
@ -349,7 +349,8 @@ interface_multipath_settings() {
}
load_interfaces() {
config_get ifname "$1" ifname
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$ifname" ] && config_get ifname "$1" ifname
config_get multipath "$1" multipath ""
[ -z "$multipath" ] && multipath="$(uci -q get openmptcprouter.$1.multipath)"
[ "$multipath" != "off" ] && [ "$multipath" != "" ] && interfaces=" ${ifname} ${interfaces}"

View file

@ -69,6 +69,9 @@ _launch_tracker() {
[ "${ifenabled}" = "0" ] && return
[ "${enabled}" = "0" ] && return
[ -z "${hosts}" ] && [ "$type" != "none" ] && return
ifstatus=$(ifstatus "$1" | jsonfilter -q -e '@["up"]')
ifdevice=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
[ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return
[ -z "${interval_tries}" ] && interval_tries=1
procd_open_instance