Takes the modem state machine by calling lcp_close instead of lcp_down
Using this method the LCP layer sends a TERMINATE_REQ to the modem and the
network interface is only taken down when the LCP layer has properly
finished.
Moved the ppp_mgmt_raise_carrier_off_event and net_if_carrier_down
to lcp.c to avoid breaking the interface.
Tested on a real modem.
Fixes: zephyrproject-rtos#41627
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Fixes bug where Host sends L2CAP Flow Control Credit after receiving a
L2CAP Disconnect Response.
The when the callback in l2cap_chan_le_recv_sdu is handed a Disconnect
Reponse, the connnection becomes disconnected, as illustrated by the
asserts. The function should now trigger sending credits if the
connection is disconnected after the callback returns.
Fixes#42112
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Fix Periodic Advertising Synchronization lost implementation
to avoid processing done event twice in cases of overlapping
events or race between sync terminate being requested.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add code comment related to sync context field used to
indicate the sync established event being generated towards
HCI Layer.
Co-authored-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update implementation to generate Periodic Sync Failed to be
Established when Sync Established message could not be
generate due to lack of free node rx buffers and when there
is sync lost before sync established message could be
generated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In case of error in hci_df_prepare_connectionless_iq_report function
e.g. due to wrong periodic advertising sync handle, uninitilized
per_adv_sync and IQ report object were passed by cte_report_cb callback
to an application.
Correct behavior in such situation is to not to cal cte_report_cb callback.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Fix any stray Extended Auxiliary PDU from being scanned
when disabling Extended Scanning.
Updated Extended Scan disable implementation to find any
active auxiliary scan context and stop them.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix advertising pdu latest get to defer release of stale
PDU chain buffers. Returning NULL after some buffers where
released causes LLL to assert when chained PDUs are
switched.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
many functions in the lwm2m librarys api take a pathstr argument
that is never written to, so make it const
Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
Nordic Semiconductor Radio peripheral provides IQ samples as
12 bits signed integer with sign extended to 16 bits.
Where out of range IQ samples (saturated) have value -32768.
Due to conversion of IQ samples to 8 bit signed integer, required by
BT 5.3 Core Vol 4, Part E sections 7.7.65.21 and 7.7.65.22 the
saturation information was lost.
The PR fixes that issue by use of value -128 to mark saturated
IQ samples. Note that BT 5.3 Core does not give any particular
value of IQ sample a special meaning.
This is a vendor specific solution and does not affect other
implementations of lower link layer.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
The path was erroneously pointing to update state
resource instead of update result causing a wrong
resource value to be updated.
Signed-off-by: Jarno Lamsa <jarno.lamsa@nordicsemi.no>
After https://github.com/zephyrproject-rtos/zephyr/pull/41337, extended
advertising reports are no longer discardable. Ensure the
non-discardable events are large enough.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The conn pointer is still valid / not reused at this time and can be
used further up the stack as an identifer. This simplifies the API of
ATT, and fixes callbacks in GATT that pass on this value directly since
their API does not allow conn to be NULL.
Fixes#41794
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Unlock tcp_lock when calling the recv_cb. In case when
a connection is being closed from both the tcp stack
and the application, a race condition can happen resulting
in locking each other out on tcp_lock and socket lock.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
Possibility to initialize USB device support is useful when
only CDC ACM class is enabled and CDC ACM UART is used as
backend for console, shell, or logging.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
HCI/GEV/BV-01-C tries to send 255 bytes over HCI, as part of sending
an unknown/unsupported command, but the default buffer size
is 65, which results in a buffer overflow and undefined behaviour.
Instead of crashing hard we now check the buffer length.
In order for EDTT tests to pass we set the buffer size to 255
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
This patch fixes an issue where mcux usb devices may stop
functioning after a reset event, because they do not
provide a USB_DC_DISCONNECTED event and USB_DC_RESET
events were not handled by the forward status callback.
Signed-off-by: Jacob Caughfield <mlsvrts@protonmail.com>
In previous commits the crc16_ansi() function has been made compliant
with the CRC-16-ANSI aka CRC-16-MODBUS standard. Use that standard
function instead of a custom one.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Since this CRC uses the 0x1021 poly with no reflection, a faster
implementation is available in the crc16_itu_t() function, which is
O(n).
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix Periodic Sync Terminate implementation for race
conditions with ULL scheduling by using a flag to stop any
new ULL scheduling to receive chain PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
There was missing a PDU initialization. CP bit in data channel
PDU heder was not cleared. Also cte_info byte was not crelader.
That lead to malformed control procedures PDUs and issues
with connection maintenance.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
In direction finding connected mode there is a CP bit that is set
data PDU header. The bit was initialized only if CTE transmission
was enabled. In case of reception of a CTE the bit was available
in PDUs but not initialized.
That caused issues in connection maintenance if PDU memory buffers
were reused. PDU were malformed and connections were lost.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Guard call to k_thread_abort() to ensure it's not called with an
uninitialized thread and fix improper use of inet_pton() with
INADDR_ANY passed in place of a dotted-decimal string. Both of these
would otherwise lead to NULL pointer dereferences.
Signed-off-by: Berend Ozceri <berend@recogni.com>
Fix missing offset adjust field assignment in the Periodic
Advertising's sync_info struct that is present in the
Extended Advertising PDU.
When the sync offset is equal or over 2.4576 seconds from
the Extended Advertising PDU, then the sync offset has to
be reduced by 2.4576 seconds and the offs_adjust flag be
set in the sync_info field.
This fixes a bug where Periodic Synchronization could not
be established for Periodic Advertisings with intervals
greater than 2.4576 seconds as the sync offset was
incorrect due to rollover in the 13-bit offset field.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Firmware Update Protocol Support resource initialization
has been left out in #41402.
Initialise the resource in object creation function.
Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
The Exchange MTU sub-procedure shall only be supported on the
LE Fixed Channel Unenhanced ATT bearer.
This was checked when receiving, but sending was allowed.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
The directory listing's record length should not reflect the size of the
directory listing object. This field is only the size of the directory
listing entry in the directory object and is intended to help a client
find the next record entry in the list.
Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
The packaged string coming from logging subsys requires some
additional processing if there are string arguments.
These strings are actually embedded inside the package so
the string pointers inside the argument list must be
replaced with pointers to strings inside the package.
Without this extra step of processing, MIPI Sys-T's printf
function would process these arguments directly which may be
NULL pointers or invalid one pointing to somewhere.
This utilizes the new cbpprintf_external() for the processing
before feeding data to the MIPI library.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The commit fixes smp_process_request_packet failing to decrement
message_size, of read stream, by number of bytes it trims from
an input buffer.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Increments send retry every time
after the tcp_send_data when resending.
That way unhandled return values can time
out after set amount of tcp_retries.
Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
The new macro USBD_STRING_DESCR_USER_DEFINE works like
USBD_STRING_DESCR_DEFINE with the exception of being
ordered strictly after it. The new macro is needed to
ensures that user defined string descriptors can be added
without disturbing the order of string descriptors
defined by the usb subsystem.
Signed-off-by: Alexander Mihajlovic <a@abxy.se>
Constant Tone Extension may not be transmittied with PHY CODED.
There were check to avoid situation that controller tries to
transmit or receive CTE when PHY is set to CODED.
These check were not conditionally compilated, hence when
PHY Update feature is disabled code did build.
The commit fixes the issue.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
In case the direction finding RX is enabled but without Angle
of Arrival functionality enabled, there HCI command buffer
had wrong command length assigned. It didn't take into account
two dummy antenna IDs provided to fulfil requirement from
BT 5.3 Core Vol 4, Part E sections: 7.7.82, 7.7.85.
HCI driver when received such command buffer, didn't handle it
due to wrong command length.
The commit fixes the problem.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
BT_BUF_EVT_RX_SIZE size by default was set to 68 bytes.
In case of build with direction finding connected mode receiver
enabled the size of event buffer was not enough to store all
IQ samples. In such situation IQ samples reports were not delivered
to Host.
The commit changes default size of event RX buffer to 255 in
case the BT_DF_CONNECTION_CTE_RX is enabled.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Direction finding samples had dependency on KConfig option defined
in Controller. That caused a problem for split builds where
an application and host are not part of the same binary as
controller. The code dependend on the Kconfig option
was always disabled.
To fix that issue new Kconfig options were introduced to
Host. The dependency is removed. Unwanted features may stil be
disabled and samples binaier will be smaller.
The commit aligns all direction finding samples code.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.
Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
OpenOCD is still using these alias, until we fix OpenOCD
upstream we should keep them.
This partially reverts commit
1a7bc06086.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Fix duplicate incomplete data status generated for Periodic
Advertising Report when LLL scheduling is used but auxiliary
context failed to be allocated in ULL.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix duplicate release of auxiliary context when scanning
uses LLL scheduling for reception of auxiliary PDU but the
reception fails.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Calling lwm2m_rd_client_stop causes the client context to be closed.
Doing this from arbitrary thread other than internal lwm2m engine thread
causes racing condition on lwm2m engine context pointers.
Fixes#42358
Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
Move the same peer periodic sync check to after check for
existing periodic sync create on both 1M and Coded PHY.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing progression of the rx_last pointer when
appending rx buffers before flushing them towards Host.
Under continuous scanning, as the disabled_cb would only
be called when reference count reaches zero, the rx_last
pointer needs to progress when appending the rx buffers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing Periodic Advertising Report with incomplete
data status when ULL scheduled chain reception is aborted.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing Periodic Advertising Report with incomplete
data status when LLL scheduled chain reception is aborted.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Controller implementation to release auxiliary context
when there is no node rx buffer available to receive
Periodic Advertising Sync AUX_CHAIN_IND PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>