Disconnect or block a wireless client

You can use "ubus list" to find out all of the "modules" (i'm probably not using correct terminology here) that ubus can interface with. On my system there's about a dozen, two of which are hostapd wlan's.
This file in the source code is the implementation of ubus for hostapd:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/hostapd/src/src/ap/ubus.c

Without knowing too much about hostapd itself, but if you've ever looked at how CLI interfaces are written, we should try to look for some kind of struct or set of definitions of the command line options. At line 911 it looks like what we are after. So the list of (current) possible ubus commands for hostapd are:

  • get_clients
  • del_client
  • list_bans
  • etc etc...

These first three are going to be the most interesting for what you want to do anyway. The struct also lists what function is called for each command. Looking at the associated del_client function we can see another struct telling us what things we need to include:

  • Address
  • Reason
  • Deauth
  • Ban Time

This is about all you can glean from this file without digging further into the code and having a deeper understanding.
With a bit of googling we can find out that the "reason" can be one of the reasons defined in the wpa_supplicant source code:
https://w1.fi/wpa_supplicant/devel/ieee802__11__defs_8h_source.html
Looks like they start at line 170.
Now you could google each of those and figure out which one is safest to use (and this also relies on proper client implementation). My previous research has shown reason 5 "disassoc ap busy" works perfectly fine and causes clients to just drop off without too many issues. They immediately try to reconnect though which is where the ban time comes in.

Let me know if there's more that you need or you want clarified. I kind of just spewed information into the textbox here.