-
Notifications
You must be signed in to change notification settings - Fork 724
Add P2P support #3452
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
base: main
Are you sure you want to change the base?
Add P2P support #3452
Conversation
Add TLSv1.3 support in wifi example for RW612 and IW610. Signed-off-by: Hui Bai <[email protected]> (cherry picked from commit 439d9a9)
…tiple VIF This commit links the hostap PR required for the nrf7002 driver. west.yml is updated Signed-off-by: Hanan Arshad <[email protected]> Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit c99a526)
…ignal.h paths Update the hostap module to use non-prefixed paths for the ISO C time.h and signal.h headers. Signed-off-by: Chris Friedt <[email protected]> (cherry picked from commit 5a7a574)
The hostap module is updated with a build fix fetched from upstream. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 7452cce)
DUT Failed to associate fast-gtc/fast-mscahpv2 enterprise network, there is error log shows 'EAP-FAST: Compound MAC did not match'. tls_connection_get_eap_fast_key() gets wrong key, currently using mbedtls_ssl_tls_prf to derive key, and it's not PSA API. Therefore, conn->expkey_keyblock_size can't be set as 0, the correct expkey_keyblock_size should contain keylen + mac_key_len + ivlen. Remove MBEDTLS_USE_PSA_CRYPTO to get keyblock_size correctly. Signed-off-by: Maochen Wang <[email protected]> (cherry picked from commit 4f395b4)
Due to the recent nRF70 driver changes, the driver ops are removed from config, but few functions in hostap still depend on that, so, pull the fix for hostap driver ops. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit dadcee7)
Add configuration options for background scanning (bgscan) in wpa_supplicant. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 93c4dbd)
Add a shell command to configure the background scanning. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 1da7a11)
Use `ssids` instead of `filter_ssids` to set the SSID in probe requests. `filter_ssids` are to filter scan results to include only the specified SSIDs. Signed-off-by: Ravi Dondaputi <[email protected]>
In P2P mode, inform supplicant that the driver is P2P capable. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add supplicant api and mgmt ops support for P2P discovery. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
…d support Add shell command support for P2P discovery. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Update hostap revision to add wpa_cli command response with no print. Update nrf_wifi revision to include P2P build time flags. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]> Signed-off-by: Kapil Bhatt <[email protected]>
Add ops for remain-on-channel and cancelling remain-on-channel. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
…e responses For frames sent down by supplicant in station mode, inform RPU to allow off-channel transmission. This is needed for sending P2P probe responses. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
For frames like Probe Requests, there is no match criterion. Re-arrange the checks to support registering of frames without providing any matching info. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Increase required heap and stack size for P2P. More stack was required during WPS negotiation. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
We now support a single MbedTLS shim for hostap, so, this extra check is not needed, we can always use DH5 groups from Mbedtls. Upstream PR #: 97183 Signed-off-by: Chaitanya Tata <[email protected]>
Add structures and API support for P2P connect. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
…support Add shell command support for P2P connect. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
|
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 2 projects with PR revision, 1 project with metadata changes and 5 blob changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
…control channel Update WPA supplicant functions to pass the control channel (socket) as a parameter instead of relying on a global socket. This change aligns with the PR 80 modifications in hostap repo and ensures that each Virtual Interface (VIF) uses its dedicated control channel for communication. Signed-off-by: Hanan Arshad <[email protected]> Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit 53a885a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Wi-Fi Direct (P2P) support to the Zephyr networking stack, enabling device discovery and connection capabilities. The implementation includes P2P shell commands, event handling, and background scanning functionality.
- Adds P2P device discovery, connection, and peer management functionality
- Implements background scanning for legacy roaming scenarios
- Extends the WiFi management API with P2P operations
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| west.yml | Updates hostap and nrf_wifi module revisions to pull/head versions |
| subsys/net/l2/wifi/wifi_shell.c | Adds P2P shell commands and background scanning support |
| subsys/net/l2/wifi/wifi_mgmt.c | Implements P2P and background scan management handlers |
| modules/hostap/src/wpa_cli.c | Updates wpa_cli implementation with interface handling |
| modules/hostap/src/supp_main.h | Removes duplicate function declaration |
| modules/hostap/src/supp_main.c | Adds P2P and background scan operations to management API |
| modules/hostap/src/supp_events.h | Extends event structures for P2P device discovery |
| modules/hostap/src/supp_events.c | Implements P2P event processing and parsing |
| modules/hostap/src/supp_api.h | Adds function declarations for P2P and background scan |
| modules/hostap/src/supp_api.c | Implements P2P operations and background scanning logic |
| modules/hostap/Kconfig | Adds configuration options for P2P and background scanning |
| modules/hostap/CMakeLists.txt | Includes P2P and background scan source files |
| include/zephyr/net/wifi_mgmt.h | Extends WiFi management API with P2P structures and events |
| drivers/wifi/nrf_wifi/src/wpa_supp_if.c | Updates driver interface for P2P support |
| drivers/wifi/nrf_wifi/src/fmac_main.c | Adds P2P callback registrations |
| drivers/wifi/nrf_wifi/inc/wpa_supp_if.h | Extends interface with P2P function declarations |
Comments suppressed due to low confidence (1)
modules/hostap/src/supp_api.c:1
- The macro
wpa_cli_cmd_vspans multiple lines but lacks proper backslash continuation on line 95. This could cause compilation issues.
/**
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static void print_peer_info(const struct shell *sh, int index, | ||
| const struct wifi_p2p_device_info *peer) | ||
| { | ||
| uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buffer size calculation using sizeof() on a string literal is fragile. Consider using a named constant like #define MAC_ADDR_STR_LEN 18 to make the intent clearer.
| if (sscanf(argv[1], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", | ||
| &mac_addr[0], &mac_addr[1], &mac_addr[2], | ||
| &mac_addr[3], &mac_addr[4], &mac_addr[5]) != WIFI_MAC_ADDR_LEN) { |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MAC address parsing logic is duplicated in multiple functions (lines 3596-3598 and 3752-3754). Consider extracting it into a helper function like parse_mac_address() to reduce code duplication.
| if (sscanf(argv[1], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", | |
| &mac_addr[0], &mac_addr[1], &mac_addr[2], | |
| &mac_addr[3], &mac_addr[4], &mac_addr[5]) != WIFI_MAC_ADDR_LEN) { | |
| if (parse_mac_address(argv[1], mac_addr) != 0) { |
| if (sscanf(addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", | ||
| &mac[0], &mac[1], &mac[2], | ||
| &mac[3], &mac[4], &mac[5]) == WIFI_MAC_ADDR_LEN) { |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another instance of duplicated MAC address parsing logic. The same pattern appears in the shell commands and should be consolidated into a shared utility function.
| if (params->num_ssids) { | ||
| scan_info->scan_params.num_scan_ssids = params->num_ssids; | ||
|
|
||
| for (indx = 0; indx < params->num_filter_ssids; indx++) { | ||
| for (indx = 0; indx < params->num_ssids; indx++) { | ||
| memcpy(scan_info->scan_params.scan_ssids[indx].nrf_wifi_ssid, | ||
| params->filter_ssids[indx].ssid, | ||
| params->filter_ssids[indx].ssid_len); | ||
| params->ssids[indx].ssid, | ||
| params->ssids[indx].ssid_len); | ||
|
|
||
| scan_info->scan_params.scan_ssids[indx].nrf_wifi_ssid_len = | ||
| params->filter_ssids[indx].ssid_len; | ||
| params->ssids[indx].ssid_len; | ||
| } | ||
| } |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code should validate that params->ssids[indx].ssid_len does not exceed the destination buffer size before calling memcpy() to prevent buffer overflow.
No description provided.