Add optional ZLP after an IN transfer that is an exact multiple of the
endpoint MaxPacketSize. Track outstanding IN completions via in_pending
to release tx_lock exactly once.
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Switch RX handling to enqueue completed OUT buffers into a FIFO
and parse them in a worker.
Re-arm BULK OUT immediately to avoid host-side stalls.
Drop zero-length OUT completions without scheduling the worker
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
The -test command line option can be used to filter tests for execution
on native_sim targets, but if ZTEST_SHELL is enabled this filtering can
be done via the shell itself, so the option loses its purpose and can be
disabled.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
On POSIX targets, TC_END_POST calls posix_exit(), which terminates the
process after test execution. When tests are run via the ztest shell,
this behavior is undesirable, as the shell session is expected to remain
active for further interaction.
Change TC_END_POST to expand to an empty statement when CONFIG_ZTEST_SHELL
is enabled, preventing premature process termination.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
When CONFIG_ZTEST_SHELL=y, the system failed to compile due unsatisfied
references to ztest_set_test_args and ztest_reset_test_args. This commit
fixes the issue by copying these functions from ztest_shell and
modifying libc calls to their nsi_host_* equivalents, fixing
compilation.
Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
The whole TCP Kconfig options block is already behind "if NET_TCP",
therefore "depends on NET_TCP" on certain options was redundant.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Zephyr by default closes all TCP contexts associated with a given
network interface when the interface goes down. This leads to
reporting an error on the associated network socket, allowing the
application to reopen sockets (for example in case of a network or
an IP address change).
It's been reported however that in certain cases this behavior is
undesirable. If this option is enabled, the TCP stack won't
close any TCP contexts when the network interface is going down.
Therefore, it is the application's responsibility to monitor the IP
address or network interface state changes, and restart the TCP
sockets when needed. Enable this option only if you can guarantee
that the application handles that properly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Contexts bound to any address are not associated with any specifc IP
address (sockets not connected yet or listening sockets bound to any),
therefore there's no need to shut down the connection context on the
interface down event. Hence, check the local address binding before
shutting down the context.
Note, that there's some extra logic involved when reading the TCP local
address, implemented in net_tcp_endpoint_copy(), therefore I've simply
reused that function for the purpose.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Moved forward decision debug messages ahead of interface TX/RX
operations. That's proper to see forward decision debug messages
first, and then interface TX/RX debug messages.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Added FDB (Forward Database) table support for bridge.
Implemented very basic functions for adding/deleting
static <MAC + iface> FDB entry.
The dynamic FDB entry and hardware FDB configuration is
still TODO work.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Add check for ACL connection before submitting recycled.
Since ISO and SCO connections do not trigger the disconnected
callback, nor affects e.g. advertising, they should not
trigger the recycled callback.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
On qemu_x86, the size of a coverage report entry for certain testcases can
exceed 32KiB, resulting in the "No memory available to continue dump" error
message in the gcov data output and the subsequent twister error in parsing
the data:
ERROR - General exception: non-hexadecimal number found in fromhex()
arg at position 0
This commit increases the gcov heap size to 64KiB to work around the above
issue.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Failure to clear ct->ct_notify[event_id] when avrcp_prepare_vendor_pdu
fails, leading to an error return if ct->ct_notify[event_id].cb != NULL
during the next notification registration.
Signed-off-by: Lu Jia <jialu@xiaomi.com>
Use the same HAL header for the simulated 54LM20 as for the 54L15,
just like we do for real targets.
Note this ifdef is the last one, and therefore the real targets
have already been caught before.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fix address resolution wait to not be infinite loop and
instead exit with a reasonable count down value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
struct dns_header is packed therefore it fields need to be accessed with
respective helper macro to avoid warnings with clang.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
for example:
l2cap_br_encrypt_change() calls l2cap_br_conn_pend(chan, hci_status) first,
which may trigger l2cap_br_chan_cleanup(chan). This clears chan->conn and
makes the channel invalid. The subsequent callback to
chan->ops->encrypt_change(chan, hci_status) then dereferences a NULL conn
in rfcomm_encrypt_change, causing a crash.
Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
Returning negative values which are not -1, isn't what POSIX would do and
the API is specifically designed to behave like recvfrom.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
- gw_id is an uint8_t in the protocol, so neither char, nor uint16_t are
the correct type to use.
- addr is an array of bytes, not a string (of characters).
This also corrects related log messages and makes them more consistent, by
using hex for all gw_id's.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The address is only used for gateway discovery, but using a truncated
`struct sockaddr` can lead to out of bounds reads.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
I don't know, why this was added originally, but there are many issues with
it:
- You can't really return NULL, because src_addr is a `void*`, not a
`void**`. The `src_addr = NULL` didn't do anything.
- The code was checking if the src_addr equals to the broadcast address,
but under normal conditions, that's always a unicast address.
- Even if we would check if the destination address was the bcaddr, I don't
see how that's useful. Currently, the address is only used for messages
of types advertise and gwinfo, which use it to create a new entry in the
gateway list. In that list, you always need the unicast address, never
the broadcast address.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
According to RFC 6763, chapter 12.1, PTR responses SHOULD include
"All address records (type "A" and "AAAA") named in the SRV rdata.".
This was not the case, as only one IPv6 and one IPv4 address was added
in the response by Zephyr. This commit changes this behavior, Zephyr
DNS SD responder will now try to include all IPv4/6 addresses configured
on a given network interface. The current approach of choosing one IPv6
and one IPv4 address first to include in the message is retained - this
is to prevent situation where for example IPv6 addresses will consume
all buffer space, leaving no place for IPv4 ones. The DNS responder will
encode those selected IPv6 and IPv4 addresses first, and then attempt to
include remaining IPv6/4 addresses with "best effort" approach, if there
still is a space in the buffer to add those.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
IPv4/IPv6 source address lookups may return unspecified address in case
there's no valid match (like for example LL address for global
destination). As it makes no sense to include unspecified addresses in
DNS SD replies, verify if that's not the case before adding A/AAAA
record in the response.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Instead of manipulating net_buf's data buffer directly, use net_buf APIs
to reduce complexity when creating mDNS response.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RFC 6762 Section 6.2 "Responding to Address Queries" specifies that mDNS
responses must include all valid addresses on the interface that is
sending the response. That was not the case for Zephyr's implementation,
which sent only on address in the response (and in some corner cases no
address at all).
This commit fixes this problem. Instead of encoding a single
pre-selected address in the response, mDNS responder will now loop over
all addresses on a given interface, and try to encode them as separate
answer records in the reply.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Adds support for using MCUmgr over UART (not via shell) in a raw
mode which does not include base64 and other SMP over console
encoding
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
If we get DHCPv4 bound event, then resend mDNS announce message
for that interface. This way a new address from DHCP server will
get announced properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If we try to add an already existing IP address to the
address monitor list, then mark the address to be in use.
The address might have been marked as not-in-use before.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If we override a static address by a DHCPv4 address, then send
address DEL event so that listeners notice it. This happens
for example with mDNS responder that needs to keep track of
what IPv4 addresses it needs to advertise.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The "init_called" flag needs to be per context and cannot be global
as it is meant to tell whether the context is initialized first time
or not.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fixed multicast address checking.
- net_eth_is_addr_multicast() should be for multicast address checking
but not for only IP multicast address. Then net_eth_is_addr_group()
is no longer needed.
- LLDP and gPTP multicast address checking should not depend on Kconfig
option.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Fix L2CAP configuration negotiation failure when peer device sends
MPS value larger than its own TX MTU in the configuration request.
This issue occurs when connecting to certain devices (e.g., iPhone)
using enhanced retransmission mode with MAP or PBAP profiles. The
peer may send an MPS that exceeds the TX MTU specified in the same
L2CAP_CONFIGURATION_REQ packet.
Instead of rejecting the configuration, adjust the MPS to match the
peer's TX MTU and include the corrected value in the
L2CAP_CONFIGURATION_RSP packet. This allows the connection to proceed
while ensuring MPS stays within valid bounds.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Since we have already supported sniff mode,
the corresponding link mode change event should be received.
Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
There is no reason for which CONFIG_NET_SOCKETS_SOCKOPT_TLS should select
some crypto features by default. The correct list really depends on the
server/client the device would like to connect to.
For this reason the selection of any crypto feature is removed from
CONFIG_NET_SOCKETS_SOCKOPT_TLS with the idea that the proper ciphersuite
is to be enabled in the final sample/test configuration file.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
CID (card id register) can be useful to application for traceability of SD
cards (#66460).
Adds disk ioctl command to get the CID data that is read at initialisation.
Changes the card_read_cid function to take pointer to cid register so that
the ioctl command can utilize with the passed user buf. Updated
calling functions to pass this pointer.
Signed-off-by: John Whittington <git@jbrengineering.co.uk>
CID (card id register) can be useful to application for traceability of SD
cards.
Adds disk ioctl command to get the CID data that is read at initialisation.
The struct sd_cid is moved to sd_card so that it can be read and retrieved
by card_ioctrl.
Signed-off-by: John Whittington <git@jbrengineering.co.uk>
Add an optional power policy hook to provide custom "next event"
ticks during pm_system_suspend(), in addition to the existing
kernel ticks and policy event list.
This hook enables applications and SoC-specific code to derive
the next wake-up time directly from proprietary or
hardware-specific data structures (e.g. hardware registers,
binary-only modules, complex schedulers) that are not
practical to convert into the standard PM policy event list.
The feature is gated by CONFIG_PM_CUSTOM_TICKS_HOOK and is fully
backwards compatible when disabled.
Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>