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

Use network_get_device to get device

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-07-04 07:20:55 +02:00
parent ec6cdb8209
commit 18a6613650
5 changed files with 62 additions and 28 deletions

View file

@ -6,6 +6,8 @@ START=5
USE_PROCD=1
. /lib/functions/network.sh
omr_intf_del() {
[ -z "$1" ] && return
uci -q delete openmptcprouter.$1
@ -18,12 +20,14 @@ omr_intf_check() {
omr_intf_set() {
local device
local ifname
config_get ifname "$1" device
network_get_device ifname $1
[ -z "$ifname" ] && network_get_physdev ifname $1
[ -z "$ifname" ] && config_get ifname "$1" device
[ -z "$ifname" ] && config_get ifname "$1" ifname
config_get devicename "$1" _modem_device
config_get type "$1" type
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
#config_get devicename "$1" _modem_device
devicename=${ifname}
config_get type "$1" type
if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
devicepath=$(readlink -f /sys/class/net/${ifname})
@ -57,7 +61,9 @@ omr_set_settings() {
local ifname
local multipath
config_get multipath "$1" multipath
config_get ifname "$1" device
network_get_device ifname $1
[ -z "$ifname" ] && network_get_physdev ifname $1
[ -z "$ifname" ] && config_get ifname "$1" device
[ -z "$ifname" ] && config_get ifname "$1" ifname
config_get device "$1" device
config_get proto "$1" proto