Commit graph

6647 commits

Author SHA1 Message Date
Gang Li
50bcb122e8 net: wifi: shell: fix 11k neighbor request cannot specify ssid
Fix the issue of sending neighbor report request failing
when specifying ssid.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2025-01-10 09:49:55 +01:00
Nicolas Pitre
46aa6717ff Revert "arch: deprecate _current"
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").

This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.

The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.

Hence this revert.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
Maochen Wang
76fd272652 net: wifi: fix wifi connect parameter count error
Fix wrong parameter count error when input 'wifi connect' in
enterprise mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
65545997b6 net: wifi: should enable MFP when connect to WPA3 network
Add check that should enable MFP when connect to WPA3 network,
as MFP required is mandatory for WPA3 network.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
bc370ea075 net: wifi: support printing WPA3 enterprise in scan result
Support printing WPA3 enterprise type in scan result for more
accurate display, including the suiteb, suiteb-192 and WPA3
enterprise only.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
f2f2fbb315 hostap: support getting enterprise type by status cmd
For 'wifi status' and 'wifi ap status' cmd of the hostap case,
originally only support getting 'EAP-TLS' for the enterprise
mode, which is not correct. Now support getting the specific
enterprise mode, including the WPA3 enterprise mode and
the EAP method type.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
c1782420d5 hostap: add WPA3 enterprise security type
Change Wi-Fi suiteb type into WPA3 enterprise security type, it
includes suiteB, suiteB-192 and WPA3 enterprise only mode.
Support setting WPA3 enterprise only mode, which should use
cipher_config->key_mgmt as WPA-EAP-SHA256, and the AKM in RSN
IE will show 00-0F-AC:5.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Maochen Wang
4777dfaa28 net: l2: wifi: remove EAP TLS SHA256 security
Remove EAP TLS SHA256 security, as it was added to support the AKM
of 00-0F-AC:5 in RSN IE, but actually this AKM is used by WPA3
enterprise only mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-10 07:48:40 +01:00
Matt Rodgers
b7091ed439 net: http_server: serve resources only for their defined services
Ensure that HTTP resources can only be served to a client connected on
the specific service(s) that the resource was registered against using
the HTTP_RESOURCE_DEFINE macro.

This allows different resources to be registered to different services,
for example to make some resources only available via an HTTPS service
and not via unencrypted HTTP.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-09 14:13:57 +01:00
Matt Rodgers
549e5de277 net: websocket: pass HTTP upgrade request context to user callback
Passing HTTP upgrade request context to the user callback allows the
user to decide whether to accept or reject the websocket connection
based on the HTTP headers in the request. The primary reason for this is
to enable authentication of the websocket connection (e.g. via cookies
or Authorization header).

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-08 21:02:02 +01:00
Daniel Mangum
2522bb0f1b net: support configuring offloaded network device as default interface
Adds Kconfig option for making an offloaded network device the default
interface.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2025-01-08 19:11:15 +01:00
Triveni Danda
3a2a7c1855 net: ip: Add a name to existing Kconfig choice
Update kconfig choice name to enable overriding
from other parts of the code.

Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
2025-01-07 08:08:58 +01:00
Matt Rodgers
b7b3449f48 net: websocket: don't mask data sent from server via zvfs write
RFC6455 section 5.1 specifies that "A server MUST NOT mask any frames
that it sends to the client". Implement this for websocket write calls
via ZVFS, by storing in the websocket_context whether a socket is acting
in the client or server role, and using this to determine if sent data
should be masked.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-03 13:26:43 +01:00
Chaitanya Tata
b28f246f53 net: l2: wifi: Fix PHY rate display
The WPA supplicant already converts this to Mbps.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-01-03 11:39:13 +01:00
Kris Wolff
991fd8d4d5 net: dhcpv4: update DNS address assignment to be optional
The DHCPv4 options always assigns the DNS address if the router
provides one through the DHCP callback. There are times a developer
may not always want to assign the server from the router, but only
manually assign them. Adding a Kconfig option for assigning the DNS
address and defaulting to true to not interfere with previously
expected functionality.

Signed-off-by: Kris Wolff <kwolff@wavelynx.com>
2025-01-02 16:03:25 +01:00
Maochen Wang
f9901e8e9b net: sockets: change socketpair related buffer and heap size
Latest supplicant uses 1K buffer size for sending control message via
socketpair, so reducing the NET_SOCKETPAIR_BUFFER_SIZE to save memory
footprint. There are 4 socketpairs for supplicant only case, and 6
socketpairs for hostapd case, update the heap size correspondingly.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-01-02 12:35:46 +01:00
Seppo Takalo
4a7ef5c010 net: lwm2m: Convert tickeless to use eventfd()
For waking up the poll() use eventfd() instead of socketpair()
so we save some buffer space and one file descriptor.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-24 13:54:39 +01:00
Øyvind Rønningstad
617df3b5c1 scripts: Remove zcbor requirement from requirements-extras.txt
lwm2m_README: Add instructions to install zcbor when needed

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-12-23 17:09:43 +01:00
Adam Wojasinski
690a854c7c net: lib: ptp: Fix array boundry check in PTP Port initialization
Before it was possible to overrun array by one element.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-12-20 16:06:17 +01:00
Adam Wojasinski
c6d6a3c27c net: lib: ptp: Fix wrong type casting in potential overflow
Previously added type casting was still causing coverity to complain.
This time casting multiplication before bitshift operation.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-12-20 16:06:17 +01:00
Adam Wojasinski
1946e04756 net: lib: ptp: Fix potential NULL dereference in transport prot addr
Retreiving IP address from the networking interface assigned to
a PTP port could result in NULL dereference or undefined behaviour
when passing NULL to `memcpy()` function. Added check on addresses
returned from functions retreiving IP address from an interface.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-12-20 16:06:17 +01:00
Pete Skeggs
6ec5729a3d net: lib: tls_credentials: return size required
If either no buffer is provided or the size of it
is too small, return the required length.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2024-12-20 03:17:10 +01:00
Jukka Rissanen
3f4b5a6f3b net: shell: ping: Do not wait in ICMP Echo-Req
Use the net_icmp_send_echo_request_no_wait() when sending
ICMP Echo-Req so that we can avoid the warning message from
system workqueue handler.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 15:18:33 +01:00
Jukka Rissanen
81c60e7257 net: icmp: Add a way to send ICMP Echo-Req without waiting
Create a net_icmp_send_echo_request_no_wait() variant that will
not wait when allocating net_buf to be sent. This variant will avoid
a warning to be printed when sending Echo-Req from a system workqueue
because the work cannot sleep in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 15:18:33 +01:00
Jukka Rissanen
420c4b153e net: ethernet/vlan: Add support for embedding ll header
If Ethernet based network device driver is advertizing
ETHERNET_EMBEDDED_LL_HEADER, then the L2 driver will can
return the proper L2 header size for the network interface.
This info is then used in TX to determine whether to have a
separate net_buf for the link level header, or to embed the
header to the same net_buf as the L2 payload.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:21:28 +01:00
Jukka Rissanen
45ac1f9848 net: pkt: Add possibility to reserve link layer header
Allow network device driver to configure the system so that
when a network packet is sent to it, the link layer header
is stored just before the L2 payload in the same packet.

Currently the link layer header is stored in a separate
net_buf that is linked in front of the L2 payload.

This option can typically save one net_buf when sending
a network packet. Note that if you are using variable data
size buffers (CONFIG_NET_BUF_VARIABLE_DATA_SIZE) then this
embedding is not needed because one can allocate just the
right size network buffers and not waste any memory.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:21:28 +01:00
Jukka Rissanen
24bf9c2334 net: ipv4: Re-join multicast groups if needed
If network interface goes operative down, then re-join user defined
IPv4 multicast groups that where joined earlier when the interface comes
up again. If user takes the network interface down manually (admin down),
then the user specific groups are not re-joined. This works now the same
way as IPv6 re-joining.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:20:56 +01:00
Robert Lubos
6e37d31c15 net: http_server: Support PUT/PATCH/DELETE for dynamic resources
Extend the list of methods supported by dynamic resources with
PUT/PATCH/DELETE. The methods does not require any extra handling
from the server perspective, so the existing method handlers could be
reused.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-12-18 18:15:02 +01:00
Qingling Wu
d22026c440 net: wifi: hostap: add set RTS threshold command support
Add set RTS threshold command support for sta and sap.

Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
2024-12-18 10:17:24 +01:00
Maochen Wang
b5007b5190 net: wifi: avoid adding duplicate mgd_ifaces
Add iface and type check to avoid adding duplicate mgd_ifaces.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-17 09:48:29 +01:00
Gaofeng Zhang
0e59cf41d7 hostap: support legacy roaming
There are currently four types of roaming, 11r roaming, 11v roaming, 11k
roaming and legacy roaming, The priority of the roaming mode is
11r-->11v-->11k-->legacy roaming. If the ap does not support 11r/11v/11k
roaming, we will use legacy roaming. legecy roaming needs to do
full channel scan, which is the same as the general scan connection
process, so the legacy roaming time will be longer.

Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
2024-12-17 05:49:21 +01:00
Rex Chen
ab948b080d net: wifi: shell: fix twt setup quick failed issue
The default exponent is 0, will cause twt setup quick failed,
set exponent value derived from twt interval to fix it.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
0406f9b403 net: wifi: shell: add parameters for twt setup
Add two parameters for twt setup.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
a1f579a2f3 net: wifi: shell: add btwt feature support
Add btwt_setup cmd for sap.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Rex Chen
f9a96f3503 net: wifi: shell: enhance twt parse parameters code
Enhance the parse parameters code for twt.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-12-16 13:10:02 +01:00
Maochen Wang
91c4482267 net: wifi: fix ap status when enabled
Add WIFI_SAP_IFACE_NO_IR state to keep same as hostapd_iface_state,
which is updated as the hostap upmerge.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Maochen Wang
10d4de5237 net: wifi: remove HAPD in Wi-Fi shell layer
For CMD 'wifi ap status', removing HAPD related definition to make it
more commonly used for non-supplicant case.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 13:08:37 +01:00
Maochen Wang
671f0f6cfa net: sockets: choose SOCKETPAIR_HEAP when MEM_POOL enabled
Don't check 'HEAP_MEM_POOL_SIZE != 0', as HEAP_MEM_POOL_SIZE might be 0,
but HEAP_MEM_POOL_ADD_SIZE_xxx is defined, which means the actual heap
size is not zero. So check KERNEL_MEM_POOL instead.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-16 10:53:21 +01:00
Chaitanya Tata
cf7ecb18c0 net: l2: wifi: Add a verbose option for reg_domain
Most users won't be interested in the per-channel rules but only in the
country code, so, add a verbose option to hiden per-channel rules which
are too verbose.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-12-13 21:51:02 +01:00
Chaitanya Tata
6223c4a904 net: l2: wifi: Convert reg_domain to use get_opt
In order to prepare for extending the options, convert to getopt long
for easier parsing of options.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-12-13 21:51:02 +01:00
Li Long
4d178f664c modules: hostap: add tls_cipher param
Add tls_cipher param for client WPA3 enterprise suiteb-192.
Add parameter "-T" to specify tls_cipher:
Specify "-T 1": client use ECC P384.
Specify "-T 2": client use RSA 3K.

Signed-off-by: Li Long <li.long@nxp.com>
2024-12-12 11:09:15 +01:00
Jukka Rissanen
228b271f01 net: Remove deprecated CONFIG_NET_PKT_BUF_DATA_POOL_SIZE
This removes the deprecated CONFIG_NET_PKT_BUF_DATA_POOL_SIZE.
User should either use CONFIG_NET_PKT_BUF_RX_DATA_POOL_SIZE or
CONFIG_NET_PKT_BUF_TX_DATA_POOL_SIZE depending of net packet type.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:32:29 +01:00
Jukka Rissanen
0e48ce20c5 net: Remove deprecated CONFIG_NET_TCP_ACK_TIMEOUT option
Use CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT to control the total timeout at the TCP
level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:32:02 +01:00
Jukka Rissanen
da148ab3bc net: dns: Close socket service properly from dispatcher
We need to close the socket service context when dispatcher is
unregistered.

Fixes #82652

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:29:21 +01:00
Jukka Rissanen
c110331507 net: dns: Avoid errors when DNS dispatcher is already registered
Skip error prints and extra DNS events if DNS dispatcher was already
registered.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:29:21 +01:00
Jukka Rissanen
efcfcfe292 net: dns: Fix the debug print when dispatcher fails
Depending on DNS type, print the output (mDNS vs DNS) correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:29:21 +01:00
Jukka Rissanen
1f2595a456 net: wifi: shell: Remove obsolete subcmd settings from commands
If a shell command does not have a sub command, then the 3rd parameter
to SHELL_SUBCMD_ADD() macro should be set to NULL so that the help
will only print information specific to that command and not all
wifi commands.

Fixes #82633

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:28:17 +01:00
Emil Lindqvist
6dafb5f4a9 wifi: fix warning on wifi_ps_exit_strategy_txt
This commit fixes a warning when including wifi.h:
type qualifiers ignored on function return type

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2024-12-11 15:55:03 +00:00
Marcin Niestroj
a7ceb4723f net: l2: wifi: fix handling of missing 'ap_disable'
When calling wifi_ap_disable() API specific WiFi driver implementation was
checked whether 'ap_enable' was provided, instead of 'ap_disable'. Fix
that copy-paste error.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-12-11 15:54:18 +00:00
Jukka Rissanen
027760b6d4 net: if: Replace asserts by proper runtime checks
The asserts were not proper here, replace those by runtime
checks as the functions can be called from applications and
asserts are not meant for error checking.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-10 11:09:25 +01:00