reject client

sa6565
Posts: 1
Joined: Sun Jul 14, 2024 11:39 am

reject client

Postby sa6565 » Fri Jul 26, 2024 5:14 pm

Hello every body
I want to be able to allow any client I want to connect and reject the rest when the esp8266 is configured in ap mode. In the investigations I did, I found that even if I use wifi_set_event_handler_cb or WiFi.onSoftAPModeProbeRequestReceived and send a deauthentication package to the client, the client can still connect. My guess is that the esp8266 sends a response packet to the client at the same time as mine, allowing it to connect.
What should I do if I want to manage the connection or non-connection of clients myself in the program?
Thanks
Sajjad Qadri

AgentSmithers
Posts: 12
Joined: Fri Jul 02, 2021 12:18 am

Re: reject client

Postby AgentSmithers » Mon Aug 05, 2024 10:25 am

Im using the NONOS SDK, are you trying to keep the AP open and accept a specific client or just the first one?

In my case I do the following:
Use struct softap_config to set max_connection=1
wifi_softap_set_config(&softapConfig);

If you register wifi_set_event_handler_cb(wifi_handle_event_cb);
then monitor EVENT_SOFTAPMODE_STACONNECTED, you can toggle the access point if the MAC isnt the address you are looking for.

Its kind of hackish but may work for you. If you find the solution post back as this seems to be a common question going unanswered.

There may also be an undocumented API?

*update*
bool wifi_softap_deauth(uint8 mac[6]);

I think there is one located in libmain.a, I havent tried it but you'd need to call it by adding a header link in the user_interface.h file and try from there (I have not done this and it may not work at all).

RTOS has a supported API esp_wifi_deauth_sta, as for NONOS SDK, it does not appear to be natively supported AFAIK.

Who is online

Users browsing this forum: No registered users and 10 guests