Skip to content

Wifi credentials manager shell uses ethernet ifaces #88441

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

Open
matt-wood-ct opened this issue Apr 10, 2025 · 0 comments
Open

Wifi credentials manager shell uses ethernet ifaces #88441

matt-wood-ct opened this issue Apr 10, 2025 · 0 comments
Assignees
Labels
area: Wi-Fi Wi-Fi bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@matt-wood-ct
Copy link

Describe the bug
If you use the wifi shell to auto_connect under credentials it will attempt to do so using the first L2 ethernet interface which does not consider if the interface is actualy Wi-Fi. This typically causes faults when the unhandled net management events are sent to that interface.

The code uses this snippet:

struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));

when it should be

struct net_if *iface = net_if_get_first_wifi();
/* or even better  */
struct net_if *iface = net_if_get_wifi_sta();

To Reproduce
Build the wifi shell sample for the FRDM_RW612 board with theses extra configs:

CONFIG_ETH_DRIVER=y
CONFIG_NET_IF_MAX_IPV4_COUNT=3
CONFIG_NET_IF_MAX_IPV6_COUNT=3

CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_WIFI_CREDENTIALS=y
CONFIG_SETTINGS=y
CONFIG_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
# Initialization priorities are critical here. The FlexSPI MEMC driver must
# initialize first. Then, the QSPI flash driver must initialize to program
# the LUT table for port A. Finally, the PSRAM driver can initialize and
# program the LUT table for port B
CONFIG_MEMC_MCUX_FLEXSPI_INIT_PRIORITY=0
CONFIG_FLASH_INIT_PRIORITY=50
CONFIG_MEMC_INIT_PRIORITY=60

This enables ethernet and credential manager

then add a network using wifi cred add ... the try to connect using wifi cred auto_connect

Expected behavior
Shell command should send management events to the wifi driver not the ethernet interface

Impact
Minor, shell only. Should be updated more so to serve as a good example of how to use net_mgmt, many users use the shell command as a basis for their actual code.

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Toolchain Zephyr SDK
  • Commit 68b2e7d

Additional context
Similar errors exist in some samples, for example the tagoio sample uses the network management with default iface, but it sends wifi specific management commands e.g. NET_REQUEST_WIFI_CONNECT which would fault on a multi interface platform like the RW612.

@matt-wood-ct matt-wood-ct added the bug The issue is a bug, or the PR is fixing a bug label Apr 10, 2025
@krish2718 krish2718 added this to Wi-Fi Apr 10, 2025
@krish2718 krish2718 moved this to Todo in Wi-Fi Apr 10, 2025
@nashif nashif added the priority: medium Medium impact/importance bug label Apr 14, 2025
D-Triveni added a commit to D-Triveni/zephyr that referenced this issue Apr 25, 2025
Fix auto_connect to use the correct Wi-Fi interface (STA)
instead of the first L2 Ethernet interface.

Fixes zephyrproject-rtos#88441.

Signed-off-by: Triveni Danda <[email protected]>
D-Triveni added a commit to D-Triveni/zephyr that referenced this issue Apr 25, 2025
Fix auto_connect to use the correct Wi-Fi interface (STA)
instead of the first L2 Ethernet interface.

Fixes zephyrproject-rtos#88441.

Signed-off-by: Triveni Danda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Wi-Fi Wi-Fi bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

6 participants