diff --git a/package/lean/luci-app-flowoffload/Makefile b/package/lean/luci-app-flowoffload/Makefile index 876161666..cb281091f 100644 --- a/package/lean/luci-app-flowoffload/Makefile +++ b/package/lean/luci-app-flowoffload/Makefile @@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for Flow Offload LUCI_DEPENDS:=@LINUX_4_14 LUCI_PKGARCH:=all PKG_VERSION:=1.0 -PKG_RELEASE:=2 +PKG_RELEASE:=5 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua b/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua index 05713274b..54c2e3792 100644 --- a/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua +++ b/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua @@ -1,11 +1,36 @@ module("luci.controller.flowoffload", package.seeall) function index() - if not nixio.fs.access("/etc/config/flowoffload") then + if not nixio.fs.access("/etc/config/firewall") then return end local page page = entry({"admin", "network", "flowoffload"}, cbi("flowoffload"), _(" Flow Offload ACC"), 101) page.i18n = "flowoffload" page.dependent = true + + entry({"admin", "network", "flowoffload", "status"}, call("action_status")) end + +local function is_running() + return luci.sys.call("iptables --list | grep FLOWOFFLOAD >/dev/null") == 0 +end + +local function is_bbr() + return luci.sys.call("sysctl net.ipv4.tcp_congestion_control | grep bbr >/dev/null") == 0 +end + +local function is_fullcone() + return luci.sys.call("iptables -t nat -L -n --line-numbers | grep FULLCONENAT >/dev/null") == 0 +end + +function action_status() + luci.http.prepare_content("application/json") + luci.http.write_json({ + run_state = is_running(), + down_state = is_bbr(), + up_state = is_fullcone() + }) +end + + diff --git a/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua b/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua index f0d5a730d..48a7c58ce 100644 --- a/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua +++ b/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua @@ -1,25 +1,25 @@ local m,s,o local SYS = require "luci.sys" - -if SYS.call("iptables --list | grep FLOWOFFLOAD >/dev/null") == 0 then - Status = translate("Linux Flow offload Forwarding Engine is Running") -else - Status = translate("Linux Flow offload Forwarding Engine is Not Running") -end - -m = Map("flowoffload") +m = Map("firewall") m.title = translate("Linux Flow Offload Forwarding Engine Settings") m.description = translate("Opensource Linux Flow Offload driver (Fast Path or HWNAT)") +m:append(Template("flow/status")) -s = m:section(TypedSection, "flowoffload", "") +s = m:section(TypedSection, "defaults", "") s.addremove = false s.anonymous = true -s.description = translate(string.format("%s

", Status)) -enable = s:option(Flag, "enabled", translate("Enable")) -enable.default = 0 -enable.rmempty = false +flow = s:option(Flag, "flow_offloading", translate("Enable")) +flow.default = 0 +flow.rmempty = false +flow.description = translate("Enable software flow offloading for connections. (decrease cpu load / increase routing throughput)") + +hw = s:option(Flag, "flow_offloading_hw", translate("HWNAT")) +hw.default = 0 +hw.rmempty = false +hw.description = translate("Enable Hardware NAT (depends on hw capability like MTK 762x)") + return m diff --git a/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm b/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm new file mode 100644 index 000000000..89aeccbef --- /dev/null +++ b/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm @@ -0,0 +1,21 @@ +
+ <%:Running Status%> + + + + +
FLOW 加速状态<%:Collecting data...%>
BBR 加速<%:Collecting data...%>
FULLCONE NAT加速<%:Collecting data...%>
+
+ + diff --git a/package/lean/luci-app-flowoffload/root/etc/config/flowoffload b/package/lean/luci-app-flowoffload/root/etc/config/flowoffload deleted file mode 100644 index 10fbf33f8..000000000 --- a/package/lean/luci-app-flowoffload/root/etc/config/flowoffload +++ /dev/null @@ -1,4 +0,0 @@ - -config flowoffload 'config' - option enabled '1' - diff --git a/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload b/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload index 627b0d7fd..b9490ea0a 100755 --- a/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload +++ b/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload @@ -1,41 +1,9 @@ #!/bin/sh /etc/rc.common # Copyright (c) 2011-2015 OpenWrt.org -START=30 - -re=0 - -start(){ - enable=$(uci get flowoffload.config.enabled 2>/dev/null) - if [ $enable -eq 1 ]; then - echo "enable" - sed -i '/FLOWOFFLOAD/d' /etc/firewall.user - echo "iptables -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD" >> /etc/firewall.user - if [ $re -eq 0 ]; then - echo $re - /etc/init.d/firewall restart - fi - fi -} - -stop(){ - echo "stop" - iptables -D FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD - enable=$(uci get flowoffload.config.enabled 2>/dev/null) - if [ $enable -ne 1 ]; then - echo "disable" - sed -i '/FLOWOFFLOAD/d' /etc/firewall.user - if [ $re -ne 1 ]; then - echo $re - /etc/init.d/firewall restart - fi - fi -} +START=99 restart(){ - re=1 - stop - start /etc/init.d/firewall restart } diff --git a/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload b/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload deleted file mode 100755 index 713816d55..000000000 --- a/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@flowoffload[-1] - add ucitrack flowoffload - set ucitrack.@flowoffload[-1].init=flowoffload - commit ucitrack -EOF - -/etc/init.d/flowoffload enable - -rm -f /tmp/luci-indexcache -exit 0 diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index 34c7b7f04..14582696f 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -13,7 +13,7 @@ FEATURES:=squashfs ext4 vdi vmdk pcmcia targz fpu SUBTARGETS:=generic legacy geode 64 MAINTAINER:=Felix Fietkau -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 KERNELNAME:=bzImage