As the allocation is run in system workqueue context, it can
cause problems if waiting forever when allocating net_pkt.
Fixes#77935
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.
Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Move the net_buf implementation from the networking subsystem to a library
as they have no dependency on the networking subsystem.
Network buffers are used in subsystems outside of networking
(e.g. Bluetooth, USB).
Fixes: #36374
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
When virtual interface is being started or stopped so when the
interface is brought up or down, check the return code and pass
it to net_if_up() or net_if_down() calls.
This helps to avoid printing success status even if the interface
up/down failed at the virtual interface level.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The legacy bridging code prevented normal IP traffic to the
bridged Ethernet interfaces. This is not intuitive and differs
how bridging setup works in Linux. This commit changes that and
creates a separate virtual interface that is doing the actual
bridging. This enables the bridged Ethernet interfaces to work
normally and provide IP connectivity.
How this works in practice:
* User needs to enable CONFIG_NET_ETHERNET_BRIDGE
* User needs to have a device with more than one Ethernet
interface
* After booting, the net-shell or program API can be used
to add interfaces to the bridge like this.
net bridge addif 1 3 2
where the 1 is the bridge interface index and
2 and 3 are the Ethernet interface indices.
* The bridging is then finally enabled / started when the
bridge interface 1 is taken up
net iface up 1
* If bridged interfaces are removed from the bridge (minimum
of two interfaces are needed there), then the bridging is
disabled automatically. The bridge interface stays up in
this case and can be taken down manually.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow application to register certain HTTP request headers to be stored
by the server. These stored headers can then be accessed from a dynamic
resource callback.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Changed NET_CONFIG_CLOCK_SNTP_INIT depends on to require
POSIX_TIMERS instead of the deprecated POSIX_CLOCK
Signed-off-by: Luca Arato <luca.arato@secomind.com>
Without this it is not possible to serve both IPv6 and IPv4
connections if service host is NULL.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow NULL host parameter when creating HTTP service. This means
that the socket is created without specifying binding address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Adds missing checks for get_capabilities method not being NULL.
Fixes crash with netusb and possibly other drivers.
Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
Using strncasecmp to match HTTP headers can give unexpected results when
the strings to be compared match up until the end of one string, but the
other string contains additional characters. This can result in falsely
matching a HTTP header value, for example:
strncasecmp("Upgrade-Something", "Upgrade", sizeof("Upgrade") - 1) --> 0
In this case we know that both strings are NULL terminated since one is
a string literal and we have just length-checked and explicitly NULL
terminated the other. So we can just use strcasecmp without a max
length.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
The lwm2m_check_buf_sizes() function was not checking resources of
type LWM2M_RES_TYPE_U16, which could lead to potential overflows
when writing larger data types into U16 resources. Add a case for
LWM2M_RES_TYPE_U16 to properly validate the buffer size.
Fixes#77016
Signed-off-by: Hyunsu Yoon <piedroconti@naver.com>
If IPv6 is enabled, the fixed size net_buf data needs to be
large enough so that the full IPv6 header with extensions
can fit to one net_buf packet.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Increase wifi connect input parameters max count to 13. Previous count
7 is not enough if other security type is supported.
When enabling softAP, the parameter cnx_params in cmd_wifi_ap_enable()
is with static key word. Then the parameter will always save
configurations of last time. Remove static keyword to eliminate effects
of configs from last tim and do memset before setting up softAP.
Signed-off-by: Hui Bai <hui.bai@nxp.com>
Increase max count of CONFIG_WIFI_SHELL_MAX_AP_STA from 5 to 8. The
SoftAP of NXP wifi chip can support up to 8 stations.
Signed-off-by: Hui Bai <hui.bai@nxp.com>
Added new flag CONFIG_WIFI_NM_HOSTAPD_AP for hostapd support. Once this
flag is enabled, softAP will be setup by hostapd. Both wpa_supplicant
and hostapd uses same task and eloop.
Included necessary hostapd files when compiling wifi samples if
CONFIG_WIFI_NM_HOSTAPD_AP is enabled. Added hostapd support for all
softAP command of L2 wifi shell commands.
Signed-off-by: Hui Bai <hui.bai@nxp.com>
This commit addresses an issue in net_context_bind() where unaligned
memory access was not properly handled when checking for INADDR_ANY.
The problem primarily affected MCUs like ARMv6 that don't support
unaligned memory access.
- Use UNALIGNED_GET() to safely access the sin_addr.s_addr field
- Ensures correct behavior on architectures with alignment restrictions
This fix improves compatibility and prevents potential crashes or
unexpected behavior on affected platforms.
Signed-off-by: Daekeun Kang <dkkang@huconn.com>
If we receive incoming neighbor solicitation packet and drop
it for some reason, ignore some of the errors which are not
really errors so that the icmpv6 handler does not complain.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure that incoming DAD NS message is allowed in
so that we can detect duplicate address detection NS packets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Net capturing would not link when either IPv6 or IPv4 was switched off
due to missing symbols. This change allows for capturing a single IP
protocol only.
To reproduce:
samples/net/sockets/http_client/prj.conf
```
-CONFIG_NET_IPV4=y
+CONFIG_NET_IPV4=n
-CONFIG_NET_CONFIG_NEED_IPV4=y
+CONFIG_NET_CONFIG_NEED_IPV4=n
+
+CONFIG_NET_CAPTURE=y
```
This will cause the following linker error:
```
.../subsys/net/lib/capture/capture.c:648:
undefined reference to `net_if_ipv4_get_ttl'
```
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Improved debuggability of IEEE 802.15.4 network management commands.
Some of these conditions were especially hard to debug (e.g. invalid
channels due to the wrong driver being selected, conflict between
settings, ...)
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
ENABLED suffix does not really makes much sense for a kconfig
so it should be removed. Also other MBEDTLS symbols were recently
updated accordingly.
Moreover having it named exactly the same way as in Mbed TLS
symplifies the understanding of what this kconfig is doing.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Building with NEWLIBC triggers warnings about
snprintf since stdio is no longer automatically
included by printk.h
This PR switches to using snprintk to avoid these
warnings.
Fixes#77330
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
According to recvmsg man page, msg_controllen should be set to the sum
of the length of all control messages in the buffer.
This is missing from the current recvmsg implementation.
This commit aims to fix this by updating msg_controllen each time control
data are added to the buffer.
This commit also fixes cases where the msg_controllen is cleared
incorrectly.
Fixes#77303
Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
All the network related shell activities should be under
network shell so moving it to "net bridge ..." command.
Add this information to migration guide.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit ensures that the state of the address can be changed from
the Deprecated state to the Preferred state.
Additionally, an issue with improper memory comparison size for the mesh
local prefix has been fixed.
Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
dhcv4 server was not providing the dns server details to the
client because dns option was handled. Added the dns server
option to be send to the client as response form dhcpv4 server
Signed-off-by: Muhammad Haziq <muhammad.haziq@zintechnologies.com>
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Adds commands for triggering conn_mgr functions and
tweaking conn_mgr connectivity flags.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add basic WPA2 EAP-TLS support.
Also, add test infrasturcture esp. the certification handling,
non-certificate credentials are take as runtime input and certificated
are build time input for testing.
A real application can set certificates at runtime too.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
TX time tracing tells how long it took from network packet
creation to when the stack got rid of it.
So the network stack allocates net packet, this is the
start time. The end time is when the packet is fully processed (sent)
by the network device driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
RX time tracing tells how long it took from network packet
creation to when the stack got rid of it.
So the network device driver allocates net packet, this is the
start time. The end time is when the packet is fully processed.
Currently the limitation is that the RX time duration is used
for network packets that are tied to an open socket.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For two reasons:
- prevent exposing the previous user's info to the new user
- make NULL checks on user_data work
Since we don't really have a field that specifies what part of the
user_data array is valid, we have to rely on other checks.
Such a check, if user_data contains a callback, is comparing against
NULL before calling said callback.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>