Commit graph

18755 commits

Author SHA1 Message Date
Jukka Rissanen 2ed2d38d7d shell: backend: uart: Fix POSIX name conflict
If CONFIG_POSIX_API is enabled, the read() and write() function
names will conflict.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-24 12:45:46 -04:00
Carles Cufi 6cc771cb0c Bluetooth: mesh: Remove deprecated Kconfig option
The MESH_LABEL_NO_RECOVER Kconfig option was introduced as deprecated in
Zephyr 3.5.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-24 12:42:30 -04:00
Carles Cufi 06d7d763bd Bluetooth: gatt: Remove deprecated write struct member
The struct member was deprecated back in Zephyr 3.1.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-24 12:42:30 -04:00
Robert Lubos b854d8b466 net: sockets_service: Increase stack size for mDNS responder
Tests showed that mDNS responder needs slightly more stack on certain
platforms, hence increase the default for such case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Robert Lubos 027a19a565 net: lib: dns_sd: Fix buffer sizes on query processing
A few issues were identified with DNS_SD segment buffers, making it work
"by chance" (depending on memory layout):

- size check in dns_sd_query_extract() did not take NULL termination
  into account, and in result could overflow provided buffer
- the proto_buf in send_sd_response() can either be used to parse
  protocol or domain, depending on number of segments in the query.
  It should therefore be large enough to hold either.
- Similarily, instance_buf should be able to hold
  DNS_SD_INSTANCE_MAX_SIZE, not DNS_SD_SERVICE_MAX_SIZE.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Aleksandr Khromykh ddc23f47d8 Bluetooth: Mesh: rename deprected key refresh field
Commit renames deprecated key refresh field.
It still has to exist to allow backward compatibility
with previous versions when data are restored from
the persistent memory.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-06-24 12:42:03 -04:00
Robert Lubos d9a979f2dc net: lib: dhcpv4: Fix typo in logs
DHCPv4 was misspelled in logs.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:41:38 -04:00
Robert Lubos cd5e1cd0a5 net: lib: http_server: Fix possible NULL pointer dereference
Fix possible NULL pointer dereference in http_hpack_decode_header().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:41:22 -04:00
Jukka Rissanen a0b56dab1a net: dns: llmnr_responder: Fix uinit variable
The family variable was not initialized and could potentially
be left like that. This could only affect error printout.

Fixes #74796
Coverity-CID: 368799

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-24 12:41:06 -04:00
Aleksander Wasaznik a9c95c5c87 Bluetooth: Host: Enforce correct pool in bt_hci_cmd_send_sync
`cmd(buf)` depends on this since it uses `net_buf_id`, which would alias
multiple pools.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-06-24 14:26:11 +02:00
Bjarki Arge Andreasen 016b4f1d33 modem: ppp: coverity 330618: explicitly ignore retval
Explicitly ignore the return value of net_pkt_read_u8() as the
net_pkt is validated before being queued for transmit within
modem_ppp_ppp_api_send()

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-24 14:25:46 +02:00
Alberto Escolar Piedras f13196429e subsys/net/lib/http: Set feature macro as required
This file uses strnlen() but the C library
is not require to expose its prototype unless
_POSIX_C_SOURCE is defined.
So let's define it to avoid an implicit function
declaration warning.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-24 13:01:38 +02:00
Aleksandr Khromykh f9d7385879 Bluetooth: Mesh: add extension config server by lcd server
Commit add extension of configuration server by large
composition data server.
Mesh Protocol v1.1 specification
4.4.21.1
The Large Composition Data Server is a main model
that extends the Configuration Server model.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-06-24 09:44:58 +02:00
Aleksandr Khromykh 3e2b44a5dd Bluetooth: Mesh: add extension config server by private beacon server
Commit add extension of configuration server by private
beacon server.
Mesh Protocol v1.1 specification
4.4.11.1
The Mesh Private Beacon Server model is a main model
that extends the Configuration Server model.

Configuration server and private beacon server shall always
exist together since they have bound states.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-06-24 09:44:58 +02:00
Jordan Yates 07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
frei tycho 75cd10bf56 testsuite: change controlling expressions in while to Boolean
Use `do { ... } while (false)` instead of `do { ... } while (0)`.

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-06-21 15:41:26 -04:00
Lingao Meng cfd79e8bf0 bluetooth: host: Use K_WORK replace delayable
Use K_WORK defined. This delayed work is never used with any
other timeout than K_NO_WAIT, so the "delayed" part of it
is never actually needed

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-21 11:42:04 -04:00
Robert Lubos abc91227b2 net: lib: zperf: Fix socket leak during asynchronous TCP upload
In case of TCP upload error, zperf would leak a socket when running in
asynchronous mode. The upload work have to release the socket it
allocated in any case, regardless of the session result.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-21 11:38:11 -04:00
Robert Lubos 5cea38021e net: lib: zperf: Fix socket leak during socket setup
During socket setup, if one of the setsockopt() calls failed, the
function would return an error w/o closing the socket. That's wrong, as
in case of errors the function should clean up any resources it
allocated, the socket file descriptor is lost otherwise and resources
are leaked.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-21 11:38:11 -04:00
Marek Pieta f6600040e4 usb: cdc_acm: Update log level only if UART log backend is enabled
Change updates log level only if UART log backend is enabled in Kconfig
configuration. The log level update is not needed in case logs are
provided over other backend (e.g. RTT).

Change affects both USB stacks.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2024-06-21 08:45:22 -04:00
Robert Lubos 1aca4205b8 net: lib: dns: Fix error code returned when socket creation failed
We should return the errno value in such case, as ret will always be -1
on failure, which might misleading, as it does not give any hint on what
failed.

Also bump the log level of the error message, so the failure is visible
w/o needing to enable debug logs. Such a failure is fatal for the DNS
subsystem, so error level is justified here.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-21 08:44:29 -04:00
Robert Lubos e018281d3b net: lib: dns: Fix DNS dispatcher double net buf unref
The `dns_data` buffer, allocated by the DNS dispatcher was dereferenced
twice - once in registered DNS handler, second time in the dispatcher
itself.

Since the buffer was allocated by the dispatcher, and it's not really
guaranteed that the buffer will be freed in the registered handler (this
depends on the processing outcome, the function may return early w/o
freeing the net buf in case of errors), it makes most sense for the
dispatcher to keep ownership of the buffer. Hence, the registered
handlers will no longer release the buffer provided in any case, and the
dispatcher will free it on exit.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-21 08:44:15 -04:00
Troels Nilsson eea1573b2b Bluetooth: Controller: Collection of small fixes for BIS
Use PDU_BIS_LLID_FRAMED in empty PDUs for framed BIS

Allocate room for header when calculating max_pdu for framed BIS

Set group_sync_delay, stream_sync_delay and framed properly for BIS
broadcaster

Add missing call to isoal_tx_event_prepare() for BIS

Signed-off-by: Troels Nilsson <trnn@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-06-20 12:07:32 -04:00
Morten Priess b1bcd799fb Bluetooth: controller: Add data path config for ISO sync receiver
- Assign sync_delay parameters for ISO-AL sink creation
- Store framing information from BIGinfo for use in sink creation
- Set max_octets for sink creation

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-06-20 12:07:32 -04:00
Nirosharn Amarasinghe 1a640e4711 Bluetooth: controller: Included transport latency in LE_Big_Established
Included missing transport_latency_BIG information in HCI
LE_Big_established message.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2024-06-20 12:07:32 -04:00
Rubin Gerritsen 69fb606579 Bluetooth: Host: Define bt_security_err_to_str()
This can be useful if application developers
want to print them in the applications.

Later we can also use them in
the host to improve debuggability.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-20 15:34:39 +02:00
Rubin Gerritsen b25985ad6a Bluetooth: Host: Define bt_smp_err_to_str()
This API converts a SMP error code to a string.
This can be useful if application developers want
to print them in the applications.

BT_SMP_ERR_SUCCESS was added for completeness.

Later we can also use them in the host to improve debuggability.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-20 15:34:39 +02:00
Rubin Gerritsen 94d712e5cf Bluetooth: Host: Define bt_att_err_to_str()
This can be useful if application developers
want to print them in the applications.

Later we can also use them in
the host to improve debuggability.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-20 15:34:39 +02:00
Maochen Wang 8a37897b5c net: ethernet: Fix EAPol packet length changed wrongly
In ethernet_recv(), it will call ethernet_update_length() to check for
ipv4 or ipv6 packet if it needs to get rid of the padding in the
packets. But for EAPOL packets, no need to do this, which may modify
the packet length of EAP type packet wrongly and leads to EAPoL
packets dropped in supplicant.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-06-20 12:47:18 +02:00
Maochen Wang 762169034b net: wifi: split wifi interface into STA and uAP
Split wifi interface into station mode and soft-AP mode, as there may be
station and soft-AP two interfaces that work concurrently.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-06-20 12:47:18 +02:00
Henrik Maier abeae8fd08 net: lib: http_server: Fix dynamic HTTP post zero 0 length reply
Fix issue in http server that a http post
was unable to send a 0 length reply.

Signed-off-by: Henrik Maier <hwmaier@gmail.com>
2024-06-20 08:58:03 +02:00
Aleksandr Khromykh 3cf219fb97 Bluetooth: Mesh: align mesh and host psa usage
Commit aligns usage mesh and host PSA.
Since PSA crypto is supported in host then
there is no reason to switch off some of host
features to get rid of tinycrypt functions in
the final image.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-06-19 13:24:08 -04:00
Jonathan Rico c6345c6371 Bluetooth: l2cap: service as much TX channels as possible
Similar to ISO connections, ACL connections are not serviced as fast as
possible. Change this, and try to send as much as we have resources for.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-06-19 13:38:49 +02:00
Jonathan Rico d3dbf890bf tests: Bluetooth: make an L2CAP multilink stress test
This test's purpose is to stress the TX data path in the case of multiple
connections.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-06-19 13:38:49 +02:00
Jonathan Rico 8af7180531 Bluetooth: iso: make TX path service all connections
ISO connections that were in the TX queue were not getting serviced in
time. This happens because `iso_data_pull()` returns `NULL` when that
particular connection (`conn`) is done sending.

But it doesn't trigger the TX processor again to process other channels in
the queue. This patch fixes that by calling `bt_tx_irq_raise()`.

We can't do this from `conn.c` as we don't know if the `NULL` returned is
because the current channel is out of data or because it has data but it
can't send it (e.g. the current buf is being "viewed" already).

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/74321

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-06-19 13:38:41 +02:00
Rubin Gerritsen 1b33616535 Bluetooth: Host: Add log entry for connection creation timeout
This makes it more clear what is happening when the host cancels
connection creation where the controller raises
the connection complete event with status set to
"UNKNOWN CONNECTION IDENTIFIER (0x02)".

This is especially useful for developers not familiar with this
detail in the spec.

See also: Core_v5.4, Vol 4, Part E, Section 7.8.13,
LE Create Connection Cancel command.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-18 20:11:53 -04:00
Alberto Escolar Piedras 1949f3205e subsys/pm/Kconfig: Fix typo
Fix a trivial typo in Kconfig

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-18 20:02:00 -04:00
Flavio Ceolin 836c2ccfd4 pm: device_system_managed: Fix functions return
Fix functions return when CONFIG_PM_DEVICE_SYSTEM_MANAGED is
not enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-06-18 19:56:39 -04:00
Chris Friedt 72bd951ac4 net: ptp: do not use a reserved id in global scope
Generally, we should avoid using reserved names in global
contexts.

subsys/net/lib/ptp/clock.c:58:25: \
  error: 'clock' redeclared as different kind of symbol
   58 | static struct ptp_clock clock = { 0 };

/opt/toolchains/zephyr-sdk-0.16.8/arm-zephyr-eabi/picolibc/ \
  include/time.h💯12: \
  note: previous declaration of 'clock' with type 'clock_t(void)' \
  {aka 'long unsigned int(void)'}
  100 | clock_t    clock (void);

subsys/net/lib/ptp/clock.c:58:25: \
  error: 'clock' defined but not used [-Werror=unused-variable]
   58 | static struct ptp_clock clock = { 0 };

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-18 19:54:53 -04:00
Yong Cong Sin 15dc87d172 tracing: trace sys_init calls
Created tracing APIs to trace the enter and (exit + result) of
SYS_INIT and DEVICE_DT_DEFINE (and friends).

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:39:05 -04:00
Pierrick Guillaume 724762facd fs: open: fix zfp flags not set when calling truncate
If filesystem relies on zfp flags being set after open, this can lead to
inconsistency with the current implementation of FS_O_TRUNC.
Move the assignment of zfp->flags before any other call to fs api to avoid
such issues.

Signed-off-by: Pierrick Guillaume <pierguill@gmail.com>
2024-06-18 14:35:03 -04:00
Yong Cong Sin 95dc81998e settings: remove CONFIG_CONFIG_SETTINGS_FS
`CONFIG_CONFIG_SETTINGS_FS` has been deprecated for
more than 2 releases, remove it and its associated source
code.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin 624f4a1ec0 net: ieee802154: remove CONFIG_NET_L2_IEEE802154_ACK_REPLY
`CONFIG_NET_L2_IEEE802154_ACK_REPLY` has been deprecated for
more than 2 releases, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin e6295b5279 log: remove CONFIG_LOG_DOMAIN_ID
`CONFIG_LOG_DOMAIN_ID` has been deprecated for years and
shouldn't be used according to its documentation, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin 1899e4f667 bluetooth: remove CONFIG_BT_DEBUG_LOG
`CONFIG_BT_DEBUG_LOG` has been deprecated for more than 2
releases, replace it with `CONFIG_BT` + `CONFIG_LOG`:

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin 3c0aae8415 net: lwm2m: replace deprecated lwm2m_engine_get_resource
`lwm2m_engine_get_resource()` has been mark for deprecation for
more than 2 releases, but we are still using it in tree now,
because the `__deprecated` marker was probably forgotten in the
initial deprecation commit.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:32:56 -04:00
Yong Cong Sin 94e12d595e net: lwm2m: remove deprecated functions & definition
These functions have been deprecated for more than 2 releases,
remove them:

- lwm2m_engine_update_observer_min_period
- lwm2m_engine_update_observer_max_period
- lwm2m_engine_create_obj_inst
- lwm2m_engine_delete_obj_inst
- lwm2m_engine_set_opaque
- lwm2m_engine_set_string
- lwm2m_engine_set_u8
- lwm2m_engine_set_u16
- lwm2m_engine_set_u32
- lwm2m_engine_set_u64
- lwm2m_engine_set_s8
- lwm2m_engine_set_s16
- lwm2m_engine_set_s32
- lwm2m_engine_set_s64
- lwm2m_engine_set_bool
- lwm2m_engine_set_float
- lwm2m_engine_set_objlnk
- lwm2m_engine_set_time
- lwm2m_engine_get_opaque
- lwm2m_engine_get_string
- lwm2m_engine_get_u8
- lwm2m_engine_get_u16
- lwm2m_engine_get_u32
- lwm2m_engine_get_u64
- lwm2m_engine_get_s8
- lwm2m_engine_get_s16
- lwm2m_engine_get_s32
- lwm2m_engine_get_s64
- lwm2m_engine_get_bool
- lwm2m_engine_get_float
- lwm2m_engine_get_objlnk
- lwm2m_engine_get_time
- lwm2m_engine_register_read_callback
- lwm2m_engine_register_pre_write_callback
- lwm2m_engine_register_validate_callback
- lwm2m_engine_register_post_write_callback
- lwm2m_engine_register_exec_callback
- lwm2m_engine_register_create_callback
- lwm2m_engine_register_delete_callback
- lwm2m_engine_set_res_buf
- lwm2m_engine_set_res_data
- lwm2m_engine_set_res_data_len
- lwm2m_engine_get_res_buf
- lwm2m_engine_get_res_data
- lwm2m_engine_create_res_inst
- lwm2m_engine_delete_res_inst
- lwm2m_engine_path_is_observed
- lwm2m_engine_send
- lwm2m_send
- lwm2m_engine_enable_cache

And additionally, the following definition:
- LWM2M_RD_CLIENT_EVENT_REG_UPDATE_FAILURE

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:32:56 -04:00
Yong Cong Sin d85087ee46 subsys/settings: remove deprecated function
`settings_mount_fs_backend()` has been deprecated for
more than 2 releases, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:32:56 -04:00
Yong Cong Sin 606f90efa9 net: dns: remove deprecated function
`dns_sd_extract_service_proto_domain()` has been deprecated for
more than 2 releases, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:32:56 -04:00
Yong Cong Sin d9743aaa35 include: mgmt: mcumgr: remove deprecated functions
These functions have been deprecated for more than 2 releases,
remove them:

- zephyr_smp_rx_req
- zephyr_smp_alloc_rsp
- zephyr_smp_free_buf

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:32:56 -04:00