Skip to content

Commit

Permalink
mpskd: kick all 6G clients upon reload
Browse files Browse the repository at this point in the history
Signed-off-by: John Crispin <john@phrozen.org>
  • Loading branch information
blogic committed Sep 23, 2024
1 parent b2e7782 commit 911da1b
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions feeds/ipq807x_v5.4/hostapd/files/mpskd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ let ubus = libubus.connect();
let interfaces = {};
let ssids = {};
let cache = {};
let sub_6g = [];
let sub_6g_obj;
let subs_hapd = [];
let reload_timer;
let gc_timer;

Expand Down Expand Up @@ -66,10 +65,9 @@ function event_cb(req) {
}

function create_6g_subscriber() {
for (let cur_sub in sub_6g)
for (let cur_sub in subs_hapd)
cur_sub.remove();
sub_6g = [];

subs_hapd = [];
for (let ifname, iface in interfaces) {
let obj = 'hostapd.' + ifname;
let cur_sub;
Expand All @@ -78,7 +76,7 @@ function create_6g_subscriber() {
else
cur_sub = ubus.subscriber((req) => event_cb(req));
cur_sub.subscribe(obj);
push(sub_6g, cur_sub);
push(subs_hapd, cur_sub);
printf(`subscribe ${ifname}\n`);
ubus.call(obj, 'notify_response', { notify_response: 1 });
}
Expand Down Expand Up @@ -314,12 +312,30 @@ let ubus_methods = {
return {
interfaces,
ssids,
cache
cache,
};
},
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(); });
Expand Down

0 comments on commit 911da1b

Please sign in to comment.