mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 02:48:18 +00:00
uspot: accounting: s/radius_stop/client_kick/
radius_stop() had nothing to do with RADIUS. Simplify the function prototype by handling spotfilter args internally. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
committed by
John Crispin
parent
dfdf25834c
commit
60c708dce9
@@ -84,19 +84,6 @@ function radius_call(interface, mac, payload) {
|
|||||||
fs.unlink(path);
|
fs.unlink(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function radius_stop(interface, mac, payload, remove) {
|
|
||||||
if (!radius_available(interface, mac))
|
|
||||||
return;
|
|
||||||
debug(interface, mac, 'stopping accounting');
|
|
||||||
payload.interface = interface;
|
|
||||||
payload.address = mac;
|
|
||||||
ubus.call('spotfilter', remove ? 'client_remove' : 'client_set', payload);
|
|
||||||
system('conntrack -D -s ' + clients[interface][mac].ip4addr + ' -m 2');
|
|
||||||
if (clients[interface][mac].accounting)
|
|
||||||
clients[interface][mac].timeout.cancel();
|
|
||||||
delete clients[interface][mac];
|
|
||||||
}
|
|
||||||
|
|
||||||
function radius_acct(interface, mac, payload) {
|
function radius_acct(interface, mac, payload) {
|
||||||
let state = ubus.call('spotfilter', 'client_get', {
|
let state = ubus.call('spotfilter', 'client_get', {
|
||||||
interface,
|
interface,
|
||||||
@@ -203,19 +190,35 @@ function client_add(interface, mac, state) {
|
|||||||
clients[interface][mac].timeout = uloop.timer(interval, () => radius_interim(interface, mac));
|
clients[interface][mac].timeout = uloop.timer(interval, () => radius_interim(interface, mac));
|
||||||
}
|
}
|
||||||
|
|
||||||
function client_remove(interface, mac, reason) {
|
function client_kick(interface, mac, remove) {
|
||||||
syslog(interface, mac, reason);
|
debug(interface, mac, 'stopping accounting');
|
||||||
radius_stop(interface, mac, {}, true);
|
let payload = {
|
||||||
}
|
interface,
|
||||||
|
address: mac,
|
||||||
function client_flush(interface, mac, reason) {
|
...(remove ? {} : {
|
||||||
syslog(interface, mac, reason);
|
|
||||||
radius_stop(interface, mac, {
|
|
||||||
state: 0,
|
state: 0,
|
||||||
dns_state: 1,
|
dns_state: 1,
|
||||||
accounting: [],
|
accounting: [],
|
||||||
flush: true,
|
flush: true,
|
||||||
});
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
ubus.call('spotfilter', remove ? 'client_remove' : 'client_set', payload);
|
||||||
|
system('conntrack -D -s ' + clients[interface][mac].ip4addr + ' -m 2');
|
||||||
|
|
||||||
|
if (clients[interface][mac].accounting)
|
||||||
|
clients[interface][mac].timeout.cancel();
|
||||||
|
delete clients[interface][mac];
|
||||||
|
}
|
||||||
|
|
||||||
|
function client_remove(interface, mac, reason) {
|
||||||
|
syslog(interface, mac, reason);
|
||||||
|
client_kick(interface, mac, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function client_flush(interface, mac, reason) {
|
||||||
|
syslog(interface, mac, reason);
|
||||||
|
client_kick(interface, mac, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user