This commit fixes the bug that the memory of the work request is
freed up in the work handler, before it is not needed anymore by the p4wq.
This is fixed now, by using the new done_handler in the p4wq
for freeing up that memory.
Signed-off-by: Florian Weber <Florian.Weber@live.de>
Fix to release aux context stored in node rx, and not in the
superior scan or sync context as the one in the superior scan
or sync context could be reset or have a different new aux
context when multiple advertising chain reception is used.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion due to changes introduced to support multiple
advertising chain reception.
Auxiliary context association with the Periodic Sync context
was not cleared due to which when terminating a Periodic
Synchronization triggered an assertion check, under race
conditions, detecting that the auxiliary context was already
released.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.
This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix missing sync_delay and transport_latency information in HCI
LE BIG Complete event.
Relates to commit 1a640e4711 ("Bluetooth: controller:
Included transport latency in LE_Big_Established").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In ap enable cmd, channel set to 0 means ACS mode.
Remove hostapd AP macro for this case to make ACS mode
available for public usage.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
Fix incorrect device address reported in the LE Periodic
Advertising Sync Established event when using Periodic
Advertiser List.
During Extended Scanning there can be an ADV_EXT_IND PDU
received between currently being received ADV_EXT_IND PDU
and AUX_ADV_IND PDU; if the one received between has an
address match then incorrectly the Periodic Synchronization
was established to the device whos AUX_ADV_IND PDU is being
received. Fix by storing the auxiliary context that has the
address match and compare with it when matching the SID in
SyncInfo of AUX_ADV_IND PDU being received prior to creating
the synchronization.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BT_CTLR_LOW_LAT_ULL conditional compilation code by
decoupling it from BT_CTLR_LOW_LAT code.
BT_CTLR_LOW_LAT_ULL makes ULL execution context to tailchain
in comparison to continuously process in a while loop.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since the PACS service is not part of the bt_bap API it should
not use the bt_bap prefix, and instead just be bt_pacs like the
rest of the PACS API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When writing to a time resource, the logic was incorrect when validation
was enabled for the resource - when determining the actual underlying data
type we should compare against the data buffer length and not the
validation buffer length.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If an IP address already exists when it is tried to be added to the
network interface, then just return it but update ref count if it was
not updated. This could happen if the address was added and then removed,
but for example an active connection was still using it and keeping the
ref count > 0. In this case we must update the ref count so that the IP
address is not removed if the connection is closed.
Fixes#85380
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The mDNS probing is described in RFC 6762 chapter 8.1.
The code will send an unsolicited mDNS query to network and
will check if there are existing hosts with the same name.
If there are, then the mDNS responder will not respond to
queries it is configured to use.
Fixes#84333
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to specify the network interface where the query should
be sent, but only if the user has supplied the DNS servers in sockaddr
list. If user has specified a DNS servers in a string list, then the
possible network interface is taken from the string.
The reason for this is that it is not possible to add network interface
to the sockaddr list so an extra parameter is needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to specify socket service struct and port number so
that DNS servers specified in Kconfig etc are not used. This way
we can send a DNS query to arbitrary address without it affecting
the system configuration.
This is used in mDNS probing so that that mDNS responder can send
probe message and not change / configure system global DNS config.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Introduce dns_resolve_name_internal() that allows resolving a name
and not use DNS cache if caching is enabled.
This is needed in mDNS probing (RFC 6762 chapter 8.1) which needs
to send a mDNS query and not get any results from cache.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The code for checking for allocated BR/EDR PSMs was potentially resulting
in an integer overflow, due to doing a <= UINT16_MAX (0xffff) comparison
on a uint16_t variable. To avoid this, use a uint32_t variable internally.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Building with clang warns:
subsys/net/lib/http/http_hpack.c:21:20: error: unused function
'http_hpack_key_is_dynamic' [-Werror,-Wunused-function]
static inline bool http_hpack_key_is_dynamic(uint32_t key)
^
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
There are some boards and samples in the tree that use the CDC ACM UART
as the default serial backend, just like a real UART controller would.
The new device stack requires more detailed configuration than the old
one. In order to use the CDC ACM UART as the serial backend with the new
device stack in the same way as with the legacy stack, we need to
provide a solution to initialise and enable the CDC ACM UART at boot
time. We cannot use snippets as they do not support Kconfig files or
source code. Shields would be an option, but they cannot be used for
virtual devices such as the CDC ACM UART. The remaining solution is to
put the code and Kconfig file for it in the subsys directory.
Allow CDC ACM UART instance and USB device stack to be initialized and
enabled at boot time and to use it as serial backend for logging or
shell.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Fix "warning: 'cdc_acm_send_notification' defined but not used"
when Kconfig option UART_USE_RUNTIME_CONFIGURE is not used and
properly handle enqueue error.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Added a new function, bt_conn_is_type, that returns whether
the provided conn object is of the provided type.
This check is then used to ensure that the conn objects
supplied to other bt_conn function are of the right type.
The right type has also been documented for these functions.
This is an initial commit for a larger change in the BT Host,
as similar checks should be added to the L2CAP, GATT, ISO,
Audio and possibly Mesh APIs.
The type check could have been implemented by using the
bt_conn_get_info function, but that requires additional
function calls as well as memory allocation and copy.
Since bt_conn_is_type is designed to be widely used, it
was suited for its own function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit removes the double cdb node entry storing
into the settings if device was reprovisioned over
nppi interface.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
If BT_ISO_BROADCAST is enabled, then we shall support
at least 1 BIG and at most BT_EXT_ADV_MAX_ADV_SET since
each BIG requires its own advertising set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The coap_client.h header won't build if included from c++ file:
error: expected primary-expression before ‘.’ token
.value[0] = coap_bytes_to_block_size(CONFIG_COAP_CLIENT_BLOCK_SIZE),
Therefore move the actual function implementation to the library C file
to prevent this.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The 'log_flush()' function is used to wait for all pending log messages
to be processed by the background thread. This is performed by polling
the 'log_data_pending()' function, which scans all available buffers.
The log core already provides a 'buffered_cnt' variable that keeps track
of the number of pending messages. This variable is updated atomically
and could be a more efficient implementation for that check.
This commit moves the 'buffered_cnt' decrement _after_ the message
processing and buffer release, to ensure that the variable reflects
the number of pending messages at any moment in time.
The 'log_data_pending()' function is then replaced with a direct check
of the 'buffered_cnt' variable.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Added new parameter "A" in wifi connect command to support
CA certificate used or CA certificate skipped for
EAP-TTLS-MSCHAPV2 and EAP-PEAP-MSCHAPV2.
Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
Remove START_PENDING flag, and replace with
bt_mesh_adv_is_empty_by_tag
not only make adv_ext.c more readable, but also enhancement
In previous implementation, after proxy started, will check
this flag, and when the flag is true, will direct stop proxy
and re-enter schedule, but has one problem, this flag set true,
but buf will be empty, such as when sending mesh relay messages
will for-each every sets, until find not-active, but also set
previous set START_PENDING flags, so will cause proxy advertising
started->stop->started.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
The first why introduce ADV_FLAG_PROXY_START
see here(https://github.com/zephyrproject-rtos/zephyr/pull/58826)
The main core change is to mark ADV_FLAG_PROXY as moving to the last
enabled proxy instead of before.
But introducing the ADV_FLAG_PROXY_START flag seems meaningless.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
option struct was uninitialized in insert_option() function
during encode_options() call when the while loop wasn't
executed before.
Signed-off-by: Jakub Witowski <jakub.witowski9302@gmail.com>
The hdr_len was uninitialized when none of if-else
conditions were met in decode_delta() function.
Signed-off-by: Jakub Witowski <jakub.witowski9302@gmail.com>
From the MQTT-SN spec:
6.5 Topic Name Registration Procedure
...
At any point in time a client may have only one
REGISTER message outstanding, i.e. it has to wait
for a REGACK message before it can register another
topic name.
...
6.9 Client’s Topic Subscribe/Un-subscribe Procedure
...
As for the REGISTER procedure, a client may have only
one SUBSCRIBE or one UNSUBCRIBE transaction open at a time.
...
Until now, the library did not comply with these requirements.
An additional "waiting" state for topics was introduced:
REGISTER, SUBSCRIBE and UNSUBSCRIBE as an extra step before
switching to REGISTERING, SUBSCRIBING and UNSUBSCRIBING. The
library now makes sure that only one topic can be REGISTERING
and only one topic can be in either SUBSCRIBING or UNSUBSCRIBING.
Additionally, requesting to UNSUBSCRIBE is now denied if the topic
is not yet SUBSCRIBED, to avoid weird race conditions.
Also, added two tests that verify this behavior.
This fixes#84644
Signed-off-by: Rene Beckmann <rene.bckmnn@gmail.com>
Add word 'by' to function names to clarify which is the thing that
is found and which is the thing that is searched for. For example,
mqtt_sn_topic_find_name was renamed to mqtt_sn_topic_find_by_name
because the function does not find the name but finds a topic by
its name.
Signed-off-by: Rene Beckmann <rene.bckmnn@gmail.com>
When HTTP 101 Switching Protocols response is received, force the HTTP
parser to ignore any potential message body payload (which should
already belong to the new protocol).
This is usually not an issue, as Switching Protocols reply should
contain headers only, however it's been observed that some servers
specify chunked transfer-encoding header which tricks the parser
to wait for payload event though it never arrives.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When building relocatable extensions, exported symbol names might end
up in a separate section (in my case ".rodata.str1.1") for which
storage address don't match section address. To access those names
addresses have to be relalculated.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Building bluetooth.shell.audio.only_gtbs with clang warns:
subsys/bluetooth/audio/tbs.c:1646:6: error: variable 'ret' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (param->gtbs) {
^~~~~~~~~~~
subsys/bluetooth/audio/tbs.c:1667:9: note: uninitialized use occurs here
return ret;
^~~
subsys/bluetooth/audio/tbs.c:1646:2: note: remove the 'if' if its
condition is always true
if (param->gtbs) {
^~~~~~~~~~~~~~~~~
subsys/bluetooth/audio/tbs.c:1626:9: note: initialize the variable 'ret'
to silence this warning
int ret;
^
= 0
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
We have previously fixed an issue with shifting and
assigning the value without a cast, but coverity
is still complaining about aa[1] and aa[0] with:
"Casting narrower unsigned aa[1] to wider signed type
int effectively tests its lower bound."
Using the common function, sys_get_le24, should fix this issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Explicitly cast Kconfig option value to avoid truncation issue reported
by Coverity.
Fixes#84697
Coverity-CID: 487737
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit checks that ATT MTU value returned by `bt_gatt_get_mtu` is
greater or equal to 3 to prevent integer overflow.
Fixes#84693
Coverity-CID: 487743
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Ensure that ~(link.rx.seg) & SEG_NVAL doesn't result in 0.
Fixes#84804
Coverity-CID: 393090
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fixed the following issues:
1) Missing guard before accessing parameters
2) Fixed bad sizeof when resetting
3) Fixed several bad offsets when removing attributes
Added tests to verify that it works now.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds a new Kconfig for selecting swap using move in MCUboot which
aligns with the proper MCUboot symbol and allows for adding
additional mode Kconfigs
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When we receive a response from a server we do not have an
outstanding request with, we disconnect the connection
rather than just ignoring it.
The reason for this is that the remote server is
not ensuring correct ATT flow control, which means
that we cannot trust future responses from the
server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
psa_crypto_init was bounded to CONFIG_BT_HOST_CRYPTO_PRNG and
used to be called under prng_init. Updating the ifdef condition
and appropriating the function name for crypto init.
Also it is better to make sure psa_crypto_init called by host.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>