• R/O
  • HTTP
  • SSH
  • HTTPS

luci: Commit

LuCI - OpenWrt Configuration Interface


Commit MetaInfo

Révision720dfdd7487aa7fca94c0635b31b4ca56245c888 (tree)
l'heure2022-05-12 22:37:57
AuteurTianling Shen <cnsztl@immo...>
CommiterTianling Shen

Message de Log

eluci-app-turboacc: drop shortcut-fe support

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>

Change Summary

Modification

--- a/applications/luci-app-turboacc/Makefile
+++ b/applications/luci-app-turboacc/Makefile
@@ -11,28 +11,22 @@ PKG_RELEASE:=$(COMMITCOUNT)
1111 PKG_LICENSE:=GPL-3.0-only
1212 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
1313
14-LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE
14+LUCI_TITLE:=LuCI support for flow offloading
1515 LUCI_DEPENDS:=+pdnsd-alt \
1616 +PACKAGE_TURBOACC_INCLUDE_BBR_CCA:kmod-tcp-bbr \
1717 +PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER:dnsforwarder \
1818 +PACKAGE_TURBOACC_INCLUDE_DNSPROXY:dnsproxy \
19- +PACKAGE_TURBOACC_INCLUDE_OFFLOADING:kmod-nft-offload \
20- +PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE:kmod-fast-classifier
19+ +PACKAGE_TURBOACC_INCLUDE_OFFLOADING:kmod-nft-offload
2120 LUCI_PKGARCH:=all
2221
2322 define Package/luci-app-turboacc/config
2423 config PACKAGE_TURBOACC_INCLUDE_OFFLOADING
2524 bool "Include Flow Offload"
26- depends on PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE=n
2725 default y
2826
29-config PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE
30- bool "Include Shortcut-FE"
31- default n
32-
3327 config PACKAGE_TURBOACC_INCLUDE_BBR_CCA
3428 bool "Include BBR CCA"
35- default y
29+ default n
3630
3731 config PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER
3832 bool "Include DNSForwarder"
@@ -47,8 +41,7 @@ PKG_CONFIG_DEPENDS:= \
4741 CONFIG_PACKAGE_TURBOACC_INCLUDE_BBR_CCA \
4842 CONFIG_PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER \
4943 CONFIG_PACKAGE_TURBOACC_INCLUDE_DNSPROXY \
50- CONFIG_PACKAGE_TURBOACC_INCLUDE_OFFLOADING \
51- CONFIG_PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE
44+ CONFIG_PACKAGE_TURBOACC_INCLUDE_OFFLOADING
5245
5346 include ../../luci.mk
5447
--- a/applications/luci-app-turboacc/luasrc/controller/turboacc.lua
+++ b/applications/luci-app-turboacc/luasrc/controller/turboacc.lua
@@ -4,6 +4,7 @@ function index()
44 if not nixio.fs.access("/etc/config/turboacc") then
55 return
66 end
7+
78 local page
89 page = entry({"admin", "network", "turboacc"}, cbi("turboacc"), _("Turbo ACC Center"), 101)
910 page.i18n = "turboacc"
--- a/applications/luci-app-turboacc/luasrc/model/cbi/turboacc.lua
+++ b/applications/luci-app-turboacc/luasrc/model/cbi/turboacc.lua
@@ -1,4 +1,7 @@
1-local kernel_version = luci.sys.exec("echo -n $(uname -r)")
1+local fs = require "nixio.fs"
2+
3+local boardinfo = luci.util.ubus("system", "board") or {}
4+local m, s, o
25
36 m = Map("turboacc")
47 m.title = translate("Turbo ACC Acceleration Settings")
@@ -6,74 +9,54 @@ m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardw
69
710 m:append(Template("turboacc/status"))
811
9-s = m:section(TypedSection, "turboacc", "")
12+s = m:section(TypedSection, "turboacc")
1013 s.addremove = false
1114 s.anonymous = true
1215
13-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_flow_offload.ko") then
14-sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading"))
15-sw_flow.default = 0
16-sw_flow.description = translate("Software based offloading for routing/NAT")
17-sw_flow:depends("sfe_flow", 0)
18-end
19-
20-if luci.sys.call("cat /etc/openwrt_release | grep -q mt762") == 0 then
21-hw_flow = s:option(Flag, "hw_flow", translate("Hardware flow offloading"))
22-hw_flow.default = 0
23-hw_flow.description = translate("Requires hardware NAT support. Implemented at least for mt762x")
24-hw_flow:depends("sw_flow", 1)
16+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_flow_offload.ko") then
17+ o = s:option(Flag, "sw_flow", translate("Software flow offloading"))
18+ o.default = 0
19+ o.description = translate("Software based offloading for routing/NAT")
20+
21+ if boardinfo.release.target:match("(mt762[0-9])$") then
22+ o = s:option(Flag, "hw_flow", translate("Hardware flow offloading"))
23+ o.default = 0
24+ o.description = translate("Requires hardware NAT support. Implemented at least for mt762x")
25+ o:depends("sw_flow", 1)
26+ end
2527 end
2628
27-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/fast-classifier.ko") then
28-sfe_flow = s:option(Flag, "sfe_flow", translate("Shortcut-FE flow offloading"))
29-sfe_flow.default = 0
30-sfe_flow.description = translate("Shortcut-FE based offloading for routing/NAT")
31-sfe_flow:depends("sw_flow", 0)
29+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_fullcone.ko") then
30+ o = s:option(Flag, "fullcone_nat", translate("FullCone NAT"))
31+ o.default = 0
32+ o.description = translate("Using FullCone NAT can improve gaming performance effectively")
3233 end
3334
34-sfe_bridge = s:option(Flag, "sfe_bridge", translate("Bridge Acceleration"))
35-sfe_bridge.default = 0
36-sfe_bridge.description = translate("Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)")
37-sfe_bridge:depends("sfe_flow", 1)
38-
39-if nixio.fs.access("/proc/sys/net/ipv6") then
40-sfe_ipv6 = s:option(Flag, "sfe_ipv6", translate("IPv6 Acceleration"))
41-sfe_ipv6.default = 0
42-sfe_ipv6.description = translate("Enable IPv6 Acceleration")
43-sfe_ipv6:depends("sfe_flow", 1)
35+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/tcp_bbr.ko") then
36+ o = s:option(Flag, "bbr_cca", translate("BBR CCA"))
37+ o.default = 0
38+ o.description = translate("Using BBR CCA can improve TCP network performance effectively")
4439 end
4540
46-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then
47-bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA"))
48-bbr_cca.default = 0
49-bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively")
50-end
51-
52-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_fullcone.ko") then
53-fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT"))
54-fullcone_nat.default = 0
55-fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively")
56-end
57-
58-dns_caching = s:option(Flag, "dns_caching", translate("DNS Caching"))
59-dns_caching.default = 0
60-dns_caching.rmempty = false
61-dns_caching.description = translate("Enable DNS Caching and anti ISP DNS pollution")
41+o = s:option(Flag, "dns_caching", translate("DNS Caching"))
42+o.default = 0
43+o.rmempty = false
44+o.description = translate("Enable DNS Caching and anti ISP DNS pollution")
6245
63-dns_caching_mode = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("DNS Program"))
64-dns_caching_mode:value("1", translate("Using PDNSD to query and cache"))
65-if nixio.fs.access("/usr/bin/dnsforwarder") then
66-dns_caching_mode:value("2", translate("Using DNSForwarder to query and cache"))
46+o = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("DNS Program"))
47+o:value("1", translate("Using PDNSD to query and cache"))
48+if fs.access("/usr/bin/dnsforwarder") then
49+ o:value("2", translate("Using DNSForwarder to query and cache"))
6750 end
68-if nixio.fs.access("/usr/bin/dnsproxy") then
69-dns_caching_mode:value("3", translate("Using DNSProxy to query and cache"))
51+if fs.access("/usr/bin/dnsproxy") then
52+ o:value("3", translate("Using DNSProxy to query and cache"))
7053 end
71-dns_caching_mode.default = 1
72-dns_caching_mode:depends("dns_caching", 1)
54+o.default = 1
55+o:depends("dns_caching", 1)
7356
74-dns_caching_dns = s:option(Value, "dns_caching_dns", translate("Upsteam DNS Server"))
75-dns_caching_dns.default = "114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8"
76-dns_caching_dns.description = translate("Muitiple DNS server can saperate with ','")
77-dns_caching_dns:depends("dns_caching", 1)
57+o = s:option(Value, "dns_caching_dns", translate("Upsteam DNS Server"))
58+o.default = "114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8"
59+o.description = translate("Muitiple DNS server can saperate with ','")
60+o:depends("dns_caching", 1)
7861
7962 return m
--- a/applications/luci-app-turboacc/luasrc/view/turboacc/status.htm
+++ b/applications/luci-app-turboacc/luasrc/view/turboacc/status.htm
@@ -10,12 +10,12 @@
1010
1111 <script type="text/javascript">//<![CDATA[
1212 var fastpath_state = document.getElementById('_fastpath_state');
13- var bbr_state = document.getElementById('_bbr_state');
1413 var fullconenat_state = document.getElementById('_fullconenat_state');
14+ var bbr_state = document.getElementById('_bbr_state');
1515 var dnscaching_state = document.getElementById('_dnscaching_state');
1616 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "turboacc", "status")%>', null, function(x, status) {
1717 if ( x && x.status == 200 ) {
18- fastpath_state.innerHTML = status.fastpath_state ? '<em><b style=color:green><%=luci.sys.exec("/etc/init.d/turboacc check_status fastpath")%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
18+ fastpath_state.innerHTML = status.fastpath_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
1919 fullconenat_state.innerHTML = status.fullconenat_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
2020 bbr_state.innerHTML = status.bbr_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
2121 dnscaching_state.innerHTML = status.dnscaching_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
--- a/applications/luci-app-turboacc/root/etc/config/turboacc
+++ b/applications/luci-app-turboacc/root/etc/config/turboacc
@@ -2,9 +2,6 @@
22 config turboacc 'config'
33 option sw_flow '1'
44 option hw_flow '1'
5- option sfe_flow '1'
6- option sfe_bridge '1'
7- option sfe_ipv6 '0'
85 option fullcone_nat '1'
96 option bbr_cca '0'
107 option dns_caching '0'
--- a/applications/luci-app-turboacc/root/etc/init.d/turboacc
+++ b/applications/luci-app-turboacc/root/etc/init.d/turboacc
@@ -13,9 +13,6 @@ inital_conf(){
1313 config_load "turboacc"
1414 config_get "sw_flow" "config" "sw_flow" "0"
1515 config_get "hw_flow" "config" "hw_flow" "0"
16- config_get "sfe_flow" "config" "sfe_flow" "0"
17- config_get "sfe_bridge" "config" "sfe_bridge" "0"
18- config_get "sfe_ipv6" "config" "sfe_ipv6" "0"
1916 config_get "bbr_cca" "config" "bbr_cca" "0"
2017 config_get "fullcone_nat" "config" "fullcone_nat" "0"
2118 config_get "dns_caching" "config" "dns_caching" "0"
@@ -23,7 +20,6 @@ inital_conf(){
2320 config_get "dns_caching_dns" "config" "dns_caching_dns"
2421
2522 [ ! -e "/lib/modules/$(uname -r)/nft_flow_offload.ko" ] && { sw_flow="0"; hw_flow="0"; }
26- [ ! -e "/lib/modules/$(uname -r)/fast-classifier.ko" ] && { sfe_flow="0"; sfe_bridge="0"; sfe_ipv6="0"; }
2723 [ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0"
2824 [ ! -e "/lib/modules/$(uname -r)/nft_fullcone.ko" ] && fullcone_nat="0"
2925 }
@@ -236,16 +232,6 @@ start(){
236232 uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
237233 uci commit firewall
238234
239- [ "${sw_flow}" -ne "1" ] && [ "${sfe_flow}" -eq "1" ] && {
240- lsmod | grep -q fast_classifier || modprobe fast_classifier 2>"/dev/null"
241- echo "${sfe_bridge}" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
242- if [ "${sfe_ipv6}" -eq "1" ]; then
243- [ -e "/dev/sfe_ipv6" ] || mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0"
244- else
245- rm -f "/dev/sfe_ipv6"
246- fi
247- }
248-
249235 if [ "${bbr_cca}" -eq "1" ]; then
250236 sysctl -w net.ipv4.tcp_congestion_control="bbr"
251237 else
@@ -288,12 +274,6 @@ stop(){
288274 uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
289275 uci commit firewall
290276
291- [ "${sfe_flow}" -eq "1" ] || {
292- echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
293- rm -f "/dev/sfe_ipv6"
294- lsmod | grep -q fast_classifier && rmmod "fast_classifier" 2>"/dev/null"
295- }
296-
297277 stop_dnscache
298278 revert_dns
299279
@@ -319,18 +299,8 @@ restart(){
319299 check_status(){
320300 case "$1" in
321301 "fastpath")
322- if [ "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ]; then
323- echo -n "Flow Offloading"
324- exit 0
325- elif lsmod | grep -q "ecm"; then
326- echo -n "QCA-NSS-ECM"
327- exit 0
328- elif lsmod | grep -q "fast_classifier"; then
329- echo -n "Shortcut-FE"
330- exit 0
331- else
332- exit 1
333- fi
302+ [ "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ] && \
303+ exit 0 || exit 1
334304 ;;
335305 "fullconenat")
336306 [ "$(cat "/sys/module/nft_fullcone/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ] && \
Afficher sur ancien navigateur de dépôt.