Avoid accessing request fields before validating input arguments in
coap_client_req().
The request path length is now checked only after validating the
request pointer, preventing a potential NULL pointer dereference.
No functional change intended.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Add a new API to look up a memory region's index using its DeviceTree
node name. This allows callers to identify specific regions within the
internal regions array.
Includes unit tests for successful lookups and error handling for
non-existent names.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Ensure pointers are validated before dereferencing them in
set_arbitrate_interval() and set_interval().
This avoids accessing sensor or connection fields prior to
validation and makes the code safe even when assertions are
disabled.
No functional change intended.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
Use PSA Crypto API for SHA-1 computation instead of legacy Mbed TLS crypto.
The latter is going to be removed soon.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Remove optional use of legacy Mbed TLS crypto in favor of the already
existing PSA Crypto API alternative. This is required in order to jump
to the next version of Mbed TLS (i.e. 4.0) where all this legacy crypto
support is no more available.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
If we have more than one IP on an interface we should choose the IP
corresponding to the same network as the target IP.
Signed-off-by: Andreas Huber <andreas.huber@sautergroup.com>
llext aligns and rounds up memory regions to satisfy MPU requirements,
which can waste significant memory by relocating read-only regions,
with power-of-two alignment on some architectures. However, these
MPU-aligned regions are never actually used by the MPU unless
userspace (CONFIG_USERSPACE) is enabled.
Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
Follow coding guidelines rule 78:
A full expression containing an increment (++) or decrement (–) operator
should have no other potential side effects other than that caused by the
increment or decrement operator
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
If the underlying listening TCP context reported an error, it's no
longer usable, therefore accept() call for such a socket should report
an error as well, otherwise it may block indefinitely.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case network interface goes down, all underlying TCP contexts are
being dereferenced, however they are not released until application
dereferences them as well (i.e. closed the socket). If the application
does not do so however timely, and network interface goes down again,
the TCP context would still be present on the active contexts list and
could've been dereferenced for the second time.
Fix this by checking the context state before dereferencing it on the
stack behalf. Non-listening TCP context are being set to CLOSED state
upon dereferencing. For the listening contexts, the TCP context has
only one ref from the application side, so use the `accept_cb` pointer
value as an indicator that the accept callback, indicating an error,
has already been called for the context.
Additionally, add a mutex lock when releasing listening context on
network down even, to avoid potential races with yet unprocessed
incoming packets.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
75ef6392 removed the only call to coap_client_init_request() where
reconstruct==true. All remaining calls have reconstruct==false.
This commit removes the parameter.
Signed-off-by: Sam Friedman <sam@golioth.io>
Replace some manually-defined DT_COMPAT_<> Kconfig macro variables with
their automatically generated counterparts. In most cases, this is
straightforward as the manually defined macro is named identically to the
one generated by the build system.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Although we have the three layers, SWDP driver API, DAP stack, and USB
backend, to implement a debug probe, there is no way for the user to
instantiate the DAP context, which would allow it to be used with
different backends or to change the configuration at runtime.
The Debug Access Port (DAP) is an implementation of the ARM Debug
Interface (ADI) that is typically integrated into SoC.
With all three layers, we implement a link to the DAP on the SoC.
Let's call it Zephyr DAP Link and use the dap_link prefix. There is also
a MBED DAPLink project that implements similar functionality, but using
a different name would likely cause more confusion.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Change at_get_raw_string() return type from 'char *' to 'const char *'
to match at_get_string() and improve const-correctness. This function
returns read-only AT command response data that should not be modified.
- Update at_get_raw_string() signature in at.h and at.c
- Update return statement cast from 'char *' to 'const char *'
- Update local variables in hfp_hf.c to use 'const char *':
* bvra_handle: 'id' variable
* chld_handle: 'value' variable
* cnum_handle: 'alpha' and 'speed' variables
- Mark unused 'alpha' and 'speed' in cnum_handle with __maybe_unused
- Change NULL check style from '!id' to 'id == NULL' for consistency
This completes the const-correctness improvements started in the
previous commit for HFP HF AT command string handling.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add Espressif platform and variant IDs to hci_vs.h for ESP32 family
SoCs (ESP32, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6, ESP32-H2).
Add Espressif Systems to vs_hw_platform() and vs_hw_variant()
functions in hci_core.c for proper vendor identification.
Use CONFIG_SOC_FAMILY guards in vs_hw_variant() to reduce flash
usage by only compiling variant strings for the active SoC family.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Fix validation of AD length handling in the Bluetooth shell.
Reject zero-length AD fields before subtracting the AD type size.
The previous implementation compared an unsigned length
against zero after subtraction, making the error path
unreachable.
Signed-off-by: Om Srivastava <srivastavaom97714@gmail.com>
There is a corner case that the ACL_Data_Packet_Length is less than
the MPS of the L2CAP BR channel connection. Then the partial data
will be sent and the remaining data will be sent in sequence in the
function `l2cap_br_data_pull()`. The issue occurs when sending the
continuing fragment HCI ACL packet, due to the reference counting of
sending buffer is 0. Therefore, the application will be asserted in
the function `send_buf()`.
Fix the issue by managing the reference count of the sending buffer.
Use the function `net_buf_ref()` to increment the reference count of
the sending buffer.
If the sending buffer is the last fragment, use `net_buf_unref()` to
decrement the reference count of the sending buffer to ensure that
the send buffer can be properly released when the data is sent out.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When the response has been sent completely to the client, the server
reports the new `HTTP_SERVER_TRANSACTION_COMPLETE` status. Together with
the existing `HTTP_SERVER_TRANSACTION_ABORTED` status, the application
can now also for successful completions of requests clean up any
resources allocated for handling the request.
This especially allows to dynamically allocate the response buffer
passed to the server in the request callback and free it when the
request is done.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Rename enum http_data_status to enum http_transaction_status
to better reflect its purpose, which is to indicate the status of the
overall HTTP transaction, not just data transfer.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
This patch refreshes the documentation in the Intel Audio DSP host IPC
service backend to match the current data model and backend API
contracts.
The updated comments clarify that ipc_ept_cfg::priv must point to
intel_adsp_ipc_ept_priv_data so that the backend can carry state between
the ISR and the application callbacks. They also describe that both the
send and receive paths operate on a fixed two-word uint32_t IPC payload
(header and extended payload) rather than a generic byte buffer, and
that len must always be sizeof(uint32_t) * 2.
The documentation for intel_adsp_ipc_send() is rewritten to explain the
expected payload format, the length and NULL checks performed by the
backend, and how the function programs the IPC registers while relying
on ipc_send_message() for BUSY and TX acknowledgment handling. The
parameter semantics and error returns are aligned with the generic
ipc_service send() hook contract to make the backend behaviour easier to
understand and reuse.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Rework the Intel Audio DSP host IPC service backend to use the generic
ipc_service data/len conventions and the new critical send and buffer
management APIs.
Replace the backend-specific intel_adsp_ipc_msg and related enums with a
simple two-word payload passed through the standard ipc_service_send()
and ipc_service_send_critical() interfaces, and adapt the ISR and
receive callback to operate on this representation.
Use ipc_service_get_tx_buffer_size() as a readiness check for the host
channel and provide hold_rx_buffer() / release_rx_buffer()
implementations so ipc_service_release_rx_buffer() can be used to signal
when the channel becomes available again.
Wire the emergency send path through send_critical() to route urgent
messages via the backend's emergency fast path while keeping the normal
IPC flow unchanged.
Move the synchronous IPC wait logic out of the Intel Audio DSP host IPC
backend and into the common intel_adsp_ipc helper used by tests.
Update intel_adsp_ipc_send_message_sync() to both send the IPC message
through ipc_service_send() and wait on the backend semaphore, and remove
the now redundant ipc_send_message_sync() helper from the host IPC
backend.
Document that intel_adsp_ipc_send_message_sync() is a test-only helper,
not used by SOF firmware, and that it is a candidate for future removal
or for replacement by an explicit synchronous send primitive in the
generic IPC service API or in application code.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Add ipc_service_send_critical() as a dedicated API for sending critical
high-priority messages over an IPC endpoint.
Introduce an optional send_critical() callback in struct
ipc_service_backend so backends can implement a special fast path that
bypasses normal state and busy checks for critical notifications such as
crash reports or fatal errors.
The ipc_service_send_critical() wrapper mirrors ipc_service_send() on
the service side and delegates the actual behavior to the
backend-specific send_critical() implementation.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Add missing TOOLCHAIN_WARNING_* definitions for the IAR toolchain:
- subsys/testsuite/include/zephyr/test_toolchain.h
- subsys/testsuite/include/zephyr/test_toolchain/iar.h
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Add a minimal implementation of test_asm_inline_other.h to support
non-GNUC toolchains (e.g. IAR) during kernel benchmark tests
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Fix IAR compiler error Pe1153 caused by mismatched alias type between
_kernel_openocd_offsets and _kernel_thread_info_offsets.
The alias now uses [] to match the array type. No functional change.
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Per RFC9112 (REF #1), HTTP/1.1 server is expected to be backward
compatible with HTTP1.0 request. Mainly HTTP/1.0 does
not support
1) Transfer Encoding : chunked
2) KeepAlives
So, this change will identify the HTTP protocol
version in the request and respond accordingly.
REF#
1) https://httpwg.org/specs/rfc9112.html
Tested:
1) Verified that HTTP/1.1 requests are served as usual
i.e. with chunked transfer encoding and the connection
is a Keep Alive connection
Query exits after 10s, indicating that the client connection to
the HTTP server is a Keep Alive.
```
time printf "GET /telem HTTP/1.1\r\nHost: 192.0.3.11\r\n\r\n" |
nc 192.0.3.11 80
real 0m10.185s <- Indicates connection was kept active for 10s
user 0m0.023s
sys 0m0.023s
```
`Transfer Encoding : chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf, termination byte 0)
are present in the response.
```
HTTP/1.1 200 OK
Transfer-Encoding: chunked <- Chunked encoding header
Content-Type: text/html
3e8 <- Chunk size hex bytes
:
/health/secondsdevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.
3e8 <- Chunk size hex byte
_PLUS_rawdevice_ae:9a:22:48:0f:70"0
6
/dev/ISHARE_CBU_MINUS_rawdevice_ae:9a:22:48:0f:70"0
.
.
.
/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/part_telemetry_disabledevice_ae:9a:22:48:0f:70"0
0 <- Termination Byte 0
```
2) Verfied that HTTP/1.0 requests are served with
response without chunked transfer encoding and the
connection is closed immediately.
Query exits immediately indicating the connection is closed immediately
```
time printf "GET /telem HTTP/1.0\r\nHost: 192.0.3.11\r\n\r\n" |
nc 192.0.3.11 80
real 0m0.186s <- Indicates connection was terminated immediately.
user 0m0.018s
sys 0m0.030s
```
`Transfer Encoding : chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf) not present in the
response
```
HTTP/1.1 200 OK
Content-Type: text/html
:
/health/uptimedevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.
3
/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/can_telemetry_disabledevice_ae:9a:22:48:0f:70"0
```
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Commit adds `bt_mesh_` prefix to `struct app_key`
to make it compatible with other internal API.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds functionality that synchronizes network and
application keys between mesh core and cdb.
Additionally, subnetwork bridge bsim tests were fixed since
cdb cannot allocate subnetwork if it exists.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Event about application key changes has been refactored.
Event provides access to the corresponding applicarion key
structure instead just key indexes.
The related code has been moved from mesh.h to app_keys.h.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Adds bindings for communicating with the MCTP protocol over I3C with IBI
for signaling.
Notably I3C currently requires devices on the bus be struct device's the
way the Nuvoton driver is written and the API is written. So we create a
little glue driver (mctp_i3c_endpoint) to allow us to later bind a aptly
named mctp_i3c_controller MCTP binding.
On the target side the only usable driver for target mode is Nuvoton's.
Nuvoton's driver only implements the optional buffer read/write
callbacks rather than the read/write byte at a time callbacks. This is
actually probably for the better but it does mean this binding requires
those optional target mode functions.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
This commit aims to declare and call NAT64 functions used by Border
Router application only if corresponding flag is also set.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Add a check to drop ipv4 multicast packets that are not matching any
currently registered multicast group for the interface that received
them.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
After iface was link up, the IPv4 multicast address was added to iface
repeatly. This patch is to fix this.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>