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

tun0 sqm autorate wizard config

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-04-02 19:26:04 +02:00
parent 3e47ecf0c3
commit e992652783
2 changed files with 31 additions and 9 deletions

View file

@ -258,6 +258,8 @@ function wizard_add()
end
-- Set interfaces settings
local downloadmax = 0
local uploadmax = 0
local interfaces = luci.http.formvaluetable("intf")
for intf, _ in pairs(interfaces) do
local label = luci.http.formvalue("cbid.network.%s.label" % intf) or ""
@ -462,6 +464,7 @@ function wizard_add()
end
ucic:set("network",intf,"downloadspeed",downloadspeed)
ucic:set("qos",intf,"download",math.ceil(downloadspeed*95/100))
downloadmax = downloadmax + tonumber(downloadspeed)
else
ucic:delete("network",intf,"downloadspeed")
ucic:set("sqm",intf,"download","0")
@ -477,6 +480,7 @@ function wizard_add()
end
ucic:set("network",intf,"uploadspeed",uploadspeed)
ucic:set("qos",intf,"upload",math.ceil(uploadspeed*95/100))
uploadmax = uploadmax + tonumber(uploadspeed)
else
ucic:delete("network",intf,"uploadspeed")
ucic:set("sqm",intf,"upload","0")
@ -547,6 +551,14 @@ function wizard_add()
vpn_intf = "bonding-omrvpn"
ucic:set("network","omrvpn","proto","bonding")
end
if downloadmax ~= 0 and uploadmax ~= 0 then
ucic:set("sqm","omrvpn","max_download",downloadmax)
ucic:set("sqm","omrvpn","max_upload",uploadmax)
ucic:set("sqm","omrvpn","download",math.ceil(downloadmax*50/100))
ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
end
if vpn_intf ~= "" then
ucic:set("network","omrvpn","device",vpn_intf)
ucic:set("sqm","omrvpn","interface",vpn_intf)

View file

@ -6,8 +6,8 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
uci -q batch <<-EOF >/dev/null
delete sqm.eth1
set sqm.wan1=queue
set sqm.wan1.qdisc="fq_codel"
set sqm.wan1.script="simple.qos"
set sqm.wan1.qdisc="cake"
set sqm.wan1.script="piece_of_cake.qos"
set sqm.wan1.qdisc_advanced='0'
set sqm.wan1.linklayer='none'
set sqm.wan1.enabled='1'
@ -19,8 +19,8 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
set sqm.wan1.iqdisc_opts='autorate-ingress dual-dsthost'
set sqm.wan1.eqdisc_opts='dual-srchost'
set sqm.wan2=queue
set sqm.wan2.qdisc="fq_codel"
set sqm.wan2.script="simple.qos"
set sqm.wan2.qdisc="cake"
set sqm.wan2.script="piece_of_cake.qos"
set sqm.wan2.qdisc_advanced='0'
set sqm.wan2.linklayer='none'
set sqm.wan2.enabled='1'
@ -37,8 +37,8 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
wan3="$(uci -q get network.wan3.device)"
uci -q batch <<-EOF >/dev/null
set sqm.wan3=queue
set sqm.wan3.qdisc="fq_codel"
set sqm.wan3.script="simple.qos"
set sqm.wan3.qdisc="cake"
set sqm.wan3.script="piece_of_cake.qos"
set sqm.wan3.qdisc_advanced='0'
set sqm.wan3.linklayer='none'
set sqm.wan3.enabled='1'
@ -56,8 +56,8 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
wan4="$(uci -q get network.wan4.device)"
uci -q batch <<-EOF >/dev/null
set sqm.wan4=queue
set sqm.wan4.qdisc="fq_codel"
set sqm.wan4.script="simple.qos"
set sqm.wan4.qdisc="cake"
set sqm.wan4.script="piece_of_cake.qos"
set sqm.wan4.qdisc_advanced='0'
set sqm.wan4.linklayer='none'
set sqm.wan4.enabled='1'
@ -74,7 +74,7 @@ if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then
fi
fi
if [ "$(uci -q get sqm.omrvpn)" = "" ]; then
if [ "$(uci -q get sqm.omrvpn)" = "" ] || [ -z "$(uci -q get sqm.omrvpn.delay_thr_ms)" ]; then
uci -q batch <<-EOF >/dev/null
set sqm.omrvpn=queue
set sqm.omrvpn.qdisc="cake"
@ -89,6 +89,16 @@ if [ "$(uci -q get sqm.omrvpn)" = "" ]; then
set sqm.omrvpn.verbosity='5'
set sqm.omrvpn.overhead='40'
set sqm.omrvpn.iqdisc_opts='autorate-ingress'
set sqm.omrvpn.delay_thr_ms='300'
set sqm.omrvpn.reflector_ping_interval_s='0.5'
set sqm.omrvpn.download='20000'
set sqm.omrvpn.min_download='1000'
set sqm.omrvpn.max_download='60000'
set sqm.omrvpn.upload='20000'
set sqm.omrvpn.min_upload='1000'
set sqm.omrvpn.max_upload='60000'
set sqm.omrvpn.enable_sleep_function='0'
set sqm.omrvpn.autorate='1'
commit sqm
EOF
fi