mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	mpskd: kick all 6G clients upon reload
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -9,8 +9,7 @@ let ubus = libubus.connect(); | |||||||
| let interfaces = {}; | let interfaces = {}; | ||||||
| let ssids = {}; | let ssids = {}; | ||||||
| let cache = {}; | let cache = {}; | ||||||
| let sub_6g = []; | let subs_hapd = []; | ||||||
| let sub_6g_obj; |  | ||||||
| let reload_timer; | let reload_timer; | ||||||
| let gc_timer; | let gc_timer; | ||||||
|  |  | ||||||
| @@ -66,10 +65,9 @@ function event_cb(req) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function create_6g_subscriber() { | function create_6g_subscriber() { | ||||||
| 	for (let cur_sub in sub_6g) | 	for (let cur_sub in subs_hapd) | ||||||
| 		cur_sub.remove(); | 		cur_sub.remove(); | ||||||
| 	sub_6g = []; | 	subs_hapd = []; | ||||||
|  |  | ||||||
| 	for (let ifname, iface in interfaces) { | 	for (let ifname, iface in interfaces) { | ||||||
| 		let obj = 'hostapd.' + ifname; | 		let obj = 'hostapd.' + ifname; | ||||||
| 		let cur_sub; | 		let cur_sub; | ||||||
| @@ -78,7 +76,7 @@ function create_6g_subscriber() { | |||||||
| 		else | 		else | ||||||
| 			cur_sub = ubus.subscriber((req) => event_cb(req)); | 			cur_sub = ubus.subscriber((req) => event_cb(req)); | ||||||
| 		cur_sub.subscribe(obj); | 		cur_sub.subscribe(obj); | ||||||
| 		push(sub_6g, cur_sub); | 		push(subs_hapd, cur_sub); | ||||||
| 		printf(`subscribe ${ifname}\n`); | 		printf(`subscribe ${ifname}\n`); | ||||||
| 		ubus.call(obj, 'notify_response', { notify_response: 1 }); | 		ubus.call(obj, 'notify_response', { notify_response: 1 }); | ||||||
| 	} | 	} | ||||||
| @@ -314,12 +312,30 @@ let ubus_methods = { | |||||||
| 			return { | 			return { | ||||||
| 				interfaces, | 				interfaces, | ||||||
| 				ssids, | 				ssids, | ||||||
| 				cache | 				cache, | ||||||
| 			}; | 			}; | ||||||
| 		}, | 		}, | ||||||
| 		args: { | 		args: { | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
|  | 	flush: { | ||||||
|  | 		call: function() { | ||||||
|  | 			for (let ssid, data in ssids) { | ||||||
|  | 				let band = '6g'; | ||||||
|  | 				let iface = data.bands[band]; | ||||||
|  | 				if (!iface) | ||||||
|  | 					continue; | ||||||
|  | 				let clients = ubus.call('hostapd.' + iface, 'get_clients'); | ||||||
|  | 				for (let addr, client in clients.clients) { | ||||||
|  | 					if (!cache[ssid]) | ||||||
|  | 						continue; | ||||||
|  | 					delete cache[ssid][addr]; | ||||||
|  | 					ubus.call('hostapd.' + iface, 'del_client', { addr }); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  | 		args: {} | ||||||
|  | 	}, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| reload_timer = uloop.timer(-1, () => { netifd_reload(); }); | reload_timer = uloop.timer(-1, () => { netifd_reload(); }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin