Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Fix ticker previous slot value with elapsed ticks value from
the time stopped ticker has expired. When a ticker is
stopped, if it was in its reserved time space, then the
currently occupied slot (was set to 0) should be the amount
of time that has elapsed in the expired and stopped ticker's
reserved time space and beyond until the stop.
This is required to ensure that any other new ticker does
not get scheduled over the stopped ticker's reserved time
space.
Fixes#19515.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Creates macros for determining model message lengths based on opcode,
payload length and MIC size. Also adds macro wrapping
NET_BUF_SIMPLE_DEFINE to serve the most common use case.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
When running a ticker node as "must expire", the node would invoke the
ticker callback even when programmed with latency. As "must expire" is
intended for scheduled events which are skipped due to collision, and as
such expected by LLL, purposefully skipped events should not generate
"must expire" callbacks.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Try to figure out where the ping reply should be sent if there
are multiple network interfaces in the system.
Fixes#19612
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The MQTT transport API functions are already documented in
mqtt_transport.h so need to duplicate them in individual
transport .c file.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Fix ULL implementation that uses conditional compilation by
replacing back to use of #if defined(...) in code accessing
compiled out struct members.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix for possible Tx Buffer leak during disconnection when
the buffers are in ULL context and not yet enqueued towards
LLL context.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When more than one simultaneous connections are active,
transmitting data packets to peer, a termination causes
host to use the flushed pending number of completed packets
count for other active connections. This is on reception
of HCI disconnection complete event. But the controller has
not yet released any of the pending enqueued Tx buffers
which was happening after the disconnection event was
dispatched to HCI layer.
The fix here is to dispatch the disconnection complete event
from the LLL context after pending Tx buffers have been
flushed and the buffers get returned to Tx pool in the ULL
context. This way buffers are in the Tx pool before host
get to process the disconnection complete event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix for possible Tx Buffer leak during disconnection when
the buffers are in HCI thread context and not yet demux-ed
and enqueued towards LLL context.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the mayfly scheduling of the Tx buffer flushing on
connection termination to be immediate (not to tailchain).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Randomly generating ID the first time coap_next_id() is called is more
in accordance with CoAP recommendations (see
https://tools.ietf.org/html/draft-ietf-core-coap-18, section 4.4)
"It is strongly recommended that the initial value of the
variable (e.g., on startup) be randomized, in order to make successful
off-path attacks on the protocol less likely."
Doing this in a dedicated init function is the cleanest and most
idiomatic approach. This init function is not exposed publically which
means it will be called only once, by the network stack init procedure.
Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
Uses net_buf_simple_clone to access the sdu of an unsegmented app packet
for re-encryption.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Provides a way to clone a net_buf_simple without altering the state of
the original buffer. The primary usage scenario is for manipulating a
previously allocated PDU inside a buffer without altering the length and
offset of the buffer.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Local messages are already enqueued for the LPN in the tx path, and
don't have to be added again in the rx path.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Re-encrypts single-segment application messages when the network seqnum
has changed, to avoid encrypting messages with different seqnums in
network and transport. This operation is only required for unsegmented
messages, as segmented messages don't need to use the same seqnum in
network.
Reinstates the special adv data for friend messages to store the app key
index.
Fixes#19265.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Provides a utility function for getting an application key given a
subnet and an app ID. Primary use-case in friendship re-encryption.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Provides utility function for parsing network headers outside of the
network layer. The primary intended use-case is friendship.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Check if the encryption procedure is in progress when receiving
rejection for the procedure.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix issue in the handling of LL_REJECT_EXT_IND packets, this would look
at the procedures that are enqueued, and not the procedure that was
being rejected. This meant that although a reject was received for the
encryption procedure, the handling for a different control procedure was
run.
This would result in the link being terminated as control procedure
timer would time out for the encryption procedure.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Static variables and functions don't need #ifdefs if the code calling
them is using IS_ENABLED(). If IS_ENABLED() evaluates to false the
compiler will strip out all the static entities.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Static variables and functions don't need #ifdefs if the code calling
them is using IS_ENABLED(). If IS_ENABLED() evaluates to false the
compiler will strip out all the static entities.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Static variables and functions don't need #ifdefs if the code calling
them is using IS_ENABLED(). If IS_ENABLED() evaluates to false the
compiler will strip out all the static entities.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When aborting radio event, there is a possibility that the
packet timer would start the radio while the packet timer
is being reset. Hence, perform a second radio state disable
with packet timers uninitialised.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing radio status and configurations reset on radio
event abort. This caused under race conditions the radio
being put into active state after being aborted.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect ticker/mayfly user id used in scheduling the
abort of a radio event. Incorrect use of thread context as
the caller caused the abort function to be scheduled from
thread context while being called from ULL high context
level in reality. This could cause corruption of mayfly
scheduling.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When flash driver requests abort of radio event in unreserved
time space, resume radio events in the pipeline were not
flushed. These resumed events caused flash driver to assert
on the check whether radio was in use.
Fixed by flushing the pipeline of all radio events, resume
and also those events in pipeline with pre-empt timeout
being setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When multiple simultaneous peripheral connections are
supported, restarting connectable advertising by host on
peripheral connection establishment failed in controller.
This prevented establishing new connections while first
connection was active.
The failure was caused by a bug in the way controller was
using quota for Rx PDU buffers. As the quota count was
release before the connection complete event rx PDU buffer
being released, the Rx PDUs needed to reserve for
connection complete event for new connectable advertising
was not available. This caused the connectable advertising
enable to fail.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix bug in ATT reset handling, not releasing queued notification
buffers when the connection is terminated.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
create_ipv6_answer() function is behind #define's but get used behind
IS_ENABLED(CONFIG_NET_IPV6), which is not allowed.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Periodically wake up log process thread consume more power if system
already in sleep or deep sleep state. With the help of added logging
timer and semaphore, log process thread is woken up only when there
is logging message.
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Use entropy driver directly in bt_rand instead of stitching together
calls to sys_rand32_get to improve efficiency. The use of
sys_rand32_get could also leak timestamps into keys.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Added support for vendor specific meta data in LLL node_rx_hdr. This
enables vendors to add "footer" data to the RX PDU, for supporting
specialized BLE features.
Signed-off-by: Morten Priess <mtpr@oticon.com>