mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 01:22:25 +00:00
ufpd: add fingerprint aging
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -305,22 +305,22 @@ global.ubus_object = {
|
||||
args: {
|
||||
macaddr: "",
|
||||
weight: false,
|
||||
age: 1
|
||||
age: 1,
|
||||
raw: false
|
||||
},
|
||||
call: function(req) {
|
||||
refresh_plugins();
|
||||
|
||||
let mac_list = req.args.macaddr ? [ req.args.macaddr ] : keys(devices);
|
||||
let ret = {};
|
||||
if (age)
|
||||
age = time() - (age * 1000);;
|
||||
let now = time();
|
||||
|
||||
for (let mac in mac_list) {
|
||||
let match_list = device_match_list(mac);
|
||||
if (!match_list)
|
||||
return libubus.STATUS_NOT_FOUND;
|
||||
|
||||
if (age && devices[mac].created > age)
|
||||
if (req.args.age && (now - devices[mac].created) < req.args.age)
|
||||
continue;
|
||||
|
||||
let cur_ret = { };
|
||||
@@ -340,6 +340,8 @@ global.ubus_object = {
|
||||
if (req.args.weight)
|
||||
cur_ret.weight[meta] = match_meta[1];
|
||||
}
|
||||
if (req.args.raw)
|
||||
ret[mac].raw = devices[mac];
|
||||
}
|
||||
|
||||
return req.args.macaddr ? ret[req.args.macaddr] : ret;
|
||||
|
||||
Reference in New Issue
Block a user