small-package/.github/diy/patches/luci-app-turboacc.patch

109 lines
4.4 KiB
Diff

--- a/luci-app-turboacc/luasrc/controller/turboacc.lua
+++ b/luci-app-turboacc/luasrc/controller/turboacc.lua
@@ -13,7 +13,7 @@ function index()
end
local function fastpath_status()
- return luci.sys.call("/etc/init.d/turboacc check_status fastpath") == 0
+ return luci.sys.call("/etc/init.d/turboacc check_status fastpath >/dev/null") == 0
end
local function bbr_status()
--- a/luci-app-turboacc/luasrc/model/cbi/turboacc.lua
+++ b/luci-app-turboacc/luasrc/model/cbi/turboacc.lua
@@ -10,7 +10,7 @@ s = m:section(TypedSection, "turboacc", "")
s.addremove = false
s.anonymous = true
-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.ko") then
+if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.ko") or nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_flow_offload.ko") then
sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading"))
sw_flow.default = 0
sw_flow.description = translate("Software based offloading for routing/NAT")
@@ -47,12 +47,14 @@ bbr_cca.default = 0
bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively")
end
+if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FULLCONENAT.ko") or nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_fullcone.ko") then
fullcone_nat = s:option(ListValue, "fullcone_nat", translate("FullCone NAT"))
fullcone_nat.default = 0
fullcone_nat:value("0", translate("Disable"))
fullcone_nat:value("1", translate("Compatible Mode"))
fullcone_nat:value("2", translate("High Performing Mode"))
fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively")
+end
if nixio.fs.access("/usr/sbin/pdnsd") or nixio.fs.access("/usr/bin/dnsforwarder") or nixio.fs.access("/usr/bin/dnsproxy") then
dns_caching = s:option(Flag, "dns_caching", translate("DNS Caching"))
--- a/luci-app-turboacc/root/etc/uci-defaults/luci-turboacc
+++ b/luci-app-turboacc/root/etc/uci-defaults/luci-turboacc
@@ -7,4 +7,9 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF
+ls /sys/module/shortcut_fe* >/dev/null 2>&1 && {
+uci -q del turboacc.config.sw_flow
+uci commit turboacc
+}
+
exit 0
--- a/luci-app-turboacc/root/etc/init.d/turboacc
+++ b/luci-app-turboacc/root/etc/init.d/turboacc
@@ -22,7 +22,7 @@ inital_conf(){
config_get "dns_caching_mode" "config" "dns_caching_mode" "0"
config_get "dns_caching_dns" "config" "dns_caching_dns"
- [ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" ] && { sw_flow="0"; hw_flow="0"; }
+ [[ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" && ! -e "/lib/modules/$(uname -r)/nft_flow_offload.ko" ]] && { sw_flow="0"; hw_flow="0"; }
[ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0"
}
@@ -346,10 +346,10 @@ restart(){
check_status(){
case "$1" in
"fastpath")
- if [ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ]; then
+ if [[ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null" || echo 0)" -ne "0" || "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ]]; then
echo -n "Flow Offloading"
exit 0
- elif [ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null")" -eq "0" ] && \
+ elif [[ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null")" -eq "0" || "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null")" -eq "0" ]] && \
[ -e /sys/kernel/debug/hnat/hnat_version ]; then
echo -n "MediaTek HWNAT"
exit 0
@@ -370,7 +370,7 @@ check_status(){
fi
;;
"fullconenat")
- if [ -z "$(iptables -t nat -L zone_wan_postrouting | grep -i fullcone)" ]; then
+ if [[ -z "$(iptables -t nat -L zone_wan_postrouting | grep -i fullcone)" && "$(cat "/sys/module/nft_fullcone/refcnt" 2>"/dev/null" || echo 0)" -eq "0" ]]; then
exit 1
else
exit 0
--- a/luci-app-turboacc/Makefile
+++ b/luci-app-turboacc/Makefile
@@ -7,6 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-turboacc
PKG_RELEASE:=$(COMMITCOUNT)
+PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-3.0-only
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org> & Lean <coolsnowwolf@gmail.com>
--- a/luci-app-turboacc/root/etc/config/turboacc
+++ b/luci-app-turboacc/root/etc/config/turboacc
@@ -3,7 +3,7 @@ config turboacc 'config'
option sw_flow '1'
option hw_flow '1'
option sfe_flow '1'
- option fullcone_nat '2'
+ option fullcone_nat '1'
option hw_wed '0'
option bbr_cca '0'
option dns_caching '0'