Commit graph

21541 commits

Author SHA1 Message Date
Lingao Meng
0e3b04e393 Bluetooth: Mesh: Disable network_id beacon when proxy disabled
According Mesh Spec 1.0.1 Section 7.2.2.2.1 Advertising

A node that does not support the Proxy feature or has the Proxy
feature disabled shall not advertise with Network ID.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-16 10:06:50 +02:00
Anas Nashif
b3ff5cbd70 Bluetooth: remove unused extern z_prf
z_prf is not being used in the monitor code, so remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-15 11:50:14 -05:00
Joakim Andersson
2837ac4409 Bluetooth: shell: Add disable advertising channel arguments
Add options to disable advertising channels for the different
advertising commands.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 13:21:26 +03:00
Joakim Andersson
ea273100ef Bluetooth: host: Add advertising options to disable channel
Add advertising options to disable the individual advertising
channel 37, 38 and 39 per advertising instance.

Fixes: #26732

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 13:21:26 +03:00
Joakim Andersson
426cef4477 Bluetooth: host: fix size of advertising option argument
Fix size of advertising option argument to get_filter_policy
function.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 13:21:26 +03:00
Vinayak Kariappa Chettimada
99dfa277bf Bluetooth: host: Fix missing BT_DEV_EXPLICIT_SCAN flag clear
Fix missing BT_DEV_EXPLICIT_SCAN flag clear on error
return.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-15 13:10:16 +03:00
Joakim Andersson
ee81c0865d Bluetooth: GATT: Consistent permission handling of discovered attribute
Be consistent in the permission handling of the discovered attribute
in the temporary object given in the discovery callback.
For characteristics the permission field was set to READ, while for
all other attributes it was set to 0.

Fixes: #29083

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Joakim Andersson
24f62eeea1 Bluetooth: GATT: Use UUID of attribute to check for a characteristic
Update check in the bt_gatt_attr_value_handle API function to use the
UUID of the function, in case the attribute has been declared with a
different read handler, or the attribute is a temporary object
where the read attribute has not been set.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Dominik Ermel
e7a21e83f2 fs: Move FAT FS Kconfig options to Kconfig.fatfs
All ELM FAT related Kconfig options have been moved to Kconfig.fatfs.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-14 13:19:47 -05:00
Dominik Ermel
bbd38ed6ff fs: Move all LittleFS options to Kconfig.littlefs
CONFIG_FILE_SYSTEM_LITTLEFS has been moved to Kconfig.littlefs.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-14 13:19:47 -05:00
Joakim Andersson
34cf1c74c2 Bluetooth: GATT: Fix regression in lazy loading of CCCs
Fix regression in lazy loading handling of GATT CCCs.
Bug introduced by: 00d370b09aa5dd1dc56986989989df6d4dd53bcf
The commit failed to account for ccc_set_direct calling ccc_set.

Fixes: #29150

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 17:35:22 +02:00
Joakim Andersson
c13588a508 Bluetooth: GATT: Improve service changed static RAM usage when disabled
Improve GATT service changed static RAM usage when the feature has
been disabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 17:18:35 +02:00
Armand Ciejak
6a110f93c0 net: ip: dhcpv4: Add randomization to message interval
Add +1/-1 second randomization to the timeout as per RFC 2131
chapter 4.1.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-14 14:59:39 +03:00
Armand Ciejak
b98d3b125c net: ip: dhcpv4: Limit message interval to a maximum of 64 seconds
Clip the timeout to 64 seconds, this avoids the timeout value to
increase to high values (e.g. several years).

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-14 14:59:39 +03:00
Armand Ciejak
ab5fd19c2b net: ip: dhcpv4: Add dhcpv4_update_message_timeout()
This avoids code duplication. The same logic was present
in dhcpv4_send_request() and dhcpv4_send_discover().

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-14 14:59:39 +03:00
Jukka Rissanen
d3283231a5 net: tcp2: Socket was accepted too early
The TCP2 was calling accept callback before actually finalizing
the connection attempt.

Fixes #29164

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-14 12:17:54 +03:00
Joakim Andersson
374cbdd124 Bluetooth: GATT: Refactor use of 16-bit UUID core types
Refactor use of 16-bit common GATT UUID types where a complete UUID
object is declared on the stack only to use the 16-bit value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-13 19:51:49 +03:00
Dominik Ermel
81dc347b84 fs: Improve documentation for FS API
Simple improvements in text and formatting of the documentation
the the FS API.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-13 13:16:02 +02:00
Joakim Andersson
3346aa4d39 Bluetooth: l2cap: Reduce size of disconnect pool
Reduce the size of the disconnect pool required the full MTU
for a disconnect request.
Also completely remove the pool when not needed.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-13 13:13:50 +02:00
Jukka Rissanen
accaab2112 net: shell: Add network mgmt events monitor support
Add "net events [on|off]" command that can be used to monitor
the generated network management events.

The monitor output looks like this when enabled:

EVENT: L2 [1] up
EVENT: L3 [1] IPv6 mcast address add ff02::1:ff00:1
EVENT: L3 [1] IPv6 mcast join ff02::1:ff00:1
EVENT: L3 [1] IPv6 address add 2001:db8::1
EVENT: L4 [1] connected
EVENT: L3 [1] IPv6 prefix add 2002:5b9b:41a0::
EVENT: L3 [1] IPv6 address add 2002:5b9b:41a0:0:fec2:3dff:fe11:c147
EVENT: L3 [1] IPv6 neighbor add fe80::9ec7:a6ff:fe5e:4735
EVENT: L3 [1] IPv6 router add fe80::9ec7:a6ff:fe5e:4735
EVENT: L3 [1] IPv6 DAD ok fe80::fec2:3dff:fe11:c147
EVENT: L3 [1] IPv6 DAD ok 2001:db8::1
EVENT: L3 [1] IPv6 DAD ok 2002:5b9b:41a0:0:fec2:3dff:fe11:c147
EVENT: L3 [1] IPv4 address add 192.168.1.69
EVENT: L3 [1] DHCPv4 bound 192.168.1.69

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-13 13:42:50 +03:00
Flavio Ceolin
619dcef498 mgmt: osdp: Fix a warning about an unused variable
tmp variable is only used when osdp sc is enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-10-13 10:58:02 +02:00
Flavio Ceolin
aa23af14b6 mgmt: osdp: Fix build when osdp sc is not enabled
osdp was unconditionally referencing symbols that are defined only if
osdp sc is enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-10-13 10:58:02 +02:00
Flavio Ceolin
6f7f9dfe7b mgmt: osdp: Make osdp sc requires on CSPRING_ENABLED
OSDP secure channel require a truly random number generator
source. Make this dependency explicit.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-10-13 10:58:02 +02:00
Vinayak Kariappa Chettimada
605ecf25a1 Bluetooth: controller: Fix debug pin for radio close
Fix the debug pin state when prematurely closing radio
events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:54 +02:00
Vinayak Kariappa Chettimada
43d8e3c90c Bluetooth: controller: Fix missing return on Auxiliary PDU abort
Fix the missing return statement when Auxiliary PDU
transmission is aborted because Primary PDU does not have
the aux pointer setup. Also, directly stop clocks and
post LLL done, like being done in other state/role LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:54 +02:00
Vinayak Kariappa Chettimada
77f12700e7 Bluetooth: controller: Minor conditional compile refactor
Minor Extended Advertising conditional compilation reorder
to better reflect the order Observer->Extended Scanning
dependency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:40 +02:00
Vinayak Kariappa Chettimada
4b965c6174 Bluetooth: controller: Fix rx quota mismatch due to ext adv terminate
NODE_RX_TYPE_EXT_ADV_TERMINATE is generated in ULL context
and shall not increment received PDU quota value.

Fixes #29101.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:40 +02:00
Vinayak Kariappa Chettimada
babd7289eb Bluetooth: controller: Move bsim radio hal header
Move the bsim radio hal header for nrfxx into the
controller's hal folder.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-12 19:34:13 +02:00
Andrew Boie
95bbc742ba kernel: move kernel object APIs to own header
Part of an effort to break up the gigantic kernel.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-12 12:21:46 -04:00
Jackie Ja
fac4a6a4fe net: lib: http: chunked encoding body support
We should not ignore the body when the Transfer-Encoding is
chunked.

Signed-off-by: Jackie Ja <qazq.jackie@gmail.com>
2020-10-12 13:58:19 +03:00
Jackie Ja
f07a9691ed net: websocket: Fix websocket loop close call
A normal websocket close sequence:
  close(websock) ->
    websocket_close_vmeth() ->
      websocket_disconnect()

close(ctx->sock) called in the function websocket_disconnect()
and cause websocket_close_vmeth() called again.
Finally stack overflow by loop close call.

It's maybe a side-effect by PR #27485

Signed-off-by: Jackie Ja <qazq.jackie@gmail.com>
2020-10-12 13:57:07 +03:00
Jonathan Rico
da45a88048 usb: bluetooth: Hardcode USB EP sizes
The existing calculation of the BULK_EP size can sometimes result in a
bulk EP size that is not spec-compliant. The accepted BULK_EP sizes are
8, 16, 32 or 64 bytes.

Additionally, the INT_EP size is always set to the max EP size since
BT_BUF_RX_SIZE is always greater than that (min. 73 in Kconfig).

This commit sets the BULK and INT endpoint sizes to their maximum
supported values.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2020-10-12 12:48:58 +02:00
Vinayak Kariappa Chettimada
9072f78abf Bluetooth: controller: openisa: Port drift implementation changes
Port minor anchor point synchronization drift implementation
changes.

Relates to changes in commit 732de50f67 ("Bluetooth:
controller: Refactor out drift compensation code").

Fixes #29062.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-09 13:46:46 +02:00
Eduardo Montoya
846c01434c shell: increase stack size for OpenThread
Default shell stack size is not always enough when used with
OpenThread. Increasing it to the found adequate value.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-10-09 11:51:41 +02:00
Jakub Rzeszutko
19ef740950 shell: fix compilation error
Fix a compilation error when shell help feature was not selected and
but shell help command was compiled.

Fixes: #29042

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-09 11:48:44 +02:00
Siddharth Chandrasekaran
7f4d2c741b mgmt/osdp: Add support for Secure Channel
This patch adds Secure Channel capabilities to osdp Control Panel and
Peripheral Device modes.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-09 11:45:58 +02:00
Vinayak Kariappa Chettimada
c1c627ce5a Bluetooth: controller: Fix Periodic Advertising cond. compilations
Fix Periodic Advertising conditional compilation to not
fail on undefined declarations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-09 11:41:34 +02:00
Robert Lubos
2497958298 net: lwm2m: Improve token generation
Improve token handling by removing special meaning of tokenlen == 0,
which allows to handle server requests w/o a token (so far such
requests would cause the lwm2m engine to autogenerate token in the
response).

In order to autogenerate token during message initialization, use
special symbol `LWM2M_MSG_TOKEN_GENERATE_NEW`. If no token is wished to
be used, simply set the tokenlen to 0.

Additionally, fix an issue with token autogeneration, where invalid
token len was used (0 instead of 8).

Fixes #28299

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-09 10:46:53 +03:00
Vinayak Kariappa Chettimada
c440c0d92f Bluetooth: controller: Initialize close to locality of reference
Initialize auto variables close to locality of reference.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-08 17:29:08 +02:00
Robert Lubos
b932edc772 net: lwm2m: Fix bootstrap finish response code
LwM2M engine did not set response code for the Bootstrap-finish message,
hence it replied with the code copied from the request which is not
correct. Fix this by setting correct code for the Bootstrap-finish
reply.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-08 16:31:56 +03:00
Andreas Sandberg
cfb6257327 lorawan: Cleanup error handling code
The error handling code currently has a couple of issues:

 * It relies on ordered lists and upstream not changing any constants.

 * Converted messages are not stored in constant memory which means
   that log_strdup is needed whenever they are printed.

This change also factors out error handling to a separate file,
lw_priv.{c,h}, to facilitate reuse in a future secure element and
state storage implementation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-10-08 12:15:38 +02:00
Kuba Sanak
9c976a2cad lorawan: Rework error handling code
For consistency with other parts of Zephyr, the public APIs available
in lorawan subsystem now returns error codes from the set defined in
errno.h.

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
[mani: reworked the code and commit a bit for upstream]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Kuba Sanak
b44dcf88d9 lorawan: Add support for SystemMaxRxError
SystemMaxRxError is used to negotiate overall timing error for Rx
in the loramac-node library. Hence, add support for configuring this
parameter from Kconfig.

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Manivannan Sadhasivam
3ce8540f3a lorawan: Add initial support for LoRaWAN
Add initial support for LoRaWAN based on Semtech's loramac-node
library. Current implementation only supports OTAA config and
sending data to LoRaWAN server like ThingsNetwork.

While at it, this commit also moves the "loramac-node" library
definition from drivers/lora to subsys/lorawan. This is required
because, subsys/lorawan gets processed before drivers/lora and
that creates issue while building.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Vinayak Kariappa Chettimada
e50319e055 Bluetooth: controller: Check for ticker operation failure
Add assert check to detect failure to enqueue ticker
operations. This will avoid HCI thread from stalling
forever on k_sem_take.

This assert will trigger on design fault, not defining
enough queued ticker operations count.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-08 11:54:42 +02:00
Jennifer Williams
5bda586c64 logging: fix if else if constructs missing final else
The logging subsytsem had if else if constructs without final
else statement. This commit adds else {} to comply with
coding guideline 15.7.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-10-07 23:05:18 -07:00
Vinayak Kariappa Chettimada
75bb449d2d Bluetooth: controller: Fix missing NULL check
Added a missing NULL pointer dereference check and made the
structure member scan->per_scan.sync and timeout_reload as
volatile, as they are modified in ISR context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f71664a970 Bluetooth: controller: Added link struct allocation explanation
Added link structure allocation explanation related to HCI
event generation by the controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
44243f8e0c Bluetooth: controller: Use BT_INFO to log unsupported code path
Use BT_INFO to log missing support for Periodic Advertising
report generation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2a1f134c32 Bluetooth: controller: Add Experimental keyword
Add Experimental keyword to LE Periodic Advertising in
Advertising and Synchronization state Kconfig title.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00