2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 local wa = require "luci.tools.webadmin"
16 local fs = require "nixio.fs"
18 m = Map("qos", translate("Quality of Service"),
19 translate("With <abbr title=\"Quality of Service\">QoS</abbr> you " ..
20 "can prioritize network traffic selected by addresses, " ..
21 "ports or services."))
23 s = m:section(TypedSection, "interface", translate("Interfaces"))
27 e = s:option(Flag, "enabled", translate("Enable"))
30 c = s:option(ListValue, "classgroup", translate("Classification group"))
31 c:value("Default", translate("default"))
34 s:option(Flag, "overhead", translate("Calculate overhead"))
36 s:option(Flag, "halfduplex", translate("Half-duplex"))
38 dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
39 dl.datatype = "and(uinteger,min(1))"
41 ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
42 ul.datatype = "and(uinteger,min(1))"
44 s = m:section(TypedSection, "classify", translate("Classification Rules"))
45 s.template = "cbi/tblsection"
50 t = s:option(ListValue, "target", translate("Target"))
51 t:value("Priority", translate("priority"))
52 t:value("Express", translate("express"))
53 t:value("Normal", translate("normal"))
54 t:value("Bulk", translate("low"))
57 srch = s:option(Value, "srchost", translate("Source host"))
59 srch:value("", translate("all"))
60 wa.cbi_add_knownips(srch)
62 dsth = s:option(Value, "dsthost", translate("Destination host"))
64 dsth:value("", translate("all"))
65 wa.cbi_add_knownips(dsth)
67 l7 = s:option(ListValue, "layer7", translate("Service"))
69 l7:value("", translate("all"))
71 local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
76 if not l then break end
78 l = l:match("([^/]+)%.pat$")
86 p = s:option(Value, "proto", translate("Protocol"))
87 p:value("", translate("all"))
90 p:value("icmp", "ICMP")
93 ports = s:option(Value, "ports", translate("Ports"))
95 ports:value("", translate("all"))
97 bytes = s:option(Value, "connbytes", translate("Number of bytes"))