Add HTTP client shell commands under the 'net http' subcommand group.
Supports GET, POST, PUT, and DELETE methods.
Commands:
net http get <url>
net http post <url> <body>
net http put <url> <body>
net http delete <url>
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new bt write-eir-name shell command to set the Extended
Inquiry Response (EIR) name for BR/EDR connections.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Add bt_br_write_eir() API to set the extended inquiry response (EIR)
data for BR/EDR device discovery. EIR allows remote devices to
obtain more information during the inquiry process without needing
to establish a connection.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Allow cdc_acm_poll_in() to receive when CDC ACM function gets enabled,
but only when the IRQ API is not already used.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add an initial assign and check for subgroup == NULL before
calling SYS_SLIST_PEEK_NEXT_CONTAINER as some compilers
consider subgroup otherwise considers it uninitialized:
In function ‘z_snode_next_peek’,
inlined from ‘sys_slist_peek_next_no_check’ at
/__w/zephyr/zephyr/include/zephyr/sys/slist.h:281:1,
inlined from ‘sys_slist_peek_next’ at
/__w/zephyr/zephyr/include/zephyr/sys/slist.h:292:1,
inlined from ‘bt_bap_broadcast_source_reconfig’ at
/__w/zephyr/zephyr/subsys/bluetooth/audio/bap_broadcast_source.c:1008:15:
/__w/zephyr/zephyr/include/zephyr/sys/slist.h:213:20: error:
‘subgroup’ may be used uninitialized [-Werror=maybe-uninitialized]
213 | return node->next;
| ~~~~^~~~~~
/__w/zephyr/zephyr/subsys/bluetooth/audio/bap_broadcast_source.c:
In function ‘bt_bap_broadcast_source_reconfig’:
/__w/zephyr/zephyr/subsys/bluetooth/audio/bap_broadcast_source.c:975:43:
note: ‘subgroup’ was declared here
975 | struct bt_bap_broadcast_subgroup *subgroup;
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Make the codec_cfg parameter of the BAP can CAP APIs const,
as they are now only used as one-time parameters, and not stored.
This also means that any uses of this can place the codec_cfg
parameter in the stack, rather than static memory.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The pointer represent the codec configuration
for a stream based on the ASE or broadcast configuration,
and serves as a read-only value. Changing it to `const` makes
this more clear.
Some minor changes were done to existing code to help
support this change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In some cases the codec_cfg pointer pointed to the
codec_cfg argument, and sometimes it pointed to the ep->codec_cfg.
Now all codec_cfg arguments are copied to ep->codec_cfg, and
stream->codec_cfg always points to stream->ep.codec_cfg.
This also fixes a bug where metadata updates initiated
by the server was not properly stored by the client.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The function name `avdtp_tx_signal` is misleading as it is used to
transmit single-fragment packets, not specifically signal packets.
Rename it to `avdtp_tx_single` to better reflect its actual purpose
and improve code clarity. Rename `avdtp_tx_frags` as `avdtp_tx_multi`
because AVDTP spec use `multi`.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Some resources in MCS were accessed (both read and write) by
multiple threads without any thread protection.
This commit adds a mutex to ensure thread safety.
Since the flags were previously using atomic to
prevent race condition between threads, and since there is
now a mutex, those flags have been modified to be simple
boolean values instead.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add CoAP over TCP/TLS framing, parsing, and client support as
specified in RFC 8323. This includes:
- TCP message framing with variable-length header encoding
- CSM (Capabilities and Settings Message) exchange
- Signaling codes: Ping/Pong, Release, Abort
- CoAP TCP client with blockwise transfer support
- New Kconfig options under CONFIG_COAP_OVER_RELIABLE_TRANSPORT
- Documentation update for CoAP client API
Signed-off-by: Marcus Penate <marcus.penate@ellenbytech.com>
Add bt_conn_br_set_supervision_timeout() API to configure the
link supervision timeout for a BR/EDR connection via the HCI
Write Link Supervision Timeout command.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Add bt_conn_br_get_supervision_timeout() API to read the current
link supervision timeout value for a BR/EDR connection via the
HCI Read Link Supervision Timeout command.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Posix is not a library per the definition of libraries in Zephyr. It
always has been a portability layer and shall reside with other
portability layers under subsys/portability.
Addresses #99250
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Expand the ZTEST_BENCHMARK_OUTPUT_CSV Kconfig help text to describe the
two CSV row formats (sampled and timed) so that users don't have to
reverse engineer them by looking at the code.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Fix a scenario where the logging thread can enter an infinite
loop and starve lower-priority threads when encountering an
uncommitted log message.
If a lower-priority thread is preempted before committing a
message, and a higher-priority thread triggers log processing,
the logging thread may repeatedly attempt to claim it. Since the
message is pending but not committed, z_log_msg_claim() returns
NULL while z_log_msg_pending() remains true, resulting in a
livelock.
Update the log processing logic to avoid looping on uncommitted
messages, allowing lower-priority threads to resume and complete
the commit.
Fixes#101401
Signed-off-by: Javier Romera <lromerajdev@gmail.com>
When CONFIG_LOG_MODE_IMMEDIATE and CONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT
are enabled, log messages are processed synchronously and serialized
across CPUs using a global spinlock (process_lock).
In this configuration, if a fatal exception (e.g. stack overflow
triggering a PMP fault on RISC-V) occurs while the current context
already holds process_lock, the fatal error handler may attempt to
log diagnostic messages. This leads to a recursive attempt to acquire
the same spinlock from the same CPU, resulting in a self-deadlock.
This issue is not limited to a specific architecture. It can occur on
any platform where logging is invoked from a fatal or exception context
while the lock is already held.
Fix this by introducing a lightweight owner tracking mechanism for
process_lock. The current CPU ID is stored when the lock is acquired,
and if the same CPU attempts to acquire the lock again, the lock
operation is bypassed to avoid self-deadlock.
This preserves strict log ordering across CPUs during normal operation,
while ensuring that logging remains safe and non-blocking in fatal or
exception contexts.
Signed-off-by: Li Jie <lijie.1996@picoheart.com>
sys_clock_set_timeout() and sys_clock_elapsed() are now documented
as requiring the system clock lock to be held by the caller. Wrap
the calls in subsys/pm/pm.c, soc/nxp/rw/power.c and the kernel
shell thread list command with sys_clock_lock()/sys_clock_unlock().
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
In case socket is closed during an async TCP handshake, the TCP context
should be closed immediately, otherwise the connection could be
established after the socket was closed, causing TCP context leak.
To avoid race between socket close and resend timer (i.e. socket being
closed at the same time as the retransmission limit is reached), add
extra state checks before attempting to close the TCP context.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
body_frag_len was computed using a raw buffer offset formula:
body_frag_len = data_len - (body_frag_start - recv_buf)
This is correct for Content-Length responses: the recv buffer contains
only decoded body bytes after the headers, so the offset arithmetic
gives the exact body byte count.
It is broken for Transfer-Encoding: chunked. RFC 7230 §3.3.2 makes
the two mutually exclusive, so chunked TE never comes with a
Content-Length. With chunked TE, the recv buffer contains both the
decoded body bytes and the chunk framing bytes (chunk-size line, CRLF
body-terminator, terminal chunk "0\r\n\r\n") side by side. The
formula counts everything from body_frag_start to the end of the
buffer fill, so it includes the framing bytes that follow the body,
causing body_frag_len to overcount.
http_parser already knows the exact decoded body byte count: it passes
it as the length argument to on_body(). Use that instead.
Add a regression test that sends a single chunked 206 response from a
raw loopback TCP server in one write, so the chunk terminator and
terminal chunk land in the same recv buffer as the body. The test
asserts body_frag_len equals the decoded body size, not body size + 7
framing bytes.
Signed-off-by: Vytautas Virvičius <vytautas@virvicius.dev>
This PR enables the DNS packet forwarding without taking into account
the return value of `dns_validate_msg` function.
This is to accomodate scenarios like where ANCOUNT is set to 0, or other
cases in which internal DNS implementation will not validate the
message.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Fixes the logic in detecting which partition is being executed
from, also fixes a test for this feature
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add a `LITTLE_ENDIAN` dependency to `LORAWAN_FRAG_TRANSPORT` due to the
use of bitfields and packed structures in decoding on-air payloads.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Update the fragmented data transport parsing to always consume complete
control messages, regardless of any validation errors. Simplify the
implementation of this by defining the packets as packed structures.
Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit fixes the bug by ensuring `to_write` is properly bounded.
It is now calculated as the minimum of the remaining requested bytes
(`nbytes - written`) and the remaining space in the current block
(`block_size - block_off`).
Fixes#106276
Signed-off-by: Ashirwad Paswan <ashi06712@gmail.com>
Replace the hardcoded WAMP RPC type values used when encoding OCPP
messages with their corresponding symbolic constants.
- Replace '2' with OCP_WAMP_RPC_REQ
- replace '3' with OCP_WAMP_RPC_RESP
This removes magic numbers and improves human readability.
Signed-off-by: David J. Leach, Jr. <tasmar@gmail.com>
Static analysis has a difficult time tracing whether a call to
ocpp_send_to_server() needs to initialize sndlock and rspsig because
the message type is set very much earlier in the program logic flow.
Note that coverity is creating a single issue for sndlock and for rspsig
in each function that calls ocpp_send_to_server() without initializing
them.
Adding a NULL test will prevent future static analysis false positives.
Fixes#100026Fixes#100025Fixes#100024Fixes#100017Fixes#100015Fixes#100013Fixes#100011Fixes#100010Fixes#100008Fixes#100006
Signed-off-by: David J. Leach, Jr. <tasmar@gmail.com>
Drop the unnecessary _ri_ptr NULL check, as multi-instance resources
always provide a valid instance array when _ri_count > 0. This
simplifies the initialization logic and prevents compile time warrning
messages/noice.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
ethernet_update_tx_stats checks the multicast address first and then the
broadcast which causes the broadcast address to be treated as multicast
and not counted correctly.Fix this by checking broadcast address first,
followed by the multicast address.
Signed-off-by: Taha Benderli <taha.benderli@analog.com>
There are several areas in the networking stack where this is missing.
So make sure we add it.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
`net_calc_chksum` is designed to return uint16_t checksum.
Its current behavior is to return 0 checksum on error
(or on an empty payload) and a valid non zero checksum for non empty
payloads. 0 could be a valid checksum for empty payload.
So update the `net_calc_chksum` and its wrapper's definition to
return error codes.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
tcp_options_len calculation in tcp_data_len can underflow
if th_off(th) is less than 5. This can lead to a huge
tcp_options_len value and subsequently a wrong data length calculation.
Add the checks in tcp_recv() which is a top API, so that the checks
are covered at the entry point.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/106657
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Add an initialisation time check for stream flash that the requested
offset and size does not overflow `size_t`. This in turn ensures that
`inspect_device` doesn't erroneously return `0` if the addition would
have overflowed.
Signed-off-by: Jordan Yates <jordan@embeint.com>
NRPA should be rotated every TGAP(private_addr_int)
according to spec, which is also checked in PTS.
Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
Introduce the CONNMON_LINK_UTILIZATION resource to the Connection
Monitoring object. Add backing storage, initialize it during instance
creation, and register it in the resource table.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Remove unused code related to zbus_proxy_agent_backend_desc and run-time
backend registration left over from early development.
Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Select the interface whose on-link prefix has the greatest length when
multiple prefixes match the same address. Fixes wrong iface selection
when a host has several interfaces whose on-link prefixes overlap (e.g.
a shorter prefix on one link and a longer, more specific prefix on
another). Callers that pass iface == NULL still get a boolean only; no
interface pointer is written.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
The support for running network TX/RX threads in pre-emptive way
was introduce in 2020. The experimental status is no longer valid
as the feature has been there for quite some time and it is being tested
also regularly by CI.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When the SenderResponseTimer expires in PE_DRS_SEND_SWAP, PE was
unconditionally transitioning to PE_SNK_READY. This is incorrect when
the port is operating as a Source, as it should return to PE_SRC_READY.
Replace pe_set_state(dev, PE_SNK_READY) with pe_set_ready_state(dev),
which selects the correct ready state based on the current power role.
Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
The transition from Attached.SNK to Unattached.SNK is currently
triggered if vbus is < vSafe5V.
USB-Type C Spec R2.4 Table 4-3 defines vSinkDisconnect as
the voltage to be used for the transition from
Attached.SNK to Unattached.SNK
This commit changes the check to use the correct voltage level.
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
Callback for IBI (In-Band Interrupt) was being set after enabling IBI -
which could be an issue if an IBI would be asserted in between enabling
IBI and setting the callback. This patch simply sets the callback before
enabling IBI.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Add a `mctp_i2c_gpio_target_unregister`, which basically calls I2C
`i2c_target_unregister`. While libmctp binds are only "started", with
no cleanup, this will be useful for tests, allowing a sequence of them.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
When sending "big messages", libmctp queues a series of packets and
calls the binding in a loop to transmit all messages. If previous
message was still being sent, transmission would fail with -EBUSY, but
libmctp wouldn't handle it.
This patch makes the UART TX blocking, so it only returns after
completion, allowing next TX to just work.
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>