diff --git a/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc b/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc index e200700a9..acdf904d2 100755 --- a/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc +++ b/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc @@ -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; diff --git a/feeds/ucentral/uspot/files/usr/share/uspot/handler-uam.uc b/feeds/ucentral/uspot/files/usr/share/uspot/handler-uam.uc index fccfd49dd..eca5bc6e2 100644 --- a/feeds/ucentral/uspot/files/usr/share/uspot/handler-uam.uc +++ b/feeds/ucentral/uspot/files/usr/share/uspot/handler-uam.uc @@ -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; } diff --git a/feeds/ucentral/uspot/src/radius.c b/feeds/ucentral/uspot/src/radius.c index d55fc31d6..f63596b4e 100644 --- a/feeds/ucentral/uspot/src/radius.c +++ b/feeds/ucentral/uspot/src/radius.c @@ -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);