When a client uses wildcard subscription and a new message is
published to the matching topic for the first time, the gateway
sends REGISTER message to the client, containing the exact
topic name and a new topic ID.
This change fixes adding these topic ID and name to the internal
topics list.
Signed-off-by: Alexander Vasiliev <alexander.vasiliev@siemens.com>
Add a function to MQTT-SN library API to get topic name by ID
from the internal topics list.
Signed-off-by: Alexander Vasiliev <alexander.vasiliev@siemens.com>
Added igmpv3 support based on the already existing structure for igmpv2.
The already existing api is not modified to prevent breaking exisiting
applications.
Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
Added igmpv3 checksum function to make it possible to calculate the
checksum of a complete igmpv3 pkt at once.
Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
Fix the CMakeLists of the tls_credentials and sockets folders
to link/interface to the net library instead of the zephyr library.
This fixes issues where some files are not found in the link interface
when compiling the sources in this folder.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Make sure we send the entire packet buffer before bumping the packet
counter, send() does not guarantee that all of the requested data will
be sent at once with STREAM socket.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case underlying socket reported error while waiting for TX, the
errno value was not set accordingly. This commit fixes this.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Otherwise, if the application was for example blocked on poll() pending
POLLOUT, it won't be notified.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Rework how data is queued for the TCP connections:
* net_context no longer allocates net_pkt for TCP connections. This
was not only inefficient (net_context has no knowledge of the TX
window size), but also error-prone in certain configuration (for
example when IP fragmentation was enabled, net_context may attempt
to allocate enormous packet, instead of let the data be fragmented
for the TCP stream.
* Instead, implement already defined `net_tcp_queue()` API, which
takes raw buffer and length. This allows to take TX window into
account and also better manage the allocated net_buf's (like for
example avoid allocation if there's still room in the buffer). In
result, the TCP stack will not only no longer exceed the TX window,
but also prevent empty gaps in allocated net_buf's, which should
lead to less out-of-mem issues with the stack.
* As net_pkt-based `net_tcp_queue_data()` is no longer in use, it was
removed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new function to allocate additional buffers for net_pkt, w/o any
additional preconditions/checks. Just allocate what was requested.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
RSRQ is the ratio between send and received signal strength and usually
understood/expected to be represented as a ratio in dB and as such always
has a negative range. So to allow RSRQ to be represented correctly the
resource must allow negative values, but currently it's limited to unsigned
8bit integers.
Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
Network interface numbering starts from 1, therefore when accessing
help/index array, the interface index should not be used directly, but
rather decremented by 1, to avoid out-of-bound access on those arrays.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure that the error message does not overflow the transmit buffer
when copying the error message string.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There's not really much to do when the transmission of the error reply
fails, but we can at least log the failure.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The result of string to float conversion in LwM2M shell write command
was not verified, which could result in incorrect data being written to
the resource.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Verify the return value of net_pkt_skip() function, in case the parser
ignores the unrecognized options, so that in case the option was
malformed and the actual provided option length exceeds the packet
length, it is recognize (net_pkt_skip() should fail then).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As reported by Coverity, cpkt was being used before checking it's not
NULL.
Fixes#65372 / CID: 323075
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.
The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.
This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Since lwm2m_load_tls_credentials(ctx) will assume that the ctx has a
valid security object assigned to it, it should not be called at all
when ctx.use_dtls == false.
This solves a major bug where LwM2M comms are DTLS encrypted but FOTA is
allowed to be plain-text.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
No issues with gcc but clang gives this error for
the *v4 variable few lines below.
.../lib/dns/mdns_responder.c:712:2: error: expected expression
struct net_context *v4;
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of just listening first network interface in the system,
install a multicast listener to all available network interfaces.
Fixes#18748
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add a helper macro that can be used at runtime to return
the number of network interfaces in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to bind to different network interface. This is
useful if binding a multicast address to a certain network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
DTLS Connection Identifier support requires DTLS stack
that supports it. MbedTLS support in Zephyr is already
ported in, also some offloaded sockets support it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The use case is to have a netbuf pool that is used exclusively with
net_buf_alloc_with_data() where the destroy callback takes care of
freeing the actual data buffer pointed to by __buf.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Adds a shell interface for TLS Credentials, allowing management of
credentials via the Zephyr shell
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add (internal) support for sectag iterating.
Also officially marks negative sectag values as reserved for internal
use.
This will allow a prospective TLS credentials shell to iterate over all
available credentials.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds an internal credential_digest for generating a string digest of
credentials.
Such digests would allow users of a prospective TLS credentials shell to
verify the contents of a given credential without directly accessing
those contents.
Offloading the digest process to the underlying backend allows backends
for which private portions are not directly accessible to be eventually
supported.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
A CoAP client can re-issue an observe request (same endpoint and token)
to refresh it's subscription. No new observer should be registered in
this case.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add a function to the public CoAP API to find and return the unique
observer based on the address and token.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A recent iface lock removal in ed17320c3d
exposed issues with concurrent access on TX to drivers that are not
re-entrant.
Reverting that commit does not really solve the problem, as it would
still exist if multiple Traffic Class queues are in use.
Therefore, introduce a separate mutex for TX data path, protecting the
L2/driver from concurrent transfers from several threads.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Core objects version reporting was broken for LwM2M version 1.1, as the
default object version not necessarily matches the LwM2M version.
Therefore, implement a table with default object versions for particular
LwM2M version, which can be looked up when determining whether it's
needed to include object version or not during Registration/Discovery.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit adds the option to register an event handler to CoAP
resources when observers are added/removed.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The main action in this function it queueing the packet for
transmission which doesn't need a lock and interface flags use atomic
operations.
So, remove the unnecessary lock.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
In CoAP blockwise the client is supposed to
respond with 2.31 Continue code on Ack. This was recently
broken when Block1 parsing was moved after the initialization
of reponse packet. We need separate CoAP API to modify the code
of existing CoAP packet.
Also Ack packet should contain the Block1 options, even the
last one.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Instead of consistently checking for both, IPv4 and IPv6 fragmentation
in several places, add a hidden Kconfig symbol which indicates that some
IP fragmentation has been enabled (either IPv4 or IPv6 or both).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The current logic to determine whether a packet is IP reassembled is
flawed, as it only worked in certain conditions (which was ok, as the
conditions were satisfied for the current use case, but now it's a
public function). Therefore, add an explicit flag that indicates whether
a packet is IP reassembled or not.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>