How to automatically disconnect client when RSSI is low

Hello,

I wonder if there is a way to automatically disconnect client when RSSI is low?

I searched Google and found this one:

https://gist.github.com/lg/e91d1c5c9640d963e13dbb1901bb4396

But looks like it only works for Apple device.

Is there any method that can work for all type of devices?

Thank you.

Regards,
Fergus

1 Like

You can use modded hostapd

It will work for all devices

1 Like

Thanks a lot for the info. It's pretty cool.

I will try to build the package and test it.

Patches for a similar feature were posted to the hostapd mailing list last week (I think). So this will probably show up in upstream soon.

Hi Weedy,

Is that means this feature will be added to the coming snapshot build?

I tried to complied the ipk yesterday but have some compile environment errors. If this feature will be merge to LEDE, it would make things a lot easiier.

For me it was easier to make a hostapd patch for 17.01.2 as I need stable and compile that.
I will test it this week.

Could you help make a hostpd patch for 17.01.2 for WRT3200ACM? (If it does not cost you much time)

I tried to compile many times but failed.

Thanks.

I reported the issues I found when I tried to use it:

https://github.com/mk248/lede-modhostapd/issues/2

Updates:

Now I am able to compile the LEDE firmware after delete the orginal hostapd folder, put the mod files in a new folder and renamed to hostapd.

But still have issues, wpad-mini refused to install, and no matter I put the option, such as option signal_stay, under wifi-device or wifi-iface, it does not work. Although ubus -v list | grep set_required_signal show results.

Did you read the Readme?
I wiuld make a image with modded hostapd and use that.

Yes, I read the readme already.

In the readme, both hostapd and wpad-mini are required.

So I make a image with modded hostapd, and when make menuconfig, also select wpad-mini.

After flashing the firmware, issues are:

  1. hostapd is already in the firmware, wpad is not. Should I install the builded wap-mini ipk?

  2. If I tried to install wap-mini ipk, LEDE refused, there is already a hostapd file in /usr/sbin

3, So I tried without wap-mini, I run the ubus -v list | grep set_required_signal, it does show:

"set_required_signal":{"connect":"Integer","stay":"Integer","strikes":
"Integer","poll_time":"Integer","reason":"Integer"}

However, I am not sure the configuration:

option signal_connect "-50" # dBm requred to connect
option signal_stay "-80" # dBm required to stay connected
option signal_strikes "3" # Number of polls below stay threshold before disconnection
option signal_poll_time "5" # Seconds between polls (min. 3, default 10)
option signal_drop_reason "3" # IEEE802.11 reason sent to the STA when it is dropped.

Should be placed under:

config wifi-device "wifi0"
option type "atheros"
option channel "5"
option hwmode "11g"

Or:
config wifi-iface
option device "wifi0"
option network lan
option mode "ap"
option ssid "OpenWrt"
option hidden "0"
option encryption "none"

I tried both, no effect.

wpad a hostapd + wpa_supplicant multicall binary.
It will be auto selected as well as hostapd.

Without wpad it will not work.

You need to configure it per AP so under your SSID in this case

The tricky things is that:

make defconfig
make menuconfig

only hostapd-common and wpad-mini are selected.

In my previous compile, I select hostpad(M), which makes the wpad-mini ipk not in the complied firmware, and conflic with the hostpad in usr/sbin, which refused to install.

I will try to recomplie the firmware again.

I installed the new complied firmware, with all default LEDE source, only the hostpad folder is mod.

After flashing, in Luci, it shows:

图片

图片

图片

Seems the software is OK.

And my wireless configuration:

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11a'
	option path 'soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0'
	option htmode 'VHT80'
	option country 'US'
	option channel '44'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'testing'
	option signal_connect “-50”
    option signal_stay “-60”
    option signal_strikes “3”
    option signal_poll_time “5”
    option signal_drop_reason “3”
	option encryption 'psk+ccmp'
	option key 'testing'
	option encryption 'psk'
	option key 'testing'

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11g'
	option path 'soc/soc:pcie-controller/pci0000:00/0000:00:02.0/0000:02:00.0'
	option htmode 'HT20'
	option channel '1'
	option txpower '20'
	option country 'US'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option encryption 'psk+ccmp'
	option key 'testing'
	option ssid 'testing-2.4G'
	option signal_connect “-50”
    option signal_stay “-60”
    option signal_strikes “3”
    option signal_poll_time “5”
    option signal_drop_reason “3”
	option encryption 'psk+ccmp'
	option key 'testing'

config wifi-device 'radio2'
	option type 'mac80211'
	option channel '36'
	option hwmode '11a'
	option path 'platform/soc/soc:internal-regs/f10d8000.sdhci/mmc_host/mmc0/mmc0:0001/mmc0:0001:1'
	option htmode 'VHT80'
	option disabled '1'

config wifi-iface 'default_radio2'
	option device 'radio2'
	option network 'lan'
	option mode 'ap'
	option ssid 'testing'
	option encryption 'none'

Tried to connect to 2.4G/5G. However, it does not automatically disconnect the poor signal client. The clients are keep connecting.

Not sure where is wrong.

Please help, thanks.

You are using wrong quotes, you are using double quotes while UCI uses single quotes

Thanks, thoes config are copied from readme, so I made the mistake.

After correcting and reboot, still no effect.

Checked process, confirmed that the hostapd is running:

3118 root /usr/sbin/hostapd -s -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf

0%

0%

3362 root /usr/sbin/hostapd -s -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf

0%

0%

System log only show:

Thu Sep 7 08:17:38 2017 daemon.info hostapd: wlan1: IAPP signal poll: 0 STAs, 0 dropped
Thu Sep 7 08:17:39 2017 daemon.info hostapd: wlan0: IAPP signal poll: 1 STAs, 0 dropped
Thu Sep 7 08:17:43 2017 daemon.info hostapd: wlan1: IAPP signal poll: 0 STAs, 0 dropped
Thu Sep 7 08:17:44 2017 daemon.info hostapd: wlan0: IAPP signal poll: 1 STAs, 0 dropped
Thu Sep 7 08:17:48 2017 daemon.info hostapd: wlan1: IAPP signal poll: 0 STAs, 0 dropped
Thu Sep 7 08:17:49 2017 daemon.info hostapd: wlan0: IAPP signal poll: 1 STAs, 0 dropped
Thu Sep 7 08:17:53 2017 daemon.info hostapd: wlan1: IAPP signal poll: 0 STAs, 0 dropped
Thu Sep 7 08:17:54 2017 daemon.info hostapd: wlan0: IAPP signal poll: 1 STAs, 0 dropped
Thu Sep 7 08:17:58 2017 daemon.info hostapd: wlan1: IAPP signal poll: 0 STAs, 0 dropped
Thu Sep 7 08:17:59 2017 daemon.info hostapd: wlan0: IAPP signal poll: 1 STAs, 0 dropped

Most likely your signal strenght is good.
Try moving further and further every 10 seconds or so and see will it drop your device
Also check ubus if it even configured properly

I tried, but it did not drop.

I even changed the option signal_connect '-50' to -40, and use the 5G band, also changed the LEDE signal level to 17dbm (50mw). Then my phone shows the signal is -70 dbm. I shutdown the wifi on my phone, and reconnect, it still able to connect,

If I understand correctly, in this case, the phone should not be able to connect to wifi. So I think something must be wrong.

It looks like configuration issue.
Can you check ubus for configuration?

My ubus:

'hostapd.wlan0' @0953b137
"get_clients":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_cancel":{}
"update_beacon":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer"}
"set_vendor_elements":{"vendor_elements":"String"}
"set_required_signal":{"connect":"Integer","stay":"Integer","strikes":"Integer","poll_time":"Integer","reason":"Integer"}
'hostapd.wlan1' @fe92643a
"get_clients":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_cancel":{}
"update_beacon":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer"}
"set_vendor_elements":{"vendor_elements":"String"}
"set_required_signal":{"connect":"Integer","stay":"Integer","strikes":"Integer","poll_time":"Integer","reason":"Integer"}

The forum limits the number of @, so I post the wlan only

Well as you can see all configuration parameters are at integer,which means that they are not configured.
Have you reloaded wireless config?