mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Change in luci-app-openmptcprouter to use device setting
This commit is contained in:
parent
04b15901fa
commit
72f5756eb5
4 changed files with 58 additions and 23 deletions
|
@ -18,7 +18,8 @@ omr_intf_check() {
|
|||
omr_intf_set() {
|
||||
local device
|
||||
local ifname
|
||||
config_get ifname "$1" ifname
|
||||
config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get type "$1" type
|
||||
|
||||
|
@ -56,7 +57,8 @@ omr_set_settings() {
|
|||
local ifname
|
||||
local multipath
|
||||
config_get multipath "$1" multipath
|
||||
config_get ifname "$1" ifname
|
||||
config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get proto "$1" proto
|
||||
config_get type "$1" type
|
||||
|
|
|
@ -11,7 +11,7 @@ local jsonc = require "luci.jsonc"
|
|||
function interface_from_device(dev)
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifacen = iface:name()
|
||||
local ifacename = ucic:get("network",ifacen,"ifname")
|
||||
local ifacename = ucic:get("network",ifacen,"device")
|
||||
if ifacename == dev then
|
||||
return ifacen
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ function add_interface(add_interface_ifname)
|
|||
end
|
||||
|
||||
ucic:set("network","wan" .. i,"interface")
|
||||
ucic:set("network","wan" .. i,"ifname",defif)
|
||||
ucic:set("network","wan" .. i,"device",defif)
|
||||
ucic:set("network","wan" .. i,"proto","static")
|
||||
if ointf ~= "" then
|
||||
ucic:set("network","wan" .. i,"type","macvlan")
|
||||
|
@ -128,7 +128,7 @@ end
|
|||
|
||||
function remove_interface(intf)
|
||||
-- Remove existing interface
|
||||
local defif = ucic:get("network",intf,"ifname")
|
||||
local defif = ucic:get("network",intf,"device")
|
||||
ucic:delete("network",intf)
|
||||
ucic:delete("network",intf .. "_dev")
|
||||
ucic:save("network")
|
||||
|
@ -170,7 +170,7 @@ function set_interface(intf,proto,ipaddr,netmask,gateway,sqmenabled,downloadspee
|
|||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
defif = ucic:get("network",intf,"device") or ""
|
||||
end
|
||||
ucic:set("sqm",intf,"queue")
|
||||
ucic:set("sqm",intf,"interface",defif)
|
||||
|
@ -268,7 +268,7 @@ function default_vpn(default_vpn)
|
|||
ucic:set("network","omrvpn","proto","dhcp")
|
||||
end
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","ifname",vpn_intf)
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
end
|
||||
|
@ -961,7 +961,10 @@ function interfaces_status()
|
|||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||
mArray.openmptcprouter["tun_service"] = true
|
||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||
local tun_dev = uci:get("network","omrvpn","ifname")
|
||||
local tun_dev = uci:get("network","omrvpn","device")
|
||||
if tun_dev == "" then
|
||||
tun_dev = uci:get("network","omrvpn","ifname")
|
||||
end
|
||||
if tun_dev == "" then
|
||||
tun_dev = get_device("omrvpn")
|
||||
end
|
||||
|
@ -1139,14 +1142,14 @@ function interfaces_status()
|
|||
|
||||
local ifname = get_device(interface)
|
||||
if ifname == "" or ifname == nil then
|
||||
ifname = section["ifname"] or ""
|
||||
ifname = section["device"] or ""
|
||||
end
|
||||
--if ifname ~= nil and ifname:match("^tun.*") and interface:match("^ovpn.*") then
|
||||
--ifname = get_device(interface:sub(5))
|
||||
--end
|
||||
|
||||
duplicateif = false
|
||||
if ifname ~= "" and ifname ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
|
||||
if ifname ~= "" and ifname ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) then
|
||||
if allintf[ifname] then
|
||||
connectivity = "ERROR"
|
||||
duplicateif = true
|
||||
|
@ -1156,7 +1159,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["device"] ~= nil and section["device"]:match("^@.*")) then
|
||||
if allmac[mac] then
|
||||
connectivity = "ERROR"
|
||||
duplicatemac = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue