mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
static-neighbor-reports: add package
Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local uci = require 'uci'.cursor()
|
||||
local ubus = require('ubus').connect()
|
||||
|
||||
local neighbor_reports = {}
|
||||
|
||||
local function hasKey(tab, key)
|
||||
for k, _ in pairs(tab) do
|
||||
if k == key then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
uci:foreach('static-neighbor-report', 'neighbor', function (config)
|
||||
if hasKey(config, "disabled") and config.disabled ~= '0' then
|
||||
return
|
||||
end
|
||||
|
||||
local bssid = ''
|
||||
local ssid = ''
|
||||
local neighbor_report = config['neighbor_report']
|
||||
|
||||
if hasKey(config, 'bssid') then bssid = config.bssid end
|
||||
if hasKey(config, 'ssid') then ssid = config.ssid end
|
||||
|
||||
for iface in config.iface:gmatch("%S+") do
|
||||
if not hasKey(neighbor_reports, iface) then
|
||||
neighbor_reports[iface] = {}
|
||||
end
|
||||
table.insert(neighbor_reports[iface], {bssid, ssid, neighbor_report})
|
||||
end
|
||||
end)
|
||||
|
||||
for k, v in pairs(neighbor_reports) do
|
||||
ubus:call('hostapd.' .. k, 'rrm_nr_set', {list=v})
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
config neighbor ap1
|
||||
option bssid 'f2:9e:c0:a5:a9:2c'
|
||||
option ssid 'Network'
|
||||
option neighbor_report 'f29ec0a5a92cff1900007a64090603016600'
|
||||
option iface 'net0 net1'
|
||||
option disabled '1'
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=60
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command /usr/lib/reload-neighbor-reports.lua
|
||||
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_raw_trigger "hostapd.*" 3000 /etc/init.d/static-neighbor-reports restart
|
||||
}
|
||||
Reference in New Issue
Block a user