Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Use asserts as a suggestion #67

Open
wants to merge 113 commits into
base: main
Choose a base branch
from

Conversation

krish2718
Copy link
Collaborator

Using imply makes them a suggestion not a hard requirement.

sr1dh48r and others added 30 commits July 7, 2022 12:36
Modifications for building supplicant on Zephyr RTOS.

Signed-off-by: Sridhar Nuvusetty <[email protected]>
Signed-off-by: Sachin Kulkarni <[email protected]>
Signed-off-by: Ravi Dondaputi <[email protected]>
Signed-off-by: Krishna T <[email protected]>

Co-authored-by: krishna T <[email protected]>
The file was removed but was still included.
sdk-nrf has a different version where these variables are not private,
so, remove the private macro for build.
* Adding CODEOWNERS file ..

Adding @krish2718 @sr1dh48r @rlubos @sachinthegreen

Co-authored-by: krish2718 <[email protected]>
Remove uninitialized variable that is no longer needed, this causes
crash in case supplicant thread exits.
* Include HOSTAP_BASE to fix header file paths
* Select WEP automatically through Kconfig
nRF CI treats warnings as errors, so, this is must.
Add proper pre-processor conditions to the code that uses
IPv4 API.

Signed-off-by: Damian Krolik <[email protected]>
PR [1] is now up-merged to NCS, so, remove the workaround.

[1] - zephyrproject-rtos/zephyr#45592

Signed-off-by: Krishna T <[email protected]>
Previous to [1] we used to get L2 header and that was used to filter
unregistered frames (another bug), but now that L2 header is removed,
we cannot use L2 header, so, directly parse payload and filter EAPoL
frames only.

[1] - zephyrproject-rtos/zephyr#45592

Signed-off-by: Krishna T <[email protected]>
Add const qualifier to the declaration.

Signed-off-by: Krishna T <[email protected]>
1. Add WPA_SUPP_LOG_LEVEL_* Kconfig options to control
   the WPA supplicant log level the same way as other
   SDK components.
2. Add WPA_SUPP_DEBUG_LEVEL Kconfig option to be used for
   compile-time filtering of WPA supplicant debug messages.
   By default, it is aligned with WPA_SUPP_LOG_LEVEL.
3. Implement Zephyr variants of wpa_debug.h and wpa_debug.c
   files that use Zephyr logging subystem as the default
   output and apply compile-time filtering for the messages.

Signed-off-by: Damian Krolik <[email protected]>
As per Apache-2.0 license, we need to indicate that the files have been
modified, the recommended way is to add an extra copyright header.

Signed-off-by: Krishna T <[email protected]>
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 <[email protected]>
This fixes unnecessary wait for scan results in case of failure
scenarios.

Signed-off-by: krishna T <[email protected]>
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 <[email protected]>
This can cause allocation failures and an unnecessary prints.

Signed-off-by: Krishna T <[email protected]>
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.
Sometimes we are getting a unsolicited or spurious scan result from UMAC
but we have already freed the scan results buffer, so, add a null check
before processing scan result.
This print is only for debugging, so, should use DEBUG level.

Signed-off-by: Krishna T <[email protected]>
These APIs will be used by nRF Wi-Fi management to interact with
wpa_supplicant.

Signed-off-by: Krishna T <[email protected]>
Signed-off-by: Ravi Dondaputi <[email protected]>
This is now purely an internal utility, so, moved from sdk-nrf to here
as it works with wpa_supplicant.

Signed-off-by: Krishna T <[email protected]>
Now that display scan is natively supported using wifi_mgmt, remove it
from WPA supplicant API and wpa_cli.

Signed-off-by: Krishna T <[email protected]>
Using UDP sockets need an interface with properly configured IP address
and then either IPv4/IPv6 enabled, UNIX socket don't need any of those
and work perfectly well for IPC.

This solves two bugs:

* Matter doesn't enable IPv4, so, the events stop working, as the code
  doesn't support IPv6 sockets and also doesn't protect with IPv4
  define.

* Wi-Fi sample assigns IP address in the `prj.conf` but if an
  application doesn't do that, then socket send fails.

Signed-off-by: Krishna T <[email protected]>
After every successful association, restart DHCP to get a fresh lease.

For the initial association this avoid delay due to DHCP exponential
retries, and also handles the case where interface has changed IP
subnet.

Signed-off-by: Krishna T <[email protected]>
With recent changes, WPA CLI build is broken.

Signed-off-by: Krishna T <[email protected]>
All options depend on WPA_SUPP, so, add a check.

Signed-off-by: Krishna T <[email protected]>
Don't use the same acronym in help.

Signed-off-by: Krishna T <[email protected]>
The scan result is always freed in the driver for both success and
failure cases, so, no need for wpa_supplicant to free in failure case.

Signed-off-by: Krishna T <[email protected]>
If a second configuration is defined but failed to read, then the first
configuration is leaked.

Signed-off-by: Krishna T <[email protected]>
Krishna T and others added 21 commits February 8, 2023 19:47
In some commands argv is accessed fully and relies on NULL value to
exit. This causes hard to debug crash.

Signed-off-by: Krishna T <[email protected]>
This is needed to manage interfaces using control interface for the
upcoming hotplugging support.

Signed-off-by: Krishna T <[email protected]>
Use "z_wpas_" as the prefix for all internal functions to disambiduate
between wpa_supplicant APIs.

Signed-off-by: Krishna T <[email protected]>
Using the network management events from the driver dynamically
add/remove interfaces to the WPA supplicant, this ensures a better
integration of driver and WPA supplicant rather than WPA supplicant
assuming interface is administratively up.

Default behaviour now would be for the interface to be administratively
up but operationally down till the WPA supplicant associates and then
interface will be operationally up.

Signed-off-by: Krishna T <[email protected]>
errno is not applicable for malloc, so, remove and add missing logs for
other error scenarios.

Signed-off-by: Krishna T <[email protected]>
With the limited messages we expose 1024 should be enough, this reduces
the overall stack size.

Signed-off-by: Krishna T <[email protected]>
When switching to control interface, the code to configure channel from
user to WPA supplicant has been removed, use the control interface to
configure the channel.

Signed-off-by: Krishna T <[email protected]>
This was missed in cleaning up old interface.

Signed-off-by: Krishna T <[email protected]>
All these WPA cli command invocations need to be checked for return
value to catch issues early.

Signed-off-by: Krishna T <[email protected]>
Use proper API to print it out.

Signed-off-by: Krishna T <[email protected]>
* Check for security instead of assuming psk means security (Handy in
  test for switching b/w PSK and None).
* Use Enums and remove comments.
* Specifically check for PSK.
* Throw error if not matching any.

Signed-off-by: Krishna T <[email protected]>
Now that we are using control interface as the primary communications
this is applicable for all.

Signed-off-by: Krishna T <[email protected]>
Signed-off-by: Krishna T <[email protected]>
This is needed esp. for "wifi status" as that makes a call all the way
to Driver, and if its called from network management thread then more
stack is needed.

Signed-off-by: Krishna T <[email protected]>
EK support is still experimental.

Signed-off-by: Krishna T <[email protected]>
The minimum requirement for WPA supplicant is 4.

Signed-off-by: Krishna T <[email protected]>
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 <[email protected]>
Skip printing OK/FAIL.

Signed-off-by: Krishna T <[email protected]>
Signed-off-by: Krishna T <[email protected]>
This is to catch any RAM limitations early.

Signed-off-by: Krishna T <[email protected]>
Using imply makes them a suggestion not a hard requirement.

Signed-off-by: Krishna T <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants