This doesn't make much practical difference, however it should resolve
Coverity CIDs 170740 and 170748.
Jira: ZEP-2343
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If ICMP packets do not fit in 1 net_pkt fragment the checksum
will be calculated incorrectly.
The problem shows up when using ping with the -s option to
create large ping requests. Eventhough the ping command does
accept the reply without complaining, Wireshark warns that
the icmp checksum is incorrect.
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
With the ticker for flash driver added, the Controller was
corrupting memory outside its allocations by incorrectly
using the flash ticker instance to be a BLE role and
corrupting memory. This is now fixed by checking for the
ticker ids to be within the Controller's use before using
them.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In some cases applications may want better control of advertising
instead of the stack doing automated re-enablement. Introduce a new
option that can be used to do more "manual" advertising control.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The BT_DEV_ADVERTISING flag already does a suffient job with tracking
the actual advertising state, so there's no need for bt_le_adv_stop()
to return an error if KEEP_ADVERTISING is set. We still need to clear
KEEP_ADVERTISING, but it should not be considered an error if it was
not set.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fixed uninitialised auto variables, that had caused compile
errors under CONFIG_DEBUG=y.
Jira: Zep-2334
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If a socket is closed without reading all data from peer or accepting
all pending connection, they will be leaked. So, flush queues
explicitly.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
With CONFIG_NET_SOCKETS_POSIX_NAMES=y, "raw" POSIX names like
socket(), recv(), close() will be exposed (using macro defines).
The close() is the biggest culprit here, because in POSIX it
applies to any file descriptor, but in this implementation -
only to sockets.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This adds Kconfig and build infrastructure and implements
zsock_socket() and zsock_close() functions.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Temporarily, disable scan request notification reports when
LE Advertising Extensions feature is enabled; as support for
enabling scan request notification is not yet added to the
Controller's Link Layer interface functions, yet.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Intention is to test flash driver along with BLE radio.
Added flash shell module with commands for erase, write-check, read and
co-operation with radio stress test.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Extend radio ticker nodes for support in-timeslice execution
Added interface for abort the radio
Added interface for check whether the radio is idle
Added interface for get ticker IDs for timeslice ticker node
Added interface for check whether radio ticker is running
Added interface for check whether radio ticker is initialized
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
In order to associate a hit on the hardware IRK filtering with an entry
of the resolving list, add an array of correspondance between the IRKs
and the resolving list entries.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order for some of the required checks in the ISR to be performed, we
need to keep track of which of the items in the resolving list are in
the whitelist as well. Track them using a single bit in the resolving
list entries.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to obtain the ID (index) of the device matched in a hardware
filter, a new API call has been added along with the required
implementation for nRF5x devices.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When force scheduling a ticker use the number of times the
tickers have already skipped their intervals to decide if
the forced ticker can pre-empt the colliding ticker. This
introduces a fairness amongst tickers contesting for the
overlapping time slice.
Flashing in co-operation with Radio needs to be fair in
order to avoid connection supervision timeouts.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In preparation towards mesh advertise implementation, avoid
one-shot tickers with slots, that have been scheduled to
expire, from being removed by a forced start or update
operation on another ticker.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The global mbedtls heap is set automatically now so no need to
set it individually in the http library.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Move the PRNG initialization after reading local supported commands,
so that we don't send HCI_LE_Rand if the controller doesn't support it
(we still need to fail the init however). The patch also removes a few
unnecessary #ifdefs related to crypto.h.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
To avoid iterating twice through the list, have ll_rl_find() return the
first free empty slot on the list.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add handling of the LE Set Privacy Mode HCI Command along with the logic
required to take it into account when populating the hardware filters.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order for privacy to work correctly with and without peer IRKs, an
additional hardware filter is required to help match the peer device in
the case address resolution is not possible for a peer since the Host
has not provided a peer IRK for it.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When removing a device from the resolving list, if it contained a peer
IRK then it is necessary to update the indices that point to the peer
IRK list, since the list itself is contiguous in memory.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When using privacy, an additional cache of the actual privacy peers is
required to avoid additional processing in the ISR (since some of the
peers in the whitelist will be disabled by the corresponding privacy
settings). Add the cache and populate the actual whitelist just before
advertising, scanning or initiating a connection.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Properly use the role and feature Kconfig variables to populate both the
supported commands and the supported states in the controller.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Since the peripheral role depends on the broadcaster one, and the
central role depends on the observer one, select them automatically
instead of using defaults.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Three response codes are missed in zoap_header_get_code() which will
result in the response code returned from the function being set as
ZOAP_CODE_EMPTY. Check include/net/zoap.h for the missing code
definition.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
It's possible that the controller will emit the number of completed
packets event before bt_send() returns, or possibly preempt
send_frag() before it manages to call add_pending_tx(). We have to
therefore add the pending TX entry before calling bt_send().
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fixed assert due to stale tick count in role event
preparation. This happens when ticker timeout expiry is
delayed from the requested realtime anchor, due to thread
mode processing overheads and occurring interrupts therein,
if any, that added a delay between requested anchor tick
and actual scheduling for the requested ticker timeout.
The assert is reproduced in bt shell by starting advertising
and following it with continuous scanning (interval 2.5ms,
window 2.5ms), on nRF51x. If the overheads and/or a
advertiser event delayed the scheduling of scanner by over
2.5ms, then the preparation of scanner asserted.
The assert has been fixed by checking for stale tick count
at expiry in role event preparation and skip the event
gracefully.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
For whitelist and resolving list handling, avoid trying to start the
advertiser and scanner roles when they are already running.
Additionally, and since simultaneous scanning and initiating is not
supported, correctly report this to the host both in the supported
states and in the HCI command via an error code, instead of silently
disabling scanning.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
We have conflicting types between the decleration and implementation of
several radio functions. We should be using u32_t everywhere. This
shows up when we try and build with newlib enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Added HAL Radio abstractions to use SoC specific Radio Timings
as documented in SoC's electrical characteristics.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In LISTEN state ignore a TCP RST. In SYN RCVD state, reset TCP
connection state to LISTEN when a valid RST segment is received. In all
other states close the connection - except that these other states will
not be handled in tcp_syn_rcvd() function.
Jira: ZEP-2279
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
An OCF is a 10-bit value as defined by HCI, and therefore requires a
16-bit integer to store it.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed assert due to incorrect implementation of stopping of
advertiser role under directed advertisement timeout, and
also, fixed assert due to adv stop ticker not being stopped
on advertisement disable from thread mode.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added checks for advertiser and initiator/target addresses
received in CONNECT_IND when performing directed
advertising.
This is required to pass TP/CON/ADV/BV-04-C [Directed
Advertising Connection].
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When directed advertisements timed out, connection context
associated was not being released. Subsequent connectable
advertising or connection creation failed.
This is now fixed by releasing the connection context on
directed advertisement timeout.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If the CONFIG_NET_TCP_TIME_WAIT support is disabled, then do not
start to wait for reply to sent FIN in active close, but unref
the corresponding net_context in order to close the connection
as soon as possible.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Refactor whitelist handling into generic filter management in
preparation for future resolving list ID address filters.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Rename bt_gatt_unregister_service to bt_gatt_service_unregister to be
consistent with other APIs such as bt_gatt_service_register.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This initial commit adds the following:
* Handling of privacy HCI commands
* New Link Layer filter module for both whitelist and resolving list
* Advertising RPA generation with timeouts
Follow-up commits will expand the functionality.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>