uspot: add support for radius location name

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
Thibaut VARÈNE
2023-05-12 18:32:37 +02:00
committed by John Crispin
parent 8ec07e0588
commit e4d81ee5b9
4 changed files with 9 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ config webroot def_captive
# option nasid '' # radius NAS-Identitifer, UAM '&nasid='
# option nasmac '' # radius Called-Station, UAM '&called='
# option mac_format '' # MAC format specifier: 'aabbccddeeff', 'aa-bb-cc-dd-ee-ff', 'aa:bb:cc:dd:ee:ff' or the equivalent uppercase
# option location_name '' # radius WISPr-Location-Name
# for auth_mode 'uam':
# option uam_port '3990' # local UAM server port

View File

@@ -62,7 +62,7 @@ function radius_available(interface,mac) {
}
function radius_init(interface, mac, payload) {
for (let key in [ 'server', 'acct_server', 'acct_session', 'client_ip', 'called_station', 'calling_station', 'nas_ip', 'nas_id', 'username' ])
for (let key in [ 'server', 'acct_server', 'acct_session', 'client_ip', 'called_station', 'calling_station', 'nas_ip', 'nas_id', 'username', 'location_name' ])
if (clients[interface][mac].radius[key])
payload[key] = clients[interface][mac].radius[key];

View File

@@ -210,9 +210,11 @@ return {
called_station: ctx.config.nasmac + ':' + ctx.ssid,
calling_station: ctx.format_mac,
nas_ip: ctx.env.SERVER_ADDR,
nas_id: ctx.config.nasid
nas_id: ctx.config.nasid,
};
if (ctx.config.location_name)
payload.location_name = ctx.config.location_name;
if (ctx.config.auth_proxy)
payload.auth_proxy = ctx.config.auth_proxy;
if (ctx.config.acct_proxy)

View File

@@ -44,6 +44,7 @@ enum {
RADIUS_SERVICE_TYPE,
RADIUS_PROXY_STATE_ACCT,
RADIUS_PROXY_STATE_AUTH,
RADIUS_LOCATION_NAME,
__RADIUS_MAX,
};
@@ -75,6 +76,7 @@ static const struct blobmsg_policy radius_policy[__RADIUS_MAX] = {
[RADIUS_SERVICE_TYPE] = { .name = "service_type", .type = BLOBMSG_TYPE_INT32 },
[RADIUS_PROXY_STATE_AUTH] = { .name = "auth_proxy", .type = BLOBMSG_TYPE_STRING },
[RADIUS_PROXY_STATE_ACCT] = { .name = "acct_proxy", .type = BLOBMSG_TYPE_STRING },
[RADIUS_LOCATION_NAME] = { .name = "location_name", .type = BLOBMSG_TYPE_STRING },
};
static struct blob_buf b = {};
@@ -85,6 +87,7 @@ static int cb_chap_passwd(void * p, size_t s, struct blob_attr *b);
static int cb_chap_challenge(void * p, size_t s, struct blob_attr *b);
#define VENDORSPEC_WBAL 14122
#define ATTR_WBAL_WISPR_LOCATION_NAME 2
#define ATTR_WBAL_WISPR_LOGOFF_URL 3
/** Internal keys to radcli association table */
@@ -122,6 +125,7 @@ static const struct {
[RADIUS_SERVICE_TYPE] = { .attrid = PW_SERVICE_TYPE, },
[RADIUS_PROXY_STATE_AUTH] = { .attrid = PW_PROXY_STATE, },
[RADIUS_PROXY_STATE_ACCT] = { .attrid = PW_PROXY_STATE, },
[RADIUS_LOCATION_NAME] = { .attrid = ATTR_WBAL_WISPR_LOCATION_NAME, .vendorspec = VENDORSPEC_WBAL, },
};
/**