Wifi Sta Disconnect Reason explanation

impulstek
Posts: 2
Joined: Wed May 17, 2017 9:00 pm

Wifi Sta Disconnect Reason explanation

Postby impulstek » Wed May 17, 2017 9:55 pm

I am confused with various wifi station disconnect reason code, I lookup to this definition in `user_interface.h`

Code: Select all

   REASON_UNSPECIFIED              = 1,
   REASON_AUTH_EXPIRE              = 2,
   REASON_AUTH_LEAVE               = 3,
   REASON_ASSOC_EXPIRE             = 4,
   REASON_ASSOC_TOOMANY            = 5,
   REASON_NOT_AUTHED               = 6,
   REASON_NOT_ASSOCED              = 7,
   REASON_ASSOC_LEAVE              = 8,
   REASON_ASSOC_NOT_AUTHED         = 9,
   REASON_DISASSOC_PWRCAP_BAD      = 10,  /* 11h */
   REASON_DISASSOC_SUPCHAN_BAD     = 11,  /* 11h */
   REASON_IE_INVALID               = 13,  /* 11i */
   REASON_MIC_FAILURE              = 14,  /* 11i */
   REASON_4WAY_HANDSHAKE_TIMEOUT   = 15,  /* 11i */
   REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,  /* 11i */
   REASON_IE_IN_4WAY_DIFFERS       = 17,  /* 11i */
   REASON_GROUP_CIPHER_INVALID     = 18,  /* 11i */
   REASON_PAIRWISE_CIPHER_INVALID  = 19,  /* 11i */
   REASON_AKMP_INVALID             = 20,  /* 11i */
   REASON_UNSUPP_RSN_IE_VERSION    = 21,  /* 11i */
   REASON_INVALID_RSN_IE_CAP       = 22,  /* 11i */
   REASON_802_1X_AUTH_FAILED       = 23,  /* 11i */
   REASON_CIPHER_SUITE_REJECTED    = 24,  /* 11i */

   REASON_BEACON_TIMEOUT         = 200,
   REASON_NO_AP_FOUND              = 201,
   REASON_AUTH_FAIL            = 202,
   REASON_ASSOC_FAIL            = 203,
   REASON_HANDSHAKE_TIMEOUT      = 204,


I understand some of them, like reason 8 when I changed my station config to other SSID, and reason 201 when config set to station only and the wifi router turned off. I also observe that reason 201 only happen in STA mode and not in STA+AP mode.
Where can I find the explanation for wifi event, reason and corresponding wifi mode that trigger them?


So here's the story, I have several devices all using esp8266 with setup like this

Image

While the monitor device waiting (2 to 10 minutes) no network activity or connection opened, and in the meantime wifi sometimes disconnect 1 or 2 times with reason 6, 4, or 2 and fortunately the wifi always reconnect immediately.
why wifi disconnect with REASON_AUTH_LEAVE & REASON_NOT_AUTHED while the AP using AUTH_OPEN ?

And when waiting time expired, the monitor device start opening TCP connection and connection always broken, then reconnect again.
Are this behavior designed by espressif? to make esp8266 lose connection while the network inactive

thanks.

NOTE: monitor device use sdk 2.0, the other use sdk 1.5.2.

User avatar
pratik
Posts: 402
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: Wifi Sta Disconnect Reason explanation

Postby pratik » Thu May 18, 2017 8:41 pm

I think there is something to do with the code you wrote, or might be frequency offset issue too.
Note that the reason/cause returned is not always reliable. Try connecting to a secure router (WPA2 or something) and see what happens.

Also, STA+AP mode may get disconnected because STA and AP both use same channel. So when you connect to a new AP or actively scan for APs, the AP mode may not be stable.
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests