[nrf noup] zephyr: Set Max idle period#176
Draft
ajayparida wants to merge 155 commits into
Draft
Conversation
Modifications for building supplicant on Zephyr RTOS. Signed-off-by: Sridhar Nuvusetty <sridhar.nuvusetty@nordicsemi.no> Signed-off-by: Sachin Kulkarni <sachin.kulkarni@nordicsemi.no> Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no> Signed-off-by: Krishna T <krishna.t@nordicsemi.no> Co-authored-by: krishna T <krishna.t@nordicsemi.no>
nRF CI treats warnings as errors.
Scan results are allocated by driver using k_malloc Zephyr allocator but are freed by wpa_supplicant using libc free, due to changes in metadata differences between them, we free the pointer which is 8 bytes below the actual one and cause a bus and mem fault. Copy the scan results from driver before passing to the wpa_supplicant and then let driver free them using the same k_free allocator API. We can now enable the scan results free code. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Using first interface handle everywhere is not ideal, esp. when we add support for multi-VIF, so, query wpa_supplicant with the interface name to get the handle. The interface name itself is hard coded to "wlan0" everywhere for now.
If a second configuration is defined but failed to read, then the first configuration is leaked. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Depending on OS and Compiler, time can be 32bit/64bit, so, use 64bit to store to accommodate both. This fixes below coverity warnings * COV-176118 * COV-176071 * COV-175162 Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Use the proper specifier. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Zephyr has deprecated including "zephyr" directory in includes, so, all references should mandatory use "zephyr" prefix. Also, reordered the include groups. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Mask the MSB of supported and extended supported rates since MSB identifies if its a basic rate or not, and is not required to check if the rate is one of the 11b rates. Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Add following checks to identify legacy (a, b and g) mode connections: 1) Is a legacy connection if all of HE, HE and VHT capabilities are not present. 2) If operating in a 5GHz band, identify as "a". 3) If operating in 2.4GHz band and supported/extended supported rates match 11b rates, identify as "b", else identify as "g". Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
In case of failure the reply length is still positive, so, check for the length and reply message for success/failure. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
We only support a few wpa_cli commands in Zephyr, and the lengthiest command is "status" which doesn't need 4K buffer, so, reduce to 1K to avoid memory allocation failures. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
These are needed for LED support for STA sample to track WPA supplicant connection state changes and blink LEDs. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
While checking for stale BSSes, the current time is used as a basis and then based on age the stale check time is calculated, but if this is done too early in the boot and if either BOOTTIME/MONOTONIC (the one Zephyr uses by default) are used then the stale check time underflows and goes to future causing active BSS entries in the scan to be treated as stale and flushed. Fix this by adding a check before calculating stale time and ignore this check till the system reaches the BSS expiration time (this would never happen with REALTIME clock). Signed-off-by: Krishna T <krishna.t@nordicsemi.no> Signed-off-by: Sridhar Nuvusetty <sridhar.nuvusetty@nordicsemi.no> (cherry picked from commit 12de811)
In Linux WPA CLI is a standalone application that uses sockets to communicate with ctrl_iface (uses Eloop), in Zephyr we have replaced sockets with direct function calls, but this introduces concurrency as we don't go through Eloop which causes instability and crashes esp. in the deinitialization path. Implement Zephyr's version of WPA CLI and control interface using socketpair UNIX style sockets, here WPA CLI can be invoked as a standard function rather than an executable. To avoid code duplication move all commands processing to a separate file that can be used by wpa_cli application and also wpa_cli_zephyr library (all other changes to wpa_cli are restored). Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
For basic Wi-Fi operation in Zephyr we only need few commands, so, to save flash space disable other commands by default. This also involves reordering them to group. CONFIG_WPA_CLI is used for developer access that enables all commands at the cost of Flash. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
If we send too early and if data starts immediately then it might be dropped as the port might still be unauthorized. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
This is needed to manage interfaces using control interface for the upcoming hotplugging support. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
errno is not applicable for malloc, so, remove and add missing logs for other error scenarios. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
With the limited messages we expose 1024 should be enough, this reduces the overall stack size. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
squash! [nrf noup] zephyr: Add support for WPA CLI zephyr Use proper API to print it out. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
… driver Eloop framework in wpa_supplicant uses select with minimal timeout of all registered users, but by default it is 10secs (periodic cleanup task), so, in case of no other events all registered users will be delayed by 10secs. In Linux, select exits without waiting for full 10secs as for there is a handler registered for NL80211 sockets and whenever there is a event from Kernel select exits and processes expired events immediately. In Zephyr, we don't have such mechanism as we use direction function calls between kernel and wpa_supplicant, so, add an event socket and register it with Eloop and use this to post the event, the socket handler pass the event to wpa_supplicant. For user interface we just post a dummy message only to unblock select. This solves both problems: * Unblocking select for all interesting events immediately * Terminate driver context for events as we use sockets, so, remove mbox + thread. This significantly improves the association time from 30s to 5s. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Add support to handle signal polling requests from application. Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Support for handling MLME frames. Enable RRM support in capabilities. Support for wnm_bss_query wpa_cli cmd. Signed-off-by: Sridhar Nuvusetty <sridhar.nuvusetty@nordicsemi.no>
Support for handling un-protected deauth/disassoc frame. Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
SHEL-888: Supported Operating classes IE missing in the Assoc Request. SHEL-877: DUT not responding to AP beacon request frame using case 3 SHEL-859 : No BTM response for the BTM request frame from the AP. Signed-off-by: Sridhar Nuvusetty <sridhar.nuvusetty@nordicsemi.no>
SHEL-1269: Multiple BSSID bit is not set in Association request Implement get_ext_capab op to get MBSSID support cap. info Signed-off-by: Sridhar Nuvusetty <sridhar.nuvusetty@nordicsemi.no>
These capabilities need to be advertised to the WPA supplicant to enable encryption, else, some encryptions e.g., WEP will not be supported. Also, move the capabilities setting to the driver by introducing a new op, though we do yet have the provision to query these from the RPU. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
gcc 12.1 complains about using pointer after realloc as it could potentially be moved/freed, causing any uses after UB. Fix this by doing checks before alloc and use those statuses and update with new BSS. Upstream-Pr: https://patchwork.ozlabs.org/project/hostap/patch/20230420192821.376828-1-krishna.t@nordicsemi.no/ Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Disable key installation when crypto is not enabled. Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
fixup! [nrf noup] zephyr: Get extended capabilities from driver Unintentional change. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver Fix a crash where the stack pointer from the driver call is passed directly over the socket for async processing and if its delayed then driver stack frame is destroyed, causing a crash. Copy the buffer from driver stack before passing over socket. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Wi-Fi device name has been updated to nrf_wlan0 after moving to devicetree based node creation. Modify the device name references used in send_event calls. Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver Perform a deep copy of all pointers in the association response event. Fixes SHEL-2515. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver The dynamic data for these events are not deep copied. Fixes SHEL-2515. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup![nrf noup] ci: Fix the paths The compliance should be run from hostap repo and not sdk-zephyr. And also disable few tests that won't work reliably. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Fix association response event processing Fix compliance. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! nrf noup] zephyr: Fix deep copy of remaining events Fix compliance. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Implement connect and disconnect events to Zephyr In case a use issues a disconnect for some reason, it will still send IEEE 802.11 reason code 3, which will show up as a Failure (non-zero status) in Zephyr, this should only be applicable if AP sends de-authentication with reason code as "3". Fix locally generated case to return success (the enum should also be renamed from "unspecified" to "local", but that will be handled in another PR). Fixes SHEL-2561. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
When there is a wrong password for AP, the send_wifi_mgmt_conn_event is missing for WRONG_KEY. Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Supplicant will now use POSIX signal implementation from Zephyr, the same wasy as it's done for the upstream (Zephyr) supplicant, as using libc signal conflicts on sigset_t type definition. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When selecting a network the default behaviour of WPA supplicant is to prefer higher throughput, it does this by capping the SNR. But in certain environments, reliability is important over throughput and choosing a lower SNR (thought it is greater than "Great SNR") might be sub-optimal. Introduce a configuration option to choose the two options (throughput or reliability). Upstream PR: http://lists.infradead.org/pipermail/hostap/2024-March/042483.html Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Redesign the events passing to wpa_supplicant from driver Useful in debugging. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Implement basic AP ops In SAP mode, need to fetch the inactivity timer value for a STA from the UMAC. Fixes SHEL-2681. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
unicast is now a struct net_if_addr_ipv4, not net_if_addr. See 1b0f9e865e35a6b3e1ca8aad7a67f7cfbfc2e666. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
So there's no need to provide an implementation. See 4edb9017c229c34d111ec77d3c9105f8e77448f5. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
fixup! [nrf noup] zephyr: Add support for WPA CLI zephyr For commands without any response, the failures are ignored. Fixes SHEL-2740. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
fixup! [nrf noup] zephyr: Fix failure processing of no-response commands Add a NULL check before accessing response and response can be NULL for most commands. Fixes SHEL-2755. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
We use subtraction operation over time, so, it has to be signed. Fixes "[nrf toup] Use 64bit data type to store time". Fixes SHEL-2731. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
nrf-squash! [nrf noup] zephyr: wifi: MBO Pre-certification bugfixes Free the MLME buffer once it's sent. Fixes SHEL-2738. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
DHCP client is needed only when the device is running in station mode. Check if the SSID is configured in SME structure which indicates that the given interface is operating in STA mode. Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
nrf-squash![nrf noup] mbedtls: Fix MbedTLS EC parameter A The MPI bignum's were not freed after use. Fixes SHEL-2851. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
ajayparida
added a commit
to ajayparida/sdk-nrf
that referenced
this pull request
Jun 20, 2024
nrfconnect/sdk-zephyr#1837 nrfconnect/sdk-hostap#176 nrfconnect/sdk-nrfxlib#1391 Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Dynamically set Max idle period. Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Compilation issue fixed. Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dynamically set Max idle period.(part of iot testing)