mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Initial support for DHCP range configuration
This commit is contained in:
parent
2ac8f4f716
commit
b778e77207
13 changed files with 427 additions and 10 deletions
30
scripts/lua/get_dhcp_config.lua
Normal file
30
scripts/lua/get_dhcp_config.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--
|
||||
-- (C) 2017-18 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
local json = require("dkjson")
|
||||
local dhcp_utils = require("dhcp_utils")
|
||||
require "lua_utils"
|
||||
|
||||
sendHTTPContentTypeHeader('text/json')
|
||||
|
||||
local ifid = _GET["ifid"]
|
||||
local rv = {data={}, sort={{"column_", "asc"}}, totalRows=0}
|
||||
local res = rv.data
|
||||
|
||||
if((ifid ~= nil) and (isAdministrator())) then
|
||||
interface.select(getInterfaceName(ifid))
|
||||
|
||||
for _, range in ipairs(dhcp_utils.listRanges(ifid)) do
|
||||
res[#res + 1] = {
|
||||
column_first_ip = range[1],
|
||||
column_last_ip = range[2],
|
||||
}
|
||||
|
||||
rv.totalRows = rv.totalRows + 1
|
||||
end
|
||||
end
|
||||
|
||||
print(json.encode(rv))
|
||||
Loading…
Add table
Add a link
Reference in a new issue