Skip to content

esp32/network_wlan: Add missing WLAN security constants. #16119

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

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

dpgeorge
Copy link
Member

@dpgeorge dpgeorge commented Oct 31, 2024

Summary

These were added to the network module but not the network.WLAN class, which is the new home for such constants.

Also:

  • Mark the WLAN constants in the network module as deprecated, to be removed in MicroPython 2.0.
  • Move the static assert to the WLAN source code, to be close to where it relates to.

Testing

Tested that the constants in network are the same as those added in network.WLAN:

>>> import network
>>> network.AUTH_WPA3_ENT_192 == network.WLAN.SEC_WPA3_ENT_192
True
>>> network.AUTH_WPA3_EXT_PSK == network.WLAN.SEC_WPA3_EXT_PSK
True
>>> network.AUTH_WPA3_EXT_PSK_MIXED_MODE == network.WLAN.SEC_WPA3_EXT_PSK_MIXED_MODE
True

@projectgus
Copy link
Contributor

This change LGTM. On this note, I noticed that network.STA_IF is still referenced in a couple of documentation-adjacent places:

esp32/help.c
51:    "sta_if = network.WLAN(network.STA_IF); sta_if.active(True)\n"

esp32/README.md
198:    wlan = network.WLAN(network.STA_IF)

@projectgus
Copy link
Contributor

Also, I loaded this PR onto a ESP32_GENERIC_S3 board and messed around in the REPL to look at all the constants. However I didn't actually run any code that used them.

@dpgeorge
Copy link
Member Author

dpgeorge commented Nov 4, 2024

On this note, I noticed that network.STA_IF is still referenced in a couple of documentation-adjacent places:

That and network.AP_IF are still referenced in a few places in docs/ and tests/. I think we should change those as a separate PR.

These were added to the `network` module but not the `network.WLAN` class,
which is the new home for such constants.

Also:
- Mark the WLAN constants in the `network` module as deprecated, to be
  removed in MicroPython 2.0.
- Move the static assert to the WLAN source code, to be close to where it
  relates to.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Member Author

dpgeorge commented Nov 5, 2024

I tested the new constants, see updated top comment.

@dpgeorge dpgeorge merged commit 275b3af into micropython:master Nov 5, 2024
8 checks passed
@dpgeorge dpgeorge deleted the esp32-update-wlan-constants branch November 5, 2024 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants