Commit graph

21541 commits

Author SHA1 Message Date
Lingao Meng
61370f171c Bluetooth: host: Fix host send cmd complete to dis-conn
Fixes: #38054

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-16 21:29:09 +03:00
Vinayak Kariappa Chettimada
9e2b9c7a91 Bluetooth: Host: Fix Periodic Advertising Sync using Advertiser List
Fix Periodic Advertising Sync Establishment to accept
synchronization establishment to device listed in the
Periodic Advertisers List when filter policy was used.

Fixes #38520.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-16 16:35:45 +02:00
Vinayak Kariappa Chettimada
380a800b88 Bluetooth: Controller: Fix incorrect common header length calc
Fix incorrect calculation of received common extended header
length. Due to this a zero length advertising data is
reported in Extended Advertising and Periodic Advertising
report as one byte AD data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-16 15:20:12 +02:00
Asbjørn Sæbø
e8620a7416 Bluetooth: Object Transfer Service: Defines for allowed object ID values
Add #defines for the maximum and minimum allowed values for object
IDs.

Moves the #define for the directory listing object ID to the public
header file

Having these limits available is useful for applications wanting to
ensure they pass in (or handle) valid object ID values.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-09-16 10:32:19 +02:00
Carles Cufi
6de4747979 Bluetooth: Update terms in public API to spec v5.3
The Bluetooth Core Specification, version 5.3, has introduced multiple
changes to several widely-used terms in order to make them inclusive.
Update the public API to reflect this, excluding hci.h, which will be
done in a subsequent commit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-15 14:02:50 +03:00
Trond Einar Snekvik
035d877967 Bluetooth: Mesh: Inclusive terminology
Implements the Bluetooth appropriate language mapping for the Bluetooth
mesh subsystem.

Changes the following terms:

- Master security credentials -> Flooding security credentials
- Whitelist filter -> Accept filter
- Blacklist filter -> Reject filter
- Removes CDB's NODE_BLACKLISTED, which was not in use.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-09-14 19:30:18 +02:00
Yong Cong Sin
54490e8fe3 subsys/mgmt/hawkbit: Check retval of mbedtls_md_update
Check the return value of mbedtls_md_update and break on error.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
5cee596c9b subsys/mgmt/hawkbit: Cleanup connection if error after http_request
All errors that occured after http_request should clean up the
connection.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
22b5a03321 subsys/mgmt/hawkbit: Break and return if error
There's no need to continue if there's an error, so just break and
return.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
dfb55e5353 subsys/mgmt/hawkbit: Warning if image is unconfirmed
Add a warning if the image is unconfirmed. Add a delay before rebooting
so that the user knows what happened.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
8363e805c0 subsys/mgmt/hawkbit: Handle multipacket response properly
The current HAWKBIT_PROBE & HAWKBIT_PROBE_DEPLOYMENT_BASE response
handlers aren't able to handle multipacket response from Hawkbit
server. This commit fixes it by using the implementation from
HAWKBIT_DOWNLOAD.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Signed-off-by: Joep Buruma <burumaj50@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
793c0340d4 subsys/mgmt/hawkbit: Implement DDI API authentication
Implement Hawkbit DDI API authentication for the client.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
8ffb5e2ff2 subsys/mgmt/hawkbit: Use log_strdup for string pointers
Use log_strdup for string pointers.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Yong Cong Sin
6e8b1d7c29 subsys/mgmt/hawkbit: Clean up log and print error codes
Clean up log messages and print error codes wherever possible.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-14 12:28:40 -04:00
Jani Hirsimäki
9de47d2b0b net: ip: packet_socket: fixing raw sckt IPPROTO_RAW usage
net_packet_socket_input() was changed to hardcode the return of
NET_CONTINUE and that caused a segmentation fault/crash in
net_core/process_data(), in cases when pkt was unreferred and
NET_OK was returned from net_conn_input()
This happened with socket combo of: AF_PACKET+SOCK_RAW+IPPROTO_RAW.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-09-14 08:37:36 -04:00
Kamil Gawor
50ff77fa91 bluetooth: Split configuration into separated Kconfigs
Extracted new Kconfig file for the Extended Advertising
and for the Bluetooth Isochronous Channel from the
Bluetooth subsystem Kconfig.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-14 09:57:03 +02:00
Kamil Gawor
3f09f94bd2 bluetooth: Add missing choice names in Kconfig
This commit adds missing choice names in Bluetooth
subsystem Kconfig files.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-14 09:57:03 +02:00
Kamil Gawor
c95ee1744f bluetooth: services: Use log template for BAS
The BAS serivce Kconfig uses now a log template instead of
defining logger configuration itself.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-14 09:57:03 +02:00
Stancu Florin
3eb203fd45 net: ipv6: fix NBR lock initialization
The nbr_lock var actually depends on CONFIG_NET_IPV6_NBR_CACHE
(not CONFIG_NET_IPV6_ND), so move its initialization call.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2021-09-14 09:56:37 +02:00
Andrzej Kaczmarek
defda27969 Bluetooth: Controller: Properly terminate per adv HCI on failed rx
If one of AUX_CHAIN_IND is not received properly we need to send an
extra report over HCI to indicate that data are incomplete.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-09-13 21:41:04 -04:00
Michał Narajowski
88b60f31c7 Bluetooth: Mesh: Verify if Remote confirmation is not identical
MESH/PVNR/PROV/BI-18-C verifies that the IUT rejects invalid
Confirmation Value.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-09-13 11:56:52 -04:00
Aleksander Wasaznik
fbe7699c82 Bluetooth: Host: Doc fixup for rename of BT_SECURITY_L*
BT_SECURITY_LOW and etc. were previously renamed and are no longer
valid.

The original rename is in the following commits:
1c48757d94 (New names, deprecate old)
5f2a9ba8e4 (Remove deprecated names)

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemiconductor.no>
2021-09-13 11:56:21 -04:00
Bartosz Bilas
0a9e930fdc logging: log_core: add extra space in missed strdup err msg
It improves readability in an error message:

before: <err> log: argument 0 in source storage log message "val %s"
missinglog_strdup().

after: <err> log: argument 0 in source storage log message "val %s"
missing log_strdup().

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-09-13 05:54:13 -04:00
Flavio Ceolin
8beb34237b pm: Allow override constraints implementation
Implement constraint API as weak symbols so applications or platform
can override them. Constraints are a high-level abstraction to inhibit
the power subsystem of using certain power states. Some platforms can
have their own way to set/release constraints in their drivers that
are not part of Zephyr's code base.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-09-13 05:50:54 -04:00
Robert Lubos
083f3065b4 net: lwm2m: Remove LWM2M_RES_TYPE_U64 type
Since it's not possible to encode full range of 64-bit unsigned integer,
remove this type from the LwM2M implementation, and replace its uses
with 64-bit signed integer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-10 11:04:41 +02:00
Robert Lubos
b474e0a8c3 net: lwm2m: Fix unsigned integers ecoding in TLV
As the resource values represented by the unsigned integers were casted
to integers of a corresponding size in the read handler, they were not
ecoded properly if the unsigned value was larger than the maximum
integer value of the corresponding size (i.e. they were encoded as
negative values).

Fix this by casting the unsinged value to a wider integer type, to
prevent incorrect interpratetion of the data provided. The TLV encoding
functions take care of the optimization (i. e. encoding integers on the
minimum number of bytes needed), so it should prevent bandwith waste if
the unsigned value would actually fit into the integer of the
corresponding size.

Similar case is for the write hander, where unsigned integers encoded at
8 bytes were not processed correctly. Fix this by using wider decoder as
well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-10 11:04:41 +02:00
Robert Lubos
9886d18c5c net: shell: Fix assertion in net nbr command
Listing a neighbour table with "net nbr" command, when a  neighbour w/o
assigned link address was present, resulted in an assert condition. Add
additional check to prevent this.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-09 21:44:16 -04:00
Nicolas Marty
2f28059b1e net: tcp: accept [FIN, PSH, ACK] in TCP_FIN_WAIT_2 state
TCP state machine gets stuck in TCP_FIN_WAIT_2 state
when server responds with [ FIN, PSH, ACK ]

Fixes #37842

Signed-off-by: Nicolas Marty <nicolas.marty@zuehlke.com>
2021-09-09 21:18:25 -04:00
Benedikt Schmidt
a8b7caa58d net: http: switch to zsock_ for http_client
Using zsock_ in http_client instead of the POSIX API versions of the
functions allows the usage of http_client in combination with
CONFIG_POSIX_API.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2021-09-09 21:16:28 -04:00
Daniel Leung
1672f6cea1 debug: thread_info: stack pointer is not supported for xtensa
Xtensa does not store the stack pointers in thread objects but
pushing the registers into the stack. There is no fixed location
to retrieve the stack pointer so mark it as unimplemented to
avoid the #warning.

Fixes #38405

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-09-09 19:06:38 -04:00
Rubin Gerritsen
f79fbeabd5 Bluetooth: Host: Allow setting more than 251 bytes of adv data
When the application sets more than 251 bytes of advertising data,
the data is sent over multiple HCI commands.
This is only allowed if the advertiser is not running
as defined by the HCI specification.

The data is sent to the controller one AD-field at the time.
If an AD-field is larger than BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN,
the data is split over two commands.
This introduces some additional complexity.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2021-09-09 14:22:53 -04:00
Chen Peng1
0f63d1135c cmsis_rtos_v1: fix thread instances management.
add a bitarray into struct osThreadDef_t to indicate whether the
thread is used or not, then we can get the first available thread
by searching this array when creating a new thread, and update this
array to add a free thread when terminating a thread.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2021-09-09 12:01:06 -04:00
Anas Nashif
4ffb90f202 doc: pm: rework main documentation
Minor edits and remove old terminology of central and distributed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-09-09 08:06:36 -04:00
Krzysztof Kopyściński
fa2f83bf8b Bluetooth: host: add testing API (disconnect one EATT channel)
To test fallback to remaining bearers PTS might request IUT to
disconnect one of the connected EATT channels, while the others remain
intact. Test function must be added, because we cannot create L2CAP
server on EATT PSM and manage this server as normal and have EATT
enabled at same time.

This is affecting GATT/SR/GAW/BV-14-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-09 10:30:31 +02:00
Lixin Guo
d39410a217 tests: subsys: fixed the samples/tracing code can not generate coverage
Add some tracing functions to fix that the samples/tracing code
cannot generate coverage by twister.

Fixed #38323

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-09-08 10:28:10 -04:00
Michał Narajowski
343c0bd2d3 Bluetooth: Mesh: Check if app key is bound in Model Publication Set
Th Configuration Server should respond with and Invalid AppKey Index
status code when the AppKey identified by AppKeyIndex is not known to
the node or is not bound to the model identified by the ModelIdentifier.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-09-07 11:32:16 -04:00
Emil Gydesen
5b602eab90 Bluetooth: ISO: Add missing negation for valid_chan_io_qos
A check for valid_chan_io_qos in big_init_bis was missing
a negation when checking for invalid parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-07 16:31:32 +02:00
Kamil Gawor
dc96f016a4 logging: Add choice name in template
This commit adds choice name in a logging subsystem
Kconfig template file.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-06 14:11:06 -04:00
Vinayak Kariappa Chettimada
99bdd27100 Bluetooth: Controller: Fix multiple advertising set assert
Fix assert at line 1085 in ull_adv_aux.c due to auxiliary
offset calculation scheduling on ticker timeout under must
expire which can happen for overlapping multiple advertising
sets without previous calculation not complete, a single
mayfly instance is used hence the assertion.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-06 17:25:37 +02:00
Dominik Ermel
adcf32b45c mgmt/mcumgr: Add Kconfig option for direct image upload
The commit adds CONFIG_IMG_MGMT_DIRECT_IMAGE_UPLOAD that allows
to turn on the direct image upload.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-09-06 09:22:28 -04:00
Lingao Meng
ecc7ca1b69 Bluetooth: Mesh: Fix friend buf send end not called.
As frnd->last will keep reference, so that net buffer
destructor function will not be call.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-06 08:42:05 -04:00
Piotr Pryga
aecdf4c242 Bluetooth: controller: df: fix error in remove CTE from per adv
cte_info_clear function is responsible for remove of CTE from
periodic advertising PDUs, including remove from optional chained
PDUs. The function uses subortinate function rem_cte_info_from_per_-
adv_chain to remove CTE from chained PDUs.

The rem_cte_info_from_per_adv_chain had pdu_prev and pdu as arguments.
After return from the function the pdu_prev should point to last
PDU from previously used periodic advertising data and pdu should
point to last new periodic advertising data.

The rem_cte_info_from_per_adv_chain function removes CTEInfo from
all but last one PDU. Last PDU must have removed AuxPtr field also.
Remove of CTEInfo and AuxPtr from last PDU is done explicitly in
the cte_info_clear function.

Unfortunately rem_cte_info_from_per_adv_chain had wrong type of
parameters for pdu_prev and pdu. These parameters were pointers
instead od double pointers.
That caused cte_info_clear function to remove CTEInfo and AuxPtr
from first PDU in a chain, which is AUX_SYNC_IND.

Changed parameters pdu_prev and pdu in the rem_cte_info_from_per_adv_-
chain to be double pointers.

Added small corrections in comments.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Co-authored-by: Emil Gydesen <Thalley@users.noreply.github.com>
2021-09-04 10:54:36 -04:00
Maksim Masalski
164029b0c5 testsuite: suppress usage of setjmp in a testcode (rule 21_4-a)
According to the rule MISRAC-2012 21.4.a the standard header
file <setjmp.h> shall not be used. Suppress it, because it raises
violation in a testcode, not in a runtime code.
Tag suppresses reporting of violation for the current file,
starting from the line where the suppression is located.
It is a deliberate deviation.

Found as a coding guideline violation (MISRA R21.4.a) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-09-03 10:14:57 -04:00
Lingao Meng
790ec89048 Bluetooth: Mesh: Fix missing destructor function
Zephyr Bluetooth Mesh move adv send cb to buf destructor
callback, There are two net_buf_pool define, one to adv.c
and ore to friend.c, we are missing destructor in friend.c.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-03 06:32:08 -04:00
Emil Gydesen
0ffb084bfb Bluetooth: iso: Fixes ISO paramter checking issues
Two checks reported wrong value if the value was invalid.
CIS parameter check would always fail on correct values
due to missing negation of valid_chan_qos.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-03 06:31:45 -04:00
Kamil Kasperczyk
e9f238889b shell: uart: Add waiting on DTR signal before sending data
Problem:
In some cases, as described in: https://github.com/zephyrproject-rtos/zephyr/issues/36948
shell backend sends characters to output before serial device
is ready for it. It results in observing additional characters
inserted on the shell input after device boot.

Solution:
Added waiting on DTR signal before sending anything to the output.

Fixes: #36948

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2021-09-02 19:39:16 -04:00
Michał Narajowski
f51cf9ab86 Bluetooth: mesh: Fail provisioning when RFU values are used
When Public Key field is set to RFU value then we should send
Provisioning Fail with Invalid Format error.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-09-02 19:38:52 -04:00
Vinayak Kariappa Chettimada
b51021af3c Bluetooth: Host: Fix MPU fault due to incorrect EV_COUNT
Fix MPU fault due to incorrect EV_COUNT, `conn_change`
signal was not accounted for in the array used by k_poll.

Relates to commit 7854088116 ("Bluetooth: ISO: Fixes
missing handling of broadcast ISO TX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-02 19:38:16 -04:00
Emil Gydesen
12a26649f5 Bluetooth: ISO: Wait for ISO disconnect event
Instead of disconnecting ISO channels on ACL,
we put them in a non-connected state, and wait for
the ISO disconnect events.

This ensure that the controller has free'd the
ISO channels when the iso disconnect callbacks
are received. It will thus be possible to e.g.
terminate the CIG on the ISO disconnect callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00
Emil Gydesen
5d14cddaa8 Bluetooth: ISO: Fixes ISO central disconnect and cleanup issues
When an ISO channel is disconnect on the central, it is
not deallocated, but merely disconnected. This is because,
as per the HCI spec, the CIS handle lives on in the CIG.

Instead of unref'ing the bt_conn to 0, we simply put the
channel and connection in the disconnected state.

This also fixes a few missing returns for
terminating a CIG.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-02 19:37:28 -04:00