When a small amount of supported connections is configured (especially
the default number of 1), connectable advertising may fail. This is
perfectly fine since as soon as a disconnection event happens the
advertising will be successfully restarted. To avoid causing
unnecessary user worries, downgrade the resulting errors to warnings.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There were some things that were working only when receiving a Node
Reset message from someone else, but not when the app called
bt_mesh_reset() directly. There was also some state cleanup missing
for the transport layer. This patch addresses all of these issues.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
As flash address changes between different boards of same Soc,
it is derived from .dts file instead of hard coding in .dtsi.
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
In 90b471fe4, there was a change to make k_poll() return EINTR error
if it was cancelled with k_fifo_cancel_wait(). Handle this change, or
otherwise sockets EOF handling was broken.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Previously, the connection will be reset easily due to a forged TCP
reset with a random sequence number.
As described in RFC793 p.69, we should check if the sequence number
falls into the receiver window at first.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
In case K_POLL_STATE_NOT_READY is set the return will be set to -EINTR
indicating that the poll was interrupted.
Fixes#5026
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Relies on loopback network interface added recently and being able
to run QEMU without connecting to host networking.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
The Configuration Client is such a generally useful feature for the
shell that it makes sense to have it as a mandatory dependency (the
shell wasn't anyway compiling at the moment without it).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Optimised the parameter passing order of memq interface such
that the compiled code uses less space and execution time.
Having a parameter that gets returned as the first parameter
passed to a function avoids instructions required to have
the result in the return register.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The echo-client compilation failed because mbedtls config file
was not found. Added suitable magic to CMakeLists.txt fixing that.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The Del and Overwrite operations have the exact same parameters and
expected status response as the Add operation, so we can reuse most of
the code.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Even though we have LPN enabled, we might still receive messages
through other network interfaces than the advertising one (e.g. the
local network interface).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Trying to always include mesh support resulted in the app not fitting
on some boards (e.g. nrf51_pca10028). Put the mesh-specific
configuration in a separate configuration file instead.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Having a dedicated Mesh shell app instead of extending the existing
shell app will let us fine-tune board-specific configurations for Mesh
in the future (not to mention that extending the shell app already
resulted in it not fitting on some boards).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Using the start callback, especially with multi-segment messages, may
not be super useful for applications, but we should support if if they
do provide it. One application could e.g. be to calculate the duration
it takes for a multi-segment message to be completely received by the
remote end.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Model publication was broken in a couple of ways:
- The Publish Retransmit State was not taken into account at all
- Health Server used a single publish state for all elements
To implement Publish Retransmit properly, one has to use a callback to
track when the message has been sent. The problem with the transport
layer sending APIs was that giving a callback would cause the
transport layer to assume that segmentation (with acks) is desired,
which is not the case for Model Publication (unless the message itself
is too large, of course). Because of this, the message sending context
receives a new send_rel ("Send Reliable") boolean member that an app
can use to force reliable sending.
Another challenge with the Publish Retransmit state is that a buffer
is needed for storing the AppKey-encrypted SDU once it has been sent
out for the first time.To solve this, a new new net_buf_simple member
is added to the model publication context. The separate 'msg' input
parameter of the bt_mesh_model_publish() API is removed, since the
application is now expected to pre-fill pub->msg instead.
To help with the publishing API change, the Health Server model gets a
new helper macro for initializing the publishing context with a
right-sized publishing message.
The API for creating Health Server instances is also redesigned since
it was so far using a single model publishing state, which would
result in erratic behavior in case of multiple elements with the
Health Server Model. Now, the application needs to provide a unique
publishing context for each Health Server instance.
The changes are heavily intertwined, so it's not easily possible to
split them into multiple patches, hence the large(ish) patch.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The Model Publish Retransmit Interval is in units of 50ms and not 10ms
like the other transmit/retransmit states. Create dedicated macros for
the Publish Retransmit State and use them where appropriate.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There's no need for callback exposed in the public API to be something
different than what's used internally. In fact this would just
complicate things. This patch exposes the internal callback under a
bt_mesh_adv_cb name and uses it throughout the mesh stack.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In case an outgoing message gets only delivered to the proxy interface
we should not forget to notify the send callbacks of this.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Some places of the code are interested in when the first advertising
event goes out. Others, on the other hand, are interested when the
last advertising event goes out. Some are even interested in both of
these. Instead of providing a single callback, provide a struct with
two possible callbacks for sending advertising PDUs.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This simplifies the callback implementations since they no-longer need
to do their own look-ups of the needed context.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We've so far been trying to keep the per-buffer mesh meta-data to
a maximum of 8 bytes in anticipation of upcoming net_buf refactoring
that'll have all net_bufs in the system with the same sized user data.
It's however slowly becoming unfeasible to do this - e.g. simply
adding user data to the sending callback would already fill up the
full 8 bytes.
To solve this issue, treat the net_buf user data as just a pointer to
the actual user data, and keep the actual user data in a separate
array. We still keep taking advantage of net_buf_id() however, so
buffers can cheaply be mapped to their meta-data.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add in6addr_any and in6addr_loopback which are defined in RFC2553 Basic
Socket Interface Extensions for IPv6.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Previously, if passive close is peformed, the net context is released
after FIN is received and FIN,ACK is sent. The following last ack from
the peer will be treated as an improper packet, RST is sent to the peer.
This patch refines tcp_established() by centralizing the tcp state
transition and releases the net context only if NET_TCP_CLOSED is
reached.
Besides, the logic that releases the net pkt without appdata (i.e. ACK
or FIN) is moved from packet_received() to tcp_established(). This makes
packet_received() less dependent on the protocol and make the usage of
net pkt more clear in tcp_established().
Fixes: #4901
Signed-off-by: Aska Wu <aska.wu@linaro.org>
When testing memq implementation used by controller, a
missing check on NULL pointer return could lead to NULL
pointer deferencing.
Current implementation of controller and mayfly do not
by design lead to NULL pointer dereferencing, this fix
is only for correct-ness and complete-ness.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Sphinx/breathe doesn't support showing nested groups, so explicitly add
the nested groups in the API documentation (for Bluetooth Mesh).
Also, added an ignore pattern for a nested unnamed type known issue.
fixes: issue #5040
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Increase sleep time for main thread (1 sec to 1 minute) to keep SOC
in Low Power State for longer time. Currently nrf SOC is entering into
low power state and exiting immedately after 1 sec.
With this change SOC will wake stay in Low Power State till GPIO is
pressed or sleep time expired (whichever is earlier).
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Update for LOW POWER state and SYSTEM OFF state for nrf52.
update for TICKLESS KERNEL support in xtensa_sys_timer
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Add basic documentation about Ethernet over USB and describe
prj_netusb.conf configuration file.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add configuration, pinmux, dts and documentation for the STM32L476G
Discovery board based on the STM32L476VG SoC.
Signed-off-by: Arthur SFEZ <arthur.sfez@gmail.com>
Currently Zephyr is running from RAM, and the space where
instructions can be executed from is quite small.once Flash
cache is enabled in ESP32 port we can remove this check.
Signed-off-by: Nishikant Nayak <nishikantax.nayak@intel.com>
Implement API to validate user buffer. This API will iterate
all MPU regions to check if the given buffer is user accessible
or not. For #3832.
Signed-off-by: Chunlin Han <chunlin.han@linaro.org>