mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-11-03 20:07:59 +00:00 
			
		
		
		
	Compare commits
	
		
			23 Commits
		
	
	
		
			v2.7.1-rc1
			...
			v2.7.1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					25d7b9d62d | ||
| 
						 | 
					6eaef7adad | ||
| 
						 | 
					0272d4bcad | ||
| 
						 | 
					41c64e9978 | ||
| 
						 | 
					9c2f0a098d | ||
| 
						 | 
					0bb8d0dcc0 | ||
| 
						 | 
					a542660072 | ||
| 
						 | 
					8ee15d0053 | ||
| 
						 | 
					311515867c | ||
| 
						 | 
					16bbcddd40 | ||
| 
						 | 
					ca26d347eb | ||
| 
						 | 
					9eeefa2fbf | ||
| 
						 | 
					c33705ca60 | ||
| 
						 | 
					ba41e6773b | ||
| 
						 | 
					8ebf884436 | ||
| 
						 | 
					7d4353caf0 | ||
| 
						 | 
					fa6220a615 | ||
| 
						 | 
					26517bb6ae | ||
| 
						 | 
					ea4c4b3fe5 | ||
| 
						 | 
					00f273000e | ||
| 
						 | 
					6014d3a04d | ||
| 
						 | 
					08f082acfe | ||
| 
						 | 
					12e5efcda4 | 
@@ -65,6 +65,7 @@ static void __client_free(struct interface *iface, struct client *cl)
 | 
			
		||||
		avl_delete(&iface->client_ids, &cl->id_node);
 | 
			
		||||
	avl_delete(&iface->clients, &cl->node);
 | 
			
		||||
	kvlist_free(&cl->kvdata);
 | 
			
		||||
	free(cl->device);
 | 
			
		||||
	spotfilter_bpf_set_client(iface, &cl->key, NULL);
 | 
			
		||||
	free(cl);
 | 
			
		||||
}
 | 
			
		||||
@@ -143,8 +144,10 @@ int client_set(struct interface *iface, const void *addr, const char *id,
 | 
			
		||||
 | 
			
		||||
		kvlist_set(&cl->kvdata, blobmsg_name(cur), cur);
 | 
			
		||||
	}
 | 
			
		||||
	if (device)
 | 
			
		||||
		cl->device = device;
 | 
			
		||||
	if (device) {
 | 
			
		||||
		free(cl->device);
 | 
			
		||||
		cl->device = strdup(device);
 | 
			
		||||
	}
 | 
			
		||||
	if (state >= 0)
 | 
			
		||||
		cl->data.cur_class = state;
 | 
			
		||||
	if (dns_state >= 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ struct client {
 | 
			
		||||
 | 
			
		||||
	struct spotfilter_client_key key;
 | 
			
		||||
	struct spotfilter_client_data data;
 | 
			
		||||
	const char *device;
 | 
			
		||||
	char *device;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int client_set(struct interface *iface, const void *addr, const char *id,
 | 
			
		||||
 
 | 
			
		||||
@@ -32,11 +32,15 @@ function get_idle_timeout(mac) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function get_session_timeout(mac) {
 | 
			
		||||
	if (clients[mac]?.session_timeout)
 | 
			
		||||
		return clients[mac].session_timeout;
 | 
			
		||||
	if (clients[mac]?.session)
 | 
			
		||||
		return clients[mac].session;
 | 
			
		||||
	return session_timeout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_available(mac) {
 | 
			
		||||
	return !!clients[mac]?.radius;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_init(mac, payload) {
 | 
			
		||||
	for (let key in [ 'server', 'acct_server', 'acct_session', 'client_ip', 'called_station', 'calling_station', 'nas_ip', 'nas_id', 'username' ])
 | 
			
		||||
		if (clients[mac].radius[key])
 | 
			
		||||
@@ -53,6 +57,8 @@ function radius_call(mac, payload) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_stop(mac) {
 | 
			
		||||
	if (!radius_available(mac))
 | 
			
		||||
		return;
 | 
			
		||||
	debug(mac, 'stopping accounting');
 | 
			
		||||
 | 
			
		||||
	let payload = {
 | 
			
		||||
@@ -88,6 +94,8 @@ function radius_acct(mac, payload) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_idle_time(mac) {
 | 
			
		||||
	if (!radius_available(mac))
 | 
			
		||||
		return;
 | 
			
		||||
	let payload = {
 | 
			
		||||
		acct_type: 2,
 | 
			
		||||
		terminate_cause: 4,
 | 
			
		||||
@@ -96,6 +104,8 @@ function radius_idle_time(mac) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_session_time(mac) {
 | 
			
		||||
	if (!radius_available(mac))
 | 
			
		||||
		return;
 | 
			
		||||
	let payload = {
 | 
			
		||||
		acct_type: 2,
 | 
			
		||||
		terminate_cause: 5,
 | 
			
		||||
@@ -104,6 +114,8 @@ function radius_session_time(mac) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_disconnect(mac) {
 | 
			
		||||
	if (!radius_available(mac))
 | 
			
		||||
		return;
 | 
			
		||||
	let payload = {
 | 
			
		||||
		acct_type: 2,
 | 
			
		||||
		terminate_cause: 1,
 | 
			
		||||
@@ -112,6 +124,8 @@ function radius_disconnect(mac) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function radius_interim(mac) {
 | 
			
		||||
	if (!radius_available(mac))
 | 
			
		||||
		return;
 | 
			
		||||
	let payload = {
 | 
			
		||||
		acct_type: 3,
 | 
			
		||||
	};
 | 
			
		||||
@@ -126,17 +140,25 @@ function client_add(mac, state) {
 | 
			
		||||
	if (state.state != 1)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	let interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000;
 | 
			
		||||
	let idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout);
 | 
			
		||||
	let session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout);
 | 
			
		||||
	let interval = acct_interval * 1000;
 | 
			
		||||
	let idle = idle_timeout;
 | 
			
		||||
	let session = session_timeout;
 | 
			
		||||
	let accounting = (config.radius?.acct_server && config.radius?.acct_secret);
 | 
			
		||||
 | 
			
		||||
	if (state.data?.radius?.reply) {
 | 
			
		||||
		interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval) * 1000;
 | 
			
		||||
		idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout);
 | 
			
		||||
		session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	clients[mac] = {
 | 
			
		||||
		accounting,
 | 
			
		||||
		radius: state.data.radius.request,
 | 
			
		||||
		interval,
 | 
			
		||||
		session,
 | 
			
		||||
		idle,
 | 
			
		||||
	};
 | 
			
		||||
	if (state.data?.radius?.request)
 | 
			
		||||
		clients[mac].radius= state.data.radius.request;
 | 
			
		||||
	syslog(mac, 'adding client');
 | 
			
		||||
	if (accounting)
 | 
			
		||||
		clients[mac].timeout = uloop.timer(interval, () => radius_interim(mac));
 | 
			
		||||
@@ -167,6 +189,7 @@ function client_timeout(mac) {
 | 
			
		||||
	ubus.call('spotfilter', 'client_set', {
 | 
			
		||||
			interface: "hotspot",
 | 
			
		||||
			state: 0,
 | 
			
		||||
			dns_state: 1,
 | 
			
		||||
			address: mac,
 | 
			
		||||
			accounting: [],
 | 
			
		||||
			flush: true,
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,6 @@ return {
 | 
			
		||||
		case 'aa-bb-cc-dd-ee-ff':
 | 
			
		||||
		case 'AA-BB-CC-DD-EE-FF':
 | 
			
		||||
			mac = replace(mac, ':', '-');
 | 
			
		||||
			warn('uspot: ' + ctx.env.REMOTE_ADDR + ' - ' + msg + '\n');
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -140,7 +139,7 @@ return {
 | 
			
		||||
			acct_server: sprintf('%s:%s:%s', this.config.radius.acct_server, this.config.radius.acct_port, this.config.radius.acct_secret),
 | 
			
		||||
			acct_session,
 | 
			
		||||
			client_ip: ctx.env.REMOTE_ADDR,
 | 
			
		||||
			called_station: this.config.uam.nasmac,
 | 
			
		||||
			called_station: this.config.uam.nasmac + ':' + ctx.ssid,
 | 
			
		||||
			calling_station: this.format_mac(ctx.mac),
 | 
			
		||||
			nas_ip: ctx.env.SERVER_ADDR,
 | 
			
		||||
			nas_id: this.config.uam.nasid
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
 | 
			
		||||
 	else
 | 
			
		||||
 #endif /* CONFIG_P2P */
 | 
			
		||||
-		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
 | 
			
		||||
+		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000);
 | 
			
		||||
+		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000000, sta->bandwidth[1] / 1000000);
 | 
			
		||||
 
 | 
			
		||||
 	if (hapd->sta_authorized_cb)
 | 
			
		||||
 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
 | 
			
		||||
 
 | 
			
		||||
@@ -137,7 +137,7 @@ index 0000000000..f2f4a933d7
 | 
			
		||||
+ 	else
 | 
			
		||||
+ #endif /* CONFIG_P2P */
 | 
			
		||||
+-		os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
 | 
			
		||||
++		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000);
 | 
			
		||||
++		os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000000, sta->bandwidth[1] / 1000000);
 | 
			
		||||
+ 
 | 
			
		||||
+ 	if (hapd->sta_authorized_cb)
 | 
			
		||||
+ 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user