Silently drop the IPv6 Neighbor Advertisement if we receive it
for an unknown neighbor or if there some some issue in the packet.
Returning error here would cause the ICMP module to print an
actual error which just pollutes the log without any apparent
benefit.
Fixes#66063
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
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>
* Check IPv4 TTL or IPv6 hop limit and drop the packet if
the value is 0
* Check the IP addresses so that we do the loopback check
at runtime if the packet is destined to loopback interface.
* Update the statistics properly for dropped packets.
* Do not update sent packets if we drop packets.
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>
The net_if_ipv6_set_hop_limit() API was missing the "_if_"
part in it. Fix this so that the network interface API is
consistent. The old function is deprecated and should not
be used. The old function is left to the code and it calls
the new properly named function.
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>
Commit 55802e5e86 fixed error handling of
TX errors, in case ARP request was generated. There are however also
other places where post-ARP cleanup should be done on the TX path (like
running out of buffers for Ethernet L2 header allocation).
This commit fixes those cases in ethernet_send(), where function would
exit early and report error after ARP prepare stage.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Long arguments are handy for new users. Also use hyphen's rather than
underscore to follow the convention.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Newly added security types are missing from the help. Also, now that we
have two variants of PSK, use the prefix to disambiguate.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
When interface names are enabled, a default name is applied
after initialization. Unintuitively, this overwrites any name that is
set during the net_if init.
This change sets a default name first, and then allows net_if
init to overwrite that default name if it chooses to.
Signed-off-by: Noah Luskey <noah@silvertree.io>
Signed-off-by: Noah Luskey <LuskeyNoah@gmail.com>
While printing SSID in wifi status command, If the
length is maximum(32 character). It leads to buffer
overflow. It required one character for null
terminator ‘\0’. Changing the Format Specifiers to
print proper SSID.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
This fix addresses wrong announce message length warning message.
TLV is a variable length (4+8N) based on the 802.1AS-2011 (table 10-8). In
Zephyr TLV is fixed to 12 bytes. TLV type and length are already taken
into account in the announcement message length.
Signed-off-by: Mario Paja <mario.paja@zal.aero>
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>
Fix two issues with sending ICMP Echo Reply for requests sent for
multicast address:
* Use the originator IP address instead of multicast when selecting
source address for the reply
* In case no address match is found, drop the packet, instead of
replying with unspecified address.
Signed-off-by: Robert Lubos <robert.lubos@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>
Fix the possible race between TCP work items already scheduled for
execution, and tcp_conn_unref(), by moving the actual TCP context
releasing to the workqueue itself. That way we can be certain, that when
the work items are cancelled, they won't execute. It could be the case,
that the work item was already being processed by the work queue, so
clearing the context could lead to a crash.
Remove the comments around the mutex lock in the work handlers regarding
the race, as it's not the case anymore. I've kept the locks however, as
they do make sense in those places.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If some specific option is not enabled, then add missing
ARG_UNUSED() calls in relevant functions.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Set separate option setters for bool, uint8_t and uint16_t
values. Use those generic setters when storing the desired
option value.
The uint16_t option setter stores the value to uint16_t variable
and expects that user supplies int value.
For uint8_t value, it is expected that uint8_t value is supplied
instead of int.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Set separate option getters for bool, uint8_t and uint16_t
values. Use those generic getters when fetching the desired
option value.
Noticed mixed usage (bool vs int) for txtime option. Changed
the code to use int type like in other options.
The uint16_t option getter gets the value from uint16_t variable
but returns int value to the caller, and also expects that user
supplies int value.
For uint8_t value, it is expected that uint8_t value is supplied
instead of int.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The Zephyr's core ethernet code had to be adjusted to support setting T1S
PLCA parameters from user Zephyr programs.
Such approach allows more flexibility, as T1S network configuration;
especially PLCA node numbers, can be assigned not only via device tree
at compile time. For example user can read them from EEPROM and then
configure the network accordingly.
For now - the union in struct ethernet_t1s_param only consists of plca
structure. This can change in the future, when other T1S OA parameters -
like Receive/Transmit Cut-Through Enable (bits RXCTE/TXCTE in OA_CONFIG0
register) are made adjustable from user program.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
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>
Regular OpenThread upmerge to commit `75694d2`.
Move CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE
from header file to Kconfig.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@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>
Add low level support for setting IP_PKTINFO or IPV6_RECVPKTINFO
socket options. The support is disabled by default.
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>