The mutex is being used as a simple binary semaphore. It is not
recursed so we don't need to track thread ownership nor lock count.
Exchange the mutex for a binary semaphore to save resources and
speed up shell.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Due to the alignment and granularity requirements of memory allocation,
setup->wLength is shorter than the allocated buffer size.
This lead to responses larger than what the host requested, which it
rejected. Fix it by using the minimum between the allocated size, the
struct size, and the wLength requested.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Some OSes like MacOS use shorter UVC 1.1 probe/commit messages even when
UVC 1.5 is supported, without bUsage, bBitDepthLuma, bmSettings,
bMaxNumberOfRefFramesPlus1, bmRateControlModes bmLayoutPerStream.
Accept messages of arbitrary size to safely be processed, ignoring all
missing fields, improving standard compliance.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Check if there actually is data to copy before calling memcpy() to
prevent potentially calling memcpy() with NULL value pointer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
* Simplify the logic of the get_number() function to address the corner
cases reported by UBSAN regarding byte-swapping signed integer values.
The existing logic was actually only valid for little-endian systems,
as it expected that the bytes written from the packet buffer will be
stored at the beginning of the int64_t memory, plus the actual
byte-swapping with signed integer casts inside was hard to follow.
Switch to a plain uint8_t buffer for integer readout, and use
dedicated system function to convert the big-endian data in the buffer
into unsigned integer in the system endianness, followed by the final
cast to a signed value.
* Add explicit cast to uint32_t in put_objlnk() to prevent warning about
not-fitting integer after byte shift, and update the result type to
uint32_t as well.
* Switch to buffer with sys_put_be16/32/64 when writing integers due to
similar warnings about byte-swapping signed values.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Verify if the integer value being parsed does not overflow int64_t type
and report an error in such cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Verify if the integer value being parsed does not overflow int64_t type
and report an error in such cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Check if value pointer is not NULL before passing it to memcmp() inside
lwm2m_engine_set(). As the function actually expects that the value
pointer can be NULL in case resource value is cleared (there is a test
case for such behavior), validate that len value is actually 0 if NULL
value is provided, to avoid unexpected behavior in other parts of the
function.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As packets need to be forwarded between Wi-Fi/Eth interface and
OpenThread interface, routing support has to be re-enabled and
configurable through prj.conf file.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Fix FS shell using fixed 'storage_partition' nodelabel instead of
accessing the DT defined partition from the zephyr,fstab,littlefs
node partition property.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
The modem modules cmux module is currently directly coupled to the
presence of specific modems, rather than being selected by drivers
for whatever hardware wants to request the default MTU of 127 bytes.
This commit the makes the device drivers (for now, modem_cellular)
select the symbol, thus decoupling the modem modules from the
presence of any specific device.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
This commit implements zephyr filesystem operations for virtiofs
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
This commit adds virtiofs functions implementing fuse operations required
to enable zephyr filesystem support
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
When preparing LLEXT ELF sections only invalidate instruction cache
of executable sections. Also skip the step on platforms, managing
cache at the application level.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The shell subsystem currently uses k_poll for signalling. However,
k_poll is only used for simple event signals, results are not used.
Replacing the k_poll with k_event greatly simplifies the code, and
saves 4 struct k_poll_signal and 4 struct k_poll_event (one of which
was entirely unused) while costing a single struct k_event, for
every shell instance. It also allows us to not select POLL,
as we are using the simpler EVENTS instead.
A quick test build of the shell test suite on an nrf54l15 produces
the following build info:
using EVENTS:
FLASH: 71592 B 1428 KB 4.90%
RAM: 9872 B 188 KB 5.13%
IDT_LIST: 0 GB 32 KB 0.00%
using POLL
FLASH: 75524 B 1428 KB 5.16%
RAM: 11224 B 188 KB 5.83%
IDT_LIST: 0 GB 32 KB 0.00%
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Separate CON responses do no have a reply callback registered (as no
response is expected), however are still registered for retransmission
on the pending list. Therefore, we not only need to check for empty
ACKs for such case but for RESET packets as well. However, this cannot
be done before "reply" processing, as some of the reply handlers
(notifications namely) check for RESET replies.
Therefore, add a final check for the RESET response after the existing
"reply" logic. In such case, just remove the pending response packet
from the retransmission queue, and release resources.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When using a separate response mechanism in LwM2M client, the
acknowledged flag is used to notify the engine that the request has been
acknowledged already with an empty ack and a separate CON response
should be sent. The same flag however is used by the retransmission
mechanism, to check if the CON request sent by the client has been
acknowledged by the peer.
As separate responses use the flag both ways, it has to be cleared
before sending the separate CON reply. Otherwise, the retransmission
logic assumes the reply has already been acknowledged and skips the
retransmission.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
BT_CTLR_LOW_LAT_ULL_DONE is used to reduce CPU usage in LLL
context by delegating the done event dequeue to ULL_HIGH
context.
Building a HCI Controller with BT_CTLR_LOW_LAT_ULL_DONE had
assertion when used with BlueZ stack.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix flash sync start from repeatedly forcing connection
event be skipped. Space new flash operation to be placed
in the past so that it does not force itself on to an
overlapping connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Compilation fails with an "index outside of array bounds" error:
In function 'find_memory_region',
inlined from 'gdb_mem_can_read' at \
zephyr/subsys/debug/gdbstub/gdbstub.c:93:7:
zephyr/subsys/debug/gdbstub/gdbstub.c:65:21: warning: array subscript \
idx is outside array bounds of 'const struct gdb_mem_region[0]' \
[-Warray-bounds]
65 | r = &gdb_mem_region_array[idx];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/subsys/debug/gdbstub/gdbstub.c: In function 'gdb_mem_can_read':
zephyr/subsys/debug/gdbstub/gdbstub.c:42:36: note: while referencing \
'gdb_mem_region_array'
42 | __weak const struct gdb_mem_region gdb_mem_region_array[0];
|
Use a single element array to fix the problem.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Incorporate the basic RTK API as well as a basic client integration
(serial) as a way to receive and publish the RTK data.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Now when role is sink and source sends data, stream recv callback is
not registered, apps works fail. so stream recv callback should be
checked.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
clang reports a warning about a label followed by a variable
declaration:
label followed by a declaration is a C23 extension
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fix one leftover unaligned access warning generated by clang:
warning: taking address of packed member 'th_seq' of class or
structure 'tcphdr' may result in an unaligned pointer value
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
- In bap_unicast_client, it was assumed that ASE is binded with CIS
handler during sending "received_stop_ready" to unicast_server.
- In case where unicast_client has not started the stream with
"receiver_start_ready" att command to server, but wants to disable
ASE which was Enabled previously (but not stream!) causes failure
since there is no cis_create has happened and linked to ASE.
- In BAP_TS, "BAP/UCL/SCC/BV-103-C" has a same test conditions where
client first enables the ASE, disable the ASE, and expecting
"receiver_stop_ready" att command from client to server followed by
server notification to enter its ASE in QoS_configured state.
- Removed this condition checks to send expected att command to
server from Enabling ASE state to Disable ASE.
Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
Based on TCP Spec., if the incoming packet seqnum is old but with
new data (seqnum + len > conn->ack), that part of valid data should
be accepted. Now Zephyr doesn't support it.
This patch will add support to such scenario.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
Fix LLCP to use event_counter value used during prepare to
compare instant to be the value as when in prepare and not
incorrectly use a stale value (when two radio events
overlap).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fixes an issue for MCUboot DFU whereby images would always be
uploaded to slot1 instead of slot0 meaning that updates would
never take effect, but retains uploading to slot1 if the
application is running from slot0
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The alignment value tells the amount of alignment of buffer length
when allocating net_buf data for sending. By default there is no
special alignment. This is needed for example with Nordic Wi-Fi
chip that uses SPI driver that expects 4 byte alignment for the
length of the data that is being sent.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make the interface interface state array static, ensuring that the array
is zeroed at boot. This enables interfaces which initialise earlier than
the CONN_MGR module to set flags in their init functions.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Fix a potential NULL pointer dereference for skip_fields in the function
ull_adv_sync_copy_pdu_header. This issue been reported by Coverity.
Coverity CID: 392529
Signed-off-by: Loic Domaigne <tech@domaigne.com>
Not sure why this vestigal struct member was here at this point (18
months ago...) but its unused and was causing problems for certain
parts.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
K_TICKS_FOREVER is defined as -1. Guard logic has been added for the case
when `ticks - exit_latency_ticks == -1` to prevent sys_clock_set_timeout()
from incorrectly setting a forever timeout.
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
The implementation used BT_L2CAP_ECRED_MIN_MTU to check the lower limits
of both MTU and MPS, instead of BT_L2CAP_ECRED_MIN_MPS for MPS. While
these are the same here, confusion may arise. This commit fixes the
confusion.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
There are cases, for example when peer is requesting two DNS
addresses, but we can only give one, we should reject the secondary
DNS request first, before sending NAK to acceptable options.
Option parser can reject a parameter by returning -ENOTSUP and when
it wants to NAK the parameter, it returns -EINVAL.
On RFC 1661:
Configure-Reject
If some Configuration Options received in a Configure-Request are
not recognizable or are not acceptable for negotiation (as
configured by a network administrator), then the implementation
MUST transmit a Configure-Reject.
Configure-Nak
If every instance of the received Configuration Options is
recognizable, but some values are not acceptable, then the
implementation MUST transmit a Configure-Nak.
So as stated by RFC, we should start the negotiation by rejecting all
parameters that we cannot configure. I added an example of rejecting
DNS requests, if we don't have those.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled,
Zephyr should request two DNS addresses in IPCP negotiation by sending
IPCP ConfReq for DNS otions using 0.0.0.0 as an address.
Remote peer may offer DNS by sending IPCP ConfNak with proper address.
This is explained in RFC 1332 and RFC 1877 (DNS extension).
When no DNS is required, we should only send IPCP ConfReq for IP
address, without having DNS fields in the same request.
However, when PPP is configured to serve a DNS using Kconfig option
CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the
IPCP ConfNak message and from the ipcp.peer_options structure, not from
the ipcp.my_options.
This might break backward compatibility outside this repository
as DNS addresses used to be served from ipcp.my_options.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Some APIs taken in_addr/in6_addr pointer w/o const qualifier, while they
do not actually intend to modify the provided address. This commit
adds the missing const qualifier where applicable.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
add bt_conn_br_switch_role and bt_conn_br_set_role_switchable to control
the role switch, add DEFAULT_ROLE_SWITCHABLE Kconfig to control the default
role switch state.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>