From 447cc08a8a8204dc5d20b760557d1a3b2f0b687b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 7 Nov 2010 20:01:56 +0000 Subject: [PATCH] applications/luci-firewall: support local destination in rules, add placeholders --- .../luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua | 7 +++++-- .../luci-firewall/luasrc/model/cbi/luci_fw/trule.lua | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua b/applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua index 6332d8e8c..5769c1da0 100644 --- a/applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua +++ b/applications/luci-firewall/luasrc/model/cbi/luci_fw/rrule.lua @@ -92,8 +92,7 @@ toport = s:taboption("general", Value, "dest_port", translate("Internal port (op translate("Redirect matched incoming traffic to the given port on " .. "the internal host")) toport.optional = true -toport.size = 5 - +toport.placeholder = "0-65535" target = s:taboption("advanced", ListValue, "target", translate("Redirection type")) target:value("DNAT") @@ -113,20 +112,24 @@ src_dip = s:taboption("advanced", Value, "src_dip", src_dip.optional = true src_dip.datatype = "ip4addr" +src_dip.placeholder = translate("any") src_mac = s:taboption("advanced", Value, "src_mac", translate("Source MAC address")) src_mac.optional = true src_mac.datatype = "macaddr" +src_mac.placeholder = translate("any") src_ip = s:taboption("advanced", Value, "src_ip", translate("Source IP address")) src_ip.optional = true src_ip.datatype = "ip4addr" +src_ip.placeholder = translate("any") sport = s:taboption("advanced", Value, "src_port", translate("Source port"), translate("Match incoming traffic originating from the given " .. "source port or port range on the client host")) sport.optional = true sport.datatype = "portrange" +sport.placeholder = "0-65536" sport:depends("proto", "tcp") sport:depends("proto", "udp") sport:depends("proto", "tcpudp") diff --git a/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua b/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua index 7ee8fd8e5..99011fea7 100644 --- a/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua +++ b/applications/luci-firewall/luasrc/model/cbi/luci_fw/trule.lua @@ -53,7 +53,7 @@ src.template = "cbi/firewall_zonelist" dest = s:taboption("advanced", Value, "dest", translate("Destination zone")) dest.nocreate = true -dest.default = "lan" +dest.allowlocal = true dest.template = "cbi/firewall_zonelist" proto = s:taboption("general", Value, "proto", translate("Protocol")) @@ -107,10 +107,12 @@ icmpt:value("address-mask-reply") src_ip = s:taboption("general", Value, "src_ip", translate("Source address")) src_ip.optional = true src_ip.datatype = has_v2 and "ipaddr" or "ip4addr" +src_ip.placeholder = translate("any") sport = s:taboption("general", Value, "src_port", translate("Source port")) sport.optional = true sport.datatype = "portrange" +sport.placeholder = "0-65535" sport:depends("proto", "tcp") sport:depends("proto", "udp") sport:depends("proto", "tcpudp") @@ -118,6 +120,7 @@ sport:depends("proto", "tcpudp") dest_ip = s:taboption("general", Value, "dest_ip", translate("Destination address")) dest_ip.optional = true dest_ip.datatype = has_v2 and "ipaddr" or "ip4addr" +dest_ip.placeholder = translate("any") dport = s:taboption("general", Value, "dest_port", translate("Destination port")) dport.optional = true @@ -125,6 +128,7 @@ dport.datatype = "portrange" dport:depends("proto", "tcp") dport:depends("proto", "udp") dport:depends("proto", "tcpudp") +dport.placeholder = "0-65535" jump = s:taboption("general", ListValue, "target", translate("Action")) jump.rmempty = true @@ -134,7 +138,10 @@ jump:value("ACCEPT", translate("accept")) jump:value("REJECT", translate("reject")) -s:taboption("advanced", Value, "src_mac", translate("Source MAC-address")).optional = true +smac = s:taboption("advanced", Value, "src_mac", translate("Source MAC address")) +smac.optional = true +smac.datatype = "macaddr" +smac.placeholder = translate("any") if has_v2 then family = s:taboption("advanced", ListValue, "family", translate("Restrict to address family")) -- 2.25.1