mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 01:52:51 +00:00
uspot: add max octet support
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -306,4 +306,6 @@ VALUE Add-Port-To-IP-Address Yes 1
|
|||||||
#$INCLUDE /etc/radcli/dictionary.microsoft
|
#$INCLUDE /etc/radcli/dictionary.microsoft
|
||||||
#$INCLUDE /etc/radcli/dictionary.roaringpenguin
|
#$INCLUDE /etc/radcli/dictionary.roaringpenguin
|
||||||
$INCLUDE /etc/radcli/dictionary.WISPr
|
$INCLUDE /etc/radcli/dictionary.WISPr
|
||||||
|
$INCLUDE /etc/radcli/dictionary.CoovaChilli
|
||||||
|
$INCLUDE /etc/radcli/dictionary.chillispot
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
VENDOR CoovaChilli 14122 CoovaChilli
|
||||||
|
|
||||||
|
ATTRIBUTE CoovaChilli-Max-Input-Octets 1 integer CoovaChilli
|
||||||
|
ATTRIBUTE CoovaChilli-Max-Output-Octets 2 integer CoovaChilli
|
||||||
|
ATTRIBUTE CoovaChilli-Max-Total-Octets 3 integer CoovaChilli
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
VENDOR ChilliSpot 14559 ChilliSpot
|
||||||
|
|
||||||
|
ATTRIBUTE ChilliSpot-Max-Input-Octets 1 integer ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Max-Output-Octets 2 integer ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Max-Total-Octets 3 integer ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Bandwidth-Max-Up 4 integer ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Bandwidth-Max-Down 5 integer ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Config 6 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Lang 7 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Version 8 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-OriginalURL 9 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-UAM-Allowed 100 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-MAC-Allowed 101 string ChilliSpot
|
||||||
|
ATTRIBUTE ChilliSpot-Interval 102 integer ChilliSpot
|
||||||
@@ -158,11 +158,13 @@ function client_add(mac, state) {
|
|||||||
let idle = idle_timeout;
|
let idle = idle_timeout;
|
||||||
let session = session_timeout;
|
let session = session_timeout;
|
||||||
let accounting = (config.radius?.acct_server && config.radius?.acct_secret);
|
let accounting = (config.radius?.acct_server && config.radius?.acct_secret);
|
||||||
|
let max_total = 0;
|
||||||
|
|
||||||
if (state.data?.radius?.reply) {
|
if (state.data?.radius?.reply) {
|
||||||
interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000;
|
interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000;
|
||||||
idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout);
|
idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout);
|
||||||
session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout);
|
session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout);
|
||||||
|
max_total = (state.data?.radius?.reply['ChilliSpot-Max-Total-Octets'] || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
clients[mac] = {
|
clients[mac] = {
|
||||||
@@ -170,6 +172,7 @@ function client_add(mac, state) {
|
|||||||
interval,
|
interval,
|
||||||
session,
|
session,
|
||||||
idle,
|
idle,
|
||||||
|
max_total,
|
||||||
};
|
};
|
||||||
if (state.data?.radius?.request)
|
if (state.data?.radius?.request)
|
||||||
clients[mac].radius= state.data.radius.request;
|
clients[mac].radius= state.data.radius.request;
|
||||||
@@ -201,8 +204,8 @@ function client_flush(mac) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function client_timeout(mac) {
|
function client_timeout(mac, reason) {
|
||||||
syslog(mac, 'session timeout');
|
syslog(mac, reason);
|
||||||
radius_stop(mac);
|
radius_stop(mac);
|
||||||
delete clients[mac];
|
delete clients[mac];
|
||||||
ubus.call('spotfilter', 'client_set', {
|
ubus.call('spotfilter', 'client_set', {
|
||||||
@@ -244,10 +247,18 @@ uloop.timer(1000, function() {
|
|||||||
client_remove(k, 'idle event');
|
client_remove(k, 'idle event');
|
||||||
}
|
}
|
||||||
let timeout = get_session_timeout(k);
|
let timeout = get_session_timeout(k);
|
||||||
if (timeout && ((t - v.data.connect) > timeout)) {
|
if (timeout && ((t - list[k].data.connect) > timeout)) {
|
||||||
if (clients[k])
|
if (clients[k])
|
||||||
radius_session_time(k);
|
radius_session_time(k);
|
||||||
client_timeout(k);
|
client_timeout(k, 'session timeout');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (clients[k].max_total) {
|
||||||
|
let total = list[k].bytes_ul + list[k].bytes_dl;
|
||||||
|
if (total >= clients[k].max_total) {
|
||||||
|
radius_session_time(k);
|
||||||
|
client_timeout(k, 'max octets reached');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user