luci-firewall: Add support for negations for ip addresses/nets (#218)
[project/luci.git] / applications / luci-firewall / luasrc / model / cbi / luci_fw / rrule.lua
index 6332d8e..ddecad3 100644 (file)
@@ -53,10 +53,6 @@ s.addremove = false
 s:tab("general", translate("General Settings"))
 s:tab("advanced", translate("Advanced Settings"))
 
-back = s:taboption("general", DummyValue, "_overview", translate("Overview"))
-back.value = ""
-back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "redirect")
-
 name = s:taboption("general", Value, "_name", translate("Name"))
 name.rmempty = true
 name.size = 10
@@ -66,7 +62,7 @@ src.nocreate = true
 src.default = "wan"
 src.template = "cbi/firewall_zonelist"
 
-proto = s:taboption("general", ListValue, "proto", translate("Protocol"))
+proto = s:taboption("general", Value, "proto", translate("Protocol"))
 proto.optional = true
 proto:value("tcpudp", "TCP+UDP")
 proto:value("tcp", "TCP")
@@ -92,8 +88,11 @@ 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"
+toport.datatype = "portrange"
+toport:depends("proto", "tcp")
+toport:depends("proto", "udp")
+toport:depends("proto", "tcpudp")
 
 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.datatype = "neg_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")