The websocket implementation did not comply with the RFC 6455 when it
comes to connection close. The websocket should send in such case Close
control frame. This commit fixes this behaviour.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The websocket "socket" layer did not handle ZFD_IOCTL_SET_LOCK command,
and just forwarded it to the underlying socket. This overwritten the
mutex pointer used by the underlying socket, resulting in erroneous
behaviour in certain cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Native POSIX target still needs to use the <fcntl.h> header
instead of <zephyr/posix/fcntl.h>
Also removed the include from various files that did not use it.
Also changed fcntl() calls to zsock_fcntl() because we directly
use zsock_* calls elsewhere.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fixes issue where a build warning would be emmited for sockets_tls.c due
to usage of the deprecated fcntl.h header file.
Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
The TLS_HOSTNAME socket option expects a NULL terminated string and
doesn't really care about the optlen provided. However, as the option
expects that the string is NULL terminated, the optlen value should take
NULL character into account, for consistency across the codebase.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
To write tests it is necessary to offer init function for the RDClient
to define custom fakes before.
Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
Change the http timeout mechanism to use poll instead of shutdown.
This should fix a problem where the shutdown will be called in a
different thread context which can lead to deadlocks on certain
driver implementations like offloaded modem drivers.
Fixes#53967
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
The POSIX spec requires that `SO_LINGER`, `SO_RCVLOWAT`,
and `SO_SNDLOWAT`, and `SOMAXCONN` are defined in
`<sys/socket.h>`. However, most of the existing socket
options and related constants are defined in
`<zephyr/net/socket.h>`.
For now, we'll co-locate them. It would be
good to properly namespace things.
Additionally, a no-op for setsockopt for `SO_LINGER` to
make things Just Work (TM) for now.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Full resource names aren't as long as combined basename- and name-buffer
sizes but the compiler doesn't know it. Increasing the buffer size to
avoid the compiler warning.
Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
Deprecate the old API and replace with new one which uses
the lwm2m_obj_path struct instead of a string.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate send API using the string references as paths.
Replace it with one using path structs.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate old API and make new API using path structs
instead of using old string reference based paths.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
Deprecate old API and offer a new API for object and resource
creation and deletion. The new API uses path struct instead
of using a string as a reference to a path.
Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
under certain conditions the current implementation did not maintain
the desired sort order.
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
base name or name can contain up to two shorts.
(object id & object intstance or resource id & resource instance id)
Signed-off-by: Pascal Brogle <pascal.brogle@husqvarnagroup.com>
A variable was defined directly after a label in two case statements,
resulting in build warning with certain compilers.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Check data buffer size and return error if
* buffer size is too small for opaque or string data type
* buffer size is not equal to res data length when data type
is fixed size
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Check return values from lwm2m_rd_client_pause() and
lwm2m_rd_client_resume() when engine thread suspend is requested.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
RD-Client is essential part of LwM2M specification and it can't
be disabled from LwM2M engine. This commit deprecates Kconfig
variable CONFIG_LWM2M_RD_CLIENT_SUPPORT and removes
all usages if it.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
`sntp_simple()` was forcing to resolve SNTP-server's URL into IPv4 address
addresses. This was not allowing sntp_init() to succeed in case the system
did not support IPv4 addresses (returning EPFNOSUPPORT, ie. Protocol
Family error).
Now by default SNTP has unspecified family type and it relies on
`net_getaddrinfo_addr_str()` to be able to resolve literal server URLs
into the supported IP family type.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Setting `hints.ai_family` to `AF_UNSPEC` was causing
`net_getaddrinfo_addr_str()` and in turn `getaddrinfo()` to resolve the
literal SNTP SERVER first into IPv4 and then (if supported) IPv6 addresses.
This was causing useless waste of time and memory in case IPv4 was not
supported. In addition, in case IPv4 addresses were not supported, other
system components (eg. SNTP) could fail due to the DNS returning IP
addresses with unsupported family type (ie. IPv4).
Now, if address family is not explicitly set to `AF_INET` (ie. IPv4), then
no attempt is made to resolve SNTP server address into an IPv4 address.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
Add shell command
cache :Enable data cache for resource
cache PATH NUM
PATH is LwM2M path
NUM how many elements to cache
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fixed problem for matching path url with or without '/'
by change time series data structure to use struct lwm2m_obj_path.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Call lwm2m_send_message_async() from function
lwm2m_information_interface_send() and remove duplicate code.
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
lwm2m_send_message() sends a message directly to the socket. Remove
the function from public API and combine the code with
socket_send_message().
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Now that we a proper API, shell is just optional, so, make the
dependency optional by refactoring the code.
Also, add a build test combination in twister.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Fix LwM2M rd client stop call hang when Queue client is at
RX_ON_IDLE_STATE. Added miossing connection resume for
de-register functionality.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Check receiving buffer size and return error if
* buffer size is too small for opaque or string data type
* buffer size is not equal to data lenght when data type is
fixed size
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
Instead of calling zperf shell initialization routine on the first
command execution, initialize it during system boot, along with other
zperf submodules.
Remove redundant IP address configuration on an interface. The default
configuration relies on NET_CONFIG module, so there's no need to set the
address manually in zperf.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Zperf shell functionality is now encapsuled within a single file,
therefore it no longer makes sense to have a separate shell_utils
file.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make the TCP/UDP server functionality restartable. Provide a public API
to stop the TCP/UDP server.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add public API for zperf download functionality. The TCP/UDP server
modules are decoupled from shell, allowing to trigger download directly
from the application code. The shell submodule makes use of this new
public API.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>