mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix interface name for omr-quota
This commit is contained in:
parent
6ce9bb2827
commit
edff787f63
2 changed files with 4 additions and 5 deletions
|
@ -4,7 +4,6 @@
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local net = require "luci.model.network".init()
|
local net = require "luci.model.network".init()
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local ifaces = sys.net:devices()
|
|
||||||
|
|
||||||
m = Map("omr-quota", translate("Monthly Quota"), translate("Set monthly quota, when quota is reached interface state is set to down"))
|
m = Map("omr-quota", translate("Monthly Quota"), translate("Set monthly quota, when quota is reached interface state is set to down"))
|
||||||
|
|
||||||
|
@ -13,9 +12,9 @@ s.template_addremove = "omr-quota/cbi-select-add"
|
||||||
s.addremove = true
|
s.addremove = true
|
||||||
s.add_select_options = { }
|
s.add_select_options = { }
|
||||||
s.add_select_options[''] = ''
|
s.add_select_options[''] = ''
|
||||||
for _, iface in ipairs(ifaces) do
|
for _, iface in ipairs(net:get_networks()) do
|
||||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
if not (iface:name() == "loopback") then
|
||||||
s.add_select_options[iface] = iface
|
s.add_select_options[iface:name()] = iface:name()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ _validate_section() {
|
||||||
_launch_quota() {
|
_launch_quota() {
|
||||||
local txquota rxquota ttquota interval enabled interface
|
local txquota rxquota ttquota interval enabled interface
|
||||||
_validate_section "interface" "$1"
|
_validate_section "interface" "$1"
|
||||||
interface=$1
|
interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||||
|
|
||||||
[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
|
[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
|
||||||
[ "$enabled" = "0" ] && return
|
[ "$enabled" = "0" ] && return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue