Closed sakamoto330 closed 1 year ago
@sakamoto330 Since the ESP32-AP switches channel from channel 1 to channel 13 after the ESP32 client connects to the "logitec62", Other clients that are connected to the ESP32-AP will go for a background scan and automatically start listening to the current channel of the ESP32-AP. If the STA does not go for scan in all the channels,It will disconnect and start a fresh scan and connect. are all the client you have used,disconnect and connect back or is it only some of them,Can you mention the details of the STA that disconnected and reconnected back to the ESP32-AP,what was the laptop make and the OS used, Can we have a sniffer capture on channel 1 and channel 13 to see if any deauth was sent .
@nishanth-radja Thanks! Actually, ”ESP-IDF Programming Guide” has the following description.
- ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.
My laptop information: OS : Windows10 Home manufacturer : Dynabook Inc. Model number : P1-X4JP-EG
Sorry, I could not do sniffer capture on channel 1 and channel 13 in my environment. If any deauth has been sent, is this issue as expected phenomenon? Is it inevitable this issue because it is the effect of automatically adjusting the channel?
When I unify the channel to 1ch so thatthe channel did not automatically change from 1ch to 13ch, the disconnection did not occur.
@sakamoto330 when the AP changes channel,It displays a channel switch announcement in beacon ,To help the client shift to the channel easily.
The client should be able to understand it and move to the new channel without disconnection. instead of 13, can you see if the issue occurs when the AP shifts from channel 1 to channel 11. if we can get the beacons of AP on channel 1 before it changes to another channel,We will be able to see if its including the channel switch announcement or not. I have tried the Issue on commit "121ddb87e5130314e4fcc5e9cb260a81b7d30d36" on both ESP32 and ESP32 S3 ,both of them had a channel switch announcement.
Can you enable the wpa_supplicant logs and mbedtls logs and try switching between channel 1 to channel 11.
Thanks!
I enabled wpa_supplicant logging and mbedtls logging and tried switching from channel 1 to channel 11, but it looks like the log is not displayed. And the same issue has occurred. I added below code, is it correct?
#define CONFIG_MBEDTLS_DEBUG 1
#define CONFIG_MBEDTLS_DEBUG_LEVEL_VERBOSE 1
#define CONFIG_MBEDTLS_DEBUG_LEVEL 4
#define CONFIG_WPA_DEBUG_PRINT 1
esp_log_level_set("*", ESP_LOG_VERBOSE);
[2022-03-29 16:43:28.839] I (8908) pp: pp rom version: e7ae62f
[2022-03-29 16:43:28.848] I (8909) net80211: net80211 rom version: e7ae62f
[2022-03-29 16:43:28.853] I (8911) wifi:wifi driver task: 3fca4a7c, prio:23, stack:6656, core=0
[2022-03-29 16:43:28.859] I (8922) system_api: Base MAC address is not set
[2022-03-29 16:43:28.863] I (8923) system_api: read default base MAC address from EFUSE
[2022-03-29 16:43:28.881] I (8951) wifi:wifi firmware version: 7679c42
[2022-03-29 16:43:28.881] I (8952) wifi:wifi certification version: v7.0
[2022-03-29 16:43:28.887] I (8952) wifi:config NVS flash: enabled
[2022-03-29 16:43:28.893] I (8953) wifi:config nano formating: disabled
[2022-03-29 16:43:28.893] I (8964) wifi:Init data frame dynamic rx buffer num: 32
[2022-03-29 16:43:28.898] I (8965) wifi:Init management frame dynamic rx buffer num: 32
[2022-03-29 16:43:28.903] I (8976) wifi:Init management short buffer num: 32
[2022-03-29 16:43:28.908] I (8977) wifi:Init static tx buffer num: 16
[2022-03-29 16:43:28.914] I (8978) wifi:Init tx cache buffer num: 32
[2022-03-29 16:43:28.914] I (8979) wifi:Init static tx FG buffer num: 2
[2022-03-29 16:43:28.920] I (8990) wifi:Init static rx buffer size: 1600
[2022-03-29 16:43:28.925] I (8991) wifi:Init static rx buffer num: 10
[2022-03-29 16:43:28.931] I (8992) wifi:Init dynamic rx buffer num: 32
[2022-03-29 16:43:28.931] I (9003) wifi_init: rx ba win: 6
[2022-03-29 16:43:28.937] I (9004) wifi_init: tcpip mbox: 32
[2022-03-29 16:43:28.942] I (9005) wifi_init: udp mbox: 6
[2022-03-29 16:43:28.947] I (9016) wifi_init: tcp mbox: 6
[2022-03-29 16:43:28.947] I (9016) wifi_init: tcp tx win: 5744
[2022-03-29 16:43:28.953] I (9017) wifi_init: tcp rx win: 5744
[2022-03-29 16:43:28.959] I (9028) wifi_init: tcp mss: 1440
[2022-03-29 16:43:28.964] I (9029) wifi_init: WiFi IRAM OP enabled
[2022-03-29 16:43:28.964] I (9029) wifi_init: WiFi RX IRAM OP enabled
[2022-03-29 16:43:28.976] I (9046) phy_init: phy_version 302,3ddfab3,Dec 3 2021,14:39:12
[2022-03-29 16:43:29.026] I (9095) wifi:mode : sta (7c:df:a1:e0:5a:48) + softAP (7c:df:a1:e0:5a:49)
[2022-03-29 16:43:29.033] I (9097) wifi:enable tsf
[2022-03-29 16:43:29.033] I (9101) wifi:Total power save buffer number: 8
[2022-03-29 16:43:29.038] I (9103) wifi:Init max length of beacon: 752/752
[2022-03-29 16:43:29.047] I (9104) wifi:Init max length of beacon: 752/752
////////////////////////////////// AP+STA mode started ///////////////////////////////////
[2022-03-29 16:43:34.967] I (15036) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<0,0>, prof:1
[2022-03-29 16:43:34.974] I (15037) wifi:station: c8:09:a8:7e:fa:bd join, AID=1, bgn, 40U
[2022-03-29 16:43:35.329] I (15398) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
[2022-03-29 16:43:37.809] W (17878) wifi:<ba-add>idx:2 (ifx:1, c8:09:a8:7e:fa:bd), tid:0, ssn:100, winSize:64
////////////////////////////////// join to AP (ESP32) from STA (PC etc.) ///////////////////////////////////
[2022-03-29 16:44:29.483] I (69549) wifi:switch to channel 11
[2022-03-29 16:44:29.483] I (69550) wifi:ap channel adjust o:1,1 n:11,2
[2022-03-29 16:44:29.488] I (69551) wifi:new:<11,0>, old:<1,1>, ap:<11,2>, sta:<0,0>, prof:1
[2022-03-29 16:44:29.491] I (69553) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,0>, prof:1
[2022-03-29 16:44:29.496] I (69564) wifi:state: init -> auth (b0)
[2022-03-29 16:44:29.504] I (69568) wifi:state: auth -> assoc (0)
[2022-03-29 16:44:29.504] I (69574) wifi:state: assoc -> run (10)
[2022-03-29 16:44:29.524] I (69594) wifi:connected with logitec62, aid = 1, channel 11, BW20, bssid = 00:01:8e:9a:6d:3b
[2022-03-29 16:44:29.531] I (69596) wifi:security: WPA2-PSK, phy: bgn, rssi: -32
[2022-03-29 16:44:29.537] I (69601) wifi:pm start, type: 1
[2022-03-29 16:44:29.537] I (69602) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
[2022-03-29 16:44:29.591] I (69659) wifi:BcnInt:102400, DTIM:1
[2022-03-29 16:44:30.339] I (70407) esp_netif_handlers: sta ip: 192.168.2.101, mask: 255.255.255.0, gw: 192.168.2.1
[2022-03-29 16:44:31.239] W (71307) wifi:<ba-del>idx
[2022-03-29 16:44:31.239] I (71308) wifi:new:<11,2>, old:<11,2>, ap:<11,2>, sta:<11,0>, prof:1
////////////////////////////////// Join to AP (ESP32) from STA (PC etc.) ///////////////////////////////////
[2022-03-29 16:44:31.244] I (71309) wifi:station: c8:09:a8:7e:fa:bd join, AID=1, bgn, 40D
[2022-03-29 16:44:35.255] I (75323) wifi:station: c8:09:a8:7e:fa:bd leave, AID = 1, bss_flags is 658530, bss:0x3fcae81c
////////////////////////////////// STA (PC etc.) disconnects from AP (ESP32) ///////////////////////////////////
[2022-03-29 16:44:35.260] I (75325) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,0>, prof:1
[2022-03-29 16:44:35.330] I (75398) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,0>, prof:1
[2022-03-29 16:44:35.338] I (75400) wifi:station: c8:09:a8:7e:fa:bd join, AID=1, bgn, 40D
[2022-03-29 16:44:35.380] I (75448) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
[2022-03-29 16:44:51.249] W (91316) wifi:<ba-add>idx:2 (ifx:1, c8:09:a8:7e:fa:bd), tid:0, ssn:176, winSize:64
@sakamoto330 can you enable these in the sdkconfig, Also sniffer capture in channel 1 will be helpful when DUT changes from channel 1 to channel 11. can you edit the SDK config as shown below.
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y CONFIG_LOG_DEFAULT_LEVEL=5 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y CONFIG_LOG_MAXIMUM_LEVEL=5 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
CONFIG_MBEDTLS_DEBUG=y CONFIG_MBEDTLS_DEBUG_LEVEL_VERBOSE=y CONFIG_MBEDTLS_DEBUG_LEVEL=4
CONFIG_WPA_DEBUG_PRINT=y
Thanks!
I edit the SDK config as shown below.
I can get the log, so I attach it. ap_sta2.log
@sakamoto330 Thanks for the logs,From the logs,looks like the In-AP(ESP32AP) received an reassoc packet from client after it changed the channel.Hence the whole association happened again.
[2022-03-31 16:50:50.922] D (72506) wifi:ap recv assoc/reassoc request
[2022-03-31 16:50:50.929] W (72507) wifi:
If we get the capture on channel 1,we can see if the ap is advertising the channel change,Even after advertising the channel change,If the external -STA chooses to re-associate,Then this behavior is expected.
Thanks! But, I could not do sniffer capture on channel 1 in my environment (windows10 and wireshark app). Is there any good way or reference URL?
And in the case of the above, is disconnection inevitable?
yes,It is inevitable,As STA has chosen to reconnect after the channel change. Can you try with an ESP32 client if it reconnects. Do you have any MAC or Linux machine? It is easier to start the sniffer on those and I can guide you for the same.
I see.
Can you try with an ESP32 client if it reconnects.
Sorry, I don't understand the procedure. For example, what should I do in "Steps to reproduce".
Do you have any MAC or Linux machine?
Yes, I have Linux machine (Ubuntu).
For the sniffer,Use the following script on ubuntu.
1.Install wireshark on ubuntu.
https://linuxhint.com/install_configure_wireshark_ubuntu/
2.Run the following script.
killall wpa_supplicant
ifconfig
For the esp32 as client,
1.If you have 2 esp32's, use one as DUT
Thanks! But sorry, WiFi didn't work on my Linux machine. Since it is a PC several years ago, some functions seem to be broken.
Also, I only have one ESP32.
I would like to confirm it at a later date.
when the AP changes channel,It displays a channel switch announcement in beacon ,To help the client shift to the channel easily.
We performed a packet capture in our environment and confirmed a channel switch announcement in beacon. I think that the disconnection is caused by the PC I was using.
Thanks for your cooperation.
Thanks for reporting and sharing the updates, feel free to reopen. Thanks.
Environment
Problem Description
In AP+STA mode joining to AP(router) causes disconnection of STA (PC etc.) joined to AP (ESP32).
Issue
Connection of STA (PC etc.) joined to AP (ESP32) will lost. It is the part of "/// STA (PC etc.) disconnects from AP (ESP32) ///" described in the Debug Logs.
Expected Behavior
STAs (PC etc.) joined to AP (ESP32) keep connection.
Steps to reproduce
Code to reproduce this issue
Debug Logs