-s:option(Value, "srchost").optional = true
-s:option(Value, "dsthost").optional = true
-s:option(Value, "layer7", "Layer 7").optional = true
-
-p2p = s:option(ListValue, "ipp2p", "P2P")
-p2p:value("")
-p2p:value("all", translate("all"))
-p2p:value("bit", "BitTorrent")
-p2p:value("dc", "DirectConnect")
-p2p:value("edk", "eDonkey")
-p2p:value("gnu", "Gnutella")
-p2p:value("kazaa", "Kazaa")
-p2p.optional = true
-
-p = s:option(ListValue, "proto", translate("protocol"))
-p:value("")
+srch = s:option(Value, "srchost", translate("Source host"))
+srch.rmempty = true
+srch:value("", translate("all"))
+wa.cbi_add_knownips(srch)
+
+dsth = s:option(Value, "dsthost", translate("Destination host"))
+dsth.rmempty = true
+dsth:value("", translate("all"))
+wa.cbi_add_knownips(dsth)
+
+l7 = s:option(ListValue, "layer7", translate("Service"))
+l7.rmempty = true
+l7:value("", translate("all"))
+
+local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
+if pats then
+ local l
+ while true do
+ l = pats:read("*l")
+ if not l then break end
+
+ l = l:match("([^/]+)%.pat$")
+ if l then
+ l7:value(l)
+ end
+ end
+ pats:close()
+end
+
+p = s:option(Value, "proto", translate("Protocol"))
+p:value("", translate("all"))