luci-app-banip: sync with release 0.0.7

* determine L3 and L2 network devices to support pppoe interfaces
correctly

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2018-12-26 21:56:45 +01:00
parent 5aa2d3a77f
commit 01322c26f4
2 changed files with 17 additions and 25 deletions

View file

@ -1,17 +1,15 @@
-- Copyright 2018 Dirk Brenken (dev@brenken.org) -- Copyright 2018 Dirk Brenken (dev@brenken.org)
-- This is free software, licensed under the Apache License, Version 2.0 -- This is free software, licensed under the Apache License, Version 2.0
local fs = require("nixio.fs") local fs = require("nixio.fs")
local uci = require("luci.model.uci").cursor() local uci = require("luci.model.uci").cursor()
local sys = require("luci.sys") local net = require "luci.model.network".init()
local net = require "luci.model.network".init() local util = require("luci.util")
local util = require("luci.util") local dump = util.ubus("network.interface", "dump", {})
local dump = util.ubus("network.interface", "dump", {})
local devices = sys.net:devices()
m = Map("banip", translate("banIP"), m = Map("banip", translate("banIP"),
translate("Configuration of the banIP package to block ip adresses/subnets via IPSet. ") translate("Configuration of the banIP package to block ip adresses/subnets via IPSet. ")
.. translatef("For further information " ..translatef("For further information "
.. "<a href=\"%s\" target=\"_blank\">" .. "<a href=\"%s\" target=\"_blank\">"
.. "check the online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/banip/files/README.md")) .. "check the online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/banip/files/README.md"))
@ -29,22 +27,16 @@ o2.rmempty = false
o3 = s:option(MultiValue, "ban_iface", translate("Interface Selection"), o3 = s:option(MultiValue, "ban_iface", translate("Interface Selection"),
translate("Disable the automatic WAN detection and select your preferred interface(s) manually.")) translate("Disable the automatic WAN detection and select your preferred interface(s) manually."))
for _, dev in ipairs(devices) do if dump then
if dev ~= "lo" and dev ~= "br-lan" then local i, v
local iface = net:get_interface(dev) for i, v in ipairs(dump.interface) do
if iface then if v.interface ~= "loopback" and v.interface ~= "lan" then
iface = iface:get_networks() or {} local device = v.l3_device or v.device or "-"
for k, v in pairs(iface) do o3:value(v.interface, v.interface.. " (" ..device.. ")")
iface[k] = iface[k].sid
if iface[k] ~= "lan" then
o3:value(iface[k], iface[k].. " (" ..dev.. ")")
end
end
end end
end end
end end
o3.widget = "checkbox" o3.widget = "checkbox"
o3.default = ban_iface
o3.rmempty = false o3.rmempty = false
o4 = s:option(ListValue, "ban_fetchutil", translate("Download Utility"), o4 = s:option(ListValue, "ban_fetchutil", translate("Download Utility"),

View file

@ -1,8 +1,8 @@
<style type="text/css"> <style type="text/css">
textarea textarea
{ {
width: 100%; width: 100% !important;
height: 450px; height: 450px !important;
border: 1px solid #cccccc; border: 1px solid #cccccc;
padding: 5px; padding: 5px;
font-size: 12px; font-size: 12px;
@ -16,8 +16,8 @@
select[readonly], select[readonly],
textarea[readonly] textarea[readonly]
{ {
width: 100%; width: 100% !important;
height: 450px; height: 450px !important;
border: 1px solid #cccccc; border: 1px solid #cccccc;
padding: 5px; padding: 5px;
font-size: 12px; font-size: 12px;
@ -33,7 +33,7 @@
.cbi-section-table-row, .cbi-section-table-row,
.tr[data-title]::before .tr[data-title]::before
{ {
text-align: left; text-align: left !important;
vertical-align: top; vertical-align: top;
margin-left: 0px; margin-left: 0px;
padding-left: 2px; padding-left: 2px;