X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-firewall%2Fluasrc%2Fmodel%2Fcbi%2Ffirewall%2Fforward-details.lua;h=c80a6d0e7a26b6b4a5602266ba71c987fbd0ff87;hp=c3618ec01b665dd1b6b353d52e3297120e69a1f2;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hpb=0f71faaf340b88f3178301a3063ab50aa39d4e8d diff --git a/applications/luci-firewall/luasrc/model/cbi/firewall/forward-details.lua b/applications/luci-firewall/luasrc/model/cbi/firewall/forward-details.lua index c3618ec01..c80a6d0e7 100644 --- a/applications/luci-firewall/luasrc/model/cbi/firewall/forward-details.lua +++ b/applications/luci-firewall/luasrc/model/cbi/firewall/forward-details.lua @@ -39,22 +39,6 @@ else m.title = "%s - %s" %{ translate("Firewall - Port Forwards"), name } end -local wan_zone = nil - -m.uci:foreach("firewall", "zone", - function(s) - local n = s.network or s.name - if n then - local i - for i in n:gmatch("%S+") do - if i == "wan" then - wan_zone = s.name - return false - end - end - end - end) - s = m:section(NamedSection, arg[1], "redirect", "") s.anonymous = true s.addremove = false @@ -88,9 +72,13 @@ o = s:option(DynamicList, "src_mac", translate("Source MAC address"), translate("Only match incoming traffic from these MACs.")) o.rmempty = true -o.datatype = "macaddr" +o.datatype = "neg(macaddr)" o.placeholder = translate("any") +luci.sys.net.mac_hints(function(mac, name) + o:value(mac, "%s (%s)" %{ mac, name }) +end) + o = s:option(Value, "src_ip", translate("Source IP address"), @@ -99,12 +87,16 @@ o.rmempty = true o.datatype = "neg(ip4addr)" o.placeholder = translate("any") +luci.sys.net.ipv4_hints(function(ip, name) + o:value(ip, "%s (%s)" %{ ip, name }) +end) + o = s:option(Value, "src_port", translate("Source port"), translate("Only match incoming traffic originating from the given source port or port range on the client host")) o.rmempty = true -o.datatype = "portrange" +o.datatype = "neg(portrange)" o.placeholder = translate("any") @@ -112,15 +104,20 @@ o = s:option(Value, "src_dip", translate("External IP address"), translate("Only match incoming traffic directed at the given IP address.")) +luci.sys.net.ipv4_hints(function(ip, name) + o:value(ip, "%s (%s)" %{ ip, name }) +end) + + o.rmempty = true -o.datatype = "ip4addr" +o.datatype = "neg(ip4addr)" o.placeholder = translate("any") o = s:option(Value, "src_dport", translate("External port"), translate("Match incoming traffic directed at the given " .. "destination port or port range on this host")) -o.datatype = "portrange" +o.datatype = "neg(portrange)" @@ -134,9 +131,10 @@ o = s:option(Value, "dest_ip", translate("Internal IP address"), translate("Redirect matched incoming traffic to the specified \ internal host")) o.datatype = "ip4addr" -for i, dataset in ipairs(sys.net.arptable()) do - o:value(dataset["IP address"]) -end + +luci.sys.net.ipv4_hints(function(ip, name) + o:value(ip, "%s (%s)" %{ ip, name }) +end) o = s:option(Value, "dest_port", @@ -150,7 +148,6 @@ o.datatype = "portrange" o = s:option(Flag, "reflection", translate("Enable NAT Loopback")) o.rmempty = true o.default = o.enabled -o:depends("src", wan_zone) o.cfgvalue = function(...) return Flag.cfgvalue(...) or "1" end