Commit graph

7273 commits

Author SHA1 Message Date
Markus Becker f08045f077 settings: Fix uninitialised variables
When compiling the settings subsystems, I was getting the following
compiler warning:

```
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c: In function 'settings_line_cmp':
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c:477:6: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
  477 |  int rc;
      |      ^~
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c: In function 'settings_line_entry_copy':
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c:453:9: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
  453 |  return rc;
```

This patch fixes the warning.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-17 08:55:59 +03:00
Adam Porter f09b8681f6 net: sockets: remove POSIX_NAMES dependency on SOCKETS_OFFLOAD
This is no longer required since drivers implementing the sockets
offload interface were migrated to use pure zsock_ instead of
raw POSIX types and functions.

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-17 08:55:17 +03:00
Léonard Bise 14ced754f5 net: tcp: Do not send FIN when closing listening sockets
A net context in LISTENING mode waits for incoming connections, once
a new connection is established a new net context is spawned which
is responsible for handling the new connection.
Therefore when closing a LISTENING context it is not useful to send FIN
as it is never connected. Actually closing the connection would be done
by calling close on the spawned net context which is returned by the
accept call.

Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
2020-06-16 23:47:40 +03:00
Lukasz Maciejonczyk b0de2ee15b net: IPv6: Fix source address for mesh multicast destination
Currently there is chosen the link local address as a source address
for each multicast destination address. It is a bug for OpenThread
network where the mesh-local EID addres should be picked in this case.
This commit fixes it by distinquish the mesh local multicast among any
others.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-16 19:14:52 +02:00
Markus Becker dc4ce4edbe net: config: fix timeout 0 blocking start-up
With timeout==0 count is set to 0 as well and then it is decremented to
-1. It is later checked == 0 and continues to decrement and loop.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-16 19:10:25 +02:00
Joakim Andersson f756b79124 Bluetooth: controller: Use NRF RNG entropy device
Use the NRF RNG entropy device as the entropy device for bt_rand and
controller internal functions when LLL is Nordic.
Using an entropy source with a significant increase in stack usage
will invalidate all stack size configurations in the system and lead
to stack overflow issues.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-16 19:09:55 +02:00
Krzysztof Chruscinski 29cab30d46 logging: Clarify that hexdump messages have no function prefix
It was not clear that hexdump messages does not support prepending
with function name. Added clarification.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-16 19:05:51 +02:00
Vinayak Kariappa Chettimada 69ef82f22f Bluetooth: controller: Fix missing RADIO_TXP_DEFAULT define
Fix compile error due to missing include file that defined
RADIO_TXP_DEFAULT.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-16 17:48:59 +02:00
Vinayak Kariappa Chettimada a20ecb6722 Bluetooth: controller: Fix compilation regression
Fix compilation regression due to addition of const
qualifier to tx_pwr_lvl parameter of ll_tx_pwr_lvl_set
function. Support for BT_CTLR_TX_PWR_DYNAMIC_CONTROL
needs the tx_pwr_lvl to be updated and returned.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-16 17:48:59 +02:00
Christian Taedcke 8ac2f96ca6 net: sockets: fix conn_handler check in zsock_getsockname_ctx
The check was inverted, so a bound socket was detected as not bound.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-16 14:57:16 +03:00
Léonard Bise 8e4faab30a net: sockets: Return EINVAL when an accept call is unblocked
Under Linux when you shutdown a socket which is blocked on
an accept call the error code returned by accept is EINVAL.
Modify the socket code to be inline with this behaviour.

Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
2020-06-15 22:15:07 +03:00
Léonard Bise 5cedb73555 net: sockets: tls: Check accepted context is not NULL
When closing a listening socket the functions waiting on the
FIFO will be unblocked this will result in receiving a NULL child
context. If that is the case return an error instead of carrying on.
Return the same error code (EINVAL) that is returned on Linux when
calling shutdown on a blocked accept call.

Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
2020-06-15 22:15:07 +03:00
Robert Lubos 5bb35892dd net: coap: Parse zero-length option correctly
In case CoAP packet does not carry payload, and the last option is
zero-length, the option structure was not filled with data (opt number
and length). Fix the length check to prevent this from happening.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-15 22:13:34 +03:00
Robert Lubos 0cf55c4174 net: lwm2m: Fix "Server Store Notify" resource type in Server object
This should be boolean according to specification. It makes difference
when JSON encoding is used.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-15 22:13:34 +03:00
Robert Lubos 4c868c9abf net: lwm2m: Fix ExtDevInfo field in Device object
The field used incorrect type (s32 instead of ObjLnk) and was not
initialized properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-15 22:13:34 +03:00
Robert Lubos bd7d6926c4 net: lwm2m: Add ObjLnk resource type support
Implement LWM2M ObjLnk resource type and plaintext, TLV and JSON
readers/writers.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-15 22:13:34 +03:00
NavinSankar Velliangiri 820bfb46bc net: http: client: Add port number to HTTP Header
Add port number to HTTP Header.

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2020-06-15 16:59:20 +02:00
Maureen Helm aadcec16d9 usb: Set thread names in usb device classes
Sets thread names for all usb device class threads (bluetooth, bt_h4,
mass storage, and rndis) to aid debug.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-15 16:55:01 +02:00
Francois Ramu bd17ff7a51 soc: arm: st_stm32 add low power to stm32l4 series
This patch introduces the support of low power modes
for the STM32L4xx from STMicroelectronics based on the lptim
Here, the power modes are sleep modes with lptimer as wakeup.
Depending on the SYS_POWER_MANAGEMENT configuration.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-06-15 16:54:04 +02:00
Jukka Rissanen f7d584a0ce net: ethernet: Check that device has PTP clock before access
Avoid null pointer access by checking that Ethernet device has
PTP clock before trying to get the actual PTP clock device.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-15 16:40:36 +03:00
Marcin Niestroj e548c6c5b2 net: config: rely on type rather than number of services configured
So far net config initialization code relied on number of services
needed by application. This was fine as long as all enabled
services (e.g. CONFIG_NET_IPV4=y, CONFIG_NET_IPV6=y) were selected by
project configuration as "needed" (e.g. CONFIG_NET_CONFIG_NEED_IPV4=y,
CONFIG_NET_CONFIG_NEED_IPV6=y). Problem appeared for example when both
IPv4 and IPv6 were enabled (CONFIG_NET_IPV4=y, CONFIG_NET_IPV6=y), but
only IPv6 was marked as "needed" (CONFIG_NET_CONFIG_NEED_IPV6=y). In
such situation number of required services was equal to 1. When IPv4
setup was completed, this resulted in returning from net_config_init()
function. Application code failed, because IPv6 was still not
functional.

Do not rely on number of services anymore, as it is error prone. Use
flags instead to mark which services are ready. Compare those flags with
the flags passed to net_config_init() (selected in project configuration
in most cases) to decide whether network configuration has completed
already or not.

Also introduce services_notify_ready() and services_are_ready() helper
functions to isolate implementation details from the logic.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Marcin Niestroj d241c19b0f net: config: fix checking for protocols being ready
With current design there is single semaphore (called 'waiter') for
wakeing up initialization thread. This thread should then check for
number of protocols that still need to be initialized. This happens now
only when waiting on 'waiter' semaphore times out.

Do not check for k_sem_take(&waiter) return value, as all needed
information about protocols being initialized already is in 'counter'
semaphore.

Fixes: #25358

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Tobias Svehagen 8b3a606009 net: shell: Add support for 'net tcp recv' command
Add command to register a receive callback to the net_context used for
the TCP connection that is opened with 'net tcp connect'. The receive
callback will simply print the number of bytes received and inform if
the connection is closed. This makes it possible to test both the tx
and rx paths with the net shell.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-06-13 16:36:08 -04:00
Léonard Bise 7b869f0392 net: dns: Ignore queries when resolving a name
It might happen that while we are waiting for the response
to one of our query, we receive a query to resolve another name.
Previously this would make the current name resolution to fail because
only responses were expected to be received.

Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
2020-06-13 22:14:42 +03:00
Andrzej Puzdrowski ac07694309 storag/stream: fix stream_flash_bytes_written() return value
stream_flash_bytes_written() returned number o bytes physically
written to the flash. This number might be bigger than the requested
number as is aligned to the device write-block-size.

stream_flash_bytes_written() should return number of bytes
written requested by the user.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-06-13 11:57:35 +02:00
Carles Cufi 8617e93b84 Bluetooth: controller: Work around compiler silliness
For some reason GCC 9.x doesn't seem to be able to realize that set_num
will always be > 0 and so the local variable status will always be
initialized. Use a do {} while instead to keep it happy.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-12 22:58:05 +02:00
Vinayak Kariappa Chettimada d048570ec5 Bluetooth: controller: Re-arrange Kconfig options
Re-arrange and have conditional prompt for BT_CTLR_ADV_EXT.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 3d78a16d81 Bluetooth: controller: split: Fix initialization of new aux header
Fix missing implementation of initialization of common
advertising header bit fields when new auxiliary channel PDU
is instantiated. This caused corrupt invalid Bluetooth
Device address being copied from uninitialised previous
auxiliary PDU instead of copying from primary channel PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 205fe1825e Bluetooth: controller: split: Refactor auto variable names
Review rework updates, refactor auto variable names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 130d63a1c2 Bluetooth: controller: split: Review rework use defines
Review rework updates, use defines in place of magic values.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5d13bf4e98 Bluetooth: controller: split: Fix endianness in filling DID
Handle endianness when filling the DID value in advertising
PDU extended header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 06cba0d4e3 Bluetooth: controller: split: Move aux_offset_fill into ULL files
Move the aux pointer fill function to ULL files, so as it is
re-usable by all vendors.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 15d3711a75 Bluetooth: controller: split: Remove +1 magic ticks and microseconds
Remove use of magic numbers to adjust ticks offset, replace with
vendor defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 2037ebd58a Bluetooth: controller: Set Extended Advertising feature bit
Update supported features bitmap with Extended Advertising
bit.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e20455b9cc Bluetooth: controller: split: Fix ext create conn when coded PHY unsupp
Fix implementation from performing a redundant loop checking
for coded PHY create connection parameters in HCI command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 28f4c1b703 Bluetooth: controller: split: Rework with defines for adv set states
Review rework, added comments, TODOs, FIXMEs and converted
magic number use in advertising set state flags to defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 322561c6bb Bluetooth: controller: split: Disable all adv sets unsupported
Added comments and code to make note that disabling all
advertising sets is not yet implemented.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 95d3d5be2a Bluetooth: controller: Refactor pdu.h defines
Refactor pdu.h defined in anticipation of reused in
Advertising Extensions implementation. To reuse in
calculating ticks_slots etc.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a682fe63eb Bluetooth: controller: added Kconfig for max adv data length
Added a Kconfig for maximum advertising data length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada dc55e08ce6 Bluetooth: controller: split: Fix crash due to incorrect no. of tickers
Fix segmentation fault detected by BabbleSim test due to
incorrect number of tickers being allocated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 688ddc4db6 Bluetooth: controller: split: Fix directed adv addr type returned
Fix HCI LE Directed Advertising Report event to return
correct directed advertiser's address type.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0d6476248a Bluetooth: controller: split: Fix auxiliary channel scan window width
Fix the calculation of auxiliary channel scan window width.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c2b7f15556 Bluetooth: controller: split: Avoid ticker null pointer dereferencing
Avoid ticker from null pointer dereferencing when storing
operation callback functions to be called during collision
resolution.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada af90f17758 Bluetooth: controller: split: Fix conditional compile of ticker ids
Fix conditional compile of ticker ids for auxiliary sets and
periodic sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 516bae9536 Bluetooth: controller: split: Fix scan set allocation
Fix scan set allocation using BT_CTLR_SCAN_SET instead of
an incorrect duplicate BT_CTLR_SCAN_MAX.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 18995306f1 Bluetooth: controller: split: Fix Ext Scanning when coded PHY unsupported
Fix implementation from starting coded PHY scan window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 1aa9ca244f Bluetooth: controller: split: Fix compile error in periodic adv code
Fix copy-paste compile error in the implementation of the
periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 8eebc2e926 Bluetooth: controller: Integrate extended adv report into HCI
Integrate the generated extended adv report PDU list into
HCI layer to generate the HCI LE Extended Advertising Report
event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0c058badf2 Bluetooth: controller: split: Change the extended scan PDU rx list
Change the implementation of extended scan PDU rx list to use
the extra pointer as the next field in the linked list node.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada fbf91da922 Bluetooth: controller: split: Extended scanning Rx list
Added implementation to enqueue received auxiliary PDUs in
the ULL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 97355e4799 Bluetooth: controller: split: Fix for missing Aux PDU
Fix missing Auxiliary PDU when primary PDU is calculating
the offset. Schedule the auxiliary PDU ticker before primary
PDU ticker is scheduled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 23ef75f6d9 Bluetooth: controller: split: Fix Low Latency Prepare Done
Fix the Low Latency Prepare Done that disables ULL_LOW
context executions inside a radio event, so that
ticker_job_idle_get is invoked from ULL_LOW instead of LLL
context so that its enqueued alongwith others scheduled
in ULL_LOW. This is avoid premature disable of ULL_LOW
context executions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e9bee3b070 Bluetooth: controller: split: Updated HCI BT_INFO of scanned PDU
Updated HCI BT_INFO of printing the parsed extended PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 45231fd071 Bluetooth: controller: split: Fix missing enh conn complete HCI event
When Privacy is not supported in the build and Advertising
Extensions is enabled, HCI LE Enhanced Connection Complete
event was missing. This is fixed now.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada fa91a80f28 Bluetooth: controller: split: Port openisa files
Port OpenISA LLL files to reflect some of the changes done
in Nordic LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e51167b787 Bluetooth: controller: split: Fix to stop preempt ticker
Fixed premature abort of events due to stale preempt ticker
expiry.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 4702d9cead Bluetooth: controller: split: Minor refactor return variable
Minor refactor return variable name and fix return value
type.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada ef97208eeb Bluetooth: controller: split: Fix DID increment
Fix missing DID increment when AD data changed to zero len.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada cc2cb6a347 Bluetooth: controller: split: Fix incorrect adv_addr type
Fix incorrect adv_addr type in auxiliary PDU when address
is removed from primary and added to auxiliary PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e099cfd6d7 Bluetooth: controller: split: Add correct aux scan ticks slot
Implemented the missing ticks_slot calculation for the
auxiliary channel PDU scanning window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada cb3024fe86 Bluetooth: controller: split: Fix slave HCTO calculation
Fix missing sleep clock accuracy related jitter in the
header complete timeout calculation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 746ffdc194 Bluetooth: controller: split: Add Extended Scanning window widening
Added implementation to calculate the window widening for
the reception of auxiliary PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e9c80f8534 Bluetooth: controller: split: Initial extended scanning code
Initial extended scanning code added.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6a86307ad4 Bluetooth: controller: split: Abort auxiliary LLL if aux_ptr missing
Abort Auxiliary LLL prepare if current primary PDU is
missing the aux_ptr.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 29f26bac24 Bluetooth: controller: split: Schedule auxiliary after primary PDU
Fix to avoid a crash due to missing aux_ptr in current
primary PDU constructed by LE Set Extended Advertising
Parameter Set, while aux_ptr was populated by LE Set
Extended Advertising Data Set in the latest double buffered
PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 9a82f38435 Bluetooth: controller: split: Fix extended event properties changes
Added implementation to handle updates to adv mode and event
properties of an already created advertising set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6c2bccfb09 Bluetooth: controller: split: Refactor PKT_US for Adv. Ext. use
Refactor the PKT_US for reuse with Extended Scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e0bd57901f Bluetooth: controller: split: Use uint8_t for advertising handles
Refactor to use uint8_t for advertising handles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada d6cc180168 Bluetooth: controller: Fix collision resolution for single-shot ticker
Fix collision resolution to consider single-shot ticker,
current single-shot with ticks_slot as older that a next
periodic or single-shot ticker with ticks_slot.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 35d9933597 Bluetooth: controller: Fix single-short ticker operation failure
Fix ticker to correctly generate the operation callback if
single-shot ticker fails to be scheduled and does not
expire.

As the collision resolution is deferred to the worker, if
a single-shot ticker is cancelled, then appropriately call
the operation callback with failure status. This is allow
the user to take necessary actions, like release resources
allocated that need to be release on the failure to schedule
the single-shot ticker expiry.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada ba9b065c13 Bluetooth: controller: split: Move PKT_US into pdu.h
Move the definition of PKT_US into pdu.h so that it can be used
by Advertising Extensions implementations too.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5d6c4a6cb5 Bluetooth: controller: split: Refactor node_rx_ftr
Remove us_radio_rdy field in the footer structure as its always
a constant value which can be obtained using a functional
interface to HAL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0681c80573 Bluetooth: controller: Fix to use advertiser random address
Fix legacy advertising started using Extended Advertising
sets to use the set advertising random address.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c89c94f940 Bluetooth: controller: split: Workaround succeed on zero len scan rsp set
Added a workaround to succeed setting a zero length Extended
Scan Response Data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 3527778c41 Bluetooth: controller: split: Fix extended scan param set
Fix missing reset of phy struct member for scan set that is
not being enabled by use of LE Extended Scan Parameter Set
command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 281fa4c4a9 Bluetooth: controller: split: Allow set rand addr when using ext cmds
Allow use of HCI LE Set Random Address cmd when advertising
is enabled using Extended Advertising commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada eb102d7822 Bluetooth: controller: split: Fix missing coded PHY scanning
Fix, use phy variable instead of type to determine if
scanning on Coded PHY is to be enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a40b1e9212 Bluetooth: controller: hci: Integrate LE Ext. Create Connection
Integrate the support for HCI LE Extended Create Connection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a74276e1bd Bluetooth: controller: split: Added LE Ext. Create Connection
Added implementation of LE Extended Create Connection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b87cae97bb Bluetooth: controller: split: Add generate of ext adv legacy report
Added implementation to generate LE Extended Advertising
Report for received legacy PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada d9523c5005 Bluetooth: controller: split: SCAN_RSP for ADV_IND or SCAN_IND
Added implementation to differentiate SCAN_RSP received for
ADV_IND or SCAN_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 60a117c6ca Bluetooth: controller: split: Add the missing enable of dup filtering
Add implementation to enable duplicate filtering for extended
scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 24e3fd521e Bluetooth: controller: split: Fix missing reset of scanner state
Fix missing reset of scanner state which could cause a
spurious SCAN_RSP packet without a prior SCAN_REQ being sent
to be reported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 608063b3ec Bluetooth: controller: hci: Indent BT_INFO of extended header
Indent when logging out the field value of common extended
advertising header format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 561354dde2 Bluetooth: controller: hci: Integrate Adv Extensions commands
Integrate Advertising Extensions related Extended Advertising
and Extended Scan HCI commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada e941e72092 Bluetooth: controller: split: Added Extended Scan Support
Updated implementation to support Extended Scan Parameters
and Extended Scan Enable.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 6b17eb2291 Bluetooth: controller: split: Added Adv Random Address set
Added implementation to set advertising random address.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b0dd599db1 Bluetooth: controller: split: Support legacy AD/SR data
Added implementation to support setting of legacy
Advertising Data and Scan Response Data using Extended
Advertising Data set functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada f84ebf4869 Bluetooth: controller: split: Differentiate extended ll_adv_params_set
Differentiate call to ll_adv_params_set, whether used by
legacy LE Set Advertising Parameters or LE Set Extended
Advertising Parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 179b213fce Bluetooth: controller: split: use CONFIG_BT_CTLR_ADV_SET
Use CONFIG_BT_CTLR_ADV_SET instead of derived BT_CTLR_ADV_SET.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 594e12139b Bluetooth: controller: split: Use uint8_t for scan handles
Use uint8_t for scan set handles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5db91100bc Bluetooth: controller: split: Enable Adv Extensions
Enable Advertising Extensions features in the controller
when enabled in the Host in combined host+controller based
applications.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c8b050ee77 Bluetooth: controller: split: cond compile Ext Adv without Aux chan
Conditional compile Extended Advertising without Auxiliary
channel PDU use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 46299e71cc Bluetooth: controller: split: Fix uninitialized variable use error
Fix for compiler complaining of uninitialized variable use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 55cebf0eaa Bluetooth: controller: split: handle latency for cancelled sync events
Update implementation of periodic advertiser's LLL to
correctly handle event counter values when latencies
introduced due to sync events cancelled by active events
operating in unreserved time space.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b3190cf24c Bluetooth: controller: split: handle latency for cancelled conn events
Update implementation of master and slave LLL's to correctly
handle event counter values when latencies introduced due to
connection events cancelled by active events operating in
unreserved time space.

When an active radio event extends into unreserved time
space, and a connection event prepare is scheduled but at
the time of pre-emption timeout if the connection event is
cancelled then the event count and latencies needs to be
continiued to get acummulated.

In the current controller usecases the above scenarios does
not get exercised, the changes in this commit is needed for
future roles that can extend into unreserved time space and
would cancel a scheduled connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b348b7fa28 Bluetooth: controller: split: Fix cond. complile of periodic adv
Fix conditional compilation of advertising extensions and
periodic advertising do that platforms with not support in
their LLL can be built without advertising extensions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada de3d4a3a64 Bluetooth: controller: split: Fix piggy back implementation
Fix conditional compilation of piggy back implementation.
This code should be deleted once periodic advertising
implementation is complete.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 4d79d43db1 Bluetooth: controller: split: Implement Aux Sets
Implement use of configurable Auxiliary advertising sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 59f2bb1337 Bluetooth: controller: split: Fix to use correct secondary PHY
Fix using correct secondary PHY for auxiliary PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 18e916b22e Bluetooth: controller: split: Handle SyncInfo in Aux Data set
Handle using existing SyncInfo when updating Aux PDU AD Data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a43c3be2b9 Bluetooth: controller: split: Added SyncInfo into Aux Packet
Added SyncInfo population in Aux packet.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada a126850c15 Bluetooth: controller: split: Use correct secondary PHY, AA and CRC
Implement use of correct secondary PHY for transmission,
access address and CRC setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 1773274118 Bluetooth: controller: split: Moved chan map helper functions
Moved Channel Map helper functions into separate file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5c512d6e9a Bluetooth: controller: Move access address helper to util.c
Move the access address helper function to util.c file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada bb720d68ce Bluetooth: controller: split: Refactor to reuse common ISR code
Refactor to reuse common repeated code in ISR that reset
status, and performed abort, done and cleanup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5949205315 Bluetooth: controller: split: Add periodic adv LLL implementation
Add LLL implementation to perform periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 3eac6c3a52 Bluetooth: controller: split: Add periodic adv ULL implementation
Add ULL implementation to perform periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5ebbac32d9 Bluetooth: controller: split: Fill bdaddr in aux packet
Fill the bdaddr on advertising enable in the aux packet.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0b99773037 Bluetooth: controller: Minor refactor of SyncInfo structure
Minor refactor of SyncInfo structure field names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada be3dd3687b Bluetooth: controller: split: non-conn non-scan with aux packets
Added implementation to advertise non-connectable
non-scannable advertising with auxiliary packets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 365774da7c Bluetooth: controller: Move Adv Ext interface to ll interface
Move Advertising Extensions interface to LL interface header
file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada fdd91bb116 Bluetooth: controller: split: Add AuxPtr to ADV_EXT_IND PDU
Add implementation to support ADV_EXT_IND PDU with AuxPtr.
Changes in this commit only prepares the ADV_EXT_IND PDU
in the primary channel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada eec42ca522 Bluetooth: controller: split: Added le_set_ext_adv_param interface
Added le_set_ext_adv_param functional interface to integrate
HCI with controller's functional interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 5f1301245c Bluetooth: shell: Updated advx command to use Adv Data Set
Updated the shell commands related to Advertising Extensions
to call the LE Set Extended Advertising Data command
functional interface for testing purposes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 505fdadef2 Bluetooth: controller: split: Add Adv. Ext. HCI debug informations
Added debug information print outs in HCI code related to
Advertising Extensions events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada c4b6fd0248 Bluetooth: controller: nRF5x: Introduce sw_switch_cleanup function
Refactor and introduce hal_radio_sw_switch_cleanup interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 12:22:29 +02:00
Flavio Ceolin 77bc3815af mgmt: fs: Add security warning
Add a warning in fs mgmt option about security risks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-12 11:15:24 +02:00
Vinayak Kariappa Chettimada 428799295d Bluetooth: controller: Add support for nRF5340 debug pins
Add support for Bluetooth Controller GPIO Debug Pins for
nRF5340 PDK board. GPIO Pin toggling can be captured on the
P3 pinhead of the PDK.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 11:13:39 +02:00
Lingao Meng 7239dc1cbd Bluetooth: Mesh: Add key-value concept to store model data
Previous mode store function only can store single data,
change this to store as KV model, let's app-layer to manager
model data, other than by stack when node reset.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-06-12 11:09:11 +02:00
Kumar Gala 59708769ea net: lwm2m: Remove deprecated functions
Remove deprecated functions that have been marked deprecated since
Zephyr 2.0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-11 15:50:48 +03:00
Robert Lubos 7f9b85e8c3 net: openthread: Fix u16_t usage
PR #25936 introduced u16_t type usage and was merged after the type
transition in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-10 19:24:20 -04:00
Xavier Chapron 57db336b98 dfu: flash_img: Constify flash_img_buffered_write() data parameter
The data passed has no reason to be changed and can therefore be passed
as read only.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-06-10 09:30:08 +02:00
Gerson Fernando Budke ebe5345e87 net: lwm2m: Refactor to use coap_get_option_int
Small clean-up to use coap_get_option_int.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Gerson Fernando Budke 1ca95e7bc4 net: coap: Rem macros that uses coap_get_option_int
Clean up and remove macros that uses coap_get_option_int.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Gerson Fernando Budke 76e32ba32b net: coap: Add coap_get_option_int public method
Any CoAP implementation when use at least block transfer or is a server
side need access some CoAP options as integer values. This add a method
at public interface and defines for block wise operations to avoid code
useless code duplication.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-06-09 21:25:11 +03:00
Emil Gydesen 299ef2e5fe cpp: Fixed compile warning with extern array declaration
The extern array declaration of size 0 gives a warning when
compiling with GCC. Updated to use [] rather than [0].

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-06-09 14:42:16 +02:00
Emil Gydesen adc5fab141 shell: Fixed compile warning with extern array declaration
The extern array declaration of size 0 gives a warning when
compiling with GCC. Updated to use [] rather than [0].

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-06-09 14:42:16 +02:00
Markus Becker 2291de6abf subsys/fs/littlefs: initialize LittleFS at POST_KERNEL
Initialize LittleFS at POST_KERNEL and not at APPLICATION stage.

When using LittleFS as settings backend for OpenThread, LittleFS needs
to be available when net_init is performed.

Arguably, FS is an OS kernel component that should be ready when
applications are starting.

Possibly, the same change should be applied to FAT fs as well.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-09 13:48:34 +02:00
Vinayak Kariappa Chettimada d96a1a5fef Bluetooth: controller: split: Fix endianness in ull_sched
Use sys_put_le16 and sys_get_le16 in populating PDU with
offset values.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada 6dce205b95 Bluetooth: controller: split: Port advanced scheduling
Port advanced scheduling implementation from legacy
controller.

This implementation schedules
- non-overlapping scan window when there are simulataneous
central connections active
- central connection establishment with similar connection
intervals be placed in a non-overlapping  group, temporally
- connection parameter request with calculated window offset
hints to have non-overlapping BLE radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada 0b6664fc3d Bluetooth: controller: split: Add function to reset conn upd mutex
Add a function to reset the variable holding the connection
context of the currently active Connection Parameter Request
Procedure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:58 +02:00
Vinayak Kariappa Chettimada da95c08977 USB: Bluetooth: Fix rx_thread_stack size
Increase rx_thread_stack size to follow BT_HCI_TX_STACK_SIZE
value defined by the Bluetooth subsystem.

Below, thread 0x20000d28, the hci_rx_thread earlier had 512
bytes which could be insufficient under edge cases like an
interrupt being asserted at the deepest stack usage.

Logging output as part of update to stack size:
<inf> thread_analyzer: Thread analyze:
<inf> thread_analyzer:  workqueue           : unused 648 usage 376 /
	1024 (36 %)
<inf> thread_analyzer:  thread_analyzer     : unused 264 usage 248 /
	512 (48 %)
<inf> thread_analyzer:  0x20000e30          : unused 280 usage 232 /
	512 (45 %)
<inf> thread_analyzer:  0x20000d28          : unused 584 usage 440 /
	1024 (42 %)
<inf> thread_analyzer:  BT RX               : unused 320 usage 192 /
	512 (37 %)
<inf> thread_analyzer:  BT RX pri           : unused 284 usage 164 /
	448 (36 %)
<inf> thread_analyzer:  sysworkq            : unused 824 usage 200 /
	1024 (19 %)
<inf> thread_analyzer:  logging             : unused 200 usage 568 /
	768 (73 %)
<inf> thread_analyzer:  idle 00             : unused 272 usage 48 /
	320 (15 %)

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-09 10:43:35 +02:00
Lukasz Maciejonczyk ff8b864f48 net: openthread: Make OT thread priority class be configurable
It add an option to configure openthread thread priority class
by the application if there is a such need.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-09 11:00:17 +03:00
Andrew Boie 5d1ce47ef6 net: sockets: fix zsock_gethostname_ctx()
The SET_ERRNO() macro does nothing if a positive value is provided
to it, and the functions were not returning -1 or setting errno
as expected.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-09 10:58:02 +03:00
Andrew Boie 71d4aeb1c2 net: sockets: set errno EBADF on bad fd
APIs were returning -1 without setting errno if the file
descriptor looked up a null object or there was no function
installed in the vtable. Set to EBADF for this case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-09 10:58:02 +03:00
Lukasz Maciejonczyk 3fa2fa9a50 net: openthread: Fix the order of adding net pkt in ot_receive_handler
Net pkt is added into the ot net list after queued net pkt into
the net_rx which bases on it. It affects in losting net pkt when for
instance ot thread is preemptive.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-09 10:57:00 +03:00
Lukasz Majewski 0e32a84bcc net: eth: Add check if passed iface pointer is NULL
The eth_stats_update_errors_rx() implicitly assumes that passed pointer
to struct net_if is not NULL.

This is not true for MCUX's eth_rx() (in eth_mcux.c), where we can
execute eth_stats_update_errors_rx() after net_recv_data() returning
-EINVAL because of passed NULL iface pointer.

This change fixes this problem with adding extra check on iface not
being NULL before it is dereferenced.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-06-09 10:54:29 +03:00
Jukka Rissanen 043400ce89 net: context: Remove obsolete goto in net_context_put()
Some cleanup earlier left unnecessary goto. Cleaning the code
and removing it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-09 10:21:47 +03:00
Christian Taedcke 768968a445 net: ipv6: Also look for nexthop in nbr list
This change fixes routing for routes when the nexthop is a link-local
address of a connected peer.

The issue was that nexthop was correctly set from the routes, but the
code did not detect that the nexthop address (link local of the pc on
ppp interface) was on the ppp interface, because
net_if_ipv6_addr_onlink() only evaluated the network prefix and not
any other information (like the nbr list).

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-09 10:19:42 +03:00
Lukasz Majewski 38d38ed90a net: shell: Allow to set interface for ping (add -I option)
This change adds new, optional switch to 'net ping' command - to
be more specific the '-I <iface index>', where the <iface index>
is the number of supported network interface.

One can discover this number from the Zephyr shell after running
'net iface'.

The default interface stays the same - just the switch is added to
override the used interface for 'net ping' invocation.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-06-09 10:10:23 +03:00
Xavier Naveira 0fd16f8b78 net: mqtt: Make client "cleansession" flag configurable.
Cleansession is hardcoded to 1 but some use case might require 0
to make the sessions persistent (ie get messages sent while the
client was offline)

Signed-off-by: Xavier Naveira <xnaveira@gmail.com>
2020-06-09 10:09:04 +03:00
Michael Hope ff50ca1974 fs: nvs: fail on >= 256 B block sizes
The current code truncates the size_t block size to a u8_t, which
causes a 256 or 512 byte block size to be truncated to zero and
passing the size check.

Check as a size_t then truncate once the check passes.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-08 23:03:21 -04:00
Vinayak Kariappa Chettimada 3cabacce9a Bluetooth: controller: Address nRF5340 Engineering A Errata 16
Address the nRF5340 Engineering A Errata 16, RADIO: POWER
register is not functional.

This affects the dependency of controller's HAL
implementation that expected correct reset values being
set in the Radio peripheral.

As the SUBSCRIBE_TXEN and SUBSCRIBE_RXEN where not in their
reset value, Radio transmission and reception start using
DPPI was broken.

Fixes #25942.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-08 22:04:25 +02:00
Eduardo Montoya 75a69b940e net: openthread: cli: Align config of OT and Zephyr shell max cmd size
This PR enables the user to configure the maximum command length for
OpenThread's CLI using Zephyr's shell, which is currently fixed to
256 characteres. This limitation was not enough for certain allowed
OpenThread commands, like some variants of 'ot dataset mgmtsetcommand'.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-06-08 21:45:29 +03:00
Eduardo Montoya fc1d0635df net: l2: openthread: Add config option to enable OpenThread ref. device
This option enables specific features used by Thread Certification
reference devices.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2020-06-08 21:41:40 +03:00
Marcin Niestroj 747f20720a net: wifi: shell: store shell in context before scan
Right now shell pointer is not assigned before doing a scan, so scan
results are printed using printk(). Save shell instance in context, so
results are printed using shell_fprintf(), thus better aligned in the
console output.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-08 21:37:33 +03:00
Jukka Rissanen 2c66525b7b net: stats: Priority field was used instead of traffic class
The network statistics is stored for each traffic class, but the
collecting function was given net_pkt priority. The priority
must be first converted to traffic class and then the statistics
stored to correct place in the stats array.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-08 21:35:18 +03:00
Jukka Rissanen 43287d2323 net: socket: Add sendmsg() support to AF_PACKET
The AF_PACKET was missing support for sendmsg() socket call.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-08 21:34:35 +03:00
Markus Becker 2115b575a4 net: ieee802154: Allow to disable auto-start of 802.15.4 interfaces
Some radio drivers need configuration before start-up. Up to now only
the RF2XX drivers allowed this, but other radio drivers need this as
well. In particular for setting EUI64 addresses.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-08 19:55:19 +03:00