From: Jo-Philipp Wich Date: Tue, 11 Sep 2012 18:35:40 +0000 (+0000) Subject: applications/luci-firewall: offer zone selection in redirect quickadd (#483) X-Git-Tag: 0.11.0~105 X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=e6915e72df00a2b699d368206ee94d5d15328a50 applications/luci-firewall: offer zone selection in redirect quickadd (#483) --- diff --git a/applications/luci-firewall/luasrc/model/cbi/firewall/forwards.lua b/applications/luci-firewall/luasrc/model/cbi/firewall/forwards.lua index 660848cee..5f7a69b25 100644 --- a/applications/luci-firewall/luasrc/model/cbi/firewall/forwards.lua +++ b/applications/luci-firewall/luasrc/model/cbi/firewall/forwards.lua @@ -35,7 +35,9 @@ s.template_addremove = "firewall/cbi_addforward" function s.create(self, section) local n = m:formvalue("_newfwd.name") local p = m:formvalue("_newfwd.proto") + local E = m:formvalue("_newfwd.extzone") local e = m:formvalue("_newfwd.extport") + local I = m:formvalue("_newfwd.intzone") local a = m:formvalue("_newfwd.intaddr") local i = m:formvalue("_newfwd.intport") @@ -43,8 +45,8 @@ function s.create(self, section) created = TypedSection.create(self, section) self.map:set(created, "target", "DNAT") - self.map:set(created, "src", "wan") - self.map:set(created, "dest", "lan") + self.map:set(created, "src", E or "wan") + self.map:set(created, "dest", I or "lan") self.map:set(created, "proto", (p ~= "other") and p or "all") self.map:set(created, "src_dport", e) self.map:set(created, "dest_ip", a) diff --git a/applications/luci-firewall/luasrc/view/firewall/cbi_addforward.htm b/applications/luci-firewall/luasrc/view/firewall/cbi_addforward.htm index 9b17d52e7..3726f643d 100644 --- a/applications/luci-firewall/luasrc/view/firewall/cbi_addforward.htm +++ b/applications/luci-firewall/luasrc/view/firewall/cbi_addforward.htm @@ -1,13 +1,28 @@ +<%- + local fw = require "luci.model.firewall".init() + local izl = { } + local ezl = { } + local _, z + for _, z in ipairs(fw:get_zones()) do + if z:name() ~= "wan" then + izl[#izl+1] = z + elseif z:name() ~= "lan" then + ezl[#ezl+1] = z + end + end +-%>

- +
- + + + @@ -24,9 +39,19 @@ + +
<%:New port forward%>:<%:New port forward%>:
<%:Name%> <%:Protocol%><%:External zone%> <%:External port%><%:Internal zone%> <%:Internal IP address%> <%:Internal port%> + + + +