mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 18:07:52 +00:00 
			
		
		
		
	uspot: add support for propagating the Class VAP (25)
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -88,6 +88,8 @@ function radius_acct(mac, payload) { | |||||||
| 	payload.input_gigawords = state.bytes_ul >> 32; | 	payload.input_gigawords = state.bytes_ul >> 32; | ||||||
| 	payload.output_packets = state.packets_dl; | 	payload.output_packets = state.packets_dl; | ||||||
| 	payload.input_packets = state.packets_ul; | 	payload.input_packets = state.packets_ul; | ||||||
|  | 	if (state.data?.radius?.reply.Class) | ||||||
|  | 		payload.class = state.data.radius.reply.Class; | ||||||
|  |  | ||||||
| 	radius_call(mac, payload); | 	radius_call(mac, payload); | ||||||
| 	return true; | 	return true; | ||||||
|   | |||||||
| @@ -38,6 +38,8 @@ function auth_client(ctx) { | |||||||
| 		payload.acct = true; | 		payload.acct = true; | ||||||
| 		payload.username = ctx.query_string.username; | 		payload.username = ctx.query_string.username; | ||||||
| 		payload.acct_type = 1; | 		payload.acct_type = 1; | ||||||
|  | 		if (radius.reply.Class) | ||||||
|  | 			payload.class = radius.reply.Class; | ||||||
| 		portal.radius_call(ctx, payload); | 		portal.radius_call(ctx, payload); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ enum { | |||||||
|         RADIUS_INPUT_PACKETS, |         RADIUS_INPUT_PACKETS, | ||||||
|         RADIUS_OUTPUT_PACKETS, |         RADIUS_OUTPUT_PACKETS, | ||||||
|         RADIUS_LOGOFF_URL, |         RADIUS_LOGOFF_URL, | ||||||
|  |         RADIUS_CLASS, | ||||||
|         __RADIUS_MAX, |         __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_INPUT_PACKETS] = { .name = "input_packets", .type = BLOBMSG_TYPE_INT32 }, | ||||||
|         [RADIUS_OUTPUT_PACKETS] = { .name = "output_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_LOGOFF_URL] = { .name = "logoff_url", .type = BLOBMSG_TYPE_STRING }, | ||||||
|  |         [RADIUS_CLASS] = { .name = "class", .type = BLOBMSG_TYPE_STRING }, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static struct blob_buf b = {}; | static struct blob_buf b = {}; | ||||||
| @@ -251,6 +253,10 @@ radius(void) | |||||||
| 			return result(rh, 0, NULL); | 			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; | 	val = 19; | ||||||
| 	if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, &val, 4, 0) == NULL) | 	if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, &val, 4, 0) == NULL) | ||||||
| 		return result(rh, 0, NULL); | 		return result(rh, 0, NULL); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin