As the net_pkt might have already been sent by net_if_try_send_data()
function, the pkt might already contain garbage data. So do not try
to access if after that send call but remember the used iface and family
and use them to update the statistics.
The issue was seen with qemu_x86_64 and qemu_cortex_a53 when CONFIG_SMP
was enabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If CONFIG_NET_STATISTICS_PER_INTERFACE is not set, then the
net_shell_print_statistics_all() function was not found and
the compilation was failing.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The LwM2M SENML JSON/CBOR decoder expects a name entry for every
time-serialized record. While this was already the case for resources,
resource instances were missing their corresponding name entries. This
change ensures consistency by adding name entries for resource instances
as well.
Signed-off-by: Simon Walz <simon.walz@autosen.com>
Wrong printf format was using for size_t variable which caused
compiler warning and a failure.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit fixes an issue introduced in #97531. Multicast routes added
by application are now set to have a prefix length of 16 bits instead of
128. This will allow multicast routing to all IPv6 addresses from those
groups.
For the OpenThread multicast listener callback, route length will be set
to 128 bits, as a MLD event is expected when an address is subscribed.
Route lookup has been removed since one will always be found as the
application registers multicast routes with same scope, but with a
smaller prefix length.
Fixed issue regarding packet forwarding and BBR state. Previously, code
was covering only the case wehn BBR was secondary and packet was
received from backbone interface. A secondary BBR should not forward a
multicast packet from OT interface to backbone interface and vice versa.
Improved unicast forwarding function to return from the beginning if the
packet has a multicast destination.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
If the network interface goes down, close all TCP connections
that are bound to that interface. The reasoning here is that we
need a way to remove IP address from the interface and it might
not be possible if there is a TCP socket that is bound to that address.
If the interface comes back on, we might get the same IP address in
which case the socket closure was not really needed but it is not
possible to know in advance.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If the network interface goes down, then we do not have any time
to tear down TCP connection gracefully because there is no more
a connection to send data to. In this case the TCP connection is
forcefully closed without going into FIN_WAIT_1 state.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Using the Wi-Fi credentials system, we need to stop connecting with stored
credentials once a connection has been successful.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Zephyr's long term goal for crypto support is to use only PSA API. This
commit replaces usages of MD with proper PSA API for HMAC.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Accept the `ASYNC_CTRL_CHAR_MAP` option in configuration messages from
the peer. The map is reset to the default value each time the interface
comes up.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Expose the currently configured value for the PPP peers Asynchronous
Control Character Map through a public function.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The fix in 1264a923f3 was incomplete, because
it doesn't initialize the variable. To quote from opengroup [1]:
address_len
Either a null pointer, if address is a null pointer, or a pointer to a
socklen_t object which on input specifies the length of the supplied
sockaddr structure, and on output specifies the length of the stored
address.
This caused the returned address to be incomplete, because it got truncated
depending on what addrlen_local got initialized with implicitly. This broke
talking to discovered MQTT-SN gateways.
I intend to implement integration tests for the MQTT-SN UDP transport to
prevent such issues in future, but that will be done in a separate PR.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Adjust the way the SKIP option worked. Before this patch, a constant
priority offset was considered "high priority" this had the effect, that
the threads assigned to work on the priority were effectively usesless.
To fix it, consider this immediate handling as a pseudo-queue and compute
the tc-thead-mapping based on the effective count (+1 if skipping is
enabled). This makes it so that all threads are usefull and the
high-priority skip-path is considered as a pseudo tc-thread.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
This commit refactored IPV6 and IPV4 address events. Events have been
defined independently for each installed callback.
Previously, IPV6 address event was not triggered due to a mix of IPV4
and IPV6 flags.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Explicitly cast down the string width to int, as otherwise it is
size_t which may have a bigger size.
Avoids the following build error:
subsys/net/lib/shell/dns.c:496:67: error: field precision specifier
‘.*’ expects argument of type ‘int’, but argument 4 has type ‘size_t’
{aka ‘long unsigned int’}
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Allow to spread tc threads by more then one priority level and cleanup the
computation of the priority.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
To enable quality-of-service (QoS) applications, allow filters to modify
the priority of an incoming packet. This allows that processing can be
done on tc-queue-threads with different priorities.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
Make sure that the CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS will
reflect the number of required file descriptors in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The number of net_context now determines the minimum amount
of network sockets that are to be allocated.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of user trying to figure out what is the amount of file /
socket descriptors in the system, let the various subsystems etc.
specify their need using a Kconfig option. The build system will
then add these smaller values together and set a suitable file
descriptor count in the system.
This works the same way as the heap size calculation introduced
in commit 3fbf12487c
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
So far the TLS/DTLS credentials would only be validated upon first use,
i. e. when TLS/DTLS handshake was initiated. This could lead to some
confusion, especially when trying to understand the reason of the
handshake failure, as it wasn't clear whether the handshake failed due
to peer sending bad certificate or due to local configuration issues.
This commit attempts to improve this, by pre-validating the credentials
as soon as they are configured on a socket with TLS_SEC_TAG_LIST socket
option. That way, in case bad credentials are configured on a socket, or
more commonly, mbed TLS is misconfigured to handle certain credential
type, it will be caught early during socket configuration, instead of
during the handshake.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fix the transmit timestamp value sent in SNTP queries:
* Use sys clock as a time source instead of the uptime,
* As NTP epoch is different from Unix epoch (starts in 1900), adjust
the seconds value with appropriate offset,
* Finally, adjust the fraction calculation to the nanoseconds value
from struct timespec. Do the math in 64-bit to avoid overflows and do
the division at the end for more accurate results.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
fix(coap_link_format): Correct parameter constness in func signature
For function coap_link_format:coap_well_known_core_get_len()
the request parameter is declared to be a pointer-to-const,
but the const is missing for one of the two function definitions,
that are chosen via CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.
With this fix the code also compiles when enabling
CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.
Signed-off-by: Felix Kolbe <felix.kolbe@gmail.com>
Add NET_QBV in Kconfig, Qbv is Enhancements for Scheduled Traffic (EST),
one feature of TSN. The PTP clock provides the time reference for Qbv
Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
There are some cases when OpenThread opens a sockets and doesn't choose
as default it's internal interface, this leading to usage of
platform UDP module which will then send back the packet to the
OpenThread interface. In this case, the packet should not be treated as
originated from backbone interface.
Backbone router multicast listener callback functionality is improved.
A route with a prefix length of 128 is set
and a multicast address is added for each listener registration.
OpenThread interface joins that multicast address group.
Enabled forwarding capabilities for Backbone interface.
A border router should be able to perform default packet forwarding for
destination addresses with a multicast scope greater than admin-local.
In order to achieve this, multicast routes have been added to those
addreses. [https://datatracker.ietf.org/doc/rfc7346/]
For Border Router application, `ip6_addr_cb` is not installed.
otIp6SubscribeMulticastAddress call would re-register an IPV6 multicast
address which might have been registered by an OpenThread node using
`ipmadd add` command and even if that node performed `ipmaddr del`,
the address was still present in multicast listener table. This also
led to a missing MLDv2 message with that specific multicast IPV6
address.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Introduce `lwm2m_set_cache_filter()` so applications can drop cached
samples before they reach the LwM2M SEND path.
Fixes#91590
Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
Implement idle timeouts, primarily in the common connectivity library,
with individual interfaces notifying the library when the interface has
been used.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add an interface idle timeout parameter to the connectivity
binding structure. This will be used to track idle timeouts for
interfaces.
Signed-off-by: Jordan Yates <jordan@embeint.com>
This doesn't try to optimize memory usage for QOS=-1 publications, because
it's easier to use existing structs and allocators instead of adding new
ones with less fields.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The publish and subscribe APIs allocate topics implicitly, but don't
support allocating predefined or short topics. Additionally, we don't want
to force using short topics in case the passed topic is 2 bytes long, in
case the user doesn't want that (e.g. because the server doesn't support
it).
So instead, we add a new API which works similar to
mqtt_sn_predefine_topic, which allows allocating a short topic before using
any of these APIs.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
- These are independent from connections since they are always valid.
- Implicitly created topics(e.g. from publish or subscribe) can't be
deleted either, so that doesn't make things worse compared to those.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The address resoution from RFC6763 is generally a PTR, SRV, TXT, and
an A or AAAA. Records, so this change is mainly to start drawing a
clear functional change between the DNS query shell and the DNS
service shell that should be more of a "avahi-browse" or "dns-sd"
functional style.
So, this is not a very robust implementation since it is a chain of
queries when the goal should be to get additional records from the
message itself but those changes can be added iteratively.
Basic point of this change is to show the procedure for the "browse"
- PTR service resolution
- SRV query from the result of the PTR
- AAAA (or A) from the result of the SRV
TXT records are ignored for now but should be added into this as
additional record support is extended.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>