mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add SQM support
This commit is contained in:
		
							parent
							
								
									e6a3f4e720
								
							
						
					
					
						commit
						48e81ff30e
					
				
					 5 changed files with 84 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -75,7 +75,19 @@ function wizard_add()
 | 
			
		|||
		ucic:set("network",intf,"ipaddr",ipaddr)
 | 
			
		||||
		ucic:set("network",intf,"netmask",netmask)
 | 
			
		||||
		ucic:set("network",intf,"gateway",gateway)
 | 
			
		||||
 | 
			
		||||
		local downloadspeed = luci.http.formvalue("cbid.sqm.%s.download" % intf) or ""
 | 
			
		||||
		local uploadspeed = luci.http.formvalue("cbid.sqm.%s.upload" % intf) or ""
 | 
			
		||||
		if downloadspeed ~= "" and uploadspeed ~= "" then
 | 
			
		||||
			ucic:set("sqm",intf,"download",downloadspeed)
 | 
			
		||||
			ucic:set("sqm",intf,"upload",uploadspeed)
 | 
			
		||||
			ucic:set("sqm",intf,"enabled","1")
 | 
			
		||||
		else
 | 
			
		||||
			ucic:set("sqm",intf,"enabled","0")
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
	ucic:save("sqm")
 | 
			
		||||
	ucic:commit("sqm")
 | 
			
		||||
	ucic:save("network")
 | 
			
		||||
	ucic:commit("network")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -172,7 +184,7 @@ function wizard_add()
 | 
			
		|||
	local shadowsocks_key = luci.http.formvalue("shadowsocks_key")
 | 
			
		||||
	if shadowsocks_key ~= "" then
 | 
			
		||||
		ucic:set("shadowsocks-libev","sss0","key",shadowsocks_key)
 | 
			
		||||
		ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb")
 | 
			
		||||
		ucic:set("shadowsocks-libev","sss0","method","chacha20")
 | 
			
		||||
		ucic:set("shadowsocks-libev","sss0","server_port","65101")
 | 
			
		||||
		ucic:set("shadowsocks-libev","sss0","disabled",0)
 | 
			
		||||
		ucic:save("shadowsocks-libev")
 | 
			
		||||
| 
						 | 
				
			
			@ -581,11 +593,15 @@ function interfaces_status()
 | 
			
		|||
	    local connectivity
 | 
			
		||||
 | 
			
		||||
	    if ifname ~= "" and ifname ~= nil then
 | 
			
		||||
		    local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
 | 
			
		||||
		    if multipath_state == "" then
 | 
			
		||||
			connectivity = 'OK'
 | 
			
		||||
		    if fs.access("/sys/class/net/" .. ifname) then
 | 
			
		||||
			    local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
 | 
			
		||||
			    if multipath_state == "" then
 | 
			
		||||
				connectivity = 'OK'
 | 
			
		||||
			    else
 | 
			
		||||
				connectivity = 'ERROR'
 | 
			
		||||
			    end
 | 
			
		||||
		    else
 | 
			
		||||
			connectivity = 'ERROR'
 | 
			
		||||
			    connectivity = 'ERROR'
 | 
			
		||||
		    end
 | 
			
		||||
	    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -639,6 +655,8 @@ function interfaces_status()
 | 
			
		|||
			    multipath_available = 'ERROR'
 | 
			
		||||
			    if mArray.openmptcprouter["socks_service"] == true and connectivity == "OK" then
 | 
			
		||||
				    connectivity = 'ERROR'
 | 
			
		||||
			    elseif connectivity == "OK" then
 | 
			
		||||
				    connectivity = 'WARNING'
 | 
			
		||||
			    end
 | 
			
		||||
		    end
 | 
			
		||||
	    else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -156,6 +156,32 @@
 | 
			
		|||
			</div>
 | 
			
		||||
		    </div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<%
 | 
			
		||||
		if nixio.fs.access("/etc/init.d/sqm") then
 | 
			
		||||
		%>
 | 
			
		||||
		<div class="cbi-value">
 | 
			
		||||
		    <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="<%=uci:get("sqm",ifname,"download")%>" data-type="uinteger">
 | 
			
		||||
			<br />
 | 
			
		||||
			<div class="cbi-value-description">
 | 
			
		||||
			    <%:Set value between 80-95% of max download speed link. Used for SQM. Empty to disable.%>
 | 
			
		||||
			</div>
 | 
			
		||||
		    </div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="cbi-value">
 | 
			
		||||
		    <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="<%=uci:get("sqm",ifname,"upload")%>" data-type="uinteger">
 | 
			
		||||
			<br />
 | 
			
		||||
			<div class="cbi-value-description">
 | 
			
		||||
			    <%:Set value between 80-95% of max upload speed link. Used for SQM. Empty to disable.%>
 | 
			
		||||
			</div>
 | 
			
		||||
		    </div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<%
 | 
			
		||||
		end
 | 
			
		||||
		%>
 | 
			
		||||
	    </fieldset>
 | 
			
		||||
<%
 | 
			
		||||
	end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ MY_DEPENDS := \
 | 
			
		|||
    ca-bundle ca-certificates libustream-openssl \
 | 
			
		||||
    luci-mod-admin-full luci-app-firewall luci-app-glorytun luci-app-shadowsocks-libev luci-app-unbound luci-theme-openmptcprouter luci-base \
 | 
			
		||||
    luci-app-nginx-ha luci-app-omr-tracker \
 | 
			
		||||
    luci-app-qos \
 | 
			
		||||
    luci-app-sqm \
 | 
			
		||||
    luci-app-vnstat omr-quota luci-app-omr-quota \
 | 
			
		||||
    luci-app-mptcp luci-app-openmptcprouter luci-app-omr-bypass \
 | 
			
		||||
    omr-6in4 ip6tables-mod-nat luci-proto-ipv6 6to4 6in4 6rd iputils-traceroute6 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@
 | 
			
		|||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=openmptcprouter
 | 
			
		||||
PKG_VERSION:=0.92
 | 
			
		||||
PKG_VERSION:=0.94
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										33
									
								
								openmptcprouter/files/etc/uci-defaults/2040-omr-sqm
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								openmptcprouter/files/etc/uci-defaults/2040-omr-sqm
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
if [ "$(uci -q get sqm.wan1)" = "" ]; 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_advanced='0'
 | 
			
		||||
		set sqm.wan1.linklayer='none'
 | 
			
		||||
		set sqm.wan1.enabled='0'
 | 
			
		||||
		set sqm.wan1.interface='wan1'
 | 
			
		||||
		set sqm.wan1.download=''
 | 
			
		||||
		set sqm.wan1.upload=''
 | 
			
		||||
		set sqm.wan1.debug_logging='0'
 | 
			
		||||
		set sqm.wan1.verbosity='5'
 | 
			
		||||
		set sqm.wan2=queue
 | 
			
		||||
		set sqm.wan2.qdisc="fq_codel"
 | 
			
		||||
		set sqm.wan2.script="simple.qos"
 | 
			
		||||
		set sqm.wan2.qdisc_advanced='0'
 | 
			
		||||
		set sqm.wan2.linklayer='none'
 | 
			
		||||
		set sqm.wan2.enabled='0'
 | 
			
		||||
		set sqm.wan2.interface='wan2'
 | 
			
		||||
		set sqm.wan2.download=''
 | 
			
		||||
		set sqm.wan2.upload=''
 | 
			
		||||
		set sqm.wan2.debug_logging='0'
 | 
			
		||||
		set sqm.wan2.verbosity='5'
 | 
			
		||||
		commit sqm
 | 
			
		||||
	EOF
 | 
			
		||||
fi
 | 
			
		||||
rm -f /tmp/luci-indexcache
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue