summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/root/usr')
-rwxr-xr-xmodules/luci-base/root/usr/libexec/rpcd/luci66
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json4
2 files changed, 69 insertions, 1 deletions
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci
index 2601512da6..10c1691b96 100755
--- a/modules/luci-base/root/usr/libexec/rpcd/luci
+++ b/modules/luci-base/root/usr/libexec/rpcd/luci
@@ -516,6 +516,72 @@ local methods = {
return { error = err }
end
end
+ },
+
+ getRealtimeStats = {
+ args = { mode = "interface", device = "eth0" },
+ call = function(args)
+ local util = require "luci.util"
+
+ local flags
+ if args.mode == "interface" then
+ flags = "-i %s" % util.shellquote(args.device)
+ elseif args.mode == "wireless" then
+ flags = "-r %s" % util.shellquote(args.device)
+ elseif args.mode == "conntrack" then
+ flags = "-c"
+ elseif args.mode == "load" then
+ flags = "-l"
+ else
+ return { error = "Invalid mode" }
+ end
+
+ local fd, err = io.popen("luci-bwc %s" % flags, "r")
+ if fd then
+ local parse = json.new()
+ local done
+
+ parse:parse("[")
+
+ while true do
+ local ln = fd:read("*l")
+ if not ln then
+ break
+ end
+
+ done, err = parse:parse((ln:gsub("%d+", "%1.0")))
+
+ if done then
+ err = "Unexpected JSON data"
+ end
+
+ if err then
+ break
+ end
+ end
+
+ fd:close()
+
+ done, err = parse:parse("]")
+
+ if err then
+ return { error = err }
+ elseif not done then
+ return { error = "Incomplete JSON data" }
+ else
+ return { result = parse:get() }
+ end
+ else
+ return { error = err }
+ end
+ end
+ },
+
+ getConntrackList = {
+ call = function()
+ local sys = require "luci.sys"
+ return { result = sys.net.conntrack() }
+ end
}
}
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index a09c6b4245..540fc72c10 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -43,9 +43,10 @@
"ubus": {
"file": [ "list", "read", "stat" ],
"iwinfo": [ "assoclist", "freqlist", "txpowerlist", "countrylist" ],
- "luci": [ "getDUIDHints", "getInitList", "getLocaltime", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints" ],
+ "luci": [ "getConntrackList", "getDUIDHints", "getInitList", "getLocaltime", "getRealtimeStats", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints" ],
"luci-rpc": [ "getBoardJSON", "getDHCPLeases", "getDSLStatus", "getHostHints", "getNetworkDevices", "getWirelessDevices" ],
"network.interface": [ "dump" ],
+ "network.rrdns": [ "lookup" ],
"network": [ "get_proto_handlers" ],
"system": [ "board", "info", "validate_firmware_image" ],
"uci": [ "changes", "get" ]
@@ -62,6 +63,7 @@
"/etc/sysupgrade.conf": [ "write" ],
"/sbin/block": [ "exec" ],
"/sbin/firstboot": [ "exec" ],
+ "/sbin/ifdown": [ "exec" ],
"/sbin/ifup": [ "exec" ],
"/sbin/reboot": [ "exec" ],
"/sbin/sysupgrade": [ "exec" ],