2

In this question I am asking about how to stop my WiFi from disconnecting.

If I won't find an answer to that, the next best thing is to get my phone to re-connect automatically. The disconnect reason is: "Class 3 frame received from nonassociated STA"

I am on a rooted device running cyanogen mod on Android 5.

I'm using AFWall+ and OpenVPN, if that is relevant. OpenVPN is set to re-connect automatically already, which works.

Due to AFWall+ blocking non-vpn traffic, whenever I connect to WiFi it says "There is no Internet connectivity, do you still want to connect? [Yes/No]", ticking the "Don't ask again" box has no effect.
This might be relevant and if the phone does automatically reconnect, I obviously don't want this pop-up to prevent an automated re-connect.

  • Are you fine with disabling captive portal check? If so, you might wish to consult Captive Portal parameters. Implications are there won't be automated popups when connecting to such a network (e.g. in hotels or cafés), and you'd need to manually open a browser to "log in" to them. – Izzy Jan 17 at 20:49
  • @Izzy So basically, disabling that disables the pop-ups for networks that require log-in using a web-portal? I don't use any of that, so I wouldn't mind at all. Would that also make the device automatically re-connect after a deauth though or are additional steps required for that? Just to be clear though: That "Do you wish to connect" popup comes because of my AFWall, there is no such portal on the WiFi I wish to connect to. – confetti Jan 17 at 20:53
  • 1
    Yes to #1, and most likely to #2. Worked for me in that combination, but then there was no VPN involved (I just nailed the coffin straight with AFWall+, and that got me out again). And yes, I understood the situation, had it similar here (WiFi simply refused working as it couldn't reach the site with the captive portal check due to strict rules in AFWall+ – no real captive portal involved). I'd say simply try it (just disable the check completely), easy to revert. If it solves your issue let me know and I write an answer. – Izzy Jan 17 at 23:11
  • 1
    settings put global captive_portal_detection_enabled 0 to disable, replace the 0 by 1 to re-enable – and to be absolutely safe, check beforehand what the original setting is (adb shell settings get global captive_portal_detection_enabled). – Izzy Jan 17 at 23:16
  • 1
    @Izzy The setting worked, the pop-up doesn't appear anymore. I've tried it at home (where no disconnects happen though) and it connects automatically and simply works. Seems to have fixed it. Will try it at work now and see how it performs, but I think that did the trick and I'd appreciate a full answer to accept! :) – confetti Jan 18 at 16:15
2

Your issue is caused by Captive Portal¹ Check kicking in and not permitted through by AFWall+. So if you can live without that auto-detection, you could simply disable it:

# check what the original setting is. Should give "1" for enabled, "0" for disabled
settings get global captive_portal_detection_enabled
# now let's disable it
settings put global captive_portal_detection_enabled 0
# if you want to re-activate it
settings put global captive_portal_detection_enabled 1

Implications:

  • no more pop-ups when connecting to e.g. a hotel network using Captive Portal. Easy work-around: just open a web browser and navigate to any url, the portal should "capture" you for login
  • no more x on the WiFi symbol – so you might miss the fact of not reaching any network until you try manually (e.g. by visiting some web page and ending up on the Captive Portal's login page)
  • automatic re-connect to "known WiFis" should simply work.

I've used that trick myself when having set up AFWall+ in a quite restricting mode, and it worked for me. As you (OP) just confirmed in a comment on the question, it did the trick for you as well – despite the additional complication of a VPN.

See Captive Portal parameters for more details on manipulation.


¹ for those who don't know what a "Captive Portal" is, please see Wikipedia

  • 1
    I've lost WiFi at work a few times today (all due to out-of-range), after applying your fix not only is the pop-up gone but also it re-connected every single time as soon as it was in range again. Thank you! – confetti Jan 18 at 23:52
  • Glad to read – enjoy! \o/ – Izzy Jan 19 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.