Add the packet filter statistics to the periodic network
statistics output. This was already part of the
`net stats` command output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add the DNS statistics to the periodic network
statistics output. This was already part of the
`net stats` command output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add the IGMP statistics to the periodic network
statistics output. This was already part of the
`net stats` command output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Display the same TCP statistics fields in the periodic
network statistics output as in the net stats command
output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add per-TC dropped packet counts to the periodic
network statistics output. This was already part
of the `net stats` command output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
net_ipv6_send_ns() allocates a local NS packet (pkt) and, when called
with a pending data packet, may queue that data packet in the neighbor
pending_queue while neighbor discovery is in progress.
If the pending_queue is already non-empty, the function appends the new
data packet and returns without sending a new NS, as intended. However,
the freshly allocated NS packet is neither sent via net_send_data() nor
released. Only the data packet (pending) is queued; the NS packet (pkt)
is a separate allocation that never reaches the TX path, so it is never
released.
Under sustained traffic to an unresolved IPv6 neighbor (e.g. high-rate
UDP), each hit of this branch leaks one TX net_pkt and its buffers,
eventually exhausting CONFIG_NET_PKT_TX_COUNT / CONFIG_NET_BUF_TX_COUNT.
Fix by calling net_pkt_unref(pkt) before returning on this path.
Update the IPv6 neighbor discovery test accordingly. The previous test
assumed that a pending NS reply timer meant one TX packet and buffer
were still allocated, and adjusted the expected pool counts by one.
After fixing the leak, that assumption is no longer true: the timer may
still be pending even though the temporary unsent NS packet has already
been released. Remove that stale accounting assumption so the test
matches the corrected packet ownership behavior.
Signed-off-by: Swamidas Nampalli <Swami.Das@silabs.com>
The gptp port number to set should be less than GPTP_PORT_START +
CONFIG_NET_GPTP_NUM_PORTS, but not GPTP_PORT_END which was actual
the last gptp port number in used.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
coap_client_schedule_poll() only gives the recv semaphore, which wakes
the recv thread when it is idle but does not interrupt a poll() that is
already blocked. A request submitted mid-poll - in particular one whose
socket changed after a reconnect - is then not watched until the current
poll() returns, up to COAP_PERIODIC_TIMEOUT later, so its response is
invisible for that window.
Write the recv-thread wakeup eventfd from schedule_poll() so a blocked
poll() returns at once and the recv loop rebuilds fds[] with the current
socket set. The eventfd is the same channel cancellation already uses;
the resulting ack-sem pulse is harmless since the cancel path resets it
under the cancel mutex before waiting. Update the eventfd documentation
to cover the dual use.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
When the decision is made to keep the current packet for
further (local) processing it should not return NET_OK as
this will ultimately cause a serious leak of RX packets.
Cleanup logic a bit so we can follow the decision tree a bit
easier and fix the original bug by keeping the NET_CONTINUE
and return the proper new local interface from the bridge
function as we happen to have it ready there alredy.
Signed-off-by: Bas van Loon <s.r.vanloon@outlook.com>
memcpy(metadata_copy, metadata, strlen(metadata)) omits the trailing
NUL, so the later strlen(metadata_copy) in the fallback parse path
can read past the allocation and feed an oversized length into
json_obj_parse().
Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
Use strncpy instead of strcpy when writing the volume name into
the superblock so that an oversized cfg->volume_name cannot overrun
the fixed-size s_volume_name field.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Replace nested MIN/MAX macro calls with the min3/max3 APIs which are
safer (evaluate arguments only once) and cleaner.
Assisted-by: Gemini:gemini-3.1-pro
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit makes mcuboot_shell use boot API to determine active image
slot. Previously it used static zephyr_code_partition to determine this
which wasn't compatible with use of blinfo.
Signed-off-by: Petr Buchta <petr.buchta@nxp.com>
An application may hold its own lock while calling coap_client_req()
(which takes the client lock), and the response callback may in turn
take that same lock. Holding the client lock across the callback is then
an AB-BA deadlock. Invoke the callback with the lock released.
Releasing the lock lets other threads touch the request while its
callback runs. Keep the slot stable: skip in-callback slots in
get_free_request() and defer their release on cancel (no reuse or reset
under a running callback), and snapshot the observe/multicast flags so a
concurrent deregister cannot change how the current response is
finalised.
A cross-thread cancel can no longer block on the lock to deliver
-ECANCELED while a callback runs, so it records the error and the recv
thread delivers it once that callback returns.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
When DAD is disabled, iface_ipv6_start() called join_mcast_nodes() with
the first multicast address slot (mcast[0]), passing a multicast address
where a unicast one is expected to derive the solicited-node group. The
join is also redundant: rejoin_ipv6_mcast_groups() runs just before this
in notify_iface_up() and (re)joins the all-nodes and per-address
solicited-node groups regardless of DAD.
Remove the bogus join and rely on rejoin_ipv6_mcast_groups().
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude:claude-opus-4.8
net_if_ipv6_addr_add() tied the solicited-node multicast group join to
DAD being active, so adding an IPv6 address to an already-up interface
with CONFIG_NET_IPV6_DAD disabled never joined the group. Such addresses
could not answer neighbor solicitations and were unreachable.
Join the group whenever ND is enabled on a multicast-capable link
(RFC 4291 ch 2.8), independently of DAD.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude:claude-opus-4.8
Implement the get expiry API in the trusted backend.
In the trusted backend we can read out the certificate from the secure
storage and then parse it using the mbedtls X.509 certificate parser to
extract the expiry date from the certificate.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Implement the get expiry API in the volatile backend.
In the volatile backend we have direct access to the credential data,
so we can use the mbedtls X.509 certificate parser to extract the expiry
date from the certificate.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add a helper function to get the expiry time from a TLS credential.
This can be used by TLS credential backends that have access to the raw
certificate data and can parse it to get the expiry time.
The helper function uses MbedTLS to parse the X.509 certificate and
extract the expiry time.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
When a stream socket had a pending error (for example after the peer
reset the connection), zsock_recv_stream_timed() returned the error
immediately, without first delivering data that had already been
received and queued before the connection was closed.
As a result, data that arrived just before a peer RST could be lost,
even though the application should be able to read it before observing
the error.
Drain the receive queue first, and only report a pending error
once there is no more buffered data left to deliver.
Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Implement the SO_LINGER socket option for TCP sockets, gated behind the
new NET_CONTEXT_LINGER Kconfig option (disabled by default). The option
takes a struct net_linger argument and is stored in the net_context.
It is honored when the socket is closed:
- with linger enabled and a zero timeout, close() aborts the connection
immediately by sending a RST segment instead of performing a graceful
FIN close,
- with linger enabled and a non-zero timeout, close() blocks until the
connection has been closed by the stack or the timeout (in seconds)
expires, in which case the connection is aborted with a RST.
The blocking wait is implemented at the net_context level, using a
dedicated semaphore signalled by the TCP stack once the connection is
closed. The linger timeout itself is tracked by a TCP work item which
aborts the connection with a RST when it expires.
Besides being a standard BSD socket option, SO_LINGER is convenient in
testing, as it provides an easy way to abort a connection with a RST
when needed, instead of always closing it gracefully.
Assisted-by: Cursor:Claude Opus 4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
get_string() checked string_length > buflen, accepting a string exactly
as long as the buffer. buf[string_length] = '\0' then wrote one byte
past the end.
Change the guard to string_length >= buflen.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Two multi-resource TLV decode loops used `(len2 = oma_tlv_get(...))` as a
truthy condition. A negative return value (parse error) is non-zero and
would be treated as a successful read, causing the loop to continue with
an invalid TLV.
Change both loop conditions to `> 0` so negative returns terminate the
loop.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a new API bt_le_per_adv_update_did() that sends the
LE Set Periodic Advertising Data HCI command with operation
set to 0x04 (Unchanged Data). This instructs the controller
to update only the Advertising Data Identifier (DID) in the
ADI field without modifying the advertising data payload.
This is useful when the application wants to signal to
scanners that the periodic advertising train has new
information available (via DID change) without actually
changing the data content.
Also add a corresponding shell command 'per-adv-update-did'
for testing purposes.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
Assisted-by: Kiro:claude-opus-4.6
Add support for reserving L2 headers,
CONFIG_NET_L2_ETHERNET_RESERVE_HEADER=y, when working with priority-only
tagged frames, CONFIG_NET_VLAN_COUNT=0.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Remove lldp_pkt flag from net_pkt structure and related functions.
The lldp_pkt flag is no longer needed as the LLDP protocol can be
identified by the protocol type in the packet.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Remove ptp_pkt flag from net_pkt structure and related functions.
The ptp_pkt flag is no longer needed as the PTP protocol can be
identified by the protocol type in the packet.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
The fast nibble-copy path in the MIPI STP decoder assumes unaligned
multiword accesses are safe on Cortex-M.
With clang on mps2/an385 this can still generate unaligned accesses in
the optimized path, causing a UsageFault in debug.mipi_stp_decoder.
Disable the fast path for clang (and when unaligned trapping is
enabled), falling back to the existing byte-wise safe path.
Assisted-by: GitHub Copilot:GPT-5.3-Codex
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add RPMsgFS fs type to the mount command.
Usage: fs mount rpmsgfs <mount-point> [<remote-path>]
mount-point: Mount point path on local system
remote-path: Path within the exported directory on remote to where the
mount-point is mapped to. [Default: "/"]
Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
RPMsgFS allows mounting directories on a remote core using RPMsg. This
protocol is originally made in NuttX but has also implementations in
Linux.
To mount this file system, call fs_mount() with type: "FS_RPMSGFS" and put
the remote path in the .fs_data field as a zero terminated string.
The remote path points to the path on the remote that should be mapped
to the local mount point. The remote path must be an existing path
within the exported path on the remote file system.
Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
Add a new IPC service backend based on the RPMsg-Lite library.
The backend implements the ipc_service_backend ops (open, close,
register/deregister endpoint, send, send_nocopy, get/drop TX buffer,
hold/release RX buffer) on top of the RPMsg-Lite virtio transport.
A new DT binding (nxp,ipc-rpmsg-lite) is introduced to describe
each RPMsg-Lite link instance: shared memory region, role (host/remote),
link-id, MBOX channels, and per-instance buffer/priority tunables.
Multiple links share a single MBOX channel pair via the
notification-parent property; platform_notify() dispatches the
encoded vector_id to the correct link.
Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.
This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ find subsys/lorawan/ -type f -exec \
./scripts/check_quoted_includes.py -w {} \;
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.
This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ find subsys/dfu/ -type f -exec \
./scripts/check_quoted_includes.py -w {} \;
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The same index `i` was used for `servers` and `ctx->servers`, but since
these may be different, this resulted in strange entries in the log; for
example, mDNS was displayed for non-mDNS servers.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
Add CONFIG_LOG_MULTI_SLOT option that allows routing log messages
from different CPU cores into separate debug window slots. Each
core gets its own mtrace slot, enabling the host to read per-core
log data independently.
Key changes:
- Add CONFIG_LOG_MULTI_SLOT Kconfig option (depends on SMP,
INTEL_ADSP_DEBUG_SLOT_MANAGER and LOG_CORE_ID_PREFIX)
- Allocate per-core debug window slots in mtrace_init()
- Route log output to the correct slot based on originating core ID
using log_output context mechanism
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
The text states that the minimum is 1, but it is possible to
set the value to 0 even when CONFIG_BT_SMP=y.
This commit changes this so that the option and text matches.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix alignment of dropped packets count for each traffic class
in shell stats output. The dropped packets column was not aligned
properly with the header, making it harder to read the output.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.
This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
`grep -rsl "#include \"zephyr/" subsys/shell/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.
This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
`grep -rsl "#include \"zephyr/" subsys/sensing/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.
This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
`grep -rsl "#include \"zephyr/" subsys/pmci/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.
This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
`grep -rsl "#include \"zephyr/" subsys/net/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Remove Source_Address_Type from the receive state matching criteria in
find_recv_state_by_sink_fields_cb(). In privacy scenarios, a Broadcast
Source may advertise using a resolvable private address (RPA) or an
address type that differs from what the BASS client originally wrote.
The previous address type comparison caused the lookup to fail, preventing
the sink from ever attempting PA synchronization with a valid source.
Per BASS 3.1.1.4, the server identifies the Broadcast Source to
synchronize with by comparing Adv_SID (from ADV_EXT_IND) and
Broadcast_ID (from AUX_ADV_IND) only. Address type is not part of
the identification criteria.
Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
Change the BAP roles to require
BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE to be at least 19.
This is the minimal amount of cfg data required to support LC3,
which is mandated by BAP.
Adding this requirement should not really affect any existing
applications, given that it was the default.
Adding this requirement allows us to remove a bunch of guards
since we can rely on Kconfig to ensure it's non-0.
BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE may still be set to a lower value
in case the audio API is used without BAP.
ASCS can technically be used without BAP, but currently it is very
tied to BAP and thus the requirement was also added for ASCS until
the BAP depdenency is changed in the future.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>