Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 4way handshake error in idf5 #9025

Merged
merged 6 commits into from Mar 14, 2024
Merged

Conversation

bill88t
Copy link

@bill88t bill88t commented Mar 8, 2024

Fixes: #8888

Turns out the error did occur in any authentication mismatch.
I investigated the underlying api a bit and played with examples, and saw a lot more weirdness there.

When attempting to connect to a secure wifi without a password, event_id becomes 2 and event_data.reason is 15 (WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT).
When attempting to connect to a secure wifi with an incorrect password, event_id becomes 5 and event_data.reason is 15 (WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT).

I don't know if the upstream change in behavior is intentional, and I don't have the time to find that out right now.
This is a simple patch that when it sees 15 (WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT) it makes it 202 (WIFI_REASON_AUTH_FAIL).

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion based on what I think your goal is. I think you are trying to improve the error message in this case.

ports/espressif/common-hal/wifi/__init__.c Outdated Show resolved Hide resolved
Copy link
Member

@anecdata anecdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the else if here (lines 378-388) is redundant: the new if handles the special case, the else if would get handled anyway by the return self->last_disconnect_reason;? It's been that way for a while it seems, nothing new.

edit: I'm fine with this solution, it all bubbles up to a ConnectionError: Authentication failure in shared-bindings, so users do get a descriptive string for these cases.

ports/espressif/common-hal/wifi/Radio.c Show resolved Hide resolved
bill88t and others added 2 commits March 14, 2024 19:21
Co-authored-by: Dan Halbert <halbert@halwitz.org>
This reverts commit 6c14264.
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dhalbert dhalbert dismissed their stale review March 14, 2024 19:00

wrong suggestion

@dhalbert dhalbert merged commit 636b9df into adafruit:main Mar 14, 2024
183 checks passed
@bill88t bill88t deleted the wifierr15 branch March 21, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Espressif wifi trying to connect to secure wifi with no password unknown error 15
4 participants