uspot: add support for propagating the Class VAP (25)

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2022-11-22 16:27:27 +01:00
parent dd911cbf21
commit 5828971cfe
3 changed files with 10 additions and 0 deletions

View File

@@ -88,6 +88,8 @@ function radius_acct(mac, payload) {
payload.input_gigawords = state.bytes_ul >> 32;
payload.output_packets = state.packets_dl;
payload.input_packets = state.packets_ul;
if (state.data?.radius?.reply.Class)
payload.class = state.data.radius.reply.Class;
radius_call(mac, payload);
return true;

View File

@@ -38,6 +38,8 @@ function auth_client(ctx) {
payload.acct = true;
payload.username = ctx.query_string.username;
payload.acct_type = 1;
if (radius.reply.Class)
payload.class = radius.reply.Class;
portal.radius_call(ctx, payload);
return;
}

View File

@@ -32,6 +32,7 @@ enum {
RADIUS_INPUT_PACKETS,
RADIUS_OUTPUT_PACKETS,
RADIUS_LOGOFF_URL,
RADIUS_CLASS,
__RADIUS_MAX,
};
@@ -59,6 +60,7 @@ static const struct blobmsg_policy radius_policy[__RADIUS_MAX] = {
[RADIUS_INPUT_PACKETS] = { .name = "input_packets", .type = BLOBMSG_TYPE_INT32 },
[RADIUS_OUTPUT_PACKETS] = { .name = "output_packets", .type = BLOBMSG_TYPE_INT32 },
[RADIUS_LOGOFF_URL] = { .name = "logoff_url", .type = BLOBMSG_TYPE_STRING },
[RADIUS_CLASS] = { .name = "class", .type = BLOBMSG_TYPE_STRING },
};
static struct blob_buf b = {};
@@ -251,6 +253,10 @@ radius(void)
return result(rh, 0, NULL);
}
if (tb[RADIUS_CLASS])
if (rc_avpair_add(rh, &send, PW_CLASS, blobmsg_get_string(tb[RADIUS_CLASS]), -1, 0) == NULL)
return result(rh, 0, NULL);
val = 19;
if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, &val, 4, 0) == NULL)
return result(rh, 0, NULL);