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

Use speed only for glorytun or if no values set for SQM/QoS

This commit is contained in:
Ycarus 2019-03-22 20:27:13 +01:00
parent 67e6cbd987
commit 9db2c461dc
2 changed files with 41 additions and 19 deletions

View file

@ -215,19 +215,25 @@ function wizard_add()
end end
if downloadspeed ~= "0" and uploadspeed ~= "0" then 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,"download",downloadspeed)
ucic:set("sqm",intf,"upload",uploadspeed) ucic:set("sqm",intf,"upload",uploadspeed)
ucic:set("sqm",intf,"enabled","1") --ucic:set("sqm",intf,"enabled","1")
end
if ucic:get("qos",intf,"download") == "" then
ucic:set("qos",intf,"download",downloadspeed) ucic:set("qos",intf,"download",downloadspeed)
ucic:set("qos",intf,"upload",uploadspeed) ucic:set("qos",intf,"upload",uploadspeed)
ucic:set("qos",intf,"enabled","1") --ucic:set("qos",intf,"enabled","1")
else end
ucic:set("sqm",intf,"download","0") --else
ucic:set("sqm",intf,"upload","0") -- ucic:set("sqm",intf,"download","0")
ucic:set("sqm",intf,"enabled","0") -- ucic:set("sqm",intf,"upload","0")
ucic:set("qos",intf,"download","0") -- ucic:set("sqm",intf,"enabled","0")
ucic:set("qos",intf,"upload","0") -- ucic:set("qos",intf,"download","0")
ucic:set("qos",intf,"enabled","0") -- ucic:set("qos",intf,"upload","0")
-- ucic:set("qos",intf,"enabled","0")
end end
end end
ucic:save("sqm") ucic:save("sqm")

View file

@ -292,6 +292,9 @@ end
<% <%
local download = "" local download = ""
local upload = "" local upload = ""
download = uci:get("network",ifname,"downloadspeed")
upload = uci:get("network",ifname,"uploadspeed")
if download == "" or upload == "" then
if nixio.fs.access("/etc/init.d/sqm") then if nixio.fs.access("/etc/init.d/sqm") then
download = uci:get("sqm",ifname,"download") download = uci:get("sqm",ifname,"download")
upload = uci:get("sqm",ifname,"upload") upload = uci:get("sqm",ifname,"upload")
@ -299,15 +302,22 @@ end
download = uci:get("qos",ifname,"download") download = uci:get("qos",ifname,"download")
upload = uci:get("qos",ifname,"upload") upload = uci:get("qos",ifname,"upload")
end end
end
%> %>
<div class="cbi-value" data-index="5"> <div class="cbi-value" data-index="5">
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label> <label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger"> <input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
<br /> <br />
<div class="cbi-value-description">
<%:Used by Glorytun UDP. 0 to use default value.%>
</div>
<!--
<br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:Set value between 80-95% of max download speed link. 0 to disable SQM/QoS.%> <%:Set value between 80-95% of max download speed link. 0 to disable SQM/QoS.%>
</div> </div>
-->
</div> </div>
</div> </div>
<div class="cbi-value" data-index="6"> <div class="cbi-value" data-index="6">
@ -315,9 +325,15 @@ end
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger"> <input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
<br /> <br />
<div class="cbi-value-description">
<%:Used by Glorytun UDP. 0 to use default value.%>
</div>
<!--
<br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:Set value between 80-95% of max upload speed link. 0 to disable SQM/QoS.%> <%:Set value between 80-95% of max upload speed link. 0 to disable SQM/QoS.%>
</div> </div>
-->
</div> </div>
</div> </div>
</fieldset> </fieldset>