Commit graph

21541 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
557376a2ce Bluetooth: Controller: Fix ticks_elapsed use in reschedule_in_window
Remove ticks_elapsed use in reschedule_in_window as it has
already been used in the bottom half processing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-18 14:15:23 +02:00
Vinayak Kariappa Chettimada
c96375ec1e Bluetooth: Controller: Simplify ticker reschedule_in_window
Simplify ticker reschedule_in_window implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-18 14:15:23 +02:00
Vinayak Kariappa Chettimada
b5ec75d964 Bluetooth: Controller: Refactor to not invoke function as parameter
Minor refactor to not invoke function as parameter being
passed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-18 14:15:23 +02:00
Vinayak Kariappa Chettimada
bc0b283731 Bluetooth: Controller: Fix BT_RX_STACK_SIZE required
During use of tests/bluetooth/shell application to perform
extended scanning with periodic advertising and broadcast
audio source devices around, it was observed that the
application crashed due to too low BT_RX_STACK_SIZE, hence
increase by 128 bytes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-18 14:15:23 +02:00
Vinayak Kariappa Chettimada
5dfc58cff9 Bluetooth: Controller: Fix single switch timer minimum compare value
Fix implementation of single switch timer minimum compare
value requirement. Do not always add the maximum possible
radio latency duration, but check if the required compare
value is smaller, then use the remainder required as the
extra compare value. This fix reduces latencies to setup
radio receptions and fixes an assertion in lll_scan_aux
when radio_tmr_start_us() is checked for latencies.

Relates to commit bcd28e0a86 ("Bluetooth: Controller:
Fix sw switch single timer for spurious TXEN/RXEN").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-18 14:15:23 +02:00
Maciej Baczmanski
ca09d1daa1 net: silence no sources cmake warning
add `ALLOW_EMPTY TRUE` property to silence cmake warnings in case
when no sources are added to subsys__net library

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-10-18 14:14:56 +02:00
Jukka Rissanen
11fae015e0 net: sockets: Ignore error if there is none
Seen when having multiple network interfaces that the sock_error
was 0 even if the socket was serviced properly. So if SO_ERROR
returns 0, just ignore it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-18 14:14:45 +02:00
Jukka Rissanen
8e866e95c8 net: mdns_responder: Register properly multiple sockets
We must register all listening sockets under one file descriptor
array when calling dns_dispatcher_register() which then calls
net_socket_service_register(). The socket services expects all
the registered sockets under one service context to be in one
array. If this is not done, the latest socket array wins and
the earlier registrations are forgotten.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-18 14:14:45 +02:00
Jukka Rissanen
de98378571 net: dns: Make dispatcher check also network interface
As the DNS might listen to multicast addresses (like in mDNS) in
different network interfaces, make sure to check the network
interface index when registering the dispatcher context. This
allows two mDNS registrations to more than one network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-18 14:14:45 +02:00
Sungwoo Kim
2f50e26c40 Bluetooth: HCI: Add validation for data from controllers
Like 2ca179c, check and warn if incoming HCI event parameters exceed
the specification. This helps debugging controllers by detecting the
out-of-spec value that shouldn't appear.

Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
2024-10-18 09:17:57 +02:00
Jukka Rissanen
8169ca2e08 usb: device_next: NCM driver for usb-next
USB NCM Ethernet driver implementation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-17 15:38:00 -04:00
Nithin Ramesh Myliattil
40a8870c2e bluetooth: BAS: update helper text indentation of BAS Kconfig
Fix the indentation issue of BAS KConfig

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-10-17 15:35:58 -04:00
Robert Lubos
6545f5148f net: lwm2m: Make CoAP pendings/replies arrays access thread safe
Make sure LwM2M context mutex is locked whenever accessing CoAP
pendings/replies arrays.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-17 10:49:19 -04:00
Robert Lubos
4a4e4ec7d0 net: lwm2m: Make LwM2M context lists access thread safe
System lists are not thread safe, therefore all accesses should be
protected with a mutex. Introduce a LwM2M context specific mutex,
and use it whenever lists defined per-context are acessed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-17 10:49:19 -04:00
Robert Lubos
85c5cd4c6a net: lwm2m: Make CoAP block contetx allocation thread safe
Use global engine mutex to protect allocation/deallocation of the CoAP
block contexts.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-17 10:49:19 -04:00
Robert Lubos
b8751c669b net: lwm2m: Make LwM2M message allocation thread safe
The LwM2M message allocation was not thread safe, i. e. the message was
acquired by setting the ctx pointer, and it was freed by clearing the
entire message structure.

If preemptive threads were enabled, and memset() clearing the message
content was preempted, the message structure being currently zeroed
migh've been allocated and initialized by some other thread. If the
thread releasing the message resumed work, it would continue clearing
the freshly allocated and initialized message structure.

In order to prevent this, introduce a new global mutex for the lwm2m
engine global variables. The mutex is used when LwM2M message is
allocated/deallocated. This will prevent reallocating the message
during the release process.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-17 10:49:19 -04:00
Krzysztof Chruściński
60d8482348 logging: log_cmds: Enable log commands for shell with the logging frontend
When shell is integrated with the logging frontend then pointer to
the logging backend in the shell structure is null. When null pointer
is found assume that it is a shell instance with logging frontend
integration and use frontend in the logging commands.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-17 10:48:25 -04:00
Krzysztof Chruściński
05dd68a377 shell: Allow custom shell log backend implementation
Shell is capable of acting as the logging backend and multiplex
logging messages with shell content. It expects that logging
messages goes through the logging backend. However, there is an
option that logs go only to the custom logging frontend. In
that case this default approach does not work and logging
frontend cannot be easily integrated with the shell (due to
its custom nature). Add Kconfig option SHELL_LOG_BACKEND_OOB
which prevent compilation of the default shell log backend.
When enabled, application can provide frontend specific
implementation to integrate shell with the logging.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-17 10:48:25 -04:00
Daniel DeGrasse
66577a9d23 tracing: add named event trace
Add support for a "named event" trace. This trace is intentionally not
used by the system. The purpose of this trace is to allow driver or
application developers to quickly add tracing for events for debug
purposes, and to provide an example of how tracing subsystems can be
extended with additional trace identifiers.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-10-17 10:46:52 -04:00
Rex Chen
be151908d8 net: wifi: shell: add enterprise support for station
Add EAP-TLS, EAP-PEAP-MSCHAPv2, EAP-PEAP-GTC, EAP-TTLS-MSCHAPv2,
EAP-PEAP-TLS, EAP-TLS-SHA256  enterprise wpa2 and wpa3 suiteb
support for station.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-10-17 09:46:02 +02:00
Ajay Parida
0ce5da6da8 wifi_mgmt: Add support for configuring PS exit strategy
If AP indicates the presence of buffered traffic, then it is up to the
STA to decide whether to stay in PS or come out of PS, add configuration
options that can be used at runtime to choose this.

This is tagged as "noup" because it's a backport and "fromlist" cannot
be used as it won't apply cleanly.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Ibe Van de Veire
ba9eca3181 net: ip: igmp: Add igmp.h for definitions
Add igmp.h file to declare definitions for IGMP that are not meant te be
included by the application but can be used in e.g. tests.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-17 09:44:33 +02:00
Ibe Van de Veire
c646dd37e5 net: ip: igmp: Remove too strict length check
According to RFC2236 section 2.5, the IGMP message may be longer then 8
bytes. The rest of the bytes should be ignored.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-17 09:44:33 +02:00
Ibe Van de Veire
f852c12360 net: ip: igmp: Fix wrong header length
The header length of the net ip packet was calculated using only the
net_pkt_ip_hdr_len function. The correct header length should be
calculated by adding net_pkt_ip_hdr_len and net_pkt_ipv4_opts_len. This
resulted in an incorrect IGMP version type in case of IGMPv2 message
(when IGMPv3 was enabled). The IGMP message was not parsed correctly and
therefore dropped.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-17 09:44:33 +02:00
Jukka Rissanen
8134673309 tracing: segger-sysview: Fix compilation issues with networking
The networking tracing function definitions were missing for sysview.

Fixes #79805

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-17 09:43:33 +02:00
Maochen Wang
4af697ad6b net: l2: wifi: fix AP sets band failed with channel 0
Should support setting band for both STA and SAP mode.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-10-17 09:42:59 +02:00
Bruce Rosier
24414e3c39 subsystem: tracing: test: fix k_pipe_put_* functions
k_pipe_put_* functions should take const void* data
    instead of void* data. This can lead to warnings at the
    the -Werror=discarded-qualifiers compiler flag, because the
    the input will be const void* and the parameter will be void*.
    Fix it by replacing void* data with “const void* data”.

Signed-off-by: Bruce Rosier <brucerosier9@gmail.com>
2024-10-16 16:36:11 +01:00
Szymon Janc
5b232bf1d7 Bluetooth: GATT: Allow to tune writable device appearance permissions
This allows to select if device appearance requires encryption or
authentication or none. This makes it similar to what is implemented
for device name characteristic.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-16 16:35:56 +01:00
Szymon Janc
398487f841 Bluetooth: GATT: Convert writable device name to KConfig choice
This makes it clear on how security requirements are set and avoid
confusion on how encryption and authentication are handled.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-16 16:35:56 +01:00
Jordan Yates
bff97fbc7f random: sys_csrand_get backend for TEST_RANDOM_GENERATOR
When non-random number generation is allowed via
`TEST_RANDOM_GENERATOR`, enable an implementation for `sys_csrand_get`
that stubs out to `sys_rand_get`. This enables libraries that request
CS random numbers to be tested in CI, even if the results are not CS in
that context.

The documentation for `TEST_RANDOM_GENERATOR` is explicit enough about
the dangers of enabling this in production.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-16 10:00:47 +02:00
Kristoffer Rist Skøien
c73c5d985e shell: Added assert
Assert to check columns. Averts a potential divide by zero

Signed-off-by: Kristoffer Rist Skøien <kristoffer.skoien@nordicsemi.no>
2024-10-16 10:00:17 +02:00
Lyle Zhu
0e4561bed2 Bluetooth: SSP: No MITM if required level is less than L3
Regardless IO capabilities, clear MITM flag for pairing
initiator if the required security level is less than
BT_SECURITY_L3.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-16 09:59:38 +02:00
Kiara Navarro
41f749ce8b lorawan: unify logging level
All the remaining modules uses LOG_MODULE_REGISTER(<module>, <log level>)

Lets update the logging registration as the other modules are doing it.

Signed-off-by: Kiara Navarro <sophiekovalevsky@fedoraproject.org>
2024-10-16 09:59:01 +02:00
Lingao Meng
537d215981 Bluetooth: Mesh: Fixes after proxy advertising unable to send messages
When Proxy advertising or PB-GATT Advertising Enabled and use a same
advertising sets.

As adv\_start will call multi HCI Command will cause syswork_q yield.
At same time, if another thread(BT RX) all schedule\_send will cause
unable send mesh message, because ADV\_FLAG\_ACTIVE was be set, but
ADV\_FLAG\_PROXY not set currentlly.

Add ADV\_FLAG\_SCHEDULE\_PENDING indicate mesh buf has been pendings
but not scheduled, so when proxy advertising enable, let's take again,
as we can't break or terminated adv\_start, so we must waiting proxy
advertising enabled.

But after https://github.com/zephyrproject-rtos/zephyr/pull/68558

The `k_work_is_pending` always true in `send_pending_adv`, which cause
unable to send more mesh message until more mesh message comming

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-10-16 09:58:33 +02:00
Lingao Meng
664c087d55 Bluetooth: Mesh: Refine Mesh store logic
Move flag&handler to structure, not only save some flash size
but also make code more readable.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-10-16 09:56:26 +02:00
Gaofeng Zhang
0c54a3f8c7 hostapd: add ap status in l2 wifi
add ap status in l2 wifi

Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
2024-10-15 19:09:33 -04:00
Burak Gorduk
c5a126cedb bluetooth: host: LE CS subevent result reassembly
Adds HCI support for LE CS subevent result continue
event and the reassembly logic for the partial results.

When subevent results are completed or the subevent is
aborted, the user callback is invoked with a buffer
pointing to the HCI event buffer, so no copy is done.

When subevent results are incomplete, then a reassembly
buffer is allocated from a fixed sized pool. This buffer
is used for the reassembling of the subevent result
containing all of the step data, which is then passed
to the user via the callback. kconfigs have been added
to set the size and the count of the reassembly buffer.

Signed-off-by: Burak Gorduk <burak.gorduk@nordicsemi.no>
2024-10-15 19:09:05 -04:00
Chris Friedt
f4e07d15d6 sys: util: define bits per byte, nibble, and nibbles per byte
Collect some common bit-widths redefined in various locations
and put them under sys/util.h .

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-10-15 19:05:06 +01:00
Tomasz Moń
1dde8e2550 usb: device_next: uac2: Generate Feature Unit descriptor
Rework NUM_SPATIAL_LOCATIONS() to evaluate to integer literal to allow
using it with LISTIFY() macro. This is necessary because Feature Unit do
not operate on channel clusters but rather on logical channels.

Track back Output Terminal channel cluster to appropriate entity. This
is necessary because Feature Unit does not repeat the channel cluster
information.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-10-15 19:03:49 +01:00
Chaitanya Tata
4c5a72f9e0 net: wifi: Fix PEM certificate parsing errors
MbedTLS specifically checks for null-terminator, else it skips PEM
format processing and tries to parse it as DER causing parsing failures.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-15 13:53:30 +02:00
Tim Lin
7fa962589f ITE: it8xxx2: Remove CONFIG_PINCTRL from soc defconfig file
The driver Kconfig determines whether pinctrl is enabled
instead of soc defconfig.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-10-15 13:52:55 +02:00
Jukka Rissanen
7510e2d940 shell: backend: Create a websocket transport backend
This creates a websocket based shell backend that is used to
implement a websocket console that can be connected using a browser.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-15 04:11:03 -04:00
Jukka Rissanen
7408004531 logging: backend: Add websocket backend
Allow logging output to websocket console. Requires that
websocket shell backend and websocket HTTP server support
is also enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-15 04:11:03 -04:00
Emil Gydesen
203bcf3774 Bluetooth: CCID: Make the CCID API public
Move the CCID header to the include directory
to make it public.

This also compiles the ccid.c file whenver CONFIG_BT_CONN
is enabled, rather than having an additional Kconfig for it,
since the API is now public and may be used by other than
our internal services.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-15 04:10:28 -04:00
Emil Gydesen
5f1a573809 Bluetooth: CCID: Improved CCID allocation
Rather than throwing an assert, it will now do a better
check for already-allocated CCIDs and return an error instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-15 04:10:28 -04:00
Emil Gydesen
7461f3781e Bluetooth: CCID: Rename ccid_get_value to alloc_value
alloc_value is more correct as it does allocate a new
value, rather than just returning/getting a value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-15 04:10:28 -04:00
Jukka Rissanen
c6aa9e3803 wifi: shell: btm_query: Fix invalid pointer cast
The 11v_btm_query shell command was calling parse_number() using
a pointer to uint8_t. This will cause memory overwrite and possible
crash. Convert to use long temporary value to avoid this.

Fix also the output prints in case of an error.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-15 04:07:59 -04:00
Jukka Rissanen
8105f70d7a wifi: shell: Add missing newlines when printing error
The parse_number() did not print newline after error or warning message.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-15 04:07:59 -04:00
Jukka Rissanen
32aa1d634e wifi: Refactor wifi-shell to allow external subcommands
Rework the wifi-shell code so that external subcommands can be
bolted into it easily. This means that the commands should be
created using SHELL_SUBCMD_ADD().

Place the various subcommands in alphabetical order to find them
more easily.

Split long lines in order to pass CI checks.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-15 04:07:59 -04:00
Erik Sandgren
5f59b35b42 Bluetooth: Host: Fix issue where uninitialized value was used
This change makes sure that when a call to `bt_id_set_scan_own_addr` is
sucessful, i.e., the return value is 0, the `own_addr_type` will
be set by the `bt_id_set_scan_own_addr`.

Not setting the `own_addr_type` in a successful call to
`bt_id_set_scan_own_addr` causes, for example,
the `start_le_scan_ext` method in `scan.c` to use an
uninitialized `own_addr_type`.

Eventually this results in an unexpected failure further down in
`start_le_scan_ext`, when sending HCI command to controller with
an uninitialized `own_addr_type`.

Signed-off-by: Erik Sandgren <erik.sandgren@nordicsemi.no>
2024-10-15 04:07:50 -04:00