Extend storage_dev type beyond 'struct device' by changing
the variable type to void pointer. This will be needed if we
have additional transactional layers b/w filesystem and the
actual backend device.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Enable settings and increase the system workqueue size to deal with
the stack usage. This also makes it possible to test unpairing support
with the shell's 'clear' command.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There's a bit of unnecessary space in the bt_keys struct. Re-design
some fields for a more compact format, which is particularly helpful
now that the struct gets stored as-is to flash through the settings
API.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Integrate the bt_keys submodule with bt_settings. Add a new
bt_keys_store() API to write keys to flash, and extend the existing
bt_keys_clear() to remove the keys from flash.
Along with this, add some helpers for genrating settings key values
containing a bluetooth address, as well as for decoding them to get
the binary bt_addr_le_t.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a new linker section for a list of submodule settings handlers,
and iterate the list from the various settings callbacks.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The same functionality is now supported by the settings-based
solution, so remove bt_storage out of the way. There were stubs in
bt_storage to handle per-peer information (e.g. pairing keys) but this
was never actually implemented in full. The next step is to add this
support to the settings-based solution.
Leave the code for generating temporary IRK and identity address in
case BT_SETTINGS is not enabled. Also leave the code for using vendor
HCI to read the identity address, in which case the settings
implementation will not touch it.
Introduce a new bt_unpair() API to replace the removed
bt_storage_clear(), since the latter was actually doing more than just
storage management: it was also handling runtime storage of pairing
information. Later, the bt_unpair() implementation will be extended to
clear settings-based pairing storage.
There is one feature that the bt shell module looses: the ability to
give a specific identity address to the "init" command as a parameter.
We might look later in the future if this is really needed, and add a
separate API for this.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Introduce a basic skeleton for peristent storage based on the settings
subsystem. Also enable support for this to the peripheral sample
application, so the new code gets exersized by CI. For now, the
implementation provides the same level support as the bt_storage API
ever did, i.e. for the identity address and the IRK.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is bug-fix for issue #7311
FCB: CRC write size in append_finish doesn't honor
flash min write size
This patch changes write size to the minimum supported
write size.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
FS_FLASH_MAP_STORAGE keyword enables the storage partition,
but it was depend on flash_map module which is unused by
NFFS. This patch makes it independent thanks
to it is possible to enable the storage partition
without flash_map module.
FS_FLASH_MAP_STORAGE was renamed to
CONFIG_FS_FLASH_STORAGE_PARTITION
as it is independent for flash_map.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
The IEEE 802.1Q chapter I.3 contains a proper network packet
priority to traffic class mapping. The original mapping was
clearly incorrect.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In the future, when bootstrap support is added, this config won't
be used. Let's remove it.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Now that the LWM2M_OP_* bits have been renumbered, we no longer need
a custom BIT() macro for the LwM2M code. Let's remove it and use
BIT() instead.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Remove unused OP flag LWM2M_OP_NONE and renumber the existing flags
so that the operations used in object permissions land in the lowest
bits, and extended operations come later.
We may eventually add more permission / data flags, so let's try and
keep them inside a 1 byte boundary (flags with bits 0 to 7).
NOTE: LWM2M_OP_DELETE is currently not checked as a permission but
it may be in the future so it is in the lower bits.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
When a data pointer or data length is not set, the read and write
handlers should return ENOENT to generate the correct LwM2M error
code (COAP_RESPONSE_CODE_NOT_FOUND).
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Before ever call of string_to_path(), the lwm2m_obj_path object
was being cleared via memset. Let's move the memset into
string_to_path() to remove the duplicate code.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Eliminate several similar code-blocks by replacing
engine_get_resource() with a more useful function called:
path_to_objs()
By supplying an lwm2m_obj_path object, it will find and set
the related values for:
struct lwm2m_engine_obj_inst
struct lwm2m_engine_obj_field
struct lwm2m_engine_res_inst
NOTE: NULLs can be supplied where the returned value is not
important.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Add functions that will return correct source IPv4 address
according to given destination address. This is done similar
way as for IPv6.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The code was updating net_rx->seq to make sure sdu_recv() gets the
right sequence number (seq_auth for segmented messages), however later
net_rx->seq was also used for enqueuing to the Friend Queue, causing
the queued messages to have the wrong value.
To fix this, don't update net_rx->seq, rather pass an explicit
sequence number value to sdu_recv(), which is just net_rx->seq for
unsegmented messages, and seq_auth for segmented messages.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The 'valid' member of struct bt_gatt_ccc_cfg was redundant, since
setting 'peer' to BT_ADDR_LE_ANY does the same job. What's worse, the
handling of 'valid' was also buggy in that some places looking for
valid CCC structs only matched the address, meaning it might yield a
positive match for invalid entries.
Fix these issues by removing the 'valid' struct member, and solely
using the 'peer' member to identify valid entries. Also simplify the
code by acknowledging that no CCC entry is essentially the same as the
value '0' written to CCC.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
With fragmentation disabled echo server responds to packet fragment with
ICMPv6 message Type: "Parameter Problem (4)", Code: "unrecognized Next
Header type encountered (1)". If a fragment with payload length 15 is
received in response sent by echo server IPv6 payload length and ICMPv6
checksum are wrong. This patch solves the issue by correcting payload
length.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
The bt_mesh_provision() call results in the provisioning link state
being cleared, so link.conn will become NULL. Add code to store the
information of whether PB-GATT was used and use this information after
the call instead of relying on link.conn anymore at this point.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This patch moves USB DFU class driver to subsys/usb/class.
For the first the USB DFU class driver depends on DFU image
manager and partition layout and is limited to use as an
application for the bootloader. The driver fetches the
information about the flash, erase block size, write block
size and partitions offset from the DT now. The driver has
two interfaces associated with the two partitions "SLOT-0"
and "SLOT-1". The "SLOT-0" can only be read.
In the following work the class driver can be extended so
that it can be used from the bootloader and update a flash
region directly from the bootloader.
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Enabling C++ support for the application has been inappropriately
located at the root of the Kconfig menu. The root should be kept as
clean possible to allow easy navigation.
This commit moves CONFIG_CPLUSPLUS into
~/"Build and Linker Features"/"Compiler Options".
This is a purely cosmetic change and does not change the
'visibility' (depends) of the Kconfig option.
Arguably, it would fit better into
~/"Build and Linker Features"/"Language Options"
but this entry does not exist.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
The code was accessing network pkt before the value of the pkt
was checked.
Coverity-CID: 185394
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If CONFIG_FLASH_PAGE_LAYOUT is not enabled, building the settings code
fails at the linking stage with the following error when FCB is the
backend.
libzephyr.a(settings_init.c.obj): In function `settings_init_fcb':
subsys/settings/src/settings_init.c:62: undefined reference to `flash_area_get_sectors'
collect2: error: ld returned 1 exit status
Also, the File System backend will currently only work with NFFS due
to fs_rename() missing from other File Systems (FAT in particular).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fix regression with RNDIS due to different USB configuration method.
RNDIS drivers in Windows never call Set Interface and netusb is always
disabled. Change to enable netusb upon USB Set Configuration.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The NFFS partition at the end of flash is also useful for any other
file system or even the Flash Circular Buffer (FCB). Rename the
partition from 'nffs_partition' to 'storage_partition' and make it
depend on a new hidden Kconfig entry which the relevant users will
select (such as NFFS and FCB).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The condition 'iv_index != bt_mesh.iv_index + 1' is already caught by
the earlier conditions in this branch.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If the network is in IV Update In Progress state when we get
provisioned we should set a timer so we eventually transition back to
Normal mode (otherwise we may end up in IVU In Progress indefinitely).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When we get provisioned we can't know how long the network has been in
the current IV Update state. Introduce a special value for
bt_mesh.last_update to indicate that we don't know the duration.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit fixes crash caused by double free from message sequence
fragmentation. When double free happens the call stack is:
0 reassembly_cancel
1 handle_fragment_hdr
2 net_ipv6_process_pkt
3 process_data
4 processing_data
5 net_rx
6 process_rx_packet
7 work_q_main
8 _thread_entry
So at first packet is unrefed in reassembly_cancel and then also in
processing_data.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
After successful send, the packet is automatically cleared, so
trying to call print_send_info() on it leads to errors:
[net/pkt] [ERR] net_pkt_tcp_data: NULL fragment data!
[net/tcp] [ERR] net_tcp_get_hdr: NULL TCP header!
(if error logging enabled).
This change is similar to how print_send_info() is called in
existing send_reset() function of this source file.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
In f. settings_init_fcb the storage area was implemented badly:
- storage was always erased
- the only source of settings fcb instance was pointed twice.
This patch fix both issues.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
API settings_subsys_init call was changed so that it returns
error (so returns int instead of void).
Prototype of storage helper function export_func for
settings_handler::h_export was changed so that it returns error
(so returns int instead of void).
Fixed few other error handling issues by ignoring return
values.
Tests were aligned to above patches.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Add a reboot command for requesting a warm or cold system reboot
through the kernel shell.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Some buggy system may be pass a larger wLength when it try read
HID report descriptor, although we had already tell it the right
descriptor size.
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
Implement Bluetooth over USB functionality through Bluetooth raw
access to the Bluetooth controller. Most devices with Bluetooth and
USB controllers supported by Zephyr can export themselves as USB
Bluetooth dongles.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The implementation for the tell() primitive was attempting to unlock
the NFFS mutex after returning an error code.
Coverity-Id: 185283
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>