Add support for the IPV6_MULTICAST_LOOP socket option.
This option allows enabling or disabling the consumption of multicast
packets by the sender. By default, the socket option will be enabled.
Co-authored-by: Pieter De Gendt <pieter.degendt@gmail.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
TLS_CREDENTIAL_SERVER_CERTIFICATE credential type is misleading, as in
fact it just represents a public certificate, it does not matter if the
certificate belongs to a server or a client. And actually, it was
already used in-tree for clients as well, for example in LwM2M.
Therefore rename the credential type to a more generic
TLS_CREDENTIAL_PUBLIC_CERTIFICATE and deprecate the old one.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If there are no virtual interfaces attached to this virtual
interface, check if there is a RX handler for this virtual
interface and pass data to it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Clear all previous events when register is called a second time. This is
the same behavior as before, if the call happens with `len` equal or
greater then the previous call but in the case if `len` is less then the
first call, now, all events are cleared. This is more predictable behavior.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Keep the err in code as it is convention in Bluetooth code, remove ret,
change error_code as avdtp_err_code for avdtp protocol error.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
We drop the packet if TTL or hop limit is 0, but we should
also unref the packet in this case because we return 0 to
the caller which is not then able to free the packet because
it thinks that the packet was sent properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The check_ip() in net_core.c did not check that the packet
Ethernet type is either IPv4 or IPv6. This meant that we for
example checked TTL also for ARP packets which is pointless as
those are not IPv4 packets.
Fix this by checking the link layer protocol type of the packet
to be either IPv4 or IPv6 before doing L3 checks.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Adding a helper to parse one or more IPv4/6 strings with optional
netmask or prefix length.
Example of the string:
2001:db8::1/64,192.0.2.1,2001:db8::2,192.0.2.2/24
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
All connection information was printed only if connection debugging
was enabled which then did not print information about Wireguard or
DHCP handlers. Limiting the printouts like this is not really needed
so print all connection information with "net conn" command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
It is useful in testing to allow user to change the default
network interface by "net iface default <index>".
Also print out the default interface for "net iface" and
"net iface default" commands.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Sometimes it is useful to view low level network interface information
in the network shell. Enable such prints if network interface debugging
is enabled.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add sys_trace_idle_exit to RISCV cpu_idle functions and allow
enabling CPU_LOAD module for RISCV and disable it for SMP.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.
The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.
This commit adds a babblesim test for the new API,
as well as a shell command.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The current overhead check needlessly flushes some events for
CONFIG_BT_TICKER_SLOT_AGNOSTIC resulting in some lost or incomplete
advertising events; Use a lower overhead value for this configuration
to avoid that
Signed-off-by: Troels Nilsson <trnn@demant.com>
For a CIG with a CIG Sync Delay larger than a SDU interval, we cannot
be sure that we can target the very next ISO event when the CIG event
is ongoing; Only reduce event_offset if CIG Sync Delay is smaller
than an SDU interval
Signed-off-by: Troels Nilsson <trnn@demant.com>
Add more parameters to command `connect` and `register`, including mode,
mode_optional, extended_control, and hold_credit.
Add command `credits` to give the rx credit.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a sub-command set `l2cap` for command set `br`.
Move command `l2cap-register` to sub-command set. And rename it to
`register`.
Add command `connect`, `disconnect`, and `send` for command set
`l2cap`.
Remove original net buffer pool from `data_pool` to `data_rx_pool`.
Add a net buffer pool `data_tx_pool` for command `send`.
Do not wait anymore if no net buffer can be allocated from
`data_rx_pool`.
Dump all received data in L2CAP data received callback.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Improve the retransmission and flow control to support sending
multiple SDU at the same time if the TX windows is not full.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add mode optional support for BR l2cap connect initiator role.
If `chan->rx.optional` is true, set the mode to basic mode instead of
return error code `-ENOTSUP`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Enable signaling channel configuration for retransmission and Flow
control feature.
Send I-frame and S-frame. Support retransmission and Flow control for
sending.
Receive and handle I-frame and S-frame.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The original flow of socket_service thread handling the Zperf UDP RX
packets is: zsock_poll() polls all sockets for events, if ctx->recv_q
of Zperf is not empty, it will call trigger_work() -> udp_recv_data()
-> zsock_recvfrom() to read only one UDP packet from ctx->recv_q, then
go back to zsock_poll() and run the same process again, which is
inefficient.
The alternative solution is, in udp_recv_data(), it should exhaust all
the packets in the current ctx->recv_q, and then go back to
zsock_poll() to run the same process again.
In our Wi-Fi test case, for WPA3 security mode of 5GHz, the STA UDP RX
throughput can be improved from 91.48 Mbps to 99.87 Mbps, the SAP UDP
RX throughput can be improved from 85.97 Mbps to 96.00 Mbps.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
ENTROPY_NRF_CRACEN_CTR_DRBG symbol is based on devicetree
node with compatible nordic,nrf-cracen-ctrdrbg. It does not
have to be selected explicitly.
Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
The stack will no longer implicitly set the data path
for ISO channel, and the responsibility for doing that is
now for the upper layers/applications.
This provides additional flexibility for the higher layers
as they can better control the values and timing of the data
path, as well as support removing and even reconfiguring the
data path at will.
This also removes some complexity from the stack.
This commit also fixed a inconsistency in the disconnected
handler. CIS for centrals as well as BIS were still valid
bt_iso_chan channels in the disconnected callback,
but CIS for peripherals were completely cleaned up at this
point. This issue is fixed by moving the disconnected callback
handling to before the code to cleanup the channel for
peripherals.
Since there is a difference in how you remove data paths
depending on the GAP role (central/peripheral), the
iso_info struct type has been expanded to be more
concise of which type of CIS it is.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This was inspired by the detection of 2 instances of the warning:
warning: 'strncpy' specified bound 16 equals destination size
[-Wstringop-truncation]
The current code is already safe with regards to overflows, because
fixed-length string functions are used in the call tree. However, when
given a name 16 chars or larger, the current compare in llext_by_name()
will not work as expected because the stored extension name is truncated
to a max of 15.
Define a global LLEXT_MAX_NAME_LEN constant to simplify all this logic
and also implement name checks in the shell before calling llext_load().
Finally, using strlen() instead of strnlen() gets the real length of the
hex string passed as a parameter, which is important for the next safety
check.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Currently, the L2 PPP won't work with AF_PACKET socket family as it only
supports packets from AF_INET/AF_INET6 families. Because of this, it's
not possible to use AF_PACKET RAW or DGRAm sockets with PPP interfaces,
as the packets they generate have family field set to AF_PACKET.
Fix this, by verifying the LL protocol field in the PPP L2 before
passing the packet the respective PPP driver. If the AF_PACKET packet is
received, and the protocol field is set to IP/IPv6, update the packet
family to AF_INET/AF_INET6 accordingly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Use %zu for size_t and %zd for ssize_t, and don't use those specifiers for
any other type. Also make sure that field width specifiers get typecast to
the expected int type.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
This commit moves the assignment of backend IDs from the 'z_log_init'
function to the earlier 'log_core_init' function. This ensures that
backend IDs are assigned before they are used in the 'log_backend_enable'
function, preventing incorrect settings of log dynamic filters.
Signed-off-by: Dong Wang <dong.d.wang@intel.com>
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr
properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV6_CONNECTED
events.
Fixes: 1a5e13a79b ("net: if: Release the interface lock early when
starting IPv4 ACD")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr
properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV4_CONNECTED
events.
Fixes: 1a5e13a79b ("net: if: Release the interface lock early when
starting IPv4 ACD")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Instead of re-implementing or assuming that POPCOUNT is available
we now use the generic function from Zephyr.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix connection update microsecond interval variable data
type, to use 32-bit so that a value upto 2000 seconds, i.e.
4 seconds interval and 499 peripheral latency can be stored.
Regression in commit abfe5f17a9 ("Bluetooth: Controller:
1 ms connection").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This patch adds support for alignment requirements for sections in the
loader. The alignment requirements are taken from the ELF file and
checked when the section is mapped to a memory region and when the
region is copied to memory (or directly used from the ELF buffer).
Supporting a larger alignment requirement than the region's current
alignment is done by adjusting the region's start address. This needs
care to avoid detecting false overlaps with other regions and to ensure
that the region address and size reported by the inspection APIs are
correct. The extra offset needed to re-adjust these values is stored in
the 'sh_info' field of the region descriptor.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Since commit 0aa6b1c9de, the 'ldr_parm' pointer is guaranteed to be
valid inside all the functions of the llext_load() call tree.
This commit fixes the only exception of llext_copy_strings(), which was
not passed the 'ldr_parm' pointer, and remove the redundant checks.
No functional change is intended by this commit.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit adjusts the logic of the LLEXT memory allocation routine by:
* defining 'align' and 'alloc' variables once and updating them in the
following code;
* swapping the condition, converting it to an 'if(IS_ENABLED(...))' and
using a direct calculation for the size to make the code easier to
read;
* updating and extending a few comments.
No functional change is intended.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Since 3466dab804 the generic llext_symbol_name() function abstracts
the use of llext_string() for (non-section) symbols. Define a similar
llext_section_name() function and replace current occurrences of
llext_string() with the proper abstraction.
By extending llext_symbol_name(), this commit also allows to print the
correct name of sections that are referred to by a symbol.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Rewrite the overlap checks in llext_map_sections() to use a pair of
macros to calculate the top and bottom of a region. This makes the
code more readable and less error-prone.
No functional change is introduced in this commit apart from a log
message format change.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Use the more compact %#x format for printing out hexadecimal values in
the LLEXT subsystem. This also uses a clearer wording for the
llext_link() log message that avoids repeating information.
No functional change is introduced by this commit.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
llext_copy_section() is a misnomer, as it is copying a region of memory,
not a section. Rename it to llext_copy_region() and use 'region' in the
internal variables to better reflect their purpose.
No functional change is introduced in this commit.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>