add TCP-BBR option in Turbo ACC luci

This commit is contained in:
coolsnowwolf 2018-10-16 14:53:56 +08:00
parent 3b798eccce
commit 2057a12bd7
4 changed files with 25 additions and 6 deletions

View File

@ -6,10 +6,10 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Flow Offload
LUCI_DEPENDS:=+kmod-ipt-offload +pdnsd-alt @LINUX_4_14
LUCI_DEPENDS:=+kmod-ipt-offload +pdnsd-alt +kmod-tcp-bbr @LINUX_4_14
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=10
PKG_RELEASE:=11
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -21,6 +21,11 @@ hw.rmempty = true
hw.description = translate("Enable Hardware NAT (depends on hw capability like MTK 762x)")
hw:depends("flow_offloading", 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

@ -22,6 +22,12 @@ msgstr "开启 Flow Offloading 转发加速. (降低CPU占用 / 增强路由转
msgid "Enable Hardware NAT (depends on hw capability like MTK 762x)"
msgstr "启用硬件HWNAT加速依赖特定的硬件例如 MTK 762x 系列)"
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

@ -122,12 +122,15 @@ rr {
soa=localhost,root.localhost,42,86400,900,86400,86400;
}
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"
}
@ -148,10 +151,16 @@ revert_dns() {
start(){
dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null)
if [ $dns -eq 1 ]; then
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
uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading)
uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw)
uci commit firewall
@ -182,4 +191,3 @@ restart(){
/etc/init.d/firewall restart
}