From 85a7df18aee052360f462ce52752f2ef25a536ea Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sun, 15 Nov 2020 00:39:33 +0800 Subject: [PATCH] luci-app-turboacc: bug fixes --- package/ctcgfw/luci-app-turboacc/Makefile | 2 +- .../luasrc/controller/turboacc.lua | 4 +- .../luasrc/model/cbi/turboacc.lua | 2 - .../root/etc/init.d/turboacc | 147 +++++++++--------- 4 files changed, 79 insertions(+), 76 deletions(-) diff --git a/package/ctcgfw/luci-app-turboacc/Makefile b/package/ctcgfw/luci-app-turboacc/Makefile index dfd78c845c..7e07b87fee 100644 --- a/package/ctcgfw/luci-app-turboacc/Makefile +++ b/package/ctcgfw/luci-app-turboacc/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-turboacc PKG_VERSION:=1.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPLv3.0+ diff --git a/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua b/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua index 5e2813e66f..259859fc1c 100644 --- a/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua +++ b/package/ctcgfw/luci-app-turboacc/luasrc/controller/turboacc.lua @@ -13,7 +13,7 @@ function index() end local function fastpath_status() - return luci.sys.call("[ x$(cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null) != x0 ] || lsmod | grep -q fast_classifier") == 0 + return luci.sys.call("{ [ -e /sys/module/xt_FLOWOFFLOAD/refcnt ] && [ x$(cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null) != x0 ]; } || lsmod | grep -q fast_classifier") == 0 end local function bbr_status() @@ -21,7 +21,7 @@ local function bbr_status() end local function fullconebat_status() - return luci.sys.call("[ x$(cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null) != x0 ]") == 0 + return luci.sys.call("[ -e /sys/module/xt_FULLCONENAT/refcnt ] && [ x$(cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null) != x0 ]") == 0 end local function dnscaching_status() diff --git a/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua b/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua index 20d6ff0bb2..12892733a1 100644 --- a/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua +++ b/package/ctcgfw/luci-app-turboacc/luasrc/model/cbi/turboacc.lua @@ -46,14 +46,12 @@ end if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA")) bbr_cca.default = 0 -bbr_cca.rmempty = false 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") then fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT")) fullcone_nat.default = 0 -fullcone_nat.rmempty = false fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively") end diff --git a/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc b/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc index 70bab74434..3064f305cc 100755 --- a/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc +++ b/package/ctcgfw/luci-app-turboacc/root/etc/init.d/turboacc @@ -20,6 +20,11 @@ inital_conf(){ config_get "dns_caching_mode" "config" "dns_caching_mode" "0" config_get "dns_caching_v4_dns" "config" "dns_caching_v4_dns" config_get "dns_caching_v6_dns" "config" "dns_caching_v6_dns" + + [ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" ] && { sw_flow="0"; hw_flow="0"; } + [ ! -e "/lib/modules/$(uname -r)/fast-classifier.ko" ] && { sfe_flow="0"; sfe_bridge="0"; sfe_ipv6="0"; } + [ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0" + [ ! -e "/lib/modules/$(uname -r)/xt_FULLCONENAT.ko" ] && fullcone_nat="0" } start_pdnsd() { @@ -33,87 +38,87 @@ global { server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可 status_ctl = on; paranoid=on; # 二次请求模式,如果请求主DNS服务器返回的是垃圾地址,就向备用服务器请求 - query_method=udp_only; - neg_domain_pol = off; + query_method=udp_only; + neg_domain_pol = off; par_queries = 400; # 最多同时请求数 min_ttl = 1h; # DNS结果最短缓存时间 max_ttl = 1w; # DNS结果最长缓存时间 timeout = 10; # DNS请求超时时间,单位秒 } -server { - label = "routine"; - ip = ${dns_caching_v4_dns}; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址 +server { + label = "routine"; + ip = ${dns_caching_v4_dns}; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址 timeout = 5; # DNS请求超时时间 reject = 74.125.127.102, # 以下是脏IP,也就是DNS污染一般会返回的结果,如果收到如下DNS结果会触发二次请求(TCP协议一般不会碰到脏IP) - 74.125.155.102, - 74.125.39.102, - 74.125.39.113, - 209.85.229.138, - 128.121.126.139, - 159.106.121.75, - 169.132.13.103, - 192.67.198.6, - 202.106.1.2, - 202.181.7.85, - 203.161.230.171, - 203.98.7.65, - 207.12.88.98, - 208.56.31.43, - 209.145.54.50, - 209.220.30.174, - 209.36.73.33, - 211.94.66.147, - 213.169.251.35, - 216.221.188.182, - 216.234.179.13, - 243.185.187.39, - 37.61.54.158, - 4.36.66.178, - 46.82.174.68, - 59.24.3.173, - 64.33.88.161, - 64.33.99.47, - 64.66.163.251, - 65.104.202.252, - 65.160.219.113, - 66.45.252.237, - 69.55.52.253, - 72.14.205.104, - 72.14.205.99, - 78.16.49.15, - 8.7.198.45, - 93.46.8.89, - 37.61.54.158, - 243.185.187.39, - 190.93.247.4, - 190.93.246.4, - 190.93.245.4, - 190.93.244.4, - 65.49.2.178, - 189.163.17.5, - 23.89.5.60, - 49.2.123.56, - 54.76.135.1, - 77.4.7.92, - 118.5.49.6, - 159.24.3.173, - 188.5.4.96, - 197.4.4.12, - 220.250.64.24, - 243.185.187.30, - 249.129.46.48, - 253.157.14.165; - reject_policy = fail; + 74.125.155.102, + 74.125.39.102, + 74.125.39.113, + 209.85.229.138, + 128.121.126.139, + 159.106.121.75, + 169.132.13.103, + 192.67.198.6, + 202.106.1.2, + 202.181.7.85, + 203.161.230.171, + 203.98.7.65, + 207.12.88.98, + 208.56.31.43, + 209.145.54.50, + 209.220.30.174, + 209.36.73.33, + 211.94.66.147, + 213.169.251.35, + 216.221.188.182, + 216.234.179.13, + 243.185.187.39, + 37.61.54.158, + 4.36.66.178, + 46.82.174.68, + 59.24.3.173, + 64.33.88.161, + 64.33.99.47, + 64.66.163.251, + 65.104.202.252, + 65.160.219.113, + 66.45.252.237, + 69.55.52.253, + 72.14.205.104, + 72.14.205.99, + 78.16.49.15, + 8.7.198.45, + 93.46.8.89, + 37.61.54.158, + 243.185.187.39, + 190.93.247.4, + 190.93.246.4, + 190.93.245.4, + 190.93.244.4, + 65.49.2.178, + 189.163.17.5, + 23.89.5.60, + 49.2.123.56, + 54.76.135.1, + 77.4.7.92, + 118.5.49.6, + 159.24.3.173, + 188.5.4.96, + 197.4.4.12, + 220.250.64.24, + 243.185.187.30, + 249.129.46.48, + 253.157.14.165; + reject_policy = fail; } -server { - label = "special"; # 这个随便写 - ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址 - port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持) +server { + label = "special"; # 这个随便写 + ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址 + port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持 proxy_only = on; - timeout = 5; -} + timeout = 5; +} source { owner=localhost; @@ -217,7 +222,7 @@ start(){ lsmod | grep -q fast_classifier || modprobe fast_classifier 2>"/dev/null" echo "${sfe_bridge}" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null" if [ "${sfe_ipv6}" -eq "1" ]; then - [ ! -f "/dev/sfe_ipv6" ] && mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0" + [ ! -e "/dev/sfe_ipv6" ] && mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0" else rm -f "/dev/sfe_ipv6" fi