mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 01:52:51 +00:00
spotfilter: move accounting totals to "acct_data" table
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
committed by
John Crispin
parent
39510a6728
commit
e30cfbf36b
@@ -289,10 +289,12 @@ static void client_dump(struct interface *iface, struct client *cl)
|
||||
interface_dump_action(&b, iface, cl->data.dns_class);
|
||||
blobmsg_close_table(&b, c);
|
||||
|
||||
c = blobmsg_open_table(&b, "acct_data");
|
||||
blobmsg_add_u64(&b, "packets_ul", cl->data.packets_ul);
|
||||
blobmsg_add_u64(&b, "packets_dl", cl->data.packets_dl);
|
||||
blobmsg_add_u64(&b, "bytes_ul", cl->data.bytes_ul);
|
||||
blobmsg_add_u64(&b, "bytes_dl", cl->data.bytes_dl);
|
||||
blobmsg_close_table(&b, c);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -100,10 +100,10 @@ case 'clients':
|
||||
time: val.data.connect ? t - val.data.connect : 0,
|
||||
ip4addr: val.ip4addr || '',
|
||||
ip6addr: val.ip6addr || '',
|
||||
packets_ul: val.packets_ul || 0,
|
||||
bytes_ul: val.bytes_ul || 0,
|
||||
packets_dl: val.packets_dl || 0,
|
||||
bytes_dl: val.bytes_dl || 0,
|
||||
packets_ul: val.acct_data.packets_ul || 0,
|
||||
bytes_ul: val.acct_data.bytes_ul || 0,
|
||||
packets_dl: val.acct_data.packets_dl || 0,
|
||||
bytes_dl: val.acct_data.bytes_dl || 0,
|
||||
};
|
||||
}
|
||||
printf('%.J\n', res);
|
||||
|
||||
@@ -67,12 +67,12 @@ function radius_acct(interface, mac, payload) {
|
||||
payload = radius_init(interface, mac, payload);
|
||||
payload.acct = true;
|
||||
payload.session_time = time() - state.data.connect;
|
||||
payload.output_octets = state.bytes_dl & 0xffffffff;
|
||||
payload.input_octets = state.bytes_ul & 0xffffffff;
|
||||
payload.output_gigawords = state.bytes_dl >> 32;
|
||||
payload.input_gigawords = state.bytes_ul >> 32;
|
||||
payload.output_packets = state.packets_dl;
|
||||
payload.input_packets = state.packets_ul;
|
||||
payload.output_octets = state.acct_data.bytes_dl & 0xffffffff;
|
||||
payload.input_octets = state.acct_data.bytes_ul & 0xffffffff;
|
||||
payload.output_gigawords = state.acct_data.bytes_dl >> 32;
|
||||
payload.input_gigawords = state.acct_data.bytes_ul >> 32;
|
||||
payload.output_packets = state.acct_data.packets_dl;
|
||||
payload.input_packets = state.acct_data.packets_ul;
|
||||
if (state.data?.radius?.reply?.Class)
|
||||
payload.class = state.data.radius.reply.Class;
|
||||
|
||||
@@ -226,7 +226,7 @@ function accounting(interface) {
|
||||
continue;
|
||||
}
|
||||
let maxtotal = +clients[interface][mac].max_total;
|
||||
if (maxtotal && ((list[mac].bytes_ul + list[mac].bytes_dl) >= maxtotal)) {
|
||||
if (maxtotal && ((list[mac].acct_data.bytes_ul + list[mac].acct_data.bytes_dl) >= maxtotal)) {
|
||||
radius_terminate(interface, mac, radtc_sessionto);
|
||||
client_reset(interface, mac, 'max octets reached');
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user