-s:option(Value, "srchost").optional = true
-s:option(Value, "dsthost").optional = true
-s:option(Value, "layer7", "Layer 7").optional = true
+srch = s:option(Value, "srchost")
+srch.rmempty = true
+srch:value("", translate("all"))
+luci.tools.webadmin.cbi_add_knownips(srch)
+
+dsth = s:option(Value, "dsthost")
+dsth.rmempty = true
+dsth:value("", translate("all"))
+luci.tools.webadmin.cbi_add_knownips(dsth)
+
+l7 = s:option(ListValue, "layer7", translate("service"))
+l7.rmempty = true
+l7:value("", translate("all"))
+local pats = luci.fs.dir("/etc/l7-protocols")
+if pats then
+ for i,f in ipairs(pats) do
+ if f:sub(-4) == ".pat" then
+ l7:value(f:sub(1, #f-4))
+ end
+ end
+end