mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
upgrade luci flow to Sanhe ACC center
This commit is contained in:
parent
8091524f8a
commit
74e0c9f3bf
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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("<strong><font color=\"green\">Linux Flow offload Forwarding Engine is Running</font></strong>")
|
||||
else
|
||||
Status = translate("<strong><font color=\"red\">Linux Flow offload Forwarding Engine is Not Running</font></strong>")
|
||||
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<br /><br />", 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
|
||||
|
@ -0,0 +1,21 @@
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Running Status%></legend>
|
||||
<table width="100%" cellspacing="10" id="_xlnetacc_status_table">
|
||||
<tr><td width="33%">FLOW 加速状态</td><td id="_run_state"><em><%:Collecting data...%></em></td></tr>
|
||||
<tr><td width="33%">BBR 加速</td><td id="_down_state"><em><%:Collecting data...%></em></td></tr>
|
||||
<tr><td width="33%">FULLCONE NAT加速</td><td id="_up_state"><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var run_state = document.getElementById('_run_state');
|
||||
var down_state = document.getElementById('_down_state');
|
||||
var up_state = document.getElementById('_up_state');
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "flowoffload", "status")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
run_state.innerHTML = status.run_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
down_state.innerHTML = status.down_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
up_state.innerHTML = status.up_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
});
|
||||
//]]></script>
|
@ -1,4 +0,0 @@
|
||||
|
||||
config flowoffload 'config'
|
||||
option enabled '1'
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
@ -13,7 +13,7 @@ FEATURES:=squashfs ext4 vdi vmdk pcmcia targz fpu
|
||||
SUBTARGETS:=generic legacy geode 64
|
||||
MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
KERNEL_PATCHVER:=4.9
|
||||
KERNEL_PATCHVER:=4.14
|
||||
|
||||
KERNELNAME:=bzImage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user