The RFC[1] says about Acct-Status-Type:
It MAY be used by the client to mark the start of accounting (for
example, upon booting) by specifying Accounting-On and to mark the
end of accounting (for example, just before a scheduled reboot) by
specifying Accounting-Off.
The RFC errata[2] further specifies that Accounting-On and
Accounting-Off messages apply to the whole NAS.
The RFC also mandates that[3]:
Either NAS-IP-Address or NAS-Identifier MUST be present in a
RADIUS Accounting-Request. It SHOULD contain a NAS-Port or NAS-
Port-Type attribute or both unless the service does not involve a
port or the NAS does not distinguish among its ports.
And[4]:
An Accounting-Request packet MUST have an Acct-Session-Id.
The Acct-Session-Id SHOULD contain UTF-8 encoded 10646 characters.
Finally the freeRADIUS recommendations here[5] suggest that:
1. Acct-Status-Type = Accounting-On should not be used to indicate
sub-system reboot.
2. IANA should allocate two new values for Acct-Status-Type:
Subsystem-On, and Subsystem-Off. These values have meaning similar
to Accounting-On and Accounting-Off, except that they apply to a
subystem of the NAS.
3. NASes should use these new values to indicate subsystem on/off.
4. The Called-Station-Id attribute should contain values unique to each
subsystem.
5. The NAS should signal that the entire system has rebooted by using
the existing Accounting-On and Accounting-Off values, with a value
for Called-Station-Id that is global to the NAS, or to omit it
entirely.
In order to reconcile all this, this commit implements Accounting-On and
Accounting-Off requests as follows:
- When accounting.uc is started, it loops through each uspot interface
and keeps track of the acct_server seen for each interface. Then for
each interface that do not use a previously seen server, it generates
a unique session ID, and sends an Accounting-On request to the
RADIUS server, using this session ID and the configured NAS-ID.
- When accounting.uc stops, it sends an Accounting-Off request for each
uspot interface for which an Accounting-On message was previously sent,
using the same global session ID.
If/when the Subsystem-On/Subsystem-Off values are implemented, this
commit can be revisited to simply lift the restriction on unique servers
and change the acct_type value accordingly.
Finally, it appears that while NAS-ID is provided in the request thus
making NAS-IP unnecessary, libradcli still includes this field in the
request. Likewise, it also insists on sending a NAS-Port attribute.
[1]: https://datatracker.ietf.org/doc/html/rfc2866#section-5.1
[2]: https://www.rfc-editor.org/errata_search.php?rfc=2866
[3]: https://datatracker.ietf.org/doc/html/rfc2866#section-4.1
[4]: https://datatracker.ietf.org/doc/html/rfc2866#section-5.5
[5]: https://freeradius.org/rfc/acct_status_type_subsystem.html
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
In order to send RADIUS accounting requests at the NAS level (for e.g.
Accounting-On/Off), radius_init() and radius_call() are made to accept a
null mac argument.
For radius_call() we fall back to the acct_session value (which is
required to be present per RFC) to construct the temporary file name.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
NAS-ID is a mandatory setting in configuration. This will be useful to
support Accounting-Off frames.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Now that accounting.uc no longer needs the per-client radius server
information, there is no reason to publish these sensitive secrets in
cleartext in spotfiler data.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Address RADIUS accounting server from the global settings, and call
client_interim() only if accounting is globally enabled for that
interface.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Before this commit, interface-wide settings (mainly radius) were stored
per client, resulting in duplicate data.
This commit runs a first pass that renames the "clients" global variable
to "interfaces" which is expected to have the following content:
interfaces {
settings {},
clients {},
}
Thus the settings are stored per interface now, and the list of clients
belonging to that interface is stored within the object.
This change enables us to also remove direct calls to uci configuration
in the code and thus we no longer need to store it locally.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
If a client "disappears" from wireless, spotfilter eventually wipes
their state data before the accounting removal occurs. Thus in
radius_acct(), the ubus call returns empty and no RADIUS accounting Stop
frame is sent in this condition, leaving a dangling accounting for the
client.
This commit solves this issue by maintaining a local copy of the most
recent accounting data and sending that when the live data is no longer
available.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Instead of running one timer per client, handle interim reports in the
main loop through a simple comparison between current time and expected
time of next report.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This enables CONNMARK'ing allowed traffic, and is used by accounting to
selectively delete conntrack entries on client removal.
To be used with the following fw4 config:
config include
option type 'nftables'
option path '/usr/share/uspot/firewall.nft'
option position 'chain-post'
option chain 'mangle_postrouting'
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Per RFC: https://www.rfc-editor.org/rfc/rfc2869.html#section-2.1
It is also possible to statically configure an interim value on the
NAS itself. Note that a locally configured value on the NAS MUST
override the value found in an Access-Accept.
Don't start the interim reporting timer if no interval is configured.
Also add the config option to the documented config template
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
There is no point in setting up the interim timer if the relevant radius
data is not available. Furthermore, the return value check would only
fail if the client was unknown to spotfilter at the query time, which
isn't a failure to *send* data.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
When looping through known clients:
- removal of client in spotfilter list is checked first
- checks for known client existence are redundant by construction
Also format the max_total check similarly to the timeout one
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
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>
By construction:
- interface is one of clients[] keys
- clients[] is built from config uspot 'interface'
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit introduces a helper function "ratelimit_client()", invoked
from allow_client(), which parses the radius reply for known
ratelimiting attributes:
- WISPr-Bandwidth-Max-{Up,Down}
- ChilliSpot-Bandwidth-Max-{Up,Down}
WISPr attributes are expressed in bits/s, ChilliSpot in kbits/s.
If none of the attributes are present, the function is a NOP.
If any of the -Up or -Down is missing, the corresponding limit is not
set. NB: ratelimit currently does not support setting only up OR down
ratelimiting if defaults are not set.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
1. Using rtl8367c.c file for rtl8367S switch driver to support vlan
2. Configure eth0.1 as WAN and eth0.2 as LAN
3. Add mdio read/write in smi driver followed 5.4 kernel driver
4. add mido clock setting followed 5.4 kernel driver for 186w board
5. Add eth and wifi mac address allocation based of BaseMacAddress
6. Update new bdf for 2G radio
Fixes: WIFI-12650
Signed-off-by: Ken <xshi@actiontec.com>