Add an early check whether FAT fs is already mounted similar to
littlefs mount command. This fixes a null pointer access if the mount
command is used twice.
Fixes#104777
Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
When USE_SWITCH=y, the thread struct is now mostly degenerate. Only
the two words for ICI/IT state tracking are required. Eliminate all
the extra fields when not needed and save a bunch of SRAM.
Note a handful of spots in coredump/debug that need a location for the
new stack pointer (stored as the switch handle now) are also updated.
Signed-off-by: Andy Ross <andyross@google.com>
The SWO backend's panic() handler was a no-op. When LOG_PANIC() is
called (e.g., before a bootloader jumps to an app, or during a fatal
error), the logging subsystem flushes software buffers to the ITM
FIFO, but the TPIU hardware pipeline still has bytes in-flight on
the SWO pin. The debug probe loses these final messages.
Spin on ITM_TCR.BUSY until the formatter is idle, then busy-wait
for the TPIU output stage to clock remaining bytes out at the
configured SWO baud rate.
Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
When routing packets, check if the destination address matches an
on-link prefix on any interface before using the default router.
This ensures packets destined for on-link prefixes are not
incorrectly sent to the default router.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
Logging a message in PRE_KERNEL with CONFIG_LOG_THREAD_ID_PREFIX=y
triggers a assert in k_current_get() because the current thread is not
yet available.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Resume from cli->block.number instead of block 0,
so BLOCK_START matches the server's current block.
Blob client does not drop server due to this anymore.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Accept WAITING_FOR_CHUNK phase on resume
when server responds SUCCESS
(server's XFER_START idempotency path).
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Add a dedicated Kconfig option for this previously hidden and
automatically enabled Mbed TLS configuration.
Make the relevant key exchange Kconfig options depend on it.
Enable it explicitly where needed.
Fix the condition for defining MBEDTLS_X509_USE_C (based on
mbedtls_config.h).
Check for CONFIG_MBEDTLS_X509_CRT_PARSE_C instead of
MBEDTLS_X509_CRT_PARSE_C now that we have a Kconfig option for it.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add function to get an instance pointer by index.
This works the same as bt_tbs_client_get_by_ccid except that
it uses the index instead of the CCID.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Support for using v3 of the FUSE library instead of v2 was added in
b86e52bd6f
As time has been passing more distros are removing v2 support, and at
this point probably all include the v3 in their package repos.
So, let's switch the default to v3.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When calling bt_avrcp_ct_register_notification,
it sets ct->ct_notify[event_id].cb = cb.
In process_register_notification_rsp, it clears the callback
by setting ct->ct_notify[event_id].cb = NULL. However, when
the connection is disconnected, the callback
ct->ct_notify[event_id].cb is not set to NULL , causing
subsequent notification registrations to fail immediately with
an error because the callback pointer is still active.
Similarly, this issue also exists in the AVRCP TG.
Signed-off-by: Lu Jia <jialu@xiaomi.com>
Refactored the Stream End Point (SEP) callback mechanism to use a
unified bt_avdtp_sep_ops structure instead of individual function
pointers. This change consolidates the connected, disconnected, and
media_data_cb callbacks into a single operations structure. The stream
established callback should be called when the stream l2cap is
connected not the open cmd is finished.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Do not add a newline when flushing the buffer to the host terminal.
The caller may not want these newlines to be added, and the host
terminal can handle line wrapping on its own.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add buffer size configuration for posix log backend.
This allows to increase the buffer size for the posix console, which is
needed to avoid message flushed in the middle of ansi escape sequences.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Adds compile-time option for overriding UAC2 Feedback endpoint to allow
usage with non-class-compliant Windows UAC2 driver.
Signed-off-by: James Bennion-Pedley <James.Bennion-Pedley@thinksmartbox.com>
Remove the k_is_user_context call from the Z_LOG_LEVEL_ALL_CHECK macro.
Add the Z_LOG_LEVEL_ALL_CHECK_BREAK macro, which safely checks whether
logging is performed in user context before checking the dynamic log level
that requires access to kernel structure.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add missing memory barriers after branching on k_is_user_context() to
prevent reordering possible of privileged memory access.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Remove the unnecessary CONFIG_USERSPACE checks around k_is_user_context
calls. This function is inline and already performs the config check
internally.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add WEP security support in Wi-Fi mgmt ops.
Need to enable Kconfig CONFIG_WIFI_NM_WPA_SUPPLICANT_WEP.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Only set state to ACTIVE after RESUME succeeds, if it fails,
keep SUSPENDED STATE and attach an error code.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Replace instances of struct net_sockaddr with struct net_sockaddr_storage
for stack variables.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Storing a socket address should be done with the designated struct
net_sockaddr_storage type instead of the opaque struct net_sockaddr.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Let's avoid using off_t in the interface between the embedded and the
host side of the FUSE driver.
off_t is a C library defined type and as such can have a different sizes
between the host C library and the embedded C library.
While at it, let's do also the same with size_t. Even though size_t is
meant to be defined in stddef.h which is provided by the compiler, it is
possible to override it in the embedded side.
We just replace them with a 64 bit type for each (signed and unsigned
respectively matching the signedness of off_t and size_t).
There was a bug in the queue type which had the read/write second
parameter as off_t while it should have been size_t, which is now fixed
to be uint64_t.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
A CoAP client should not be limited to a single destination address for all
requests.
Store the destination address for each request or use the existing socket
directly.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Update the return type of the ICMP callback handler to enum net_verdict.
This fixes an issue where currently all ICMP handler are passed the same
pkt. Handlers could have modified the passed packet resulting in undefined
behavior.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
bt_mesh_suspend/resume now only re-enable provisioning bearers that
were previously active.
Adds internal bt_mesh_provisionee_suspend/resume APIs.
bt_mesh_suspend() now return -EBUSY if provisioning is active before any
suspend actions are performed.
Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
When proc_param->is_unicast_to_broadcast == false we should clear
the broadcast_to_unicast.broadcast_source instead of the
unicast_to_broadcast.broadcast_source.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Remove the required_sec_level for struct bt_iso_chan and
all related automatic security machinery built around it
(iso_chan_connect_security, bt_iso_security_changed,
BT_ISO_STATE_ENCRYPT_PENDING and the CONFIG_BT_SMP checks
in iso.c)
Applications can just call bt_conn_set_security() on the
ACL connection before bt_iso_chan_connect() instead.
Fixes#104751
Signed-off-by: Vedant Malkar <vedantitsme@gmail.com>
It turns out that power_domain_add_or_remove() when add==true only
looks for DEVICE_HANDLE_NULL empty slots to write to, and never checks
"whether this dev_handle is already in the supported handles or not".
The result is: repeated adds may insert duplicate entries; or when
there are no empty slots, even though it's "already in the domain",
it returns -ENOSPC (which conflicts with the documented semantics).
This commit adds a check: when add==true and rv[i] == dev_handle is
found, it returns -EALREADY and avoids duplicate insertion.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Make sure autoconfigured multicast IPv6 addresses are added (and thus
referenced) only once when the interface goes up to avoid mounting refs
for a given address.
Even if address is already present and net_ipv6_mld_join() is skipped
for a given address it's not an issue as all unjoined addresses have
their reports sent on interface going up via net_ipv6_mld_rejoin().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When allocating new multicast address, clear the is_joined flag as it
could've still be set from the previous allocation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add helper function that allows to rejoin multicast groups without
registering an address. This is needed in case we just want to send
report w/o increasing the ref count of the multicast address (when
interface goes up for example).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add helper function that allows to rejoin multicast groups without
registering an address. This is needed in case we just want to send
report w/o increasing the ref count of the multicast address (when
interface goes up for example).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Network interface state is now checked down the line in
net_try_send_data() so a separate check in the MLD code was redudant,
hence remove it to simplify the code.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Don't send MLD report on join if the address was already joined,
only increase the ref count by calling net_if_ipv6_maddr_add().
On leave, only send report if the address was removed from the system
(i.e. is no longer in use).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>