2008-06-08 08:14:31 +00:00
|
|
|
--[[
|
|
|
|
LuCI - Lua Configuration Interface
|
|
|
|
|
|
|
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
]]--
|
2009-07-19 00:24:58 +00:00
|
|
|
|
|
|
|
local wa = require "luci.tools.webadmin"
|
|
|
|
local fs = require "nixio.fs"
|
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
m = Map("qos", translate("Quality of Service"),
|
|
|
|
translate("With <abbr title=\"Quality of Service\">QoS</abbr> you " ..
|
|
|
|
"can prioritize network traffic selected by addresses, " ..
|
|
|
|
"ports or services."))
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2009-10-31 15:54:11 +00:00
|
|
|
s = m:section(TypedSection, "interface", translate("Interfaces"))
|
2008-04-14 17:15:49 +00:00
|
|
|
s.addremove = true
|
2010-03-27 03:02:16 +00:00
|
|
|
s.anonymous = false
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-05-15 18:46:58 +00:00
|
|
|
e = s:option(Flag, "enabled", translate("Enable"))
|
|
|
|
e.rmempty = false
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
c = s:option(ListValue, "classgroup", translate("Classification group"))
|
|
|
|
c:value("Default", translate("default"))
|
2008-04-14 17:15:49 +00:00
|
|
|
c.default = "Default"
|
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
s:option(Flag, "overhead", translate("Calculate overhead"))
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
s:option(Flag, "halfduplex", translate("Half-duplex"))
|
2009-05-18 16:16:18 +00:00
|
|
|
|
2012-11-10 20:55:50 +00:00
|
|
|
dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
|
|
|
|
dl.datatype = "and(uinteger,min(1))"
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2012-11-10 20:55:50 +00:00
|
|
|
ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
|
|
|
|
ul.datatype = "and(uinteger,min(1))"
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
s = m:section(TypedSection, "classify", translate("Classification Rules"))
|
2008-08-13 16:18:39 +00:00
|
|
|
s.template = "cbi/tblsection"
|
2008-04-14 17:15:49 +00:00
|
|
|
s.anonymous = true
|
|
|
|
s.addremove = true
|
2011-06-25 23:17:10 +00:00
|
|
|
s.sortable = true
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
t = s:option(ListValue, "target", translate("Target"))
|
2009-10-31 15:54:11 +00:00
|
|
|
t:value("Priority", translate("priority"))
|
|
|
|
t:value("Express", translate("express"))
|
|
|
|
t:value("Normal", translate("normal"))
|
|
|
|
t:value("Bulk", translate("low"))
|
2008-04-14 17:15:49 +00:00
|
|
|
t.default = "Normal"
|
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
srch = s:option(Value, "srchost", translate("Source host"))
|
2008-08-13 16:18:39 +00:00
|
|
|
srch.rmempty = true
|
|
|
|
srch:value("", translate("all"))
|
2009-07-19 00:24:58 +00:00
|
|
|
wa.cbi_add_knownips(srch)
|
2008-08-13 16:18:39 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
dsth = s:option(Value, "dsthost", translate("Destination host"))
|
2008-08-13 16:18:39 +00:00
|
|
|
dsth.rmempty = true
|
|
|
|
dsth:value("", translate("all"))
|
2009-07-19 00:24:58 +00:00
|
|
|
wa.cbi_add_knownips(dsth)
|
2008-07-17 16:02:29 +00:00
|
|
|
|
2009-10-31 15:54:11 +00:00
|
|
|
l7 = s:option(ListValue, "layer7", translate("Service"))
|
2008-08-13 16:18:39 +00:00
|
|
|
l7.rmempty = true
|
|
|
|
l7:value("", translate("all"))
|
2011-01-20 23:44:41 +00:00
|
|
|
|
|
|
|
local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
|
2008-07-17 16:02:29 +00:00
|
|
|
if pats then
|
2011-01-20 23:44:41 +00:00
|
|
|
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)
|
2008-07-17 16:02:29 +00:00
|
|
|
end
|
|
|
|
end
|
2011-01-20 23:44:41 +00:00
|
|
|
pats:close()
|
2008-07-17 16:02:29 +00:00
|
|
|
end
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2009-10-31 15:54:11 +00:00
|
|
|
p = s:option(Value, "proto", translate("Protocol"))
|
2008-08-13 16:18:39 +00:00
|
|
|
p:value("", translate("all"))
|
2008-04-14 17:15:49 +00:00
|
|
|
p:value("tcp", "TCP")
|
|
|
|
p:value("udp", "UDP")
|
|
|
|
p:value("icmp", "ICMP")
|
2008-08-13 16:18:39 +00:00
|
|
|
p.rmempty = true
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2009-10-31 15:54:11 +00:00
|
|
|
ports = s:option(Value, "ports", translate("Ports"))
|
2008-08-13 16:18:39 +00:00
|
|
|
ports.rmempty = true
|
2010-03-30 00:59:40 +00:00
|
|
|
ports:value("", translate("all"))
|
2008-04-14 17:15:49 +00:00
|
|
|
|
2010-03-30 00:59:40 +00:00
|
|
|
bytes = s:option(Value, "connbytes", translate("Number of bytes"))
|
2009-01-17 16:19:43 +00:00
|
|
|
|
2008-09-29 19:49:36 +00:00
|
|
|
return m
|