In order to make sure that the ISR never gets an incomplete or partial
local RPA, use pointers to share the local RPA between thread mode and
ISRs. Pointer updates are guaranteed to be atomic at least on ARM
Cortex-M.
Additionally add support for using local RPAs when initiating a
connection or sending a scan request.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Since the hardware is only able to resolve the first address in the
packet, use the existing functionality to resolve a potential TargetA
RPA in software to verify if it matches the local device.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit introduces controller-based privacy for both the scanner and
the initiator roles. All the features in the specification are
implemented except:
* RPA resolution for directed advertising (TargetA address)
* RPA generation for scan requests and conn ind packets
Follow-up patches will cover the 2 items of functionality still missing
from the basic implementation. Hosts not using controller-based privacy
should not be affected by this change.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
If peer has previously configure to received service changes indications
any changes to the database during the time it has been disconnected
shall be indicated once it reconnects:
[bt] [DBG] sc_process: (0x004065b4) start 0x000a end 0x0014
[bt] [DBG] sc_save: (0x004065b4) peer b8:8a:60:d8:17:d7 (public)
start 0x000a end 0x0014
[bt] [DBG] bt_gatt_connected: (0x00405240) conn 0x00405aa0
[bt] [DBG] gatt_ccc_changed: (0x00405240) ccc 0x00400b30 value 0x0002
[bt] [DBG] sc_ccc_cfg_changed: (0x00405240) value 0x0002
[bt] [DBG] sc_restore: (0x00405240) peer b8:8a:60:d8:17:d7 (public)
start 0x000a end 0x0014
[bt] [DBG] sc_process: (0x004065b4) start 0x000a end 0x0014
[bt] [DBG] gatt_indicate: (0x004065b4) conn 0x00405aa0 handle 0x0008
[bt] [DBG] sc_indicate_rsp: (0x00405240) err 0x00
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_gatt_indicate return 0 in case of success, not true, so
SC_INDICATE_PENDING was flag was not set when it should.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Control and Data packet Tx queue management updated to be
optimal and defer control packet responses when Tx is paused
during encryption setup.
This fixes:
TP/SEC/MAS/BV-12 [Master Start Encryption: Overlapping
Procedure]
TP/SEC/MAS/BV-13 [Master Start Encryption: Overlapping
Procedure with LL_SLAVE_FEATURES_REQ]
conformance tests in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix handling of different procedure collision when receiving
a PHY update request and handling of reject extended
indication.
This fixes:
TP/CON/MAS/BV-47-C [Handling Protocol Collision – Different
Procedure – Channel Map],
TP/CON/SLA/BV-46-C [Handling Protocol Collision – Different
Procedure – Channel Map] and
TP/CON/SLA/BV-48-C [Handling Protocol Collision – Different
Procedure – Connection Update]
conformance test in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing PHY update event generation on same procedure
collision,
This fixes TP/CON/SLA/BV-44-C [Handling Protocol Collision –
Same Procedure] conformance test in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix PHY update procedure intiation to use correct No Change
value in MtoS and StoM when there is no change to respective
PHYs. Also, added missing HCI event generation under this
case.
This fixes TP/CON/MAS/BV-41-C [Initiating PHY Update
Procedure] conformance test in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
As ticker can only drift in 32kHz units, the slave Rx
window should consider a +/- one 32kHz unit in addition to
+/- 16us jitter of the master. Hence, for the current
implementation the slave Rx window jitter is +/- 48us.
Future improvement can be done by using remainder of 32kHz
unit drift to reduce this jitter to +/- 16us.
With this fix 20ppm clock accuracy passes conformance TIM
tests (else 251-500ppm had to be used).
Problem was not seen in real life as master do not have a
+/- 16us jitter.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix terminate procedure timeout when supervision timeout
equals connection interval. In this case, avoid timing out
in the first event of procedure initiation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix slave implementation to initiate reject_ext_ind if peer
supports reject_ext_ind.
This fixes:
TP/SEC/SLA/BV-11-C [Slave Sending Reject_Ind_Ext]
conformance test in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix handling invalid control PDUs by generating
LL_UNKNOWN_RSP PDU.
This fixes:
TP/PAC/SLA/BV-01-C [Unknown Packet from Master]
TP/PAC/MAS/BV-01-C [Unknown Packet from Slave]
conformance tests in LL.TS.5.0.0.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix access address generation to correctly have two
transitions in the six MS bits and add other missing checks.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Minor cleanup of Encryption Restart Procedure; No need to
pause rx for slave role on reception of PAUSE_ENC_RSP PDU as
its already paused.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit adds http_client_set_net_pkt_pool() function that allows
caller to define net_buf pool that is used when sending a TCP packet.
This is needed for those technologies like Bluetooth or 802.15.4 which
compress the IPv6 header during send.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
For IPv6 header compressed packet, the IP header offsets will
be wrong. In this case there is no need to print error when
trying to print TCP packet information.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds http_server_set_net_pkt_pool() function that allows
caller to define net_buf pool that is used when sending a TCP packet.
This is needed for those technologies like Bluetooth or 802.15.4 which
compress the IPv6 header during send.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The buf variable may have been unrefed by net_buf_frag_del thus it shall
not be used to store the sent data nor it should be in the
chan->tx_queue.
Jira: ZEP-2395
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fix assert in the controller on master connection creation
due to the CONNECT_IND PDU being transmitted beyond the
calculated scan window.
This is related to commit 80a796b493 ("Bluetooth:
controller: Fix scanner to use correct slot ticks")
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix an assert in next role event preparation when a
connection terminated during the connection event being
aborted/pre-empted out by the next role event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
CONFIG_MQTT_LIB_TLS is introduced to enable TLS support.
Also, prj_frdm_k64f_tls.conf is added to demostrate the whole idea.
jira:ZEP-2261
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Use net app API since we want to enable MQTT with TLS.
mqtt_connect() and mqtt_close() are added to build and close the
connection to the broker. The caller doesn't need to deal with
the net context anymore and the most of network setup code in
mqtt_publisher is removed.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
As SLIP TAP is now the default after the commit ca0ad13a61
("net: enable SLIP only on QEMU targets"), clarify the comments
and settings in various Kconfig files that talk about slip.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Change the common "init with 0" + "give" idiom to "init with 1". This
won't change the behavior or performance, but should decrease the size
ever so slightly.
This change has been performed mechanically with the following
Coccinelle script:
@@
expression SEM;
expression LIMIT;
expression TIMEOUT;
@@
- k_sem_init(SEM, 0, LIMIT);
- k_sem_give(SEM);
+ k_sem_init(SEM, 1, LIMIT);
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
If the network interface is down, then IPv6 DAD (Duplicate
Address Detection) cannot be done if new IPv6 address is added
to the network interface. This can happen in Bluetooth, where
network interface is taken up only after there is a BT connection.
The DAD is delayed and done later after the network interface is up.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Normally network interface is always UP, but Bluetooth
interfaces are down until connected. So if this is the case,
then check the interface status before trying to access variables
that are NULL. This was seen with "net iface" shell command when
BT was enabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In case the application is using NET_L2_BLUETOOTH the SLIP drivr shall
not be selected as bus they cannot coexist since they use the same UART
port:
arch/x86/soc/ia32/Kconfig.defconfig:
config BLUETOOTH_UART_ON_DEV_NAME
default "UART_1"
config UART_PIPE_ON_DEV_NAME
default "UART_1"
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In many networking tests we had to configure SLIP in the prj.conf
leaving those configurations Qemu specific. This change enables SLIP for
QEMU targets automatically and allows reuse of prj.conf for multiple
boards.
Additionally, the TUN options is removed. This option was not used
anywhere.
To enable self-contained networking tests that do not depend on SLIP, we
introduce the new option NET_TEST which disables TAP and allows testing
in QEMU without the need for a host interface.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
* Fix the indentation which was caused by uint32_t -> u8_t changes.
* Make sure there is no unused variable warning if debugging is
enabled but debug level is low.
* Add assert that checks that Imax_abs is > 0 which it should be.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If there are no neighbors or there is no route to one specific
neighbor, then check the NULL pointer before accessing the route.
This issue was seen with "net route" shell command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The net_stack_analyze function wants to look at the stack buffer,
but it is making assumptions on where this data is that are no
longer valid. Change to use the proper APIs for referencing this.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Since we generate BLUETOOTH_MONITOR_ON_DEV_NAME based on dts we need a
!HAS_DTS check around it. Otherwise we can get into odd build errors.
Its also possibly that we don't specify "zephyr,bt-mon-uart" and in that
case we default to CONFIG_UART_CONSOLE_ON_DEV_NAME (ie 'zephyr,console'
on DTS platforms).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If IEEE 802.15.4 is enabled, then setup the network settings
automatically so that the device is ready for IP configuration.
This is only done if CONFIG_NET_APP_AUTO_INIT is enabled, which
is currently the default.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add an initial implementation for the Bluetooth Mesh Profile
Specification. The main code resides in subsys/bluetooth/host/mesh and
the public API can be found in include/bluetooth/mesh.h. There are a
couple of samples provided as well under samples/bluetooth and
tests/bluetooth.
The implementation covers all layers of the Bluetooth Mesh stack and
most optional features as well. The following is a list of some of
these features and the c-files where the implementation can be found:
- GATT & Advertising bearers (proxy.c & adv.c)
- Network Layer (net.c)
- Lower and Upper Transport Layers (transport.c)
- Access Layer (access.c)
- Foundation Models, Server role (health.c & cfg.c)
- Both PB-ADV and PB-GATT based provisioning (prov.c)
- Low Power Node support (lpn.c)
- Relay support (net.c)
- GATT Proxy (proxy.c)
Notable features that are *not* part of the implementation:
- Friend support (initial bits are in place in friend.c)
- Provisioner support (low-value for typical Zephyr devices)
- GATT Client (low-value for typical Zephyr devices)
Jira: ZEP-2360
Change-Id: Ic773113dbfd84878ff8cee7fe2bb948f0ace19ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The address lifetime timer was cancelled always even if the address
timer was never installed.
Jira: ZEP-2397
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
poll() allows to (efficiently) wait for available data on sockets,
and is essential operation for working with non-blocking sockets.
This is initial, very basic implementation, effectively supporting
just POLLIN operation. (POLLOUT implementation is dummy - it's
assumed that socket is always writable, as there's currently no
reasonable way to test that.)
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Use net_context_put(), not net_context_unref(). This makes sure
that after sending response, connections are properly closed.
Jira: ZEP-2362
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Introduce net_context_bind_default() to ensure that local address is
set for context if not yet (via explict bind() call). This fixes
dereferences of NULL pointer to local address which was exposed when
MMU was enabled for qemu_x86.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
When populating the hardware filter, add only slots that are marked as
taken to avoid the hardware being confused by all-0 addresses. This
solves an EBQ issue with whitelist filtering.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>