1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Add checkbox to enable SQM

This commit is contained in:
Ycarus 2019-04-03 23:14:25 +02:00
parent 23fcb1715a
commit f28313e61d
2 changed files with 39 additions and 23 deletions

View file

@ -121,7 +121,11 @@ function wizard_add()
ucic:commit("qos")
ucic:set("sqm","wan" .. i,"queue")
ucic:set("sqm","wan" .. i,"interface",wanif)
if ointf ~= "" then
ucic:set("sqm","wan" .. i,"interface","wan" .. i)
else
ucic:set("sqm","wan" .. i,"interface",defif)
end
ucic:set("sqm","wan" .. i,"qdisc","fq_codel")
ucic:set("sqm","wan" .. i,"script","simple.qos")
ucic:set("sqm","wan" .. i,"qdisc_advanced","0")
@ -175,6 +179,7 @@ function wizard_add()
local ipaddr = luci.http.formvalue("cbid.network.%s.ipaddr" % intf) or ""
local netmask = luci.http.formvalue("cbid.network.%s.netmask" % intf) or ""
local gateway = luci.http.formvalue("cbid.network.%s.gateway" % intf) or ""
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
if proto ~= "other" then
ucic:set("network",intf,"proto",proto)
end
@ -194,10 +199,7 @@ function wizard_add()
end
if not ucic:get("sqm",intf) ~= "" then
local defif = ucic:get("network",intf .. "_dev","ifname") or ""
if defif == "" then
defif = get_device(intf)
end
local defif = get_device(intf)
if defif == "" then
defif = ucic:get("network",intf,"ifname") or ""
end
@ -217,23 +219,27 @@ function wizard_add()
if downloadspeed ~= "0" and uploadspeed ~= "0" then
ucic:set("network",intf,"downloadspeed",downloadspeed)
ucic:set("network",intf,"uploadspeed",uploadspeed)
if ucic:get("sqm",intf,"download") == "" then
ucic:set("sqm",intf,"download",downloadspeed)
ucic:set("sqm",intf,"upload",uploadspeed)
--ucic:set("sqm",intf,"enabled","1")
ucic:set("sqm",intf,"download",downloadspeed*95/100)
ucic:set("sqm",intf,"upload",uploadspeed*95/100)
if sqmenabled == "1" then
ucic:set("sqm",intf,"enabled","1")
else
ucic:set("sqm",intf,"enabled","0")
end
if ucic:get("qos",intf,"download") == "" then
ucic:set("qos",intf,"download",downloadspeed)
ucic:set("qos",intf,"upload",uploadspeed)
--ucic:set("qos",intf,"enabled","1")
ucic:set("qos",intf,"download",downloadspeed*95/100)
ucic:set("qos",intf,"upload",uploadspeed*95/100)
if sqmenabled == "1" then
ucic:set("qos",intf,"enabled","1")
else
ucic:set("qos",intf,"enabled","0")
end
--else
-- ucic:set("sqm",intf,"download","0")
-- ucic:set("sqm",intf,"upload","0")
-- ucic:set("sqm",intf,"enabled","0")
-- ucic:set("qos",intf,"download","0")
-- ucic:set("qos",intf,"upload","0")
-- ucic:set("qos",intf,"enabled","0")
else
ucic:set("sqm",intf,"download","0")
ucic:set("sqm",intf,"upload","0")
ucic:set("sqm",intf,"enabled","0")
ucic:set("qos",intf,"download","0")
ucic:set("qos",intf,"upload","0")
ucic:set("qos",intf,"enabled","0")
end
end
ucic:save("sqm")

View file

@ -305,12 +305,22 @@ end
end
%>
<div class="cbi-value" data-index="5">
<label class="cbi-value-title"><%:Enable SQM%></label>
<div class="cbi-value-field">
<input class="cbi-input-checkbox" type="checkbox" name="sqmenabled" value="1" <% if uci:get("sqm",ifname,"enabled") == 1 then %>checked<% end %> />
<br />
<div class="cbi-value-description">
<%:You should disable SQM for LTE or any interfaces with variable speed.%>
</div>
</div>
</div>
<div class="cbi-value" data-index="6">
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
<div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
<br />
<div class="cbi-value-description">
<%:Used by Glorytun UDP. 0 to use default value.%>
<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
</div>
<!--
<br />
@ -320,13 +330,13 @@ end
-->
</div>
</div>
<div class="cbi-value" data-index="6">
<div class="cbi-value" data-index="7">
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
<div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
<br />
<div class="cbi-value-description">
<%:Used by Glorytun UDP. 0 to use default value.%>
<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
</div>
<!--
<br />