In case zperf session was aborted by the user (by for instance stopping
it from shell), or practically in case of any other
communication-related error, the zperf session could end up in a state
other than NULL or COMPLETED, with no way to recover. This made the
session no longer usable and eventually could lead to zperf being not
able to start a new session anymore.
Fix this by introducing zperf_session_reset() function, which resets the
session state back to defaults. The function is called when the zperf
receiver service is stopped.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The issues found for UDP receiver were also identified for TCP receiver,
this commit applies practically the same set of changes as in case of
UDP.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit fixes restarting of UDP receiver service, along with some
other minor cleanups:
* The core issue was udp_server_running flag not being cleared when
service was stopped. Fix this by introducing udp_receiver_cleanup()
which does all of the required cleanups when receiver service is
stopped. The function is called either when the application stopped
the service with zperf_udp_download_stop(), or when the service was
stopped due to error.
* net_socket_service_unregister() was not called on
zperf_udp_download_stop(), but only from the service callback - that
would not work in case there's no active communication.
* at the same time, net_socket_service_unregister() would be called from
the service callback in case of errors. Fix this, by making
udp_recv_data() only return an error, and let the service callback to
do the cleanup.
* Remove no longer used udp_server_run semaphore
* Remove udp_server_stop - with socket services it seems no longer
needed.
* zperf_udp_receiver_init() now returns an error, so that we don't
mark the service as running in case of socket/services error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add sockaddr member in struct net_pkt to store peer address if offloaded
network inteface is used. This enables recvfrom() to fill in src_addr if
socket type is UDP and offloaded interface driver supports it.
Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
DHCPv4 server will send an ICMP probe (echo request) for the requested
address before replying with DHCP Offer, unless probing is disabled in
Kconfig.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
We cannot always start the service monitor thread statically
because the static threads are started after the application
level. This means that when config library wants to start
dhcpv4 server which uses socket services, there would be a
deadlock. Simplest solution is to start the service thread
directly from socket service init function.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Not only check if the address pool belongs to the same subnet as the
server, but also that it does not overlap with the server address -
otherwise the server might end up assigning its own address.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Adds an option to disable the automatic initialization of the default
dns_context. This lets applications use the default context, while also
managing the `init` and `close` functions.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
As discussed during DHCPv4 server integration, group DHCPv4 client files
with DHCPv4 server in a single lib directory.
Renamed internal "dhcpv4.h" header to "dhcpv4_internal.h" so that it's
not confused with the public "dhcpv4.h" header.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The net-shell printed virtual interface name so that it got
the impression it was the network interface name which is not
correct. Now the name is printed as "Virtual name" which is
unambiguous.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The ratio between mbps and kbps, kbps and bps should be 1000, instead of
1024, as common sense.
The wrong ratio will decrease the Zperf throughput result.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
When ENABLED flag is used, we generate 32 byte DTLS
Connection Identifier and include that in our
DTLS Client HELO. This has no benefit as client only
has one connection toward the server, it does not need
any identification.
When SUPPORTED flag is used, we just include
zero length Connection Identifier in the handshake,
which tell server that we support Connection Identifier
and server can generate one for it.
We then use the CID in the packets that we send towards
server, but response packets don't contain any CID.
This gives all the benefit of CID as server is able to
identify us even when NAT mapping have changed.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Instead of relaying on those macros having been defined
somewhere else let's define them for this file.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add macro that allows registration of initialization functions that
are called when LwM2M engine starts.
On LwM2M engine starts up, it first executes all initialization
functions in following priority order:
1. LWM2M_PRIO_ENGINE
2. LWM2M_PRIO_CORE, this is where all LwM2M core objects are initialized
3. LWM2M_PRIO_OBJ, this is where all other objects are initialized
4. LwM2M_PRIO_APP, application initialization.
Now on the initialization phase, we could rely that certain objects have
already been registered.
For example custom objects can register callbacks to core objects.
On application phase, we can initialize sensor objects and register
their callbacks because objects have already been initialized.
This LWM2M_ON_INIT() should replace all use of SYS_INIT()
with the default CONFIG_KERNEL_INIT_PRIORITY_DEFAULT.
Priority order is actually just alphabetical order of names, so
the order is set on a linkin phase, and we don't need any
runtime checking for it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If bootstrap fails, RD client will call lwm2m_engine_stop()
which will close the context.
The socket loop, however still contains a call to
hint_socket_state(context, NULL) which has a null pointer now.
Fix the segfault by allowing nullpointer on hint_socket_state().
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Implement DHCPv4 shell module, which allows to start/stop DHCPv4 server
operation, and print server status (address leases).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Increase socket services thread default stack size when DHCPv4 server is
enabled, as it uses synchronous processing.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new kconfig CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING.
When enabled and device is sleeping, Reqistration Update
message is skipped and messages from send operation and
notifications are sent right away.
Reqistration update message is also skipped when
lwm2m_engine resumes from pause state.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Get TLS_DTLS_CID_STATUS and TLS_DTLS_PEER_CID_VALUE utilize
mbedtls_ssl_get_peer_cid, which expects that mbedtls_ssl_setup
has been done.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
User is able to tweak the socket service dispatcher thread
priority in order to get better performance from the system
if needed. By default the dispatcher thread runs in lowest
application thread priority (K_LOWEST_APPLICATION_THREAD_PRIO).
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The thread name output field was a bit too short in "net sockets"
command, so make it 25 char long.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The "net sockets" command was not checking if there is any
sockets in the system before trying to access them.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The place where TF-M places its non-secure api header files has changed
Therefore changing it for for all applications that use it.
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
If user has not supplied address pointer when calling accept(),
then we would not be able to figure out the used socket domain
properly. But as there is now SO_DOMAIN option supported, use
that to get the correct socket domain.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The getsockopt() will return the address domain of the given
socket like AF_INET or AF_INET6.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
gcc prints this warning message
'strncat' specified bound 1 equals source length [-Wstringop-overflow=]
58 | strncat(fd, "C", 1);
There was no error in the code but avoid the warning by not using
strncat().
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The socket service provides a similar functionality as what
initd provides in Linux. It listens user registered sockets
for any activity and then launches a k_work for it. This way
each application does not need to create a thread to listen
a blocking socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
According to the POSIX specification, null pointer
is a valid value for the `address` argument
of the `accept` function.
This commit adds a check to prevent a null pointer
dereference inside `z_impl_zsock_accept`.
Signed-off-by: Mirko Covizzi <mirko.covizzi@nordicsemi.no>
Adding a callback for handling lwm2m messages with prefixed paths defined
by the gateway object. If CONFIG_LWM2M_GATEWAY_OBJ_SUPPORT is set,
each path is checked for the prefix stored in the object instances of the
gateway object 25. If prefixes match the msg is passed to the gw_msg_cb.
Signed-off-by: Simon Walz <simon.walz@autosen.com>
lwm2m_engine_pause() caused deadlock if it was called within
engine thread.
Remove while loop from lwm2m_engine_resume().
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Add short delay before triggering registration update. This allows
postponing the update from application side if needed.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
DTLS socket is not really connection-less as UDP, as it required the
DTLS handshake to take place before the socket is usable. Therefore,
align the DTLS connect() behavior with regular TLS.
The change is backward compatible. connect() call is still optional for
DTLS socket (the handshake can still take place from send()/recv()) and
a socket option was provided to disable DTLS handshake on connect().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When using DTLS socket, the application may choose to monitor socket
with poll() before handshake has been complete. This could lead to
potential crash (as the TLS context may have been left uninitialized)
and unexpected POLLIN reports (while handshake was still not complete).
This commit fixes the above - POLLIN will only be reported once
handshake is complete and data is available
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case a socket error was caused by TLS layer, it was not reported with
POLLERR. This commit fixes this.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case TLS session is closed at the TLS level (and thus recv() reports
0 to the application) a certain race occurs between consecutive recv()
call, and TCP session teardown. As mbedtls_ssl_read() only reports
session close upon receiving CLOSE alert, consecutive non-blocking
recv() calls would report EAGAIN instead of connection closed, if called
before underlying TCP connection was closed.
Fix this, by storing the information that TLS session has ended at TLS
socket level. The new flag will be checked before attempting further
mbed TLS actions, so that connection status is reported correctly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure iovec is initialized to a value so that there
is no possibility that it is accessed uninitialized.
Fixes: #66838
Coverity-CID: 334911
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The original idea was to check that we have enough network
interfaces in the system. The check needs to verify max IPv4
and IPv6 supported interfaces instead of always checking
IPv6 one.
Fixes: #66843
Coverity-CID: 334899
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Refactored the socket state indication into its own function
that checks the state of TX queues as well as number of
pending CoAP responses.
Check the state after receiving a packet, as it might
have been a last Ack packet we have been waiting.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Deprecate lwm2m_set_u64() and lwm2m_get_u64 as only
LWM2M_RES_TYPE_S64 exist. Unsigned variant is not defined.
Technically these might have worked OK, but it is undefined
what happens to large unsigned values when those are
converted to various payload formats (like CBOR) that might
decode numbers differently depending of their signedness.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow engine to give hints about ongoing CoAP transmissions.
This information can be used to control various power saving
modes for network interfaces. For example cellular networks might
support release assist indicator.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
In slow networks, like Nb-IOT, when using queue mode,
there might be significant delay between the time we
put the packet into a transmission queue and the time
we actually start transmitting.
This might cause QUEUE_RX_OFF state to be triggered earlier
than expected. Remedy the issue by updating the timestamp on the
moment where packet is accepted by zsock_send().
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
In case a waiting TLS socket reports an error in the underlying poll
call, try to read the actual error from the socket, instead of blindly
returning -EIO in all cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There are several subsystems and boards which require a relatively large
system heap (used by k_malloc()) to function properly. This became even
more notable with the recent introduction of the ACPICA library, which
causes ACPI-using boards to require a system heap of up to several
megabytes in size.
Until now, subsystems and boards have tried to solve this by having
Kconfig overlays which modify the default value of HEAP_MEM_POOL_SIZE.
This works ok, except when applications start explicitly setting values
in their prj.conf files:
$ git grep CONFIG_HEAP_MEM_POOL_SIZE= tests samples|wc -l
157
The vast majority of values set by current sample or test applications
is much too small for subsystems like ACPI, which results in the
application not being able to run on such boards.
To solve this situation, we introduce support for subsystems to specify
their own custom system heap size requirement. Subsystems do
this by defining Kconfig options with the prefix HEAP_MEM_POOL_ADD_SIZE_.
The final value of the system heap is the sum of the custom
minimum requirements, or the value existing HEAP_MEM_POOL_SIZE option,
whichever is greater.
We also introduce a new HEAP_MEM_POOL_IGNORE_MIN Kconfig option which
applications can use to force a lower value than what subsystems have
specficied, however this behavior is disabled by default.
Whenever the minimum is greater than the requested value a CMake warning
will be issued in the build output.
This patch ends up modifying several places outside of kernel code,
since the presence of the system heap is no longer detected using a
non-zero CONFIG_HEAP_MEM_POOL_SIZE value, rather it's now detected using
a new K_HEAP_MEM_POOL_SIZE value that's evaluated at build.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Update coap_service_send and coap_resource_send to take an optional
pointer argument to the newly introduced coap_transmission_parameters.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Replace function parameter 'retries' with pointer to structure
holding coap transmission parameters. This allows setting the
retransmission parameters individually for each pending request.
Add coap transmission parameters to coap_pending structure.
Update migration guide and release notes.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Use correct format specifier for LOG_ERR in lwm2m_obj_device.c. The
previously used format specifier of %u was correct for 32 bit systems
but would produce a build warning for 64 bit systems.
Fixes#66441
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
As the common.h is only meant to be used by the network
shell files, rename it to be more descriptive in order to
avoid possible conflicts with any other common.h file.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add new functions to the public CoAP API to configure CoAP packet
retransmission settings. Application may need to re-configure the
settings for example when cellular modem changes connection from
LTE-M to NB-IoT or vice versa.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
When a TCP connection is established, if there is no data exchange
between the two parties within the set time, the side that enables
TCP Keep-alive will send a TCP probe packet with the same sequence
number as the previous TCP packet. This TCP probe packet is an empty
ACK packet (the specification recommends that it should not contain
any data, but can also contain 1 nonsense byte, such as 0x00.). If
there is no response from the other side after several consecutive
probe packets are sent, it is determined that the tcp connection has
failed, and the connection is closed.
The keep-alive default parameters are aligned with Linux defaults.
Signed-off-by: Horse Ma <mawei@coltsmart.com>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If observed resource was written during the pMin period, it did
not schedule any wake-up event into the future. Notify message would
then only be generated as a result of any other (like Update) event.
Refactor check_notifications() to follow same pattern as retransmit_req().
Return the next event timestamp, which could be now.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
SNTP response is not analyzed for uncertainty, and no uncertainty is given
to the `struct sntp_time` returned. Fix it with a Kconfig option that adds
optional SNTP uncertainty and timestamp fields in SNTP time struct, and
calculates these when parsing the response.
Adds two helper functions to convert Q16.16/Q32.32 in seconds to `int64_t`
in microseconds to facilitate this.
Also changes combined `lvm` field in `struct sntp_pkt` to bit-fields
`li`, `vn`, and `mode`.
Signed-off-by: Jasper Smit <git@jrhrsmit.nl>
This reverts commit 5227f24815.
The coap observer events will be replaced with net_mgmt events.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A device can be reset before the error code list is communicated
to a LwM2M server so optionally store error list in settings so it
can restored after reset.
Signed-off-by: Nick Ward <nix.ward@gmail.com>
If server registration fails, allow fallback to secondary server,
or fallback to bootstrap.
Also allow fallback to different bootstrap server.
Add API to tell RD client when server have been disabled by
executable command.
Changes to RD state machine:
* All retry logic should be handled in NETWORK_ERROR state.
* New state SERVER_DISABLED.
* Internally disable servers that reject registration
* Temporary disable server on network error.
* Clean up all "disable timers" on start.
* Select server first, then find security object for it.
* State functions return void, error handling is done using states.
* DISCONNECT event will only come when client is requested to stop.
* NETWORK_ERROR will stop engine. This is generic error for all kinds
of registration or network failures.
* BOOTSTRAP_REG_FAILURE also stops engine. This is fatal, and we cannot
recover.
Refactoring:
* Server selection logic is inside server object.
* sm_handle_timeout_state() does not require msg parameter. Unused.
* When bootstrap fail, we should NOT back off to registration.
This is a fatal error, and it stops the engine and informs application.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
React to disable executable, as well as add callback that allows
disabling server for a period of time.
Also add API that would find a next server candidate based on the
priority and server being not-disabled.
Move all server related functions into its own header.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Zephyr has its own multicast join/leave API but for
interoperability, it is possible to use the multicast
socket API and IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP
socket options.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Zephyr has its own multicast join/leave API but for
interoperability, it is possible to use the multicast
socket API and IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP
socket options.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We are creating a multicast address in mDNS or LLMNR
responder so set the TTL or hoplimit using the multicast
variant API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We specifically set TTL/hoplimit to 1 for LLMNR,
but only want to set it if in that specific case.
We must not pass TTL/hoplimit value 0 as that would
cause the packet to be dropped.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The IPv4 TTL could only manipulated via net_context interface.
It makes sense to allow the same from socket interface via
the setsockopt/getsockopt calls.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This was somehow missed, but since ICMP rework, message handlers should
not dereference the packet, as it's done by the ICMP lib.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Set the static initialiser socket file descriptor to -1 to make sure
it is invalid before using coap_service_send.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add extra checks that make sure that msg_iov is set
as we cannot receive anything if receive buffers are
not set.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The CoAP request handler returns errno codes in the following cases:
* ENOENT if no handler found; respond with 4.04
* ENOTSUP if an unknown request code received; respond with 4.00
* EPERM no handler found for the method; respond with 4.05
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Protected credential storage makes use of the PSA API, therefore it must
be present in the library include path. This was missed during the
recent CMakeLists.txt rework of this library.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If we for some reason are supplied unsupported socket type in
recvfrom(), then return ENOTSUP error to the caller instead of
silently accept it by returning 0.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user has set either IP_PKTINFO (for IPv4) or
IPV6_RECVPKTINFO (for IPv6) socket options, then the system
will return relevant information in recvmsg() ancillary data.
Fixes#36415
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add IP_PKTINFO or IPV6_RECVPKTINFO BSD socket options that
can be used to get extra information of received data in
the ancillary data in recvmsg() call.
For IPV6_RECVPKTINFO see RFC 3542 for details.
For IP_PKTINFO see Linux ip(7) manual page for details.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Implement testcases for Information Reporting Interface [300-399]:
* LightweightM2M-1.1-int-301 - Observation and Notification of parameter
values
* LightweightM2M-1.1-int-302 - Cancel Observations using Reset
* LightweightM2M-1.1-int-304 - Observe-Composite Operation
* LightweightM2M-1.1-int-306 – Send Operation
* LightweightM2M-1.1-int-307 – Muting Send
* LightweightM2M-1.1-int-308 - Observe-Composite and Creating
Object Instance
* LightweightM2M-1.1-int-309 - Observe-Composite and Deleting
Object Instance
* LightweightM2M-1.1-int-310 - Observe-Composite and modification of
parameter values
* LightweightM2M-1.1-int-311 - Send command
303 and 305 cannot be implemented using Leshan as it only support
passive cancelling of observation.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If the interface is WiFi one, then print information about it.
Also the device information is useful to know so print device
name corresponding to the network interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Do not include the resource type (rt=) in the registration message when
using the OMA JSON format. This was a workaround specifically for the
Wakaama LwM2M server which is no longer needed since the latest master
branch.
Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
Portfolio object created string buffers for Identity resources
that was overlapping on some cases.
Don't calculate pointers by hand, allow compiler to calculate it.
Fixes#64634
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Extend the previous support of creating object instances by allowing
creation of resource instances as well.
Similarly, add support for deleting.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If user adds IPv6 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user adds IPv4 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Fixes#64389
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Default behaviour should only bind to port independent of IP, this
allows even multicast/broadcast L4 traffic to be received.
User can always specify a specific address to bind using shell or
Kconfig or API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>