The websocket used mbedtls functions to calculate the
SHA1 needed. Update the code to use PSA crypto calls instead
when the configuration CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT
is enabled.
This can be useful for applications which use TF-M
since it only provides PSA crypto APIs.
Also check the error code from the mbedtls_sha1
call since it can fail and it was not checked before.
Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
DSA is part of Ethernet and will utilize more Ethernet definitions for
more features support. So, it's proper to let DSA header include
Ethernet header with moving some DSA definiton from DSA header to
Ethernet header and adding DSA header including in c files using DSA
definition.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Once running, a socket service could not be reconfigured (i.e. changing
file descriptors and/or events to be polled). This was due to an wrong
check at the end of the thread main loop of socket_service_thread that
evaluated to false as variable ret is zero if trigger_work(), which is
called previously for all returned events, returns successfully.
Signed-off-by: Philipp Finke <philipp_finke@gmx.de>
When an IPv4 packet is received on a dual-stack socket, return
the mapped v4 to v6 address as source address.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Fixed issue when `sendmsg()` was in use and `CONFIG_NET_IPV6`
and `CONFIG_NET_IPV4_MAPPING_TO_IPV6` were in use, as `dst_addr`
argument of `context_sendto()` was passed NULL,
but also used to determine `sa_family`.
Use msghdr, if available, to determine if v4 to v6 mapping is
present.
Also set `dst_addr` to unmapped value when v4 to v6 mapping is
used.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
If v4 to v6 mapping is used, cmsg_level and cmsg_type should
be compared with IPv6 values even if pkt family if AF_INET.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Print TCP connection pointer value for debug prints
consistently so that it is easier to find debug prints that
are related to a certain TCP connection.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print return code on error and remove logging in `sntp_resync_handler`
since it calls `net_init_clock_via_sntp` which already does logging.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Use the l2_processed-flag to decide whether a network packet needs to be
processed by an L2-handler. This could be used in the future to requeue
packets for later processing by a different traffic class queue.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
This default value 2 of WIFI_NM_MAX_MANAGED_INTERFACES
ensures WiFi network manager can properly handle both
access point and station interfaces.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
RFC4330 section 10 states:
A client MUST NOT under any conditions use a poll interval less then 15
seconds.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Used simple vlanX for vlan interface name. What interface the
vlan interface was attached to could be checked by "net iface"
or "net vlan".
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
There were two problems about vlan interface naming currently.
1. When there were more than 1 vlan interfaces. It's not able to
initialze name for all of them to same name VLAN-<free>.
2. When enabled vlan with tag, the name VLAN-xxx was used.
However we may need to support multiple physical interfaces
in the future. So, it's not able to use same name VLAN-xxx
either for same tag on different physical interfaces.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
The `%.*s` format specifier expects an int so cast the size_t parameter
to int.
Fixes an issue spotted in CI for:
west twister -p native_sim/native/64 -s sample.net.dns_resolve.mdns
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
These types are useful for IoT deployments and should be available
thru the resolver interface to get the data. The SRV is especially
useful to find services on the local network when not using a dns-sd
deployment and just something like Avanhi or Bonjour.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
When resolving SRV records - the label might not be compressed so
the first entry into the net buf is the start of the name and a
period could end up at the start - ie. ".example.local" so only add
a period when the buffer is not empty.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
The enum will auto increment, so in debug the IP and DATA records are
negative numbers which initially made this look like an error, so just
push the expected good values to be positive numbers in case of a print
or something else would imply these are ok.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
Previously, the Kconfig option `NET_GPTP_CLOCK_ACCURACY_2_5MS` had a
incorrect description "1.5ms".
Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
The loop condition is not the count of the actual tries since the
continue or breaks can occur on the loop and thus a failure count
can falsely match a loop count even when a query is outstanding.
This can be seen when a dual stack resolve is used for IPv4 and IPv6
that has two fds to be used and the interface has only gotten an
IPv6 address. The failures on the IPv4 will indicate a 1 and the break
on the tried attempt on the IPv6 will break the loop on a 1.
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
Suppress many LOG_ERR() messages from LwM2M registry
that are not necessary runtime errors.
Libraries and applications should be able to do following
without causing LOG_ERR to be produced:
* Checking existence of object, resource or resource instance
using lwm2m_engine_get_res(), lwm2m_engine_get_res_inst()
or path_to_objs(). These are only exposed in internal header.
* Delete object instance or resource instance without checking
if it exits.
As there is no public API to check existence of some path,
application is much easier to write in a way that it directly
calls just lwm2m_get...(), lwm2m_set...(), lwm2m_delete...()
and trust the return code of -ENOENT.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
UDP multicast uploads did not produce zperf-compatible server stats,
so the client waited for and tried to decode a non-existent reply,
causing “Unexpected response flags” and misleading
“LAST PACKET NOT RECEIVED!!!” output.
This change treats multicast as client-only: after sending
the negative-id FIN it does not wait for or decode server stats,
Instead transmits the FIN a few times to help receivers detect test end.
The shell prints a clear “Statistics (client only)” summary for multicast
and suppresses the error when client stats are valid.
Unicast behavior is unchanged.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Fix an issue where IPV6_RECVPKTINFO was used instead of IPV6_PKTINFO
when insert_pktinfo was called.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Add IP_RECVTTL or IPV6_RECVHOPLIMIT BSD socket options
that can be used to extract ttl/hop limit from ancillary data
in recvmsg() call.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
When the `PTP_UDP_IPv6_PROTOCOL` configuration is enabled
the `mcast_addr` variable is defined as an IPv6 structure, which
doesn't have `s_addr` member.
To not introduce preprocessor guarded code blocks in functions
added union to represent both configurations: IPv4 and IPv6.
Fixes: #92975
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
A logging module named `tls_credentials` was being declared, but no
other source module was creating and registering it. Do the registration
in the file to fix the compiler error.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Changed the number of mandatory options of `rts threshold` to 1, so as
to allow no arguments for querying.
Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
If webserver uses custom socket creation,
and it's family is AF_UNSPEC, net_sprint_addr will return NULL,
which leads to LOG_DBG crashing with busfault.
Add NULL check for that.
Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
The NET_CONN_LOCAL/REMOTE_PORT_SPEC flags were set on the connection but
not really used. At the same time, when remote address was being
cleared, only the flag was unset, but the actual port number left
intact. This could lead to false port comparisons when remote address
was cleared from the connection context.
In order to avoid that, use the NET_CONN_*_PORT_SPEC flags to determine
whether to compare local/remote ports instead of checking the port value
right away (which may not be valid anymore if the flag is unset).
Also align with MISRA rules when comparing flags in other cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
As per POSIX, for non-connection-mode sockets the peer address should be
reset if AF_UNSPEC family type is provided to the connect() call:
"If the sa_family member of address is AF_UNSPEC, the socket's peer
address shall be reset.""
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Use the native zephyr sys_clock_gettime() call instead of the XSI
gettimeofday(), since XSI is not required here and would normally
require CONFIG_XSI_SINGLE_PROCESS to be selected.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Fix multiple warnings detected by clang:
* implicit conversions back and forth from enumeration type
'enum ocpp_notify_reason' to 'enum ocpp_pdu_msg'
in ocpp_internal_handler()
* label followed by a declarations
* variable declared after one switch case and used in another
* mapping a int to uint and later using it in < 0 comparisons
and with negative values
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The original implementation select the port
as best_port when stepsRemoved is equal to
the one of best_vector.
When challenger is from announce message
set in GPTP_PA_INFO_SUPERIOR_MASTER_PORT,
its stepsRemoved is the same as in the message.
When challenger is from master_priority
copied in GPTP_PA_INFO_UPDATE,
its stepsRemoved is [stepsRemoved of bestVector]+1.
Thus, we should add one to the challenger's
stepsRemoved in comparsion to avoid useless
update of bestVector.
Signed-off-by: Yusuke Omae <s1413091@gmail.com>
Basic support for open charge point protocol v1.6 as native stack with
below functionality
1. Framework for ocpp stack and central system communication using RPC over
websocket according to occp-j.
2. Core profile with basic PDU
Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Co-authored-by: Sanjay Vallimanalan <sanjay@linumiz.com>
Providing a wrong address to the connect() call by the application is no
reason to assert, connect() should just return an error in such case.
Therefore remove the faulty assert and replace it with error log
instead.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>