When the net_mgmt event queue is full, include the event currently
being handled in the warning log. This helps identify slow event
callbacks that block the queue.
Assisted-by: Cursor:claude-opus-4.8
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
z_shell_op_word_remove() moves the remainder of the line over the word
being deleted, so the number of bytes to move is the distance from the
cursor to the end of the line, plus the string terminator. The code
used cmd_buff_len - chars_to_delete, which is the length of the line
after the removal and is unrelated to the amount of data that has to be
moved. It over-copies by cmd_buff_pos - chars_to_delete - 1 bytes, so
nearly every CTRL-W issued with the cursor away from the start of the
line reads and writes past the end of cmd_buff[].
With CONFIG_SHELL_CMD_BUFF_SIZE=256, a 200 character line whose last
word is a single character makes the memmove() touch offset 397, 142
bytes past the buffer. Sweeping all line lengths and cursor positions,
over 75% of the cases run off the end, and the worst one reaches offset
502.
In struct shell_ctx, cmd_buff[] is immediately followed by temp_buff[]
of the same size, and the overrun is bounded by 2 * size - 5, so it
always stays within temp_buff[] and cannot reach printf_buff[]. The
explicit termination after the memmove() hides the over-copied bytes,
and temp_buff[] is always rewritten before it is read, so there is no
observable misbehaviour to reproduce from the shell itself. The access
is nevertheless out of bounds and silently modifies an unrelated
member.
Derive the length from the string being moved instead. Note that
cmd_buff_len - cmd_buff_pos + 1 is deliberately not used: that form is
only correct while cmd_buff_pos <= cmd_buff_len holds, which this
function does not establish locally, and the uint16_t subtraction
underflows into a huge size_t if it ever does not.
Tested on native_sim: CTRL-W still removes a trailing word, several
words in sequence, and a word together with its trailing spaces, and
remains a no-op on an empty line. tests/subsys/shell passes. Not built
for or run on any other architecture, and not run on hardware.
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
In ec_host_cmd_log_request(), dbg_raw was sized as sizeof(dbg_fmt) (14
bytes) under the assumption that rx_header->cmd_ver (%d) takes at most
2 characters. Since cmd_ver is a uint8_t (0..255), it can take up to 3
decimal digits, requiring up to 15 bytes including the null terminator
and triggering -Werror=format-truncation= when
CONFIG_EC_HOST_CMD_LOG_DBG_BUFFERS is enabled.
Increase the debug log buffer size to accommodate 3-digit versions and
add boundary test coverage.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
In ec_host_cmd_send_response(), LOG_HEXDUMP_DBG(args->output_buf,
args->output_buf_size, "HC resp:") was called before prepare_response()
validated that args->output_buf_size + TX_HEADER_SIZE fits within
tx->len_max. When CONFIG_EC_HOST_CMD_LOG_DBG_BUFFERS is enabled and a
handler sets an oversized output_buf_size, this triggered an
out-of-bounds read past hc_tx_buffer before prepare_response() rejected
the response with EC_HOST_CMD_INVALID_RESPONSE.
Move the CONFIG_EC_HOST_CMD_LOG_DBG_BUFFERS block after
prepare_response() succeeds and add a simulator unit test
(test_no_log_on_invalid_response) verifying that rejected responses do
not trigger a response hexdump.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
When verify_rx() fails (hc->rx_status != EC_HOST_CMD_SUCCESS),
ec_host_cmd_send_response() previously read rx_header->cmd_id from
hc->rx_ctx.buf to log 'HC 0x%04x err %d'. If fewer than 4 bytes were
received or the header was invalid, this logged stale or uninitialized
bytes from hc_rx_buffer.
Only log rx_header->cmd_id when hc->rx_status == EC_HOST_CMD_SUCCESS,
and log 'HC rx err %d' otherwise. Add a simulator unit test
(test_err_log_on_unverified_rx) verifying both unverified RX errors and
handler-level errors.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
In verify_rx() and prepare_response(), the valid data size was computed
using uint16_t, which could wrap around if data_len was close to
UINT16_MAX. Additionally, incoming request size was not explicitly
bounded against rx->len_max.
Compute valid data sizes using size_t and reject incoming packets whose
expected size exceeds rx->len_max or available rx->len. Also update
the eSPI backend and cal_checksum() size type to prevent potential
truncation. Add unit tests covering large data lengths and response
wrapping, and replace the skipped test_no_log_on_rx_data_len_overflow
with test_rx_data_len_bounds.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Previously, incoming packets were logged before their length and
integrity were verified. When debug logging is enabled, a malformed
packet (such as a truncated header or unverified payload length) could
cause out-of-bounds reads and trigger a hexdump of uninitialized memory.
Defer debug logging until after the incoming packet passes header and
length validation so that only safely verified payloads are read.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Unexpected CS assertions during PROCESSING or SENDING states previously
fell through to the spi_bad_rx label, clobbering the backend state to
RX_BAD. A subsequent CS deassertion would then fail the state check and
immediately re-arm RX DMA into the shared buffer while the handler thread
was still processing the active request.
Fix this by:
- Ignoring unexpected CS assertions during PROCESSING and SENDING states
with a warning log, preserving the current state and avoiding hardware
TX register corruption.
- Extending the CS deassertion deferral check to cover the SENDING state
in addition to PROCESSING, ensuring RX re-arming is safely postponed
until the TX transfer completes.
- Adding native_sim unit tests covering unexpected CS toggles during both
PROCESSING and SENDING states.
Signed-off-by: Firas Sammoura <fsammoura@google.com>
The explicit-erase path in wr_chunk() programs a shared write block
twice when a chunk boundary is not write-block aligned, which corrupts
the ECC syndrome on flash that allows only one program per erase (e.g.
some NXP MCXW SoCs) and faults on the next read. Commit a9ad258c84
fixed only the non-erase path.
Add opt-in CONFIG_BT_MESH_BLOB_IO_FLASH_BLOCK_CACHE (default n) that
buffers a block in RAM and, on the chunk that completes the block,
programs it write-block-aligned once, so no write block is programmed
twice. The flush runs in wr() rather than block_end so a failed
flash_area_write is returned to the server (the chunk stays missing and
the client retries) and a sticky error prevents any later re-program;
an unaligned init offset is rejected up front. Default builds are
unchanged.
Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
For a next hop that is neither on-link by prefix nor routed, typically
a link-local address, net_ipv6_prepare_for_send() takes the interface
from the neighbor cache with net_ipv6_nbr_lookup(NULL, nexthop) and
then reads nbr->iface.
net_ipv6_nbr_lookup() releases the neighbor lock before it returns. A
thread waiting for that lock gets it at the unlock and, being of
higher priority (the system work queue running the ND reachable timer,
the RX thread), runs at once. If it removes the entry, nbr_free() ->
net_nbr_unlink() sets nbr->iface to NULL. The sender then puts NULL
into the packet, finds no neighbor in the second lookup and calls
net_ipv6_send_ns() with a NULL interface: get_llao_len() asserts on
lladdr != NULL, or dereferences NULL with asserts off.
Look the neighbor up and read its interface under one hold of the
lock, as the function already does for the second lookup. The
interface pointer stays valid after the unlock; if the entry is
removed meanwhile, the packet goes through neighbor discovery on that
interface.
Signed-off-by: Kirill Shypachov <kshypachov@outlook.com>
from zephyrs perspective NET_QEMU_ETHERNET
and NET_QEMU_USER is the same, the only
difference is how qemu exposes the ethernet
connection to the host system, so we should also
imply ETH_DRIVER on NET_QEMU_USER.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
PTP over ipv6 uses ZSOCK_IPV6_RECVPKTINFO, which needs
NET_CONTEXT_RECV_PKTINFO, so select it when needed.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
In ec_host_cmd_espi_send(), the backend unconditionally sets the state
back to ESPI_STATE_READY_TO_RECV after espi_write_lpc_request(). If a new
command is received via IBF interrupt right after the request finishes,
the ISR transitions the state to ESPI_STATE_PROCESSING, which can then
be inadvertently clobbered by the send function returning to READY_TO_RECV.
Switch the backend state to atomic operations and use atomic_cas() when
completing send to only transition from ESPI_STATE_SENDING to
ESPI_STATE_READY_TO_RECV if no new request was accepted in the interim.
Assisted-by: Antigravity:gemini-1.5-pro
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
A message rejected by ptp_msg_post_recv() made ptp_port_event_gen()
raise PTP_EVT_FAULT_DETECTED. The port was then re-initialized, closing
the transport and dropping all foreign time transmitter records, so any
sender on the PTP multicast group could reset the port with a single
packet. A PTPv1 sender did this several times per second, so the port
never left LISTENING.
Discard a message that is unsupported or malformed, including an empty
datagram, and fault the port only when the reception itself fails or no
message buffer is available. This is how linuxptp handles it.
ptp_msg_post_recv() now checks the header length first, then the PTP
version, then the message type and length, because the meaning of the
latter two depends on the version. An unsupported version returns
-EPROTONOSUPPORT and is logged at debug level, since it is expected
traffic. The header byte order is converted only after the checks. The
function is internal to subsys/net/lib/ptp, so there is no API change.
Tested with tests/net/ptp on native_sim/native/64. The new tests for the
check order and for the discarded messages fail without this change.
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Massimiliano Cialdi <massimiliano.cialdi@powersoft.com>
With privacy enabled random address is set via
bt_id_set_adv_private_addr() which has a shortcut for NRPA
when BT_LE_ADV_OPT_USE_NRPA flag is set. Previously advertising
instance options were set at the very beginning of configuration
and this was working correctly. But now new options are set only
after configuration was successful and this resulted in RPA being
set by bt_id_set_adv_private_addr() since options were not yet
updated.
Pass new options to bt_id_set_adv_private_addr() directly allowing
it to take proper actions. This is also consistent with current design
of bt_id_set_adv_own_addr().
This is a regression after
commit 2548b7b100 ("Bluetooth: Host: Set adv->options only on success")
This is affecting GAP/BROB/BCST/BV-04-C qualification test case.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
RFC 7959, section 3.3, lets the server answer the last block of a
block-wise upload with the first block of a block-wise response, which
the client then retrieves with further Block2 requests. The client does
not retrieve them: once the upload completed it reported the first
block as the whole response, silently dropping the rest of the body.
Fail the exchange with -ENOTSUP instead when the response to the last
upload block carries a Block2 option with the M bit set. A single-block
response is delivered as before. Retrieving the remaining blocks is
still to do and marked as such in the code.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7641, section 4.1, signals a registration the server did not
accept by a response without Observe option, and section 3.2 ends an
observation with a non-2.xx notification. The client kept such an
observation ongoing until the application cancelled it, waiting for
notifications that never come.
End the observation when a response on the registration token is not a
2.xx response with an Observe option. Block2 retrievals use their own
token and are unaffected. The response is still delivered to the
application, and a deregister sent while its callback runs keeps the
slot. The default test response now carries an Observe option, as a
server accepting a registration sends one. The
coap_client_reregister_observe() documentation describes the ending.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7641, section 3.4, requires the client to consider the most
recently sent notification the freshest: an incoming Observe value is
newer when it exceeds the last accepted one in serial number
arithmetic, or when more than 128 seconds passed since the last
accepted notification arrived. The client never read the Observe
option of incoming notifications and delivered them in arrival order,
so a reordered stale notification overwrote newer state in the
application.
Track the Observe value and arrival time of the freshest accepted
notification per request and drop notifications that are older. The
timestamp clause keeps the client from deadlocking on a server that
restarted with a lower sequence number. Notifications without an Observe
option and non-observe responses are unaffected, a dropped confirmable
notification is still acknowledged at the message layer, and the check
skips Block2 continuations, which carry no Observe option per RFC 7959,
sections 2.6 and 3.4, so a server echoing one there cannot stall the
transfer.
A notification repeating the freshest Observe value is accepted.
RFC 7641, section 4.4, requires each notification to carry a greater
value, but Zephyr's coap_server sample answers a re-registration with
the value of its last notification, as the value only increases when a
notification is sent. A strict client would drop that answer.
A dropped answer to a confirmable (re-)registration still acknowledges
it, so the refresh is not retransmitted until the observation times out.
To recognize that answer, a refresh records the registration token as
its request token, which a Block2 retrieval of an earlier notification
replaced.
The comparison reuses coap_age_is_newer(), promoted to public API: it
was previously only linkable outside coap.c in test builds, a hack the
CoAP unit test needed, and applications observing via the raw API need
the same arithmetic. Its parameters are uint32_t, as Observe option
values are 24-bit. coap_response_received() now tests its
no-notification-yet sentinel explicitly, so a first notification is
accepted whatever its Observe value, as coap_reply_init() intends; the
int comparison dropped first values from 2^23 on.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7252, section 4.1, requires an Empty message (code 0.00) to have
the token length set to zero and no bytes after the message ID, and
violations to be processed as message format errors. The parser
accepted Empty messages carrying tokens, options or payload, which is
also what coap_header_code_sanitize() folds unknown codes into.
Reject such messages in coap_packet_parse() with -EBADMSG. The client
test fakes sent twelve-byte Empty ACK and Reset messages; shrink them
to the four bytes the RFC allows.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7252, sections 4.2 and 4.3, require rejecting a malformed message: a
Confirmable one with a matching Reset, a Non-confirmable one by silently
ignoring it. The client instead treated any parse failure as a socket
error and cancelled every ongoing request with -EIO, so a single garbage
datagram from any sender tore down all exchanges.
Normalize packet parse failures to -EBADMSG in the receive helper,
covering datagrams shorter than a CoAP header, which the parser reports
as -EINVAL, and drop the offending packet only, answering a malformed
Confirmable message whose header is readable with a Reset, unless the
receive buffer truncated it. A zero-length datagram is dropped the same
way instead of being handled as a response with uninitialized contents.
Socket-level errors still cancel the client's requests.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7959, section 2.3, requires the payload size of a block with the M
bit set to match the block size implied by SZX exactly. The client
clamped oversized payloads and accepted short ones, silently
desynchronizing the transfer position: the next block request advances
by the block size while the application received a different amount.
Fail the request with -EBADMSG when a non-final block's payload does
not match the SZX of its Block2 option, and deliver a matching block
whole: the first block may be larger than the client's block size
(section 2.4). Truncated responses are exempt, as they are
re-requested with a smaller block size.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7959, section 2.2, reserves SZX value 7 (BERT) outside reliable
transports: it must not be sent and leads to a 4.00 Bad Request
response. The UDP block context updates accepted it and computed a
2048-byte block size from it.
Reject SZX 7 with -EINVAL in the UDP variants of the control and
descriptive block updates, so servers can map it to 4.00. The client
continued processing a response carrying it; fail the exchange
instead, so it cannot reach the application or desynchronize the
transfer position. Other block context update errors stay logged
only, but are no longer reported to the application after its
response was delivered, as happened for a combined Block1/Block2
response whose Block1 option is checked against the receive context.
The reliable-transport variants are unchanged, as BERT is valid there
per RFC 8323.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7959, section 2.4, states the M bit of a Block2 option in a
request has no function and the server must ignore it on reception.
update_control_block2() instead rejected such requests with -EINVAL,
for both the UDP and the reliable-transport variant, failing transfers
from clients that leave the bit set.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7252, section 5.3.2, requires both the message ID and the token of
a piggybacked response to match the request. The client only compared
the token, so an Acknowledgment carrying the right token but a foreign
message ID was accepted as the response.
Drop an Acknowledgment whose message ID differs from the request's.
Separate CON/NON responses carry their own message ID and are still
matched by token only. The observe test fake modelled notifications as
Acknowledgments with fabricated message IDs, which section 4.4 does
not allow; send them as Non-confirmable messages instead.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 7252, sections 4.4 and 5.3.2, require the source endpoint of a
response, Acknowledgment or Reset to match the destination endpoint
of the request it answers. The client matched responses by token (or
message ID for empty ACK and Reset) alone, so on an unconnected socket
a response from any address was accepted and an off-path attacker only
needed the token to spoof a response or reset a request.
Compare the received source address against the request destination as
part of request matching. The check is skipped when either address is
unknown, as on connected sockets, and for multicast requests, whose
responses legitimately arrive from the group members' unicast
addresses.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
USB 2.0 Test Mode is only required of High-Speed capable devices.
Build it only with High-Speed support, so a Full-Speed-only device
stalls SetFeature(TEST_MODE).
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
When remote client receives execute command message it contains
a pointer to a handler that should be executed. Previously, it was
blindly executed, assuming that pointer is correct. Add validation
of that pointer by checking if pointer belongs to one of the
registered command.
If handler is not found then command returns error. Added printing
error on shell remote host when remote command failed to run.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
A forged MLDv1 Query puts every MLDv2 listener on the link into MLDv1
mode for the Older Version Querier Present Timeout, and RFC 3810 ch 10.1
recommends a configuration option to ignore MLDv1 messages altogether
for links known to have no MLDv1 routers.
Add CONFIG_NET_IPV6_MLD_V1_COMPAT, enabled by default as RFC 3810 ch
8.2.1 requires. When disabled, MLDv1 Queries are ignored and Version 1
Reports are not handled, so the node stays in MLDv2 mode. The MLD test
suite gains a scenario with the option disabled.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
When multicast routes are reported along with the joined groups, room
is reserved for every route and the routes that duplicate a joined group
are skipped. The skipped records were then removed from the tail of the
packet, but their space had never been written, so the last real records
were cut off while the header still counted them. Routes with a prefix
shorter than 128 bits were counted but never appended, with the same
effect on the count.
Count only the routes that get appended and leave the packet tail alone.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The all-nodes, solicited-node and application groups are joined while
the link-local address of the interface is still tentative, so their
reports go out with the unspecified source address. Routers MUST discard
such reports (RFC 3810 ch 5.2.13), and no router learns about the
listener until it answers a General Query. The same section says a node
SHOULD report all its groups again once a valid link-local address is
available.
Report every listened to group again, with retransmissions, when a
link-local address of the interface passes Duplicate Address Detection,
or as soon as it is added when it is usable right away, as without DAD.
The test suite gains a scenario without DAD.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
An MLDv1 node that hears another listener report an address while its
own timer for the address is running stops the timer and does not
report (RFC 2710 ch 4): the querier only needs one listener per address.
Version 1 Reports were not looked at.
Cancel the pending response and the pending retransmission of the
address when a Version 1 Report for it arrives, unless the node operates
in MLDv2 mode, which has no report suppression (RFC 3810 ch 8.2.2). Only
a report with a link-local source and a hop limit of 1 counts, so that a
report forged from outside the link cannot silence the node.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The report announcing a join was sent once. If it is lost, for example
because the switch port is still converging when the link comes up, the
address is not forwarded to the node until the next General Query is
answered, and never when no querier is present. RFC 3810 ch 6.1
schedules [Robustness Variable] - 1 retransmissions of the State Change
Report at random intervals within the Unsolicited Report Interval, and
RFC 2710 ch 4 recommends the same for MLDv1.
Retransmit the report of a join and of a rejoin after interface up from
the MLD timer, one second apart at most for MLDv2 and ten seconds for
MLDv1. The number of transmissions follows
CONFIG_NET_IPV6_MLD_ROBUSTNESS. A leave is still reported once: the
address is gone from the interface when the report is sent, and a
querier that misses it keeps forwarding until its own timers expire.
Reports sent on behalf of multicast routes are not retransmitted
either, as they carry no per-address state.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A Multicast Listener Query was answered immediately. A node must instead
pick a random delay bounded by the Maximum Response Delay of the query
and answer when it expires (RFC 3810 ch 6.2, RFC 2710 ch 4), so that
the listeners of an address do not all answer at once and MUST NOT
answer a General Query right away (RFC 3810 ch 6.3).
Keep a response deadline per address and, for MLDv2, one per interface
for General Queries, and drive them from one delayed work item. A new
query is merged with a pending response following the rules of RFC 3810
ch 6.2: a pending response to a General Query due sooner covers a new
query, and an address is answered at the earliest of its pending and
the newly selected delay. In MLDv1 mode a General Query starts an
independent timer per address (RFC 2710 ch 4); a repeated address
specific query then also takes the earlier of the two delays, which
answers no later than the reset rule of RFC 2710 would. The Maximum
Response Code is decoded per version, including the floating point
MLDv2 form; the decoder is exported within the stack for the tests.
A change of the compatibility mode cancels the pending responses. The
mode last applied is remembered per interface so that the change is
also detected when the querier present timer runs out, for which the
timer is armed as well.
The lock guarding the timers is released while a response is sent:
sending takes the interface lock, which callers into MLD may hold.
Multicast Address and Source Specific Queries are answered like
Multicast Address Specific ones, with the full state of the address.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
MLDv2 hosts MUST run in MLDv1 compatibility mode while an MLDv1 querier
is present on the link (RFC 3810 ch 8.2.1). An MLDv1 query, recognized
by its length of 24 octets (ch 8.1), was dropped, and joins and leaves
were always announced with MLDv2 records the MLDv1 router does not
understand, so listeners went unnoticed.
Keep the Older Version Querier Present timer per interface and derive
the Host Compatibility Mode from it. In MLDv1 mode a join and a query
response are sent as Version 1 Multicast Listener Reports to the group
and a leave as a Done message to the all-routers group (RFC 2710 ch 8),
including the multicast routes reported on behalf of other interfaces.
The timer runs for the Older Version Querier Present Timeout, computed
from the new CONFIG_NET_IPV6_MLD_ROBUSTNESS option. Queries of a length
that matches neither version are dropped.
The timer extends struct net_if_ipv6, so the net_if API version becomes
1.1.0.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Only General Queries were answered: a query with a Multicast Address
field was dropped. A querier sends a Multicast Address Specific Query
after a listener signals a Done or a change to INCLUDE, and stops
forwarding the address when no listener answers within the Last
Listener Query Interval (RFC 3810 ch 7.6.3, RFC 2710 ch 4).
Answer such a query with a Current State Record for that address when
it is listened to on the interface, and ignore it otherwise. Multicast
Address and Source Specific Queries are answered the same way, with the
full state of the address.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A node MUST drop a Multicast Listener Query whose source is not a
link-local address, whose hop limit is not 1 or which lacks the Router
Alert option in its Hop-by-Hop Options header (RFC 3810 ch 5.1.14 and
6.2), as such a query may have been forged from outside the link. Only
the hop limit was checked.
Check the source address and look for the Router Alert option in the
Hop-by-Hop header before acting on a query. The tests injected queries
from a global address and sent them to the MLDv2 routers group instead
of the all-nodes group; they are now built from a description with a
link-local peer, and cover the checks.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Protocols such as MLD need to know whether a received packet carries a
given option, the Router Alert option in its case, while the input path
only validates the options it knows and drops the rest of the state.
Add net_ipv6_parse_ext_hdr_options(), which follows the extension header
chain from the IPv6 header to the upper layer header and hands every
option of the Hop-by-Hop and Destination Options headers to a callback,
in the style of net_ipv4_parse_hdr_options(). Padding options are
skipped, Routing and Fragment headers are stepped over, and the callback
reads the option data from the packet cursor and can stop the walk.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
RFC 3810 ch 6 forbids any MLD message for the link-scope all-nodes
address FF02::1 and for multicast addresses of scope 0 (reserved) and 1
(interface-local): listening to FF02::1 is permanently enabled on every
node, so there is nothing to report. A report was sent when the group
was joined at interface start, and every query response carried it.
Skip these addresses when reporting a join, a leave or the response to
a query, and leave out multicast routes to them, which can be added as
only the interface and link scopes are refused. The addresses are still
joined on the interface and the join event is still raised. The tests
expected the report for FF02::1 and used a group of scope 0; they now
check that no report names FF02::1 and use a transient site-local
group.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Break radio_switch_complete_and_tx lines that exceed the 100-column
checkpatch limit after expanding tabs.
Signed-off-by: Hugo Zamith <hhzamith@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace remaining magic 0/0U phy and flag arguments in Nordic and
OpenISA LLL radio setup/timing helpers with PHY_LEGACY and
PHY_FLAGS_UNUSED.
Coded PHY S2/S8 call sites already use PHY_FLAGS_S2/S8; this finishes
the cleanup for legacy paths so radio_phy_set,
radio_switch_complete_and_tx, and delay helpers consistently use the
named macros from pdu.h.
Fixes#37458
Signed-off-by: Hugo Zamith <hhzamith@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
JSON, SenML JSON and SenML CBOR writes take each record path from the
payload, but access was only checked for the request path. Check each
record path before it is created or written.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
The default requested options are copied into a buffer sized by
CONFIG_NET_DHCPV4_MAX_REQUESTED_OPTIONS, whose minimum of 3 does not
account for the optional ones. Fail the build when it is too small.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Add hardening rules for the shell command modules that give raw read
and write access to persistent storage. These are base profile rules:
unlike CONFIG_SHELL itself, which only the strict profile flags, dumping or
rewriting flash, EEPROM, settings and files is not appropriate even for
products that deliberately ship a shell.
- CONFIG_EEPROM_SHELL: n (base)
- CONFIG_FILE_SYSTEM_SHELL: n (base)
- CONFIG_FLASH_SHELL: n (base)
- CONFIG_SETTINGS_SHELL: n (base)
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/usb/device_next`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/testsuite/ztest`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/settings`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/net/lib/mcp`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/mpipe`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/mgmt/mcumgr`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `subsys/mgmt/ec_host_cmd`
Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>