-
Notifications
You must be signed in to change notification settings - Fork 734
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
Add P2P support #3452
Conversation
|
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with metadata changes and 5 blob changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
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) { |
modules/hostap/src/supp_api.c
Outdated
| 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.
5e7ef7f to
f77a05a
Compare
724321f to
f78a76a
Compare
041e1bb to
e2adce6
Compare
Add configuration options for background scanning (bgscan) in wpa_supplicant. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 93c4dbd)
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. Upstream PR #: 97183 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 nrf_wifi revision to include support for P2P feature. Upstream PR #: 97183 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 Kconfig NRF70_P2P_MODE should be enabled when WIFI_NM_WPA_SUPPLICANT_P2P is enabled. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Enable build time configs required for supporting P2P GO mode. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add per-peer authorized parameter. Port authorization command from supplicant will set this flag and will be used by driver to allow or nor allow data traffic. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add structures and API support for P2P Go mode. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Add shell commands support for P2P GO mode. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Add ops to handle P2P powersave configuration. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add cookie event callbacks to track RoC and cancel-RoC requests and its responses from firmware. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add P2P power save and cookie handling support. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
Add API support for P2P power save. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Add shell command support for P2P power save. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
Add an identifier to P2P scan request. RPU can use this to differentiate it from regular scan requests and suppress 11b rates. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
gettopt now has its own namespace in upstream, but the full POSIX namespacing is not pulled to NCS and is deemed too risky, so, this is a "noup" patch to partially rever the gettop commit [1] and reinstate old behaviour for Wi-Fi shell. [1] - zephyrproject-rtos/zephyr@22f9ef0 Signed-off-by: Chaitanya Tata <[email protected]>
…upport Add an entry with Kconfig options for NVMEM on flash devices. Signed-off-by: Pieter De Gendt <[email protected]> (cherry picked from commit 8439d0d)
Add Wi-Fi P2P mode build command and info. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
e2adce6 to
b473916
Compare
|
Integrated in #3553 |
No description provided.