Print information in "net ipv6" command how the SLAAC addresses
are generated. There is the default legacy EUI-64 method (RFC 4862) or
the stable method described in RFC 7217.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Web browsers don't support HTTP Upgrade mechanism to upgrade to HTTP2.
Instead, HTTP2 is supported only over TLS, and ALPN is used to negotiate
the protocol to be used.
This commit adds the supported HTTP protocols to the ALPN list, so that
web browsers can use HTTP2 with the server.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Fixes: #78010
This commit implements the "Gateway Advertisement and Discovery" process
defined in section 6.1 of the MQTT-SN specification.
This includes breaking changes to the transport interface and the default
included UDP interface implementation as support for UDP multicast
messages is added as implemented by the Paho MQTT-SN Gateway.
Signed-off-by: Kenneth Witham <kennywitham4@gmail.com>
If network interface is specified in the DNS server, then send
the queries to the server via the network interface. Print this
information in the server list.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to specify a network interface in the DNS server
list. User can append "%" and network interface name to the
DNS server to use this. If the network interface is mentioned
in the server list, then the DNS queries are sent via this network
interface.
For example setting the interfaces like this:
192.0.2.2%eth1
[2001:db8::2]:5353%ppp0
would cause the DNS queries to sent to 192.0.2.1 via eth1 in the first
example, and to 2001:db8::2 via ppp0 in the second example.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add a new API to cancel just one, or mathing requests,
instead of cancelling all ongoing requests.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
poll() only for sockets that have traffic ongoing or have some lifetime
left.
On socket failures during a poll(), stop listening for the socket.
Application can recover by reconnecting the socket.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When the client fails when parsing the response and we stop proceeding,
we should report that to the application.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Even if we receive duplicate confirmable message, we should still
respond with the Ack. Just don't deliver the second callback.
This is achieved by moving the MID deduplication to after Ack handling.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Return the -errno when zsock_sendto() or zsock_recvfrom() fails, so
rest of the code can deal with return values, instead of separately
comparing errno and return value.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When response is received and handled, don't just clear the structure
but instead mark it as ongoing=false.
So if we later on receive a duplicate response for it, we can still
respond with Ack or Rst.
This is achieved by using release_internal_request() when we don't
expect any response for it and reset_internal_request() when we really
fill up a new request.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The sock_obj_core_dealloc() was not called if close() is called
instead of zsock_close(). This happens if POSIX API is enabled.
Fix this by calling zvfs_close() from zsock_close() and then
pass the socket number to zsock_close_ctx() so that the cleanup
can be done properly.
Reported-by: Andreas Ålgård <aal@ixys.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
SNTP simple runs request iterations with exponential backoff.
If the net interface is a slower connection (ie. CAT M1 modems)
then the request will be sent but the response may take time to
be received, thus causing a timeout and another request to be sent.
Because of the nature of UDP and the fact that the same socket
(source IP/port combo) is being used for both requests, a delayed
response to the first request can be received as the response to the
second request, causing -EINVAL to be returned when the timestamps
mismatch (see subsys/net/lib/sntp/sntp.c). The solution provided
retries receiving the response when the timestamp is mismatched
(without sending an additional request).
Signed-off-by: Marcus Penate <marcus.penate@ellenbytech.com>
Because we might get answers in capital letters, convert the answer
to small case letters and also make sure we send query in small case
latters. This makes sure that our query_hash is properly calculated
regardless of how the resolver gets the data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allocate one extra pointer for the DNS server list so that
DNS resolving code can detect the end of the list.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In receiving thread, continuing the loops is based on
has_ongoing_exchanges() so it does not need atomic
coap_client_recv_active variable.
When idling, it wakes from semaphore. But there was potential
deadlock when coap_client_schedule_poll() would not signal the
semaphore, if atomic variable was already showing that it runs.
Removing the atomic variable removes this deadlock.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
It is error prone to flag separate booleans, so try to use
reset_internal_request() every time we release the internal request
structure.
Also refactor the reset_internal_request() so that we reset the
timeout value so it does not trigger again.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If send() fails, we have not technically send the CoAP retry yet, so
restore the same pending structure, so our timeouts and retry counters
stay the same.
This will trigger a retry next time the poll() return POLLOUT, so we
know that we can send.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Refactor the CoAP retry handling into the handle_poll() function,
so that we only try to send retries if the socket reports POLLOUT.
Also move the receiving into same loop, so when poll() reports POLLIN
we recv() the message and handle it before proceeding to other sockets.
Also fix tests to handle POLLOUT flag and add support for testing
multiple clients.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When transmission of first request fails, reset the internal request
buffer as there is no ongoing CoAP transaction.
Application can deal with the failure.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
If POSIX_API is not configured the close function is not available.
Use zsock_close instead.
Signed-off-by: Andreas Huber <andreas.huber@ch.sauter-bc.com>
Add TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to the list for use with x509
certificates. The LWM2M v1.1 specification says that a LWM2M client
which used X509 certificates must support this ciphersuite and
additional ciphersuites may be supported.
Signed-off-by: Jeroen Broersen <jbroersen@interact.nl>
Before this patch, any unexpected socket error during poll (caused by
LTE disconnects for instance) would lead to a infinite loop because the
error state was never cleared, handled or even signaled to the user.
Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
As the socket service API is currently used by mutiple applications
(dhcpv4 server, dns, telnet), it should be marked as unstable,
according to the docs:
https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
remove k_work related code and change
the argument of the callback to `struct net_socket_service_event`.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Switch from using direct `strtol` calls to `shell_strtol`.
This change leverages the extensive error handling provided
by `shell_strtol`.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Since `<host>` is a mandatory argument, the (_mand, _opt) values
should be adjusted to 2 and 12, respectively.
Note that `_mand` includes the number of mandatory arguments,
including the command name (`ping` itself).
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This patch adds a feature to directly connect to stored Wi-Fi
credentials without having to compose the NET_MGMT commands yourself.
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
Upstream NCS's library for storing Wi-Fi credentials.
This library allows storage of Wi-Fi credentials
using different backends.
Either the Zephyr settings subsystem
or the PSA secure backend can be used.
For testing purposes, credentials can be defined statically.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
Signed-off-by: Kaja Koren <kaja.koren@nordicsemi.no>
Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
Currently GCC complains that temp64 may be used uninitialized in this
function. Adds a check to ensure time is valid before assignining
and fixes GCC warning.
Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>
The library provides Prometheus metrics
types, collector and exposion formatter.
The library isn't thread-safe for now.
The next first pull request will support
that. Can be use exposion formatted
output with Zephyr Http server.
Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
Seen when having multiple network interfaces that the sock_error
was 0 even if the socket was serviced properly. So if SO_ERROR
returns 0, just ignore it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We must register all listening sockets under one file descriptor
array when calling dns_dispatcher_register() which then calls
net_socket_service_register(). The socket services expects all
the registered sockets under one service context to be in one
array. If this is not done, the latest socket array wins and
the earlier registrations are forgotten.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>