summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-bcp38/luasrc/model
diff options
context:
space:
mode:
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2018-06-23 08:43:00 +0100
committerKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2018-06-23 08:52:14 +0100
commit65cfbd8f759b97f2dc2fe3e2468172681747a78c (patch)
tree6652d4a7791376d30546cfa18a061f5ebfbfbbea /applications/luci-app-bcp38/luasrc/model
parent5142e40f9e70a09653e07a4dbc2abd6db3da36e4 (diff)
luci-app-bcp38: improve interface selection dropdown
Certain types of interface were excluded from bcp38's concept of upstream wan interface e.g. pppoa-wan Shamelessly copies the interface list generation from luci-app-sqm which solved exactly the same problem and gives additional clues by displaying the firewall zone (typically wan/lan etc) Run-tested-on: DGN3500 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Diffstat (limited to 'applications/luci-app-bcp38/luasrc/model')
-rw-r--r--applications/luci-app-bcp38/luasrc/model/cbi/bcp38.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/applications/luci-app-bcp38/luasrc/model/cbi/bcp38.lua b/applications/luci-app-bcp38/luasrc/model/cbi/bcp38.lua
index 632074a56f..731c3350eb 100644
--- a/applications/luci-app-bcp38/luasrc/model/cbi/bcp38.lua
+++ b/applications/luci-app-bcp38/luasrc/model/cbi/bcp38.lua
@@ -14,7 +14,8 @@ $Id$
local wa = require "luci.tools.webadmin"
local net = require "luci.model.network".init()
-local ifaces = net:get_interfaces()
+local sys = require "luci.sys"
+local ifaces = sys.net:devices()
m = Map("bcp38", translate("BCP38"),
translate("This function blocks packets with private address destinations " ..
@@ -37,10 +38,17 @@ a.rmempty = false
n = s:option(ListValue, "interface", translate("Interface name"), translate("Interface to apply the blocking to " ..
"(should be the upstream WAN interface)."))
+
for _, iface in ipairs(ifaces) do
- if iface:is_up() then
- n:value(iface:name())
- end
+ if not (iface == "lo" or iface:match("^ifb.*")) then
+ local nets = net:get_interface(iface)
+ nets = nets and nets:get_networks() or {}
+ for k, v in pairs(nets) do
+ nets[k] = nets[k].sid
+ end
+ nets = table.concat(nets, ",")
+ n:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
+ end
end
n.rmempty = false