add TCP-BBR option in Turbo ACC luci for kernel 4.9

This commit is contained in:
coolsnowwolf 2018-10-16 15:28:06 +08:00
parent 2057a12bd7
commit 2c836120dc
6 changed files with 26 additions and 4 deletions

View File

@ -4,4 +4,5 @@ config flow
option flow_offloading_hw '0'
option dns '0'
option dns_server '114.114.114.114,114.114.115.115'
option bbr '0'

View File

@ -6,10 +6,10 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Turbo ACC (SFE)
LUCI_DEPENDS:=+kmod-fast-classifier +pdnsd-alt @LINUX_4_9
LUCI_DEPENDS:=+kmod-fast-classifier +pdnsd-alt +kmod-tcp-bbr @LINUX_4_9
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=10
PKG_RELEASE:=11
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -27,6 +27,11 @@ ipv6.rmempty = false
ipv6.description = translate("Enable IPv6 Acceleration")
ipv6:depends("enabled", 1)
bbr = s:option(Flag, "bbr", translate("Enable BBR"))
bbr.default = 0
bbr.rmempty = false
bbr.description = translate("Bottleneck Bandwidth and Round-trip propagation time (BBR)")
dns = s:option(Flag, "dns", translate("DNS Acceleration"))
dns.default = 0
dns.rmempty = false

View File

@ -34,6 +34,12 @@ msgstr "IPv6 加速"
msgid "Enable IPv6 Acceleration"
msgstr "开启IPv6加速"
msgid "Enable BBR"
msgstr "启用 BBR"
msgid "Bottleneck Bandwidth and Round-trip propagation time (BBR)"
msgstr "BBR拥塞控制算法可以加强TCP应用表现但会降低路由器本机上的WIFI吞吐性能"
msgid "DNS Acceleration"
msgstr "DNS 加速"

View File

@ -3,6 +3,7 @@ config sfe 'config'
option enabled '1'
option ipv6 '0'
option wifi '0'
option bbr '0'
option dns '0'
option dns_server '114.114.114.114,114.114.115.115'

View File

@ -123,11 +123,14 @@ rr {
}
EOF
/usr/sbin/dnscache -c /var/etc/dnscache.conf -d && echo "Start DNS Cache"
[ -d /var/sbin ] || mkdir -p /var/sbin
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache
/var/sbin/dnscache -c /var/etc/dnscache.conf -d
echo "Start DNS Cache"
}
stop_pdnsd() {
kill $(pidof dnscache) >/dev/null 2>&1 || killall -9 dnscache >/dev/null 2>&1
kill $(pidof dnscache) >/dev/null 2>&1 || kill -9 $(ps | grep dnscache | grep -v grep | awk '{print $1}') >/dev/null 2>&1
echo "Stop DNS Cache"
}
@ -151,6 +154,7 @@ start(){
wifi=$(uci get sfe.config.wifi)
ipv6=$(uci get sfe.config.ipv6)
dns=$(uci get sfe.config.dns 2>/dev/null)
bbr=$(uci get sfe.config.bbr 2>/dev/null)
if [ $enable -eq 1 ]; then
echo "enable"
! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier)
@ -172,6 +176,11 @@ start(){
start_pdnsd
change_dns
fi
if [ $bbr -eq 1 ]; then
sysctl -w net.ipv4.tcp_congestion_control=bbr
else
sysctl -w net.ipv4.tcp_congestion_control=cubic
fi
if [ "$DNSMASQ_RESTART" = N ]; then
/etc/init.d/dnsmasq restart && echo "DNSMASQ change"
fi