Comment out mbedtls symbols that do not have a proper Kconfig
setting. Future commits will need to add relevant support in mbedtls
side to provided needed symbols so that they can be used in hostap
and uncomment these.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
To cater for different needs add an configuration options for WPA
supplicant network selection (scan results sorting). The default is
still left unchanged.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user selects a band, then we should restrict scanning channels to
that band, but using freq_list will only filter the results.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure to copy LEN -1 bytes to the destination, to
accommodate the terminating null byte.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Even if the interface is not in connected state, allow disconnect to be
accepted, this behaviour regressed when the mode check was introduced
and if not connected then SSID will be NULL.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If MbedTLS uses its own heap which is a static heap (not libc heap),
then WPA supplicant heap usage will come down, so, reduce 8K (minimum
MbedTLS heap for Wi-Fi) from the libc heap size.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Free the deep copied data of the association response event.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Using a macro here that can potentially limit the interface name
compared to add can lead to issues, so, to mimic what we do in add, use
the sizeof with a boundary check.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
These were missed earlier, and if event send fails, no point in waiting
for the state to change.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Due to AP-MLME being in the host and expensive computation WPA3 is not
working reliably, so, for now this is being disabled.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
SAP mode adds more functionality that increases the heap usage, based on
experiments, 40000 works well to avoid startup failures.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Now that TX status buffer is allocated on heap by Zephyr driver, free
the buffer once its processed.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For WPA_SUPP_CRYPTO_LEGACY, MBEDTLS_PKCS5_C is needed.
Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add missing MBEDTLS_PK_C dependcy for legacy crypto.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Key management for SAP should be retrieved from the network block rather
than using the per-interface global structure.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
By default (-1) libc uses all the available heap, this is good to
efficiently use the RAM, but for scenarios which there isn't enough RAM
the build will be success, but we see runtime failures.
Reserved the necessary RAM based on tests ahead to catch such scenarios,
of course this would mean that we might be no using full RAM in case
more is left, but that's never the case the with Wi-Fi :).
And this also adds the constant evaluation and fine tuneing like we do
for kernel heap and other parameters.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The timeout should be 5s, not 50s. Fix and rename the variables to
better reflect their meaning.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The PSA is referring to Kconfig symbols that are only found
in Nordic downstream repo so we cannot use it anyway atm.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This avoid compliance warning
Found pointless 'menuconfig' symbols without children. Use regular 'config'
symbols instead. See
https://docs.zephyrproject.org/latest/build/kconfig/tips.html#menuconfig-symbols.
WIFI_NM_WPA_SUPPLICANT modules/hostap/Kconfig:8
WIFI_NM_WPA_SUPPLICANT modules/hostap/Kconfig:8
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The big cherry-picking left some invalid code so remove/fix
it in order to pass the compilation.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Due to a typo, channel and frequency were compared causing the
connection to fail for any combination.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Use the WPA cli command to disconnect a station in AP mode.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The WPA version was only been set for WPA-PSK and WPA2-PSK, but for
others it wasn't set. For AP mode this causes issues as WPA-IE is
considered and WPA3/WPA2-PSK-256 aren't allowed, they need RSN.
Explicitly set the version for all to RSN, except for WPA-PSK.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For AP we should use the security mode from the SSID as stations can
have a different security than the configure one. E.g., WPA/WPA2 in AP
vs WPA in STA1 and WPA2 in STA2.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
If the interface is in associated state, then current SSID will always
be set, so, add an early check and use SSID info freely after that.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This way we reject disconnect in AP mode and ap disable in STA mode,
though both have same functionality we treat them differently to keep
it clean.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
These are to intimate the applications about connected Stations.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
These events are used by AP mode, tied to AP-ENABLED and AP-DISABLED
events in the hostapd/wpa_supplicant.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
These can be abstracted from the core WPA supplicant.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The management frame structure in the WPA supplicant only has a pointer,
so, it need a deep-copy before passing it to WPA supplicant, else driver
ends up freeing causing invalid memory contents.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
RSSI should only be retrieved for STA mode, but the check was wrong.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The keyword is added into array argv of wpa_cli.
The commands which require to be interactive
this keyword will allow ro print output for them.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Before starting AP mode, we don't need to search for existing networks
and join them, as the use-case is starting SoftAP.
This speeds up the AP mode operation significantly.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
RSSI is only applicable for STA mode, as for AP there are multiple
peers. This causes failure and unnecessary delay, so just skip the
retrieval.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user enables AP mode, make sure CONFIG_AP symbol
is enabled so that access point sources get compiled etc.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
WPA supplicant handle is not used anymore.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This prepares for the upcoming AP mode support and moves re-usable code
to a common helper function.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
These were missed in the original support.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of assuming that the array is perfectly aligned with enum, moved
to a data driven design, this decouples from the enum numbering and also
helps avoid repetition of the event string while parsing.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is a implementation gap and shouldn't be exposed to customers.
But when we run with debug it still helps to identify any important
events that are not handled.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use the newly added enumerations to translate from WPA supplicant status
codes to Zephyr Wi-Fi management status codes.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use the newly added enumerations to translate from WPA supplicant status
codes to Zephyr Wi-Fi management status codes.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Using "%02x" needs an unsigned integer, but all MAC addresses use
"unsigned char/char" as the data type, so, to avoid warnings, use a
temporary array.
Also, the macro from the WPA supplicant doesn't use the address of the
array element and causes warnings, so re-define the macro with address
of the element.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If the WPA supplicant internal event has a MAC address, and the sample
is compiled with newlib-nano then then the parsing fails because of lack
of support for C99 formatting options in nano [1].
Fix this by using supported specifier, even the code that encodes the
message uses the same format specifier.
[1] - https://docs.zephyrproject.org/latest/develop/languages/c/newlib.html#formatted-output
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Enabling a network would trigger a scan. Since frequency is being
set after enable_network, first scan is issued without any
specific frequency.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>