Instead of using 32 bit enum values for event numbers, convert
the code to use 64 bit long bit fields. This means that the
user API is changed to use 64 bit event values instead of 32
bit event values.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
SUBALIGN forces alignment to the specified value, even if the object
requires stricter alignment. This causes mis-aligned access when accessing
the resulting value.
Signed-off-by: Keith Packard <keithp@keithp.com>
In high throughput tests it's fairly easy to overflow the current 32-bit
byte counters in net statistics (it's just over 4 GB of data).
Therefore, make the byte counters 64-bit to prevent overflows.
Rearrange some fields to avoid padding.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
For 'wifi connect' or 'wifi ap enable' CMD, there is 'invalid option'
error log when input '-i' parameter. Parsing '-i' can fix this issue.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
remove phy related configs from eth config.
phy related configs chould go directly into the phy.
Most ethernet drivers didn't support the now removed
functions yet. Users should instead use `phy_configure_link()`
together with the `net_eth_get_phy()` function.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The help message for the wifi mode -s command indicates it sets
the Wi-Fi mode to station. However, the Zephyr Wi-Fi shell subsystem
was incorrectly using a get operation instead of set.
This commit corrects the behavior to properly set the Wi-Fi mode,
aligning the implementation with the help message.
Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
Soft ap supports WIFI_BTWT_AGREEMENT_MAX BTWT sessions.
The BTWT parameters for each session can be different.
The current usage can only set one set of parameters.
All sessions follow this set of parameters.
Add enhance code to support setting different
BTWT parameters for every sessions.
Usage:
wifi twt btwt_setup <sta_wait> <offset>
<twtli> <session_num>
<id0> <mantissa0> <exponent0> <nominal_wake0>
<id1> <mantissa1> <exponent1> <nominal_wake1>
<idx> <mantissax> <exponentx> <nominal_wakex>
The total number of '0, 1, ..., x' is session_num
For example:
wifi twt btwt_setup 0 0 0 2 0 112 10 128 1 32 10 64
Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
Added network type check to fix the system crash caused by non-wifi
network card calling wifi api interface
Company:BSH Crop
Signed-off-by: Chen Tao <ct05342@163.com>
During previous commit of adding interface arg, wrongly change the
parameter count of 'wifi ap enable' to a small one. Change the value
to 47 can fix this issue and match the need of adding interface arg.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
In order to support working with multiple VIFs (e.g., STA + AP) add
interface as an option for all commands.
The interface can belong to same chipset or different (hypothetical).
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
When PPP net_if is changed to dormant, the PPP connection
is terminated asynchronously. This is used so that the driver
can terminate the PPP connection gracefully.
Note: net_if_down() is not used as it would require synchronous
operation which would block the system workqueue thus causing
deadlock.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Error checking of otIp6AddUnicastAddress() and
otIp6SubscribeMulticastAddress() was added recently, however it wasn't
taken into account that those APIs return an error on attempt to
register an IPv6 address that is already present on the OT interface.
Therefore, add more specific error checks, to return silently in case
address was already present.
As those two APIs are not very consistent, and otIp6AddUnicastAddress()
returns OT_ERROR_INVALID_ARGS in such cases, add an extra check if the
address is already present before attempting to register the address.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Many cellular modems attempt to negotiate an ACCM value of 0x00000000.
While the PPP driver rejects this by default, it does not propose an
alternative. As a result, some modems default to using 0x00000000 after
LCP negotiation. Because the PPP driver expects all control characters
to be escaped, this causes issues during decoding. This change
negotiates an ACCM value of 0xffffffff to ensure compatibility with such
modems.
Signed-off-by: Vytautas Virvičius <vytautas@virvicius.dev>
Move OpenThread-related code from
zephyr/subsys/net/l2/openthread/openthread.c to
zephyr/modules/openthread/platform/openthread.c.
The primary goal of this refactor is to enable the use
of OpenThread as an independent module, without the necessity
of Zephyr's networking layer.
This change is particularly beneficial for simple applications
that have their own implementation of the IEEE802.15.4 driver
and do not require a networking layer. These applications can
now disable Zephyr's L2 and IEEE802.15.4 shim layers and
directly use the OpenThread module, saving valuable kilobytes
of memory.
In this approach if the CONFIG_NET_L2_OPENTHREAD
Kconfig option is set, Zephyr's L2 and IEEE802.15.4 layers
will be used, and everything will function as before.
The main difference is the Zephyr's L2 layer now uses
the OpenThread module, no longer implementing it.
While most of the functions in include/net/openthread.h
have been deprecated, they are still available for use to
maintain backwards compatibility.
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
Current clock synchronization was always stepping clock. This was
causing large offset, and discontiguous ptp hardware clock time.
For TSN hardware, discontiguous ptp hardware clock time was not
able to be used for other TSN protocols.
This patch is to convert to frequency adjustment with a basic
PI control algorithm.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Shift the error handling for `ethernet_ll_prepare_on_ipv4` out into
`ethernet_send`, since that is the function that needs to handle the
various result types of the ARP process.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Make it clearer that the `net_buf_ref` is for `k_queue_unique_append`,
and reverse the reference if the queue add fails.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Update `net_arp_prepare` to return a return code instead of a pointer,
so that the various results of the function can be differentiated.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The new DSA framework purpose and changes are as below.
- Aligned to Linux DSA framework which has been already mature framework
for many years, For now in zephyr, the DSA components were splited
as: switch, port, master(not need driver file for now), slave, and tag.
Seperated drivers were used for maintaining and developing new
features.
- The unified dts bindings (aligned to linux) were supported. The port
driver would parse DTS to decide the port type (master port, slave
port, or cpu port) to set up the switch. All the ports registered as
standard ethernet devices. (dsa port and dsa switch tree was not
supported.)
- How to add DSA device driver based on the framework? All the device
driver needing to do is providing dsa_spi implementation and private
data, and calling below initialization.
DSA_INIT_INSTANCE(n, _dapi, data)
- For switch tag case, recv/xmit helpers in dsa_api could be used for
taging/untagging. No modified ethernet drivers.
For no-tag type case, ethernet driver of master port should support
packet injection/extraction for slave ports leaving NULL recv/xmit.
The dsa_nxp_imx_netc.c driver will be the first example of the new DSA
framework.
The future work for DSA will be supporting bridge for ports. We may align
Linux to give users two options to use DSA device:
- Standalone mode: the switch ports work as regular ethernet ports.
- Bridge mode: switch mode with virtual bridge device which could be
assigned IP address.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Current DSA TX/RX way was hard-coded in ethernet devices driver
with ETH_DSA_SUPPORT and NET_DSA.
This patch is to make such way obsolete, as we actually will support
a better DSA framework to handle this in NET/DSA core driver.
To make legacy devices not affected, below options are used instead.
- ETH_DSA_SUPPORT_DEPRECATED
- NET_DSA_DEPRECATED
Once the legacy devices are converted to new DSA framework, this code
could be removed.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Moved OpenThread-related Kconfigs from L2 layer to
modules/openthread. All of those configs were not strictly related
to the L2 layer, so they fits better to OpenThread module.
This operation allows using OpenThread Kconfigs even if L2 layer is
disabled.
Enabling NET_L2_OPENTHREAD also configures those configs by
selecting the OPENTHREAD kconfig, so there is no change regarding
backwards compatibility. The only change is that the Kconfigs
related to Thread were moved to the modules space, so their
location in the menuconfig also changed.
Once it is done, a choice for setting different L2 implementations
seems to be redundant.
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
RSA3K based certs are not supported on all platforms, so, keep both
variants, rsa2k (the older certs but with longer expiry 9999 days) and
rsa3k (latest ones) and we can have more variants in this folders.
Also, add a cmake variable to override the path with default as rsa3k.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Certificates usage depends on STA/AP mode, but we don't have that
information at a build time, so, make all certs as optional and if a
file isn't found then generate an empty header so that corresponding C
code will be built.
Any missing mandatory certificates will be validated before connection
and connection is failed.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Using TLS credentials library add support for run-time certificates where
the installed certs are retrieved from the credential store (as of now
only volatile backend is tested).
This helps in production environments.
Implements #79564.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Make sure that we check possible network packet filtering status
before accepting the packet.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The number of ports in gptp_domain.default_ds.nb_ports is a uint8_t.
A pointer to it is passed to gptp_add_port.
However, in this method, the pointer is cast to an int pointer.
The C compiler generates an int-size store for this.
In addition to potentially overwriting adjacent attributes, on platforms
such as RISC-V that do not support unaligned accesses, this causes an
exception on access.
This commit casts nb_ports to the correct type, uint8_t.
Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
Do not ignore return values of OT functions registering IPv6 addresses.
As this is called from the net_mgmt callback context, which returns
void, there's not much that can be done, other than logging the error.
To simplify the logging code and avoid the need to use extra buffer,
use net_sprint_ipv6_addr() networking utility function within the log
message to convert binary address to string.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
- Modified conditions in WIFI_CONNECT()
function to reject SAE password and
PSK based on length parameter
Signed-off-by: Nitin Pandey <nitin.pandey@silabs.com>
Fix the kconfig check for enterprise crypto support in AP mode.
Also, remove the unnecessary Hostapd enterprise crypto check in
credentials code.
Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
Some OpenThread functions were called without verifying the return
value, which not only is not the best practice, but also could lead to
build warnings with llvm. This commit fixes it.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The current mapping gets the network interface into dormant state when
Thread is not attached. While the node is not capable of doing multi-hop
communication when it's not attached, it should be able to do link-local
communication. This commit changes the mapping to look at OpenThread's
own network interface state instead without further checking Thread's
device role, so that link-local communication is supported when a node
in detached state.
Signed-off-by: Yakun Xu <xyk@google.com>
The least significant bit of the first octet of a MAC address is a
unicast/multicast bit. The bit should be cleared when generating a
random link address for a virtual interface. Any frames from such
interface/address will be dropped by the network as invalid if
the multicast bit is set.
Signed-off-by: Jack Chistyakov <jack.chistyakov@outlook.com>
The check for index out of bound is missing, It turns into a crash
for input channel more than WIFI_MGMT_SCAN_CHAN_MAX_MANUAL.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Fix compiler warning by adjusting the number of chars copied to the
destination. Compiler does not like if the destination size of the
`strncpy`-operation is the same as the number of characters written. Even
though it is not a bug in this case. Only copying size-1 characters fixes
the warning and exhibits the same behavior.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
The help text for connect says
[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]
but it disallows setting band to 0. Change this and allow
band 0 option when doing normal connect. Disallow setting
the band 0 when enabling AP mode.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The negative status code is actually the errno which we might
get returned from lower levels. For example if user sets -t
(timeout) option, the -ETIMEDOUT might be returned. In this case
map the errno value to connection timeout status value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If "wifi connect" fails, tell user why in textual format.
This helps debugging connectivity issues.
Signed-off-by: Jukka Rissanen <jukka.rissanen@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>
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>