Commit graph

1151 commits

Author SHA1 Message Date
Torsten Rasmussen
205691edce cmake: linker: evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake
Evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake instead of in the
linker script.

It cannot be assumed that a linker generator implementation is
pre-processed and therefore Kconfig settings cannot be used in those
but must be evaluated in CMake.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-09-25 16:16:35 -05:00
Daniel DeGrasse
bc8cb0be4c net: l2: wifi: ensure certificates directory is created
Ensure that the output certificates directory is created, where
generated certificates will be placed. This fixes a build error seen
when using `make` to build samples/net/wifi for the rd_rw612_bga board,
where the output directory for generated certificates did not exist at
build time.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-09-19 18:01:53 -04:00
Florian Grandel
da0371accf net: l2: ieee802154: decouple frame decryption from upper layer fields
The L2 function `ieee802154_decipher_data_frame()` relied on upper layer
LL address fields which breaks encapsulation.

Also fixes a bug introduced in another fix that went overboard (#53734).

Fixes: #78490

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Florian Grandel
766fda06c2 net: l2: ieee802154: move vars to top of block
Found a few variable declarations that were not yet moved to the top of
the function/block. Doing this before actually fixing #78490 so that the
fix becomes more readable.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Florian Grandel
a7f235596c net: l2: ieee802154: fix typo
renamed ieeee802154 to ieee802154

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Florian Grandel
041d8c707c net: l2: ieee802154: fix deadlock
When an incoming PAN ID does not match or when an error occurs while
sending association requests, then locks were not properly released.

Fixes: #78495

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 15:13:41 +02:00
Fengming Ye
c642b44c95 net: wifi_mgmt: add DPP reconfig support
Hostap does not support wpa_cli DPP reconfig command.
So add wifi_mgmt DPP reconfig command and api.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Fengming Ye
23d2281d6a wifi: shell: add AP DPP shell commands
Add AP DPP shell commands by expanding wifi_cmd_dpp.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Fengming Ye
4f93c84a94 hostap: add AP network security type DPP
Add DPP security type for AP DPP support.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Jukka Rissanen
cd4b854c89 net: bridge: Ignore promisc mode errors for native-sim
We do not need promiscuous mode setting in host side when testing
bridging with native-sim, so just ignore errors in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-13 13:42:20 +02:00
Valerio Setti
33931cf8e1 mbedtls: remove unused option MBEDTLS_SSL_EXPORT_KEYS
According to Mbed TLS changelog this feature was set default ON
since 3.1.0 release, so the build symbol is no more available.
This commit removes it from Zephyr.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-09-12 13:31:20 -04:00
Henrik Brix Andersen
159f7dbbb1 lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.

Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Jukka Rissanen
36137bc8cc net: vlan: Fix RX debug print
The interface index and tag prints were swapped.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Jukka Rissanen
25301ace0e net: virtual: Pass status to caller when starting/stopping interface
When virtual interface is being started or stopped so when the
interface is brought up or down, check the return code and pass
it to net_if_up() or net_if_down() calls.
This helps to avoid printing success status even if the interface
up/down failed at the virtual interface level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Jukka Rissanen
6986b1ef71 net: bridge: Overhaul the code to use virtual interfaces
The legacy bridging code prevented normal IP traffic to the
bridged Ethernet interfaces. This is not intuitive and differs
how bridging setup works in Linux. This commit changes that and
creates a separate virtual interface that is doing the actual
bridging. This enables the bridged Ethernet interfaces to work
normally and provide IP connectivity.

How this works in practice:

* User needs to enable CONFIG_NET_ETHERNET_BRIDGE
* User needs to have a device with more than one Ethernet
  interface
* After booting, the net-shell or program API can be used
  to add interfaces to the bridge like this.
     net bridge addif 1 3 2
  where the 1 is the bridge interface index and
  2 and 3 are the Ethernet interface indices.
* The bridging is then finally enabled / started when the
  bridge interface 1 is taken up
     net iface up 1
* If bridged interfaces are removed from the bridge (minimum
  of two interfaces are needed there), then the bridging is
  disabled automatically. The bridge interface stays up in
  this case and can be taken down manually.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Maciej Panek
532b279ef0 net: l2: ethernet: check if the dev->api not NULL
adds a check for Ethernet driver's API not being NULL
in ethernet_mcast_monitor_cb

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek
a452aa5763 net: l2: ethernet: check if the dev->api->send method not NULL
adds a check for "send" method in Ethernet driver's API
not being NULL in ethernet_send

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek
62df6108c7 net: l2: ethernet: check if the dev->api->get_capabilities method not NULL
Adds missing checks for get_capabilities method not being NULL.
Fixes crash with netusb and possibly other drivers.

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Hui Bai
c2472e8bae net: l2: wifi: Fix issue command wifi connect fail.
Increase wifi connect input parameters max count to 13. Previous count
7 is not enough if other security type is supported.
When enabling softAP, the parameter cnx_params in cmd_wifi_ap_enable()
is with static key word. Then the parameter will always save
configurations of last time. Remove static keyword to eliminate effects
of configs from last tim and do memset before setting up softAP.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-08-28 06:51:41 -04:00
Hui Bai
86feca37f1 net: l2: wifi: Increase max count of connected STA
Increase max count of CONFIG_WIFI_SHELL_MAX_AP_STA from 5 to 8. The
SoftAP of NXP wifi chip can support up to 8 stations.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-08-28 06:51:41 -04:00
Hui Bai
2cc55bf85e modules: hostap: Add support of setting up softAP with hostapd
Added new flag CONFIG_WIFI_NM_HOSTAPD_AP for hostapd support. Once this
flag is enabled, softAP will be setup by hostapd. Both wpa_supplicant
and hostapd uses same task and eloop.
Included necessary hostapd files when compiling wifi samples if
CONFIG_WIFI_NM_HOSTAPD_AP is enabled. Added hostapd support for all
softAP command of L2 wifi shell commands.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-08-28 06:51:41 -04:00
Kapil Bhatt
b9ef207ee1 net: wifi: Display rts threshold in wifi shell
Add a new offload API to get rts threshold and
display to the user in wifi shell.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-27 12:45:02 +02:00
Florian Grandel
c19feadbdb net: l2: ieee802154: 6lo_fragment: improved error message
Improved error messages, especially the fragment cache message that
occurs very often.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-08-26 17:06:37 +02:00
Florian Grandel
d4729dfa36 net: l2: ieee802154: mgmt: improved logging
Improved debuggability of IEEE 802.15.4 network management commands.
Some of these conditions were especially hard to debug (e.g. invalid
channels due to the wrong driver being selected, conflict between
settings, ...)

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-08-26 17:06:37 +02:00
Valerio Setti
e3e13fb40b mbedtls: rename MBEDTLS_ENTROPY_ENABLED as MBEDTLS_ENTROPY_C
ENABLED suffix does not really makes much sense for a kconfig
so it should be removed. Also other MBEDTLS symbols were recently
updated accordingly.
Moreover having it named exactly the same way as in Mbed TLS
symplifies the understanding of what this kconfig is doing.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-08-24 07:16:51 -04:00
Jukka Rissanen
8284ea7b11 net: shell: Move bridge shell under net shell
All the network related shell activities should be under
network shell so moving it to "net bridge ..." command.
Add this information to migration guide.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-08-21 18:27:14 +01:00
Łukasz Duda
6eb1e652de net: openthread: Fix the handling of address state changes
This commit ensures that the state of the address can be changed from
the Deprecated state to the Preferred state.

Additionally, an issue with improper memory comparison size for the mesh
local prefix has been fixed.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-08-20 19:42:13 -04:00
Maochen Wang
1db73c3d4f wifi: Add WPA2 EAP-TLS support
Add basic WPA2 EAP-TLS support.
Also, add test infrasturcture esp. the certification handling,
non-certificate credentials are take as runtime input and certificated
are build time input for testing.

A real application can set certificates at runtime too.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-20 10:30:55 +02:00
Maochen Wang
0a951e2174 hostap: Support flushing PMKSA cache entries
Support flushing PMKSA cache entries in the reconnection
failed case of WPA3 SAE.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-08-20 10:30:55 +02:00
Maochen Wang
1a547dd40e hostap: Support getting Wi-Fi connection parameters recently used
Support saving and getting Wi-Fi connection parameters recently used.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-08-20 10:30:55 +02:00
Rex Chen
1b8fa46ac1 hostap: add 11v BTM query support
Add 11v BTM query L2 layer cmd support.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-08-19 09:58:40 -04:00
Rex Chen
ff7bb3e85c hostap: add pwe config for station
Add pwe config for station connect cmd.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-08-19 09:58:01 -04:00
Pisit Sawangvonganan
d5a458df2e net: l2: ppp: ensure proper null-termination in ppp_fsm_close
- Remove the `strlen`, as it is unnecessary for safe copying.
- Limit the `strncpy` to `sizeof(fsm->terminate_reason) - 1`
  to ensure the last byte is reserved for null-termination.
- Add an explicit null terminator to guarantee correct string termination.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-14 09:40:23 +02:00
Muhammad Haziq
9958a2e3c3 net: wifi: replace (1 << xyz) with BIT(xyz)
Refactor (1 << xyz) to use the BIT(xyz) macro.
The change aims to enhance code readability.

Signed-off-by: Muhammad Haziq <muhammad.haziq@zintechnologies.com>
2024-08-13 18:19:33 -04:00
Pisit Sawangvonganan
edbf8efeab net: wifi_utils: correct channel scan range in Wi-Fi 6GHz
Introduce `wifi_utils_get_next_chan_6g` to get the next
valid Wi-Fi 6GHz channel.

This commit addresses the proper handling of cases when
`chan_start` is not 1.

Fix #74063

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-09 08:36:22 -04:00
Pisit Sawangvonganan
721ee31c36 net: wifi: shell: enhance consistency in code style
Enhancing code consistency provides cognitive leverage with
the following changes:
- Unified the order of declaration for `opt`, `opt_index`,
  `state`, and `long_options`.
- Unified the wrapping of `getopt_long` calls, regardless of
  the length of the `options` string.
- Renamed `option_index` to `opt_index` for consistency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
2ef08cee38 net: wifi: shell: use getopt_state for safer optarg access
Using `getopt_state` to access `optarg` and also `optopt` offers
a better alternative to direct global access.

See e145eb9201 for the previous change related to this.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
5af4e9df2f net: wifi: shell: apply struct option as static const
This change marks the remaining instance of the `struct option` as
`static const`.

The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Pisit Sawangvonganan
e87d508ae5 net: wifi: shell: manual code formatting
Various manual code formatting adjustments, including:
- Wrapping lines in the `long_options` declaration to prevent them
  from extending too far to the right.
- Adding missing `{` and `}` in the `if` statement in
  `cmd_wifi_set_rts_threshold`.
- Aligning `SHELL_CMD_ARG` in `wifi_commands` with previous declarations.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-08 20:21:13 -04:00
Kapil Bhatt
2f088fabc2 net: wifi: Add Current PHY rate
Current PHY rate
It represents the current PHY rate of transfer
of data in bits per second. It will a TX data rate.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Kapil Bhatt
459a63b137 net: wifi: Add over run count statistics
Over run count
It represents the number of packets dropped either at
received and sent due to lack of buffer memory to retain
all packets on the network interface.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Łukasz Duda
fb71ca2237 net: openthread: Handle deprecated IPv6 addresses correctly
This commit fixes an issue where deprecated IPv6 addresses were not
being correctly marked. In some cases, deprecated addresses might have
been used as source addresses.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-08-07 07:13:54 -04:00
Fengming Ye
86b5b59928 net: wifi: shell: add DPP commands
DPP shell command handler will parse user args to params in enum
and send l2 mgmt DPP requests.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Fengming Ye
1640826fc5 net: wifi_mgmt: add hostap DPP support
Add wifi l2 mgmt dpp handlers.
Add wifi subcommand dpp to call l2 mgmt dpp handlers.

DPP l2 handlers will parse params to hostap wpa_cli format args
and send wpa_cli commands to hostap.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Ravi Dondaputi
37491cb0f7 wifi: utils: Get correct channel count
For 2.4GHz and 6GHz bands, while counting the channels in configured
range, start of the range is being counted twice. Correct this
by advancing the index by 1 while counting channels in range.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-08-05 18:39:58 -04:00
Kapil Bhatt
cd14be6073 net: wifi: Add reset command for Wi-Fi statistics
Add "reset" as a subcommand of wifi statistics.
Also add help option in statistics command.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Kapil Bhatt
3d38b5e094 wifi_mgmt: Add new API to reset Wi-Fi statistics
Add a new offload API to reset Wi-Fi statistics from
the Wi-Fi driver.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Jukka Rissanen
20a69f6dbf net: wifi: Add iterable_sections header file
This is related to change in commit dacb3dbfeb
("iterable_sections: move to specific header")

Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-08-01 12:36:00 +02:00
Fabian Pflug
31e91794de net: l2: ieee802154: mgmt: allow beacons without association bit
The Association permit bit shall be set to zero if the coordinator does
not accept association requests.
Not accepting association request ist not a reason to filter the
beacons from this coordinator during network scan. It is still a
network, just one you cannot associate with.

Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
2024-07-31 10:08:03 +02:00
Marcin Gasiorek
313a92baf9 net: openthread: Set CIDR for NAT64
Implementation of functionality whitch configure CIDR for OT NAT64.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-07-28 07:29:50 +03:00