Commit graph

5605 commits

Author SHA1 Message Date
Andreas Rudolf f531afbd2c net: lwm2m: Add config to always report obj version
Adds a config that enables sending the object version for all objects.

According to LwM2M specification v1.0 and v1.1, non-core object versions
other than 1.0 'must' be provided, while all other versions 'may' be
provided. With specification v1.2, a client 'can always attach Object
Version Information'. Or in other words, it is OK to always report the
object version with all specifications.

Signed-off-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
2024-04-23 21:26:39 +00:00
Peter Mitsis 02cc127475 linker: subsys: Use Z_LINK_ITERABLE_SUBALIGN
Updates the linker script fragments under 'subsys' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-04-20 13:45:25 -04:00
Jukka Rissanen b864cd9053 net: if: Do not add IPv6 address lifetime timer twice to list
The IPv6 address lifetime timers are kept in a slist, but
the code that adds the entry to the list does not check
whether the item is already in the list. This will cause
problems when trying to remove the address from the list.

Normally this is not causing issues, but if the function
net_if_ipv6_addr_update_lifetime() is called multiple times
before the address expires, then the item was added to the
slist multiple times.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-19 17:04:17 +00:00
Ravi Dondaputi b45ff98f47 wifi: shell: Support WPA auto personal security mode
Applications need to run a scan to identify the security
mode before attempting the connection which adds to the time
taken for connection to be established.
To avoid the initial scan, support auto security mode which will
enable STA to choose between WPA, WPA2 and WPA3, based on the
network configuration.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-19 16:40:29 +00:00
Ajay Parida 4d4b304e03 net: wifi_mgmt: Setting RTS threshold
Support to set RTS threshold.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2024-04-18 08:42:29 -07:00
Ravi Dondaputi 0e617a3929 net: wifi: shell: Remove redundant break
Having a `break` statement after `return` is redundant and
needs to be removed.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-18 08:07:35 -07:00
Ravi Dondaputi 72c81eec3b net: wifi: shell: Correct help text for connect command
Since `NONE` is a valid option for key management in `connect`
command, we should remove the part in help text which says:
"valid only for secure SSIDs".

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-04-18 08:07:35 -07:00
Konrad Derda 701b6aed4b net: shell: print interfaces per multicast route entry
This commit change a method of printing multicast routes by showing
all interfaces per entry instead of aggregating them by interface.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda 61dca2b8bf net: ipv6: add multiple interfaces to multicast routing entry
In order to save memory, a single multicast routing entry now
contains configurable number of network interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda 97fc5ea597 net: ipv6: check if multicast packet was forwarded
This commit adds a check to determine if the packet wasn't already
forwarded to a given interface.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Konrad Derda df34742df7 net: ipv6: use ARRAY_FOR_EACH_PTR() for iteration over mcast routes
This commmit changes the way of iterating over multicast routing
entries from explicit for-loop to ARRAY_FOR_EACH_PTR().

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Brad Kemp 3e2c067010 net: wifi: shell: update wifi ap enable to use get opt parsing
The commit 8256d02d3a introduced
getopt parsing for the wifi connect command
This needs to be updated for the wifi ap enable since ap
enable also uses the same parsing as connect.
The use of getopt removes the parameter ordering restrictions

Signed-off-by: Brad Kemp <brad@beechwoods.com>
2024-04-15 12:53:47 +02:00
Robert Lubos a0f0e55668 net: tcp: Fix FIN with data handling
In case FIN packet included data bytes, Zephyr would ignore the
data. It wasn't passed to the application, and it wasn't considered
when bumping the ACK counter. This ended out in connection timing out,
instead of being properly terminated.

Fix this, by refactoring FIN processing in TCP_ESTABLISHED state.
Instead of handling FIN/FIN,ACK/FIN,ACK,PSH cases separately, have a
common handler when FIN flag is present, and when ACK flag is present
along with FIN. When FIN is present, take any potentially incoming data
into account.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Seppo Takalo 51d80a9838 net: lwm2m: Allow CoAP block size to be changed
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.

It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-04-12 09:14:36 -04:00
Adam Matus 869d4fc041 net: zperf: Improve shell upload cmd
Minor improvements to usage of zperf_shell upload.
Added common defaults for the upload commands arguments.
Print defaults in cmd help.
Throw warning when user sets baud rate for TCP upload.

Signed-off-by: Adam Matus <adam.matus@nxp.com>
2024-04-12 11:54:49 +02:00
Jukka Rissanen d40abe8c0f net: vlan: Fix net_eth_get_vlan_tag() to check correct interface
The network interface parameter for net_eth_get_vlan_tag() should
be the VLAN interface so use the search loop properly.
Earlier the main interface could be checked.

Add also test cases for this so that we can catch that the func
works properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-12 11:54:33 +02:00
Robert Lubos b292a9e8b5 net: sockets: tls: Add more logging in case of errors
Add more error logs in case of (mostly) mbed TLS errors, so it's easier
to get an initial idea of what went wrong based on logs only. Getting
an information on an actual mbed TLS error code is quite helpful in such
cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-12 11:54:02 +02:00
Marco Argiolas f0212367dc net: lib: lwm2m: fix formula for expected next block
Block size is a 3-bit value mapping values [0, 6] to powers of 2 in the
range [16, 1024]. Value 7 is invalid.
The previous formula was not working in case the client's preferred size
was 4 (or more) times bigger than the server's.
This commit takes into account also the case the client's preferred size
is smaller than the server's.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-04-11 14:40:44 +02:00
Jonathan Rico e3ff993000 Network: L2: remove IPSP
Remove IPSP support from the tree.

It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 12:48:50 +02:00
Jukka Rissanen cb7aae6f82 net: dns-sd: Do not use sockaddr struct directly
The "struct sockaddr" should only be used in casts and never
as a standalone variable because it might not have enough
space allocated for all the protocol specific fields.
So refactor the port_in_use() function to reflect that.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-10 07:42:42 -04:00
Robert Lubos f77c7a3d05 net: dhcpv4_server: Fix positive error codes returned
errno values are positive, therefore they should be negated when
assigned as return values for net_dhcpv4_server_start().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-10 07:42:21 -04:00
Dominik Ermel 5a0ecb9641 flash: Move dependency on FLASH_PAGE_LAYOUT where it belongs
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
 FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-10 10:01:40 +02:00
Jukka Rissanen 85911bcfc1 net: mdns_responder: Avoid joining IPv4 mcast group if iface is down
Check if the interface is down before joining IPv4 mDNS multicast
group. This avoids warning later when the network packet cannot be sent.

Fixes #71121

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-10 10:00:49 +02:00
Nick Ward 17abc2743b net: lib: coap: set MAX_RETRANSMIT maximum to 100
Some application environments may need it.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-04-09 20:11:21 +02:00
Robert Lubos eeb527a5da net: Restore the default networking behavior on qemu platforms
Commit e99b5228a1 changed the default
networking behavior on qemu platforms, as the SLIP_TAP driver no longer
selected Ethernet L2. In results, qemu platforms in default
configuration had no network interface to work with.

Fix this, by restoring select for NET_L2_ETHERNET, but this time in
NET_SLIP_TAP. The difference is that SLIP_TAP is a generic driver
config, which could be enabled on any platform, so not changing the
behavior here, while NET_SLIP_TAP is a config dedicated for qemu only,
so it's reasonable to enable all that's needed to get SLIP to work with
qemu by default.

As there were circular Kconfig dependencies, move the respective qemu
configs outside of NET_RAW_MODE if block (as this caused the circular
dependency with ETH_DRIVER_RAW_MODE). Also, remove dependency to
NET_L2_BT, as it made little sense there, and also caused dependency
problems.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-09 13:56:08 -04:00
Kapil Bhatt a087a40ac6 net: wifi: Remove constraints for dwell time
There is no limitations for dwell time. Just add
valid condition for positive value. So , it's better
to remove those constraints.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-04-09 14:21:10 +02:00
Robert Lubos 837d09ed9e net: connection: Log an error when running out of contexts
Running out of connection contexts is most likely due to app
misconfiguration, therefore it's useful to get an explicit information
that context allocation failed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-09 11:05:10 +02:00
Georges Oates_Larsen 7fc6ef28d3 net: lib: http: Correct http_client edge-case behavior
Correct various small edge-case behaviors that have been accidentally
introduced in the http_client.

- http_client_req no longer incorrectly returns -ETIMEDOUT on NULL HTTP
  resonse. -ETIMEDOUT is now only returned when the underlying TLS
  socket times out.
- http_client_req now returns -ECONRESET upon incomplete (but non-NULL)
  HTTP response. The request callback is no longer called in this case
  (as with any other error state).
- http_wait_data has been refactored slightly to increase clarity.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2024-04-05 13:35:22 -05:00
Declan Snyder 69e0b03ca9 net: zperf_shell: Fix IPv6 invalid warning
Fix the ipv6 invalid warning always appearing when
a valid ipv4 address is provided.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-05 18:46:58 +03:00
Jukka Rissanen 4c45884c8c net: tcp: Give a warning to user if packet cloning fails
If the packet cloning fails (can easily happen when working with
loopback interface and when having low net_buf count), then
print a warning to the user. Error could also be possible but
as the situation might correct itself in this case, the warning
should be enough.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-05 16:45:32 +03:00
Fin Maaß a1ea9b7351 net: use appropriate sys_randX_get()
use the appropriate sys_randX_get() instant
of always sys_rand32_get().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:28:46 +02:00
Jukka Rissanen 83d879bb1a net: if: No error if mcast group join fails because iface down
If we fail to join all nodes or solicit node multicast groups
when the interface is down, then there is no need to print an
error message. The groups are automatically re-joined when the
interface comes up.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-05 12:19:27 +02:00
Jukka Rissanen 78a0cfbd94 net: shell: capture: Set capture device if user did not use shell
If user created the capture device using the API and not via
the shell, then the device name was not set. Use the default
capture device in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 2064306d41 net: capture: Generate events when starting / stopping capture
The event NET_EVENT_CAPTURE_STARTED is generated when the
capture is enabled, and NET_EVENT_CAPTURE_STOPPED when capture
is disabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 0516ce9311 net: capture: Add capture function that returns a status
The net_capture_pkt() does not return information what happened
to the net_pkt because the packet was always cloned. With cooked
capture we can avoid the cloning in which case we need to know
the capture status in order to unref the packet if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 46cb5c0bd1 net: capture: Add Linux cooked mode capture support
Add support for capturing arbitrary data via the cooked mode (sll)
capture API. The actual packet capture is done using net_capture_data()
function, the packet capture infrastructure does not need any changes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 3bd43ea865 net: Implement pseudo a.k.a "any" interface
Allow user to create a kitchen sink pseudo a.k.a any network
interface that one is only able to write to. This might seem
unnecessary, but it is possible to attach virtual network
interfaces on top of this pseudo interface. These virtual
interfaces could then process the data for example for
packet capture purposes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 00502a8894 net: Add helper to print the verdict as string
For debugging purposes it would be nice to see the verdict
printed as a string instead of number.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Jukka Rissanen 9a9f6f3d96 net: dummy: Add support for receiving data
Add a recv callback to dummy API. After this it is possible to
receive data by a dummy network interface. This is only useful
if one attaches a virtual interface on top of the dummy one.
One such example is the cooked mode capture interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-04 17:02:11 +02:00
Konrad Derda 377756e0f9 net: ipv6: mld: fix handling of MLD queries
This commit fixes an issue where due to inverted logic (static function
returned 0 on success but the caller expected true/false) the MLDv2
reports were silently dropped.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-03 15:30:03 -05:00
Robert Lubos f211cd6345 net: tcp: Deprecate CONFIG_NET_TCP_ACK_TIMEOUT
Deprecate CONFIG_NET_TCP_ACK_TIMEOUT as it is redundant with the
combination of CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT. The total retransmission timeout (i. e.
waiting for ACK) should depend on the individual retransmission timeout
and retry count, having separate config is simply ambiguous and
confusing for users.

Moreover, the config was currently only used during TCP handshake, and
for that purpose we could use the very same timeout that is used for the
FIN timeout. Therefore, repurpose the fin_timeout_ms to be a generic,
maximum timeout at the TCP stack.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-03 15:32:45 -04:00
Jukka Rissanen eff03ca071 net: shell: Add printout when hostname changes
Add hostname changed printout to event monitor. As the name
says, it is generated when the hostname of the device changes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-03 15:40:16 +01:00
Reto Schneider ccc58b8ce5 net: lwm2m: device object: Fix coverage compatibility
Starting with b1d24e425c (net: lwm2m:
device object: optionally store error list in settings), it was no
longer possible to build the code with coverage enabled when the
settings subsystem was disabled.

The build would fail with an error like this:

> subsys/net/lib/lwm2m/lwm2m_obj_device.c:262: undefined reference to
> `settings_name_steq'

This fixes #70923.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-04-03 15:39:49 +01:00
Marcin Gasiorek 9c0b8181f3 net: dhcpv6: Add configurable DUID buffer length
According to the `RFC8415` the length of the DUID is at least 1 octet
up to 128 octets. Now a user can choose buffer length without the need
for source code modification.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-04-03 10:28:20 +03:00
Declan Snyder db8a0b4b0c net: ethernet: Include ethernet API in eth_stats.h
eth_stats.h is using ethernet api but not including the header,
it must be working by luck in files that include it after
something else that includes ethernet.h, fix by just including it.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-02 21:02:25 -04:00
Reto Schneider da676d2e01 net: buf: Include user data when cloning
net_buf_user_data() is supposed to copy any data, which includes the
user data.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-29 16:00:39 -05:00
Robert Lubos 8e2722e1ca net: Provide separate configs for TX/RX memory pool for variable bufs
Instead of having a single config specifying the memory pool size for
variable-sized net buffers, have a separate one for TX and RX for better
configuration granularity when optimizing memory usage of the
application.

Deprecate the old configuration but use its value as a default (for now)
for the new configs. This will need to change when the config is
deleted.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-29 15:56:07 -05:00
Kapil Bhatt 6a0e6e4737 net: wifi: Replace numeric values with defines
There should be a particular defines which clarify the
use of that number. So, replacing numbers with defines
in wifi shell.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-03-29 15:08:00 +00:00
Seppo Takalo c62dd778cd net: lwm2m: Fix socket hints for block transfer
Outgoing block-transfers now set the socket hint
to ONGOING as long as the BLOCK1/BLOCK2 header has
MORE flag set to true.
This means as only the last packet in the block-transfer
set the socket hint to LAST or ONE_RESPONSE.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-03-28 16:02:34 -05:00
Chaitanya Tata 159617c8f6 net: wifi: Fix the Wi-Fi state check
Once Wi-Fi is associated few parameters like listen interval and
power-save mode cannot be changed. The state for association is
"ASSOCIATED" and not completed. Even after state transitions to
COMPLETE, it can still go back to other states, e.g., PTK/GTK renewal.

Fix the state check.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-03-28 14:47:50 +00:00
Jukka Rissanen def4a7ec12 net: gptp: Remove VLAN support
The gPTP is not suppose to be run on top of VLAN and the
earlier support was just for testing purposes. Remove VLAN
support now after the VLAN overhaul.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 3a67c6d8f5 net: arp: Enhance debug prints by printing interface index
Print also network interface index together with the pointer value
in order to get more useful information what is going on in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 0e6341cc22 net: ethernet: Enhance debug prints by printing ifindex
Network interface index number is useful to see in
debug messages so print it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 0de1a75f91 net: shell: Print multicast join status for iface cmd
Print information whether a multicast address is properly
joined to a multicast group when print addresses using
"net iface" command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 999c169d9d net: shell: Print VLAN name instead of interface type
As the interface type is always Virtual, no need to print it.
Print instead the name of the network interface as it is more
useful to the user.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen eb11a8af1c net: shell: Refactor VLAN configuration prints
Rework the way VLAN configuration is printed out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 092f7f7666 net: virtual: Do not try to send data if interface is down
Make sure the interface is up before trying to send data to
lower level interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen e9994c8af8 net: virtual: Force LAA bit for link address
Make sure LAA (locally administred address) bit is set for the
generated link address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 63081bd7da net: if: We can only rejoin mcast groups for native IP stack
No point trying to join multicast groups if the network interface
is offloaded one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen e3f1271fb9 net: if: Join all unjoined solicited node multicast groups
If an IPv6 address was added to the interface while the
interface was down, its solicited node multicast address
is not joined properly and IPv6 communication will to
other hosts will fail. So make sure to rejoin all the
solicited node multicast groups that were joined already
when the network inteface is going up.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 493c1c1f01 net: if: Add debug print when interface is taken up
Add debug information to print when the network L2 enable
callback is called and fails. Useful to see this information
as at that point the interface goes down.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen a96a2f8d09 net: if: Start IPv6 DAD when interface comes up
Start any pending IPv6 DAD timers when interface comes up.
If IPv6 addresses have been added to the network interface when
it was down, the addresses would never work properly if the DAD
is not done.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen b5bdc1fa6b net: if: Enhance debug prints when adding IP address to iface
Instead of printing just a network interface pointer, print
also the interface index so debugging is a bit faster as no
lookup from interface listing is needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen ff01324c9b net: if: Remove VLAN count checks
No need to do the checks any more because user has specified
the VLAN count and so many VLAN virtual interface are already
created.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 2058d8f139 net: ethernet: VLAN overhaul and refactoring
Re-implement the VLAN support inside the network stack.
All the user facing APIs stay as is but internally the VLANs
are implemented using the L2 virtual interfaces.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 42356b6d5c net: wifi: shell: Avoid declaring variables after case statement
Some compilers have trouble parsing variables directly after a case
statement.

Fixes: #70792

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 16:26:45 -05:00
Jukka Rissanen d7c9d67a9c net: Use always zephyr/posix/fcntl.h
Changing remaining users of fcntl.h to use the include from our own
POSIX file so that the values in there are consistent in all parts
of the sources.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 873af2ee98 net: sockets: Use only Zephyr POSIX headers
Use only Zephyr specific POSIX header files so that the whole
system is getting values from the same files. There was an issue with
native_sim run of tests/net/socket/af_packet which had O_BLOCKING set
to 0x4000 from include/zephyr/posix/fcntl.h, but then the file
subsys/net/lib/socket/sockets.c was having O_BLOCKING set to 0x0800
because different header files were used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 1b07425ead net: websocket: Use zsock_ API calls
Use zsock_ API calls so that we do not need to enable POSIX_API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen de52f8924f net: socks: Remove socket selection
Currently the socks library does not use sockets so there
is no need to select socket symbols.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 79585d5355 net: tftp: Use zsock_ API functions
The library should be using internal socket API functions
so that we do not need to depend on POSIX_API inside the
network stack.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen e6e6bb4242 net: socket: Create zsock_fcntl and fsock_ioctl functions
Have special wrappers for zsock_fcntl and zsock_ioctl functions
so that gcc warning can be avoided.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 3eeb0f0c7f net: sockets: Deprecate CONFIG_NET_SOCKETS_POSIX_NAMES
The CONFIG_NET_SOCKETS_POSIX_NAMES option is marked as deprecated in
favor of using normal POSIX socket API includes found under the
include/zephyr/posix directory. If you want to use BSD socket API calls,
you need to select POSIX_API and use the socket headers found in the
POSIX subsystem. If you do not want to or cannot enable POSIX_API,
then you must use zsock_ prefix when working with BSD socket calls.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Pisit Sawangvonganan e145eb9201 net: wifi: shell: adopt getopt_state for safer optarg access
By using `getopt_state` to access `optarg`, offering a better alternative
to direct global `optarg` access.

This approach mitigates the risks associated with concurrent access to
the global variable.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-03-27 14:33:51 +00:00
Pisit Sawangvonganan a6865c4191 net: wifi: shell: apply struct option as static const
This change marks each instance of the `struct option` as `static const`.

The rationale is that `struct option` is a read-only variable.
By using `static const`, we ensure immutability, leading to usage of only
the `.rodata` section and a reduction in the `.data` area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-03-27 14:33:51 +00:00
Pisit Sawangvonganan d9c6d30c25 net: wifi: shell: streamlined local variable initializations
This commit simplifies the access to structure members and omits
unnecessary variable initializations.

Specific adjustments include:
- Moving from pointer-based access (`(&regd)->chan_info`) to
  direct structure member access (`regd.chan_info`).
- Removing explicit initializations where not required.
- Removing excess backslashes '\' before '%' in the format string.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-03-27 14:33:51 +00:00
Jukka Rissanen d1ef9167da net: if: Make sure no other interface has same name
When setting a name to a network interface, verify that no other
interface has the same name as that would make very difficult to
select an interface by a name.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 14:32:34 +00:00
Reto Schneider 8918247f37 net: buf_simple: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Reto Schneider 9b2312d055 net: buf: Fix cloning of zero-sized buffers
For zero sized buffers, instead of pointing to a buffer, net_buf->__buf
is NULL. For this reason, when cloning a buffer, the code needs to check
__buf before dereferencing it.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:31:21 -04:00
Ravi Dondaputi 73ed81ccce net: wifi: shell: Support BSSID configuration
Add support for BSSID configuration in connect call.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-03-26 11:13:21 -05:00
Ravi Dondaputi 8256d02d3a net: wifi: shell: Use getopt API for connect options
Use getopt API to process the arguments passed with connect
command.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-03-26 11:13:21 -05:00
Jukka Rissanen 9fb8d511e1 net: if: Set default interface name if needed
If the driver does not set the interface name, then set
a default name for it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-26 12:01:51 -04:00
Marco Argiolas 2f35d11bfe net: lib: lwm2m: block 0 resets prev block transfer for same resource
As stated in "[RFC7959], Section 2.5":
   "The Block1 Option provides no way for a single endpoint to perform
   multiple concurrently proceeding block-wise request payload transfer
   (e.g., PUT or POST) operations to the same resource.  Starting a new
   block-wise sequence of requests to the same resource (before an old
   sequence from the same endpoint was finished) simply overwrites the
   context the server may still be keeping."

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-03-26 09:38:55 +00:00
Marco Argiolas 215782aa5c net: lib: lwm2m: fix function parameter for SW management object
Fix build error.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2024-03-26 09:38:55 +00:00
Jukka Rissanen 280391ded8 net: ipip: Refactor the IP tunneling support
Refactor the IP tunneling support as the input callback was removed
in previous commit. The data will flow through the recv callback now
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-25 17:07:43 +01:00
Jukka Rissanen 2c1f10b60e net: virtual: Remove the input callback as obsolete
The input callback was an unfortunate idea which just complicated
how the packet flows through virtual interfaces so removing it.
The data is passed normally through the recv callback from now on.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-25 17:07:43 +01:00
Jukka Rissanen f61453de10 net: virtual: Add statistics collection
Collect statistics of sent/received network packets for the
virtual interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-25 17:07:43 +01:00
Jukka Rissanen ce8c618b6b net: virtual: Fix the virtual L2 receive function
The function needs to loop through the virtual interfaces
tied to this physical interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-25 17:07:43 +01:00
Kapil Bhatt c1e29cc107 net: wifi: Add channel validity check for AP mode
Channel is mandatory for AP mode. It is processed only
if its less than or equal to three characters. Otherwise
we need to throw error for channel in AP mode.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-03-25 16:18:18 +01:00
Reto Schneider 9dd87a7194 net: buf: Support copying of user data
This functionality is useful on the following scenario:

1) The first buffer in a net_pkt contains user data which is relevant
   for the (whole) net_pkt.
2) When inserting a new buffer in front of the net_pkt, the (previously)
   first buffer (and its user data) are no longer accessible via
   net_pkt->buffer.
3) net_buf_user_data_copy() allows to simply copy the user data from the
   old to the new first  buffer.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-25 09:32:48 +01:00
Jukka Rissanen 09abd850d9 net: shell: Do not print DHCPv4 info if IPv4 is not available
If the network interface does not enable IPv4, then it is pointless
to print DHCPv4 information when invoking "iface" shell command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-22 21:00:37 -05:00
Robert Lubos 7207f35758 net: tcp: Fix ACK check in LAST_ACK state
The final ACK check during passive close was wrong - we should not
compare its SEQ number with the ACK number we've sent last, but rather
compare the ACK number it acknowledges matches our current SEQ number on
the connection. This ensures, that the ACK received is really
acknowledging the FIN packet we've sent from our side, and is not just
some earlier retransmission. Currently the latter could be the case, and
we've closed the connection prematurely. In result, when the real "final
ACK" arrived, the TCP stack replied with RST.

Subsequently, we should increment the SEQ number on the connection after
sending FIN packet, so that we are able to identify final ACK correctly,
just as it's done in active close cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-22 15:56:50 -05:00
Kapil Bhatt e25c68be5d net: wifi: Set default values of dwell time
Dwell time Active or Passive is optional in wifi scan.
If user don't set the Dwell time value, it will be set
as 0. We are adding a range check in scan extensions
for dwell time. So need to set default values.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-03-22 14:26:01 +00:00
Noah Pendleton 38ad4b6d43 net: sockets: tls: Add error log when cert parse fails
Add an error log if there's a failure when attempting to load
certificates during socket connect.

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2024-03-22 14:49:37 +01:00
Konrad Derda 42e6c1fbc6 net: mdns: add capability of providing records in runtime
Current implementation of mDNS responder does makes it mandatory to have
all the records set at compile time. It is not suited well for applications
that have to publish/unpublish or change records in runtime, e.g. data
received from the network.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-03-22 12:41:56 +00:00
Robert Lubos 323f1f81b9 net: dhcpv4_server: Add option to NAK Request from unrecognized client
Zephyr's DHCPv4 server does not implement persistent storage of address
leases. In result, all leases are lost on reboot, which can cause
delays with clients starting in INIT-REBOOT state and thus sending
(potentially several) Requests before attempting full Discover-Request
procedure.
Add option to override RFC defined behavior, which states that if we
don't recognize the client sending the Request, the server shall remain
silent. Enabling that option allows the server to send NAK reply in case
client is not recognized, informing the client it should proceed with
full procedure.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-22 10:24:15 +01:00
Robert Lubos fd113b7102 net: dhcpv4_server: Include client ID in server responses
RFC6842 updated RFC2131 in terms of including client ID option in
responses sent from the server. According to that RFC, the server MUST
include the client ID option in Offer/Ack/Nak replies, if it was
provided by the client.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-22 10:24:15 +01:00
Robert Lubos 41ffc5fabb net: dhcpv4_server: Improve DHCP Request retransmission handling
In case ACK from the server was lost, we'd not reply Request
retransmissions, as the lease state is already in allocated state on the
server side. Therefore we also need to allow to reply with ACK in such
case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-22 10:24:15 +01:00
Robert Lubos 50e0807c0a net: dhcpv4_server: Increase reserved address timeout
5 seconds turned out to be too short timeout in case retransmissions
kicked in at DHCP level, hence increase the timeout.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-22 10:24:15 +01:00
Robert Lubos 239d718bc7 net: ipv6: Introduce separate logger module for IPv6 ND
Debugging IPv6 Neighbor Discovery issues requires to enable full IPv6
logs, which can get bloated given it provides logs for every single
packet. We should be able to focus on IPv6 ND logs only, hence introduce
a separate log module for IPv6 ND.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-21 18:00:50 +01:00
Pieter De Gendt e99b5228a1 drivers: ethernet: Introduce ETH_DRIVER_RAW_MODE option
Add a Kconfig symbol to allow building ethernet device driver without
an L2 layer.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-20 08:05:55 -05:00
Jukka Rissanen 8f4ac0d4ab net: trickle: Rename interval function
The function inteval_timeout() was missing "r", the function
should be called interval_timeout()

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-19 15:20:14 -05:00
Savin Weeraratne 816a1381fa net: ipv4: Allow IGMP packets with zero src address
IGMP queries sent out by a proxy querier can have
a source IP address 0.0.0.0
Allow these incoming packets.

Fixes #69917

Signed-off-by: Savin Weeraratne <savin.weeraratne@audinate.com>
2024-03-19 09:47:00 +01:00
Fengming Ye 6a0c38680f net: ipv6: fix link local ping fail with default router
When we receive Router Advertisement with life time,
we will add this as default router, like typing command "net iface"
and has show below
IPv6 default router :
fe80:xxxx::xxxx

When this default router is backend A and
we ping backend B with link local address,
we will use default router A and send echo request
to backend A instead of B, which will receive Redirect and no reply.

Fix it by link local address does not check route.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-03-19 09:46:49 +01:00
Pieter De Gendt af8ba2a361 net: ethernet: Register multicast monitor for MAC filtering
Register a multicast monitor for ethernet if HW MAC filtering is supported

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt 64bc618725 net: ethernet: mgmt: Add HW MAC address filtering
Add an ethernet management API to set or unset HW MAC address filtering.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt 63133be42c net: iface: Allow catch-all multicast monitor
Registering a multicast monitor with a NULL interface will receive all
events.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Pieter De Gendt 303c56fbb2 net: ip: Add helper NET_NATIVE_IP kconfig symbol
Introduce a NET_NATIVE_IP symbol similar to IPv4/IPv6 variants.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-18 10:14:34 +01:00
Robert Lubos cb0a12311b net: tcp: Remove redundant debug logs
Debug logs in helper functions like tcp_unsent_len() or
tcp_window_full() are not very helpful and generate a heavy, unnecessary
log output. Therefore, tcp_unsent_len() will no longer generate log, and
tcp_window_full() will print out a log only when the window is actually
full, which could be an useful information.

Also, reduce the log load during TX, as currently redundant logs were
printed in tcp_out_ext(), tcp_send_process_no_lock() and finally in
tcp_send().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-15 15:30:00 +01:00
Maochen Wang 7b916593ec net: igmp: Fix double unref of igmp packet
If send the igmp packet when lower interface is down, the packet will be
freed twice and show error log. Remove the net_pkt_unref in igmp_send(),
and let the caller free it.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-03-15 13:35:16 +01:00
Fengming Ye 10670b7515 net: zperf: multicast support on multi interfaces
Zperf upload multicast always use default interface.
Zperf download multicast cannot receive packets from other than
224.0.0.1 which is default multicast group.

Add zperf upload/download option -I <interface name> for multicast.
So that user can select interface for multicast.
Add join multicast group for zperf download.

Use the "device list" command to get the interface name as
follows:
 "- ua (READY)"  #uAP interface name
 "- ml (READY)"  #STA interface name

Multicast traffic commands:
zperf udp upload -a -I ua 224.0.0.2 5001 10 1470 1M
zperf udp download -I ua 5001 224.0.0.3

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-03-15 13:07:14 +01:00
Carlo Kirchmeier 7bfaca4c58 net: dns: Add DNS cache for improved performance
In order to reduce dns resolve requests when using the dns
resolver an optional cache was introduced. This cache
retains query requests for the TTL duration and therefore
prevents premature refetching of DNS RRs.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
2024-03-15 08:37:29 +00:00
sukrit buddeewong 3ad8d32d18 net: mqtt: Implement ALPN Support for socket mqtt
Implement the ALPN Support for Mqtt Library allow mqtt to have
ability to utilize ALPN for connect to server that support ALPN, such
as AWS IoT Core

Signed-off-by: sukrit buddeewong <sukrit.omu@gmail.com>
2024-03-14 17:04:11 -05:00
Takuya Sasaki 7d1edd1fcb net: context: Fix the ICMP error on raw
This commit applies the issues detected in UDP to recv_raw() as
well. Please refer to the previous commit log for details.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
2024-03-14 11:08:59 -05:00
Takuya Sasaki 4f802e1197 net: context: Fix the ICMP error on udp
When receiving a UDP packet, net_conn_input() searches for a
matching connection within `conn_used`.

However, when receiving UDP packets simultaneously from multiple
clients, we may encounter a situation where the connection that was
supposed to be bound cannot be found within `conn_used`, and raise
the ICMP error.

This is because, within recv_udp(), to avoid the failure of
bind_default(), we temporarily remove it from `conn_used` using
net_conn_unregister().

If the context already has a connection handler, it means it's
already registered. In that case, all we have to do is 1) update
the callback registered in the net_context and 2) update the
user_data and remote address and port using net_conn_update().

Fixes #70020

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
2024-03-14 11:08:59 -05:00
Takuya Sasaki 46ca624be4 net: conn: Add internal function for update connection
This commit adds the new internal function for update the callback,
user data, remote address, and port for a registered connection
handle.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
2024-03-14 11:08:59 -05:00
Takuya Sasaki ef18518e91 net: conn: Add static function for changing remote
This commit adds the new static function for change the remote
address and port to connection, and replaces the changing process
for remote address and port in net_conn_register().

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
2024-03-14 11:08:59 -05:00
Takuya Sasaki 49c6da51ce net: conn: Move net_conn_change_callback() to static
The net_conn_change_callback() is not currently being called by
anyone, so this commit moves to static function, and replaces
the change callback parameter process in net_conn_register().

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
2024-03-14 11:08:59 -05:00
Stefan Schwendeler 947d4a13c3 net: lwm2m: removes redundant newline for log and shell calls
All the shell and logger calls here already add a newline.

Signed-off-by: Stefan Schwendeler <Stefan.Schwendeler@husqvarnagroup.com>
2024-03-14 11:04:59 -05:00
Daniel Nejezchleb 9d801c4fdc net: tcp: Fix possible deadlock in tcp
The mutex was removed in tcp_recv() where it doesn't seem
to be needed anymore as tcp_conn_search() got
tcp_mutex. In the other areas the tcp_mutex was
narrowed down to protect only the list.

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2024-03-14 12:22:08 +01:00
Maochen Wang ebced020ec net: arp: Fix failed to add the arp table in stress test
During stress test with WiFi connect, disconnect, ping and throughput
traffic, ARP table updating failed issue may occur.
In arp_prepare(), if packet allocate failed, should add the arp
entry back to arp_free_entries, to avoid this entry is leak forever.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-03-14 12:21:39 +01:00
Fengming Ye c5b2a16dd2 net: zperf: fix download ipv6 bind fail on specific ip address
For command zperf udp download 5001 192.168.10.1,
zperf will bind both ipv4 and ipv6 sockets on ipv4 address.
But bind ipv6 socket will fail, thus command return fail.

Fix it by check ip address when zperf download.
For ipv4 address only bind ipv4 socket.
For ipv6 address only bind ipv6 socket.
For unspecific address bind both ipv4 and ipv6 sockets.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-03-14 09:47:03 +00:00
Seppo Takalo 8a38ff7161 net: lwm2m: Handle empty URI
On some content-types, it might be impossible to
send strings with size of zero.
Therefore empty URI should also allow cases
where strlen() is zero.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-03-13 11:37:54 -05:00
Robert Lubos 53561e3766 net: dns: Fix timeout calculation with DNS retransmissions
With recently introduced DNS retransmission mechanism, a certain bug
could occur when calculating query timeout.

If the time until the final DNS timeout (as indicated by
CONFIG_NET_SOCKETS_DNS_TIMEOUT) was less than 1 millisecond, the actual
millisecond timeout value was rounded down, resulting in 0 ms timeout.
This in order was interpreted as invalid argument by dns_get_addr_info()
function, so in result, instead of reporting query timeout, the function
reported invalid argument error.

Fix this by rounding the millisecond timeout up, instead of down, so
that in any case, if the final timeout is not due, we always provide
non-zero timeout to dns_get_addr_info().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-12 15:13:31 -05:00
Robert Lubos 9e2e234003 net: telnet: Switch TELNET shell backend to use sockets
Rework TELNET shell backend to use socket API for communication and
socket service library for socket monitoring.

Additionally, rework the TX part so that non-blocking TX is used when
sending from the system work queue. In case transfer is not possible at
the moment, the TX work is rescheduled instead of blocking the system
work queue.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-11 15:09:32 -05:00
Robert Lubos fef58a2a69 net: sockets: Stick to NET_SOCKETS_POLL_MAX limit in socket services
Socket service pollfd count should not exceed the configured
NET_SOCKETS_POLL_MAX limit, as poll() will not be able to monitor
sockets beyond that limit anyway. Adding +1 there prevented the library
from catching the configuration error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-11 15:09:32 -05:00
Jukka Rissanen 7072e75162 net: dhcpv4: Network interface netmask was set too early
When we receive the subnet mask option from the server, we
cannot yet set the netmask to the network interface as the
mask is tied to the IP address we received from the server.
We need to delay the setting of netmask until we have added
the requested IP address to the interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-08 18:04:35 +01:00
Fin Maaß 0d776d39bb net: dhcpv4: set log backend net ip via option
Adds the option to set the log_backend_net ip via dhcpv4
option 7.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-08 15:18:30 +00:00
Fin Maaß 6e12b0210f log: net: move log_backend_net_get() to header
This moves the declaration of log_backend_net_get() to
zephyr/logging/log_backend_net.h

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-08 15:18:30 +00:00
Robert Lubos 9412ad306f net: sockets: packet: Ignore the packet type if LL address is not set
In case the LL address is not set on a packet for any reason, don't try
to access address structure to determine packet type.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-08 13:04:45 +00:00
Pieter De Gendt e2f0b92fda net: lib: shell: Fix IPv6 neighbor build
When building net shell without IPv6 native support we can't use neighbor
support.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-08 10:02:02 +00:00
Chaitanya Tata 0a8cbb6a22 net: mgmt: Handle loops in the linked list
In case the same callback handler is added to the list twice, this can
result in a loop.

Fixes: #69825.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-03-08 09:35:04 +01:00
Gang Li 03fce7dd3c net: zperf: Fix multicast data failure to receive server's AckFIN packet
In iperf2, for multicast data, if it is a client, it will not wait for
the server's AckFIN packet. Because the iperf2 server will not send an
AckFIN packet.
So in zperf_upload_fin(), an error will occur when the zperf client
waits for the server's AckFIN packet.
Multicast only send the negative sequence number packet and doesn't
wait for a server ack can fix this issue.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2024-03-07 16:17:18 -06:00
Pieter De Gendt 0db120abd4 net: lib: shell: iface: Fix when building ethernet without IP support
The count stack variable is also used when CONFIG_NET_L2_ETHERNET_MGMT is
enabled. Make sure it is available.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-03-06 15:23:52 -06:00
Jukka Rissanen 5be84131d6 net: dns: Split long resolving to smaller pieces
If getaddrinfo() is called with a long DNS timeout, then split
the timeout to smaller pieces with exponential backoff. Reason
for this is that if a DNS query is lost, then we do not need
to wait for a long time to find it out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-06 13:33:50 +01:00
Chaitanya Tata 6327478429 net: lib: Add debug for sockets total and owner
This helps in figuring out the need for the number of sockets.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-03-06 10:20:22 +00:00
Robert Lubos 919cb6f614 net: sockets: tls: Improve sendmsg() support on DTLS sockets
DTLS socket should be able to combine more than one message into a
single datagram when calling sendmsg().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-06 09:13:38 +01:00
Marcin Gasiorek fb99f65fe9 net: ip: Fix for improper offset return by net_pkt_find_offset()
The original packet's link-layer destination and source address can be
stored in separately allocated memory. This allocated memory can be
placed just after pkt data buffers.
In case when `net_pkt_find_offset()` uses condition:
`if (buf->data <= ptr && ptr <= (buf->data + buf->len)) {`
the offset is set outside the packet's buffer and the function returns
incorrect offset instead of error code.
Finally the offset is used to set ll address in cloned packet, and
this can have unexpected behavior (e.g. crash when cursor will be set
to empty memory).

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-03-05 18:23:24 +00:00
Fin Maaß c148dc15fd net: dhcpv4: add vendor specific option callback
In certain scenarios, it may be necessary to get values of additional
options from the application layer. With this patch, this can be
accomplished by registering a callback with the DHCP client.

This change has been tested using the posix build in qemu.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-05 10:22:21 -05:00
Florian La Roche e8b843b913 net: shell: keep event_mon_handler compatible to k_thread_entry_t
Nearly all other code places for k_thread_entry_t also keep
unused params in place to stay compatible with k_thread_entry_t.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2024-03-05 14:58:29 +00:00
Sibert Declercq 808f79d863 net: coap: CoAP observe age now correctly wraps around
Fixes two bugs:
* When a notify is executed before any observers are added, the age is
incremented from 0 to 1. When an observer is registered, the age is not 0
as expected, causing the age to be 1 instead of the expected 2
* The check if a message is newer than the last received one is described
in RFC7641, section 3.4. Simply incrementing age will not comply to what
the RFC describes once the value wraps around. This is now fixed

Signed-off-by: Sibert Declercq <sibert.declercq@basalte.be>
2024-03-05 14:34:42 +01:00
Jukka Rissanen a943d7fd53 net: Convert various address loops to use ARRAY_FOR_EACH macro
Convert various networking subsystem files to use ARRAY_FOR_EACH
macro to make the looping more robust.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Jukka Rissanen 6e7d97dc38 net: if: Convert array loops to use ARRAY_FOR_EACH macro
Convert various array loops in the net_if.c to use the
ARRAY_FOR_EACH() macro. This makes the code more robust
as we do not need to keep track of the separate define
that tells the array size.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Jukka Rissanen 58b2a3dfd4 net: ipv4: Deprecate the old netmask set/get routines
This commit deprecates these legacy netmask get/set routines

net_if_ipv4_set_netmask()
net_if_ipv4_set_netmask_by_index()
net_if_ipv4_get_netmask()

as they do not work well if there are multiple IPv4 address
assigned to the network interface.

User should use these functions instead

net_if_ipv4_set_netmask_by_addr()
net_if_ipv4_set_netmask_by_addr_by_index()
net_if_ipv4_get_netmask_by_addr()

as they make sure the netmask it bound to correct IPv4 address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Jukka Rissanen 1b0f9e865e net: ipv4: Make netmask IPv4 address specific
The netmask should be tied to the IPv4 address instead of being
global for the network interface.

If there is only one IPv4 address specified to the network interface,
nothing changes from user point of view. But if there are more than
one IPv4 address / network interface, the netmask must be specified
to each address separately.

This means that net_if_ipv4_get_netmask() and net_if_ipv4_set_netmask()
functions should not be used as they only work reliably if there is
only one IPv4 address in the network interface.

The new net_if_ipv4_get_netmask_by_addr() and
net_if_ipv4_set_netmask_by_addr() functions should be used as they make
sure that the netmask is tied to correct IPv4 address in the network
interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Florian La Roche d835772f38 net: conn_mgr: set a thread name
Set a thread name for net conn_mgr, so that e.g. thread listings
within the shell are easier to look at.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2024-03-02 15:03:27 +01:00
Tomasz Bursztyka a4af2ac8dc net/ip: Removing useless extra data capability in neighbors
This is not used by anyone, and is unlikely to be useful actually.
Helps to save 4 bytes for each instance of struct net_nbr also (removing
a 2 bytes attributes, which was anyway generating a 4bytes loss due to
structure misalignment).

Removing relevant useless functions related to it as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka a3d7278588 net/ipv6: Enforce MLD to be selected if ND is enabled
As noted in net_if.c:net_if_ipv6_addr_add() IPv6 ND needs MLD.

It is not selected during test, as the combination of ND without DAD/MLD
breaks (something to study/fix further it seems).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka 20ccc30273 net/if: Trivial comment fix about all-nodes
s/net_ipv6_mcast_join/net_ipv6_mld_join

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka 6d718ed480 net/mgmt: Trivial debug output fix about layer
Net MGMT uses layer identifiers that are meaningful only for itself, but
for users it requires a trivial operation to show the real layer value.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka 48216eff76 net/config: Initialize and add the net mgmt callback at the right time
Net MGMT mask should be fully configured first, prior to be used to
initialize and add the callback.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka 4d48f066a1 net/shell: Fixing a trivial error code
As for adding an ipv6 address, removing one should return the same error
code when the network interface is not found.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Tomasz Bursztyka 366402a0c7 net/shell: Net shell has no mandatory support for IPv6 MLD
It's an optional support, and it should not select it by default.
Improving information message in case such support is disabled.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2024-03-01 15:33:53 +01:00
Maochen Wang eda7dd1460 net: zperf: Fix wrong throughput in long-duration traffic test
The zperf received or sent bytes length and duration are in 32bits,
if running long-duration zperf test more than 20min, the value will
overflow, and the test result is wrong. Change it to 64bits can fix
this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-02-29 11:54:07 +00:00
Maochen Wang e7444dcf42 net: zperf: Fix TOS option not working in zperf
When the zperf command is called with '-S' option which means IP_TOS
for IPv4 and IPV6_TCLASS for IPv6, an error is printed and the
setting does not work. The socket option handling was changed by
commit 77e522a5a243('net: context: Refactor option setters'), but the
callers of option setters were not changed. This causes the IP_TOS
or IPV6_TCLASS option failed to set. The fix is to use uint8_t to
store the value of the -S option.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-02-29 11:53:57 +00:00
Pieter De Gendt d9d710e6d3 net: ip: Add iface IPv4/IPv6 multicast foreach handlers
Add helper functions to iterate IPv4/IPv6 multicast addresses.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-02-28 13:18:06 -06:00
Fin Maaß bcf90edd1f net: config: use dhcpv4 option for sntp
Allow the use of the NTP server address, set by
dhcpv4 option, by the net_init_clock_via_sntp function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-28 18:03:53 +00:00
Fin Maaß 3be6557078 net: dhcpv4: set sntp ip via option
Adds the option to set the ntp address ip via
dhcpv4 option 42 (Network Time Protocol Servers).

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-28 18:03:53 +00:00
Fin Maaß 2140a4af6a net: lib: sntp_simple: add a function to use with ip address
This adds a function to use sntp_simple with a
ip address directly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-28 18:03:53 +00:00
Fin Maaß 78813fa3ad net: ip: add function to set default port
This adds a function, to set the default port
of a sockaddr, if the port had not been set.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-28 18:03:53 +00:00
Robert Lubos dc52b20705 net: sockets: tls: Return an error on send() after session is closed
It was an overlook to return 0 on TLS send() call, after detecting that
TLS session has been closed by peer, such a behavior is only valid for
recv(). Instead, an error should be returned.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-28 18:03:40 +00:00
Jukka Rissanen 28a46c0f60 net: http: client: Return error if waiting timeout
Return error to the caller if no data was received or there
was some other error. Earlier we did not check the error
condition properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-28 18:02:34 +00:00
Jukka Rissanen 1df8aaeec2 net: ipv6: Allow user to configure the IPv6 MTU size
This makes it possible to set the minimum IPv6 packet size that
can be sent without fragmentation. The default value is 1280 bytes.
This commit allows user to set the IPv6 MTU value within reasonable
limits [1280, 1500].

Fixes #61587

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-28 09:41:53 +01:00
Jukka Rissanen 4b82b108c8 net: zperf: Select also sockets API in Kconfig
We select sockets service API in Kconfig but should select also
sockets API so that user does not need to set the sockets API separately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-28 09:40:41 +01:00
Jukka Rissanen bdfcc753c8 net: shell: Print mgmt socket information properly
The "net sockets" command did not print network management
socket information properly but claimed that the socket
was IPv4 one which it is not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-28 09:39:27 +01:00
Jukka Rissanen afa4b4ad1d net: socket: mgmt: Return error for poll
The net_mgmt socket does not support poll() or fcntl(), so
return EOPNOTSUPP error if user tries to use those functions
for AF_NET_MGMT type socket.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-28 09:39:27 +01:00
Fin Maaß 1f2a3c46df net: dhcpv4: initialization of option_callbacks list
Initialize sys_slist_t option_callbacks statically.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-27 14:45:40 +01:00
Fin Maaß 866c804cb8 net: dhcpv4: option callback check value explicitly
Check the value of net_dhcpv4_add_option_callback()
and net_dhcpv4_remove_option_callback() explicitly.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-27 14:45:40 +01:00
Tomi Fontanilles a738bfa7f4 net: l2: ppp: ipv6cp: add assert to check the link address length
This ensures that the configured link address is
at least as big as the part of it that is used.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-02-26 14:43:07 +01:00
Juha Ylinen f38ecb7a09 net: lwm2m: Add API to set multiple resource values
Add new API lwm2m_set_bulk() to set multiple resource values in
one function call.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-02-26 11:53:29 +00:00
Łukasz Duda 6e31820f4c net: ipv6: nbr: Expose API for reporting neighbor reachability
This commit extends Zephyr's networking API to allow higher layers to
report on neighbor reachability.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-02-26 11:51:42 +00:00
Robert Lubos 9cb21e695f net: dhcpv4_server: Apply range limits for Kconfig options
Apply ranges to DHCPv4 server timeout Kconfig options, so that it cannot
be set to a negative value by mistake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Robert Lubos e28428caae net: dhcpv4_server: Improve declined addresses management
In case conflict is detected (either due to receiving Decline message or
due to ICMP probe getting reply), the conflicting address becomes
blocked for further use.

Although the RFC is not specific about how long should the address be
blocked, it make sense to implement some fallback mechanisms to reuse
blocked addresses in the server, otherwise, after longer period of
operation, it may run out of usable address.

This commit adds a timeout for declined addresses, so that by default
the address is marked back as "free" after 24 hrs (default lease time).
It also implements a mechanism, which allows to re-use the oldest
declined entry in case the server runs out of fresh addresses to assign.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Pisit Sawangvonganan b6f51edd6c wifi: shell: removed NULL check to net_mgmt callback
Since PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING already have
an embedded `sh` NULL check, we can remove the change from PR #68809.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 11:41:03 +00:00
Pisit Sawangvonganan 7b8a9e1818 net: shell: ensure the shell sh is valid before call shell_printf
It is possible that the `sh` was not set before use.
This change adds a NULL check for `sh` in the following macros:
PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING.
In case `sh` is NULL, the above macros will call `printk` instead.

Fixes #68793

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 11:41:03 +00:00
Fengming Ye ac8920e342 net: ip: Allow traffic class thread priority customization
Add traffic class priority custom option to customize traffic class
priority base for throughput performace.

Wi-Fi traffic performance depends on cooperation between net threads
and Wi-Fi driver threads. So we want traffic class threads priority
to be more flexible to fit more vendors.

Eg: when traffic class tx thread priority is higher than driver tx
thread, it will consume much more cpu time and send packets until driver
queue full.
When traffic class tx thread priority is lower than driver tx thread,
it will become serial transmition, also affecting throughput.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-02-26 12:11:19 +01:00
Pisit Sawangvonganan bd94e199e5 net: wifi_utils: fix typo and whitespace adjustment
Corrected 'subsytem' to 'subsystem' and made minor whitespace formatting.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 12:10:36 +01:00
Pisit Sawangvonganan 0d4961b8d4 net: wifi_utils: reduce valid_5g_chans_20mhz memory footprint
This change reduces the memory footprint by changing the data type of
`valid_5g_chans_20mhz` from `uint16_t` to `uint8_t`.

Additionally, since the maximum channel number for 5GHz Wi-Fi is 177,
it can fit within the `uint8_t` range.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 12:10:36 +01:00
Fin Maaß 652c2ae1f5 net: dhcpv4: Add vendor class identifier option
Adds the funktion to set the DHCPv4 option 60
(Vendor class identifier) via Kconfig.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-26 12:05:03 +01:00
Mateusz Karlic bdd09558bb net: shell: ipv4: Add command to set gateway
Add a command `net ipv4 gateway` that allows
setting IPv4 gateway for an interface from net shell.

Signed-off-by: Mateusz Karlic <mkarlic@antmicro.com>
2024-02-26 11:53:56 +01:00
Markus Lassila f033cd5601 net: sockets: tls: Add config for DTLS max fragment length
Add CONFIG_NET_SOCKETS_DTLS_MAX_FRAGMENT_LENGTH for limiting
the Maximum Fragment Length (MFL) for DTLS with Mbed TLS.

This is needed when MBEDTLS_SSL_OUT_CONTENT_LEN and
MBEDTLS_SSL_IN_CONTENT_LEN are set to larger values than the MTU
of the network and IP fragmentation is not supported.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-02-26 11:51:25 +01:00
Fin Maaß 7206737450 net: dhcpv4: request options from server
If a option callback is enabled, this option
should also be requested from the DHCPv4 server.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-26 11:44:45 +01:00
Chaitanya Tata 6c3b0ee5ff wifi: shell: Fix the case for acronym
DFS is an acronym, so, should be capitalized.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-02-26 11:41:40 +01:00
Chaitanya Tata 92fe088629 wifi: shell: Fix the header for passive transmission only
This flag indicates that only passive transmissions are allowed in that
channel for that regulatory domain.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-02-26 11:41:40 +01:00
Jukka Rissanen c5b0f542f0 net: socket: Start socket service earlier
Make sure that socket service is started earlier than
config library. This is enforced in config libs init.c
but set the default value here too.
The reason for this is that the config library might need
to start dhcpv4 server which needs socket service to work,
so the ordering is important here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:40:15 +01:00
Jukka Rissanen 3de1f1b5d0 net: if: Check IPv6 pointers properly in hop limit setters/getters
We must make sure that IPv6 configuration pointer is valid
so that the hop limit can be set for a given interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:39:50 +01:00
Jukka Rissanen e7b1d6d8aa net: if: Check IPv4 pointers properly in TTL setters/getters
We must make sure that IPv4 configuration pointer is valid
so that the TTL can be set for a given interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:39:50 +01:00
Jukka Rissanen dceff4a98f net: if: Init must be called before setting the name
As the interface init function might configure the system
such a way that would affect the naming of the network
interface, we need to call the init before setting the name.
This is mostly needed by Wifi where the Wifi driver needs
to mark its network interface as Wifi interface as by default
the Wifi interface will look like Ethernet one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:39:25 +01:00
Maochen Wang 11a5904760 net: arp: Fix dead lock caused by arp_mutex
Fix the dead lock between rx_q and tx_q thread.
When tx_q thread prepares to send ARP packet, it might get
the net_if_tx_lock in net_if_tx(), then in net_arp_prepare(),
it will try to get the arp_mutex.
At the same time, if the rx_q thread receives an ARP reply
packet, in arp_update(), it will get the arp_mutex first,
and flush the packets in arp pending_queue and try to get
the net_if_tx_lock. Then the dead lock occurs, two threads
stuck and all the packcets can't be freed.
In arp_update(), taking the net_if_tx_lock first then taking
the arp_mutex can fix this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-02-26 11:38:47 +01:00
Jukka Rissanen ea189d5aee net: sockets: Do not start service thread if too little resources
If the CONFIG_NET_SOCKETS_POLL_MAX is smaller than what is needed
for the socket service API to work properly, then we should not
start the service thread as the service API cannot work and might
cause memory overwrite in ctx.events[] array.

Fixes #69233

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-25 20:52:18 -05:00
Robert Lubos bc2858ad2d net: lib: coap: Add error check when waking server thread
There's not much to be done in case waking up the server thread with
socketpair send() fails, but at least we can log an error on such event
(to please coverity).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-19 19:07:03 +01:00
Jukka Rissanen 7e6813dcf5 net: trickle: Print the abs value using %u
The Imax_abs value should be printed using %u instead of %d
as it can be large and should be printed as positive value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-13 19:36:30 +01:00
Mike Szczys e72ac4b091 net: coap: add TOO_MANY_REQUESTS to return codes
Add COAP_RESPONSE_CODE_TOO_MANY_REQUESTS to coap_header_get_code(). CoAP
4.29 response code for "Too many requests" is defined in coap.h but was
missing from the list of cases, resulting in a 0 being returned instead
of the proper code.

Signed-off-by: Mike Szczys <mike@golioth.io>
2024-02-13 11:14:01 +01:00
Wojciech Slenska 6b1b8157cd wifi: shell: added NULL check to net_mgmt callback
By default variable context.sh is set to NULL. If any net_mgmt
event will be called when the variable has default value, there
will be a system exception.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2024-02-09 16:36:03 -06:00
Robert Lubos 7b6e7d6088 net: ipv6: Improve Neighbor Discovery thread safety
Currently, the only thread-safe part of the IPv6 Neighbor processing
implementation are stale_counter related operation.

Fix this, by extending the mutex protection over all of the module, so
that message handlers, timers and API functions do not interfere with
each other.

As IPv6 Neighbor cache is tightly coupled with the Routing module, use
the same mutex to protect both, neighbor and routing tables, to prevent
deadlocks.

Also, replace the semaphore used with a mutex, as it seems more fit for
this particular job.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-09 16:34:34 -06:00
Łukasz Duda 838f33494e net: tcp: Rate-limiting of neighbor reachability hints
This commit implements simple rate-limiting for Neighbor Reachability
Hints in TCP module to prevent the potentially costly process of
frequent neighbor searches in the table, enhancing system performance.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-02-09 16:26:10 -06:00
Markus Lassila ca7e69523c net: sockets: tls: Timeout DTLS with poll
Changed poll to perform incoming data check with connected
DTLS connections. This allows the CONFIG_NET_SOCKETS_DTLS_TIMEOUT
to timeout the connections to server socket if there is no
incoming data.

Previously, if the remote client closed the DTLS connection without
close notify, the timeout of the ongoing connection only happened
when next connection was taken to the server socket. Depending on
the timeouts, this could prevent the next connection from succeeding.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-02-09 10:25:46 -06:00
Kapil Bhatt 2207fedbc8 net: l2: wifi: Fix Print of SSID in WIFI scan result
WIFI scan result shows junk character in SSID because of
the length of ssid is maximum(32 character) which leads
to buffer overflow. It required one character for null
terminator ‘\0’.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-02-08 09:49:10 +00:00
Konrad Derda b324e1e4d8 net: buf: add max allocation size to allocation info
Previously, there was no way to determine maximum number of bytes
that can be allocated using only net_buf structure. This commit
introduces such field.

Moreover, this commit fixes an issue where allocation of less than
maximum number of bytes from a fixed buffer pool would set buffer's
size to this number instead of the whole buffer size.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-02-06 12:56:37 +01:00
Manuel Schappacher b5bf5a3cef net: gptp: Use local port identity when forwarding sync messages
As defined in IEEE802.1AS-2020 ch. 10.2.12.2.1, the port identity
of an MDSyncSend structure sent from a port shall be set to the
port identity of the sending port according to and ch. 8.5.2.

This commit replaces the port identity before forwarding a sync.

Fixes #68385

Signed-off-by: Manuel Schappacher <manuel.schappacher@hs-offenburg.de>
2024-02-02 22:35:20 +01:00
Jukka Rissanen 692ebf404c net: sockets: Update msg_controllen in recvmsg properly
If recvmsg() does not update control data, then it must
set msg_controllen length to 0 so that the caller can
understand this.

Fixes #68352

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-02 11:51:53 -06:00
Robert Lubos 68bc981c52 net: zperf: Fix session leak
In case zperf session was aborted by the user (by for instance stopping
it from shell), or practically in case of any other
communication-related error, the zperf session could end up in a state
other than NULL or COMPLETED, with no way to recover. This made the
session no longer usable and eventually could lead to zperf being not
able to start a new session anymore.

Fix this by introducing zperf_session_reset() function, which resets the
session state back to defaults. The function is called when the zperf
receiver service is stopped.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 10:31:53 -06:00
Robert Lubos 4ce0352026 net: zperf: Fix TCP receiver start/stop operation
The issues found for UDP receiver were also identified for TCP receiver,
this commit applies practically the same set of changes as in case of
UDP.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 10:31:53 -06:00
Robert Lubos 139bc4e87e net: zperf: Fix UDP receiver start/stop operation
This commit fixes restarting of UDP receiver service, along with some
other minor cleanups:

* The core issue was udp_server_running flag not being cleared when
  service was stopped. Fix this by introducing udp_receiver_cleanup()
  which does all of the required cleanups when receiver service is
  stopped. The function is called either when the application stopped
  the service with zperf_udp_download_stop(), or when the service was
  stopped due to error.
* net_socket_service_unregister() was not called on
  zperf_udp_download_stop(), but only from the service callback - that
  would not work in case there's no active communication.
* at the same time, net_socket_service_unregister() would be called from
  the service callback in case of errors. Fix this, by making
  udp_recv_data() only return an error, and let the service callback to
  do the cleanup.
* Remove no longer used udp_server_run semaphore
* Remove udp_server_stop - with socket services it seems no longer
  needed.
* zperf_udp_receiver_init() now returns an error, so that we don't
  mark the service as running in case of socket/services error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 10:31:53 -06:00
John Johnson 125a2bccaa net: net_pkt: add peer sockaddr member in net_pkt struct
Add sockaddr member in struct net_pkt to store peer address if offloaded
network inteface is used. This enables recvfrom() to fill in src_addr if
socket type is UDP and offloaded interface driver supports it.

Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
2024-02-02 09:42:18 -06:00
Robert Lubos 3c76ff9a8c net: dhcpv4_server: Implement ICMP probing of offered addresses
DHCPv4 server will send an ICMP probe (echo request) for the requested
address before replying with DHCP Offer, unless probing is disabled in
Kconfig.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 12:42:44 +01:00
Pieter De Gendt 0bc1a2b314 net: lib: coap: Reduce CoAP server stack usage
Declare the CoAP server receiving buffer as static to lower the
stack usage.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-02-02 10:51:32 +01:00
Pisit Sawangvonganan 055ac61542 wifi: shell: replace print(...) with PR(...)
Additionally, replace the local print(sh, level, fmt, ...) macros
with PR, PR_ERROR, and PR_WARNING macros.

Then remove the print(sh, level, fmt, ...) macros.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-31 15:15:19 -06:00
Pisit Sawangvonganan 81342132fb wifi: shell: refactor to use PR(...) from "net_shell_private.h"
Replaced direct shell_fprintf calls with PR, PR_ERROR, PR_INFO
and PR_WARNING macros.

This change simplifies the code by using predefined macros.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-31 15:15:19 -06:00
Pisit Sawangvonganan 10939c7a02 wifi: shell: move "scan_result" variable into context struct
Moved 'scan_result' from a standalone variable into the 'context' struct
to enhance code optimization.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-31 15:15:19 -06:00
Pisit Sawangvonganan a8a39231e7 wifi: shell: introduce local 'sh' variable
This commit introduces a local variable 'sh' to store 'context.sh' for
use with the 'shell_fprintf' function.

By doing so, we avoid the repeated dereferencing of 'context.sh',
thereby reducing the code footprint.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-31 15:15:19 -06:00
Manuel Schappacher 6fc6b30fb3 net: gptp: Fix double converted byte order of BMCA info steps_removed
Fixes #68320

Signed-off-by: Manuel Schappacher <manuel.schappacher@hs-offenburg.de>
2024-01-31 15:53:06 +00:00
Łukasz Duda 5273af6ba8 net: ipv6: nbr: Add IPv6 reachability confirmation API
This commit introduces a new IPv6 API for positive reachability
confirmation, as specified in RFC 4861, Section 7.3.1. This feature aims
to enhance the effectiveness of the Neighbor Discovery mechanism, by
enabling upper-layer protocols to signal that the connection makes a
"forward progress".

The implementation within TCP serves as a reference. Compliance with
RFC 4861, especially Appendix E.1, was ensured by focusing on reliable
handshake and acknowledgment of new data transmissions.

Though initially integrated with TCP, the API is designed for broader
applicability. For example, it might be used by some UDP-based protocols
that can indicate two-way communication progress.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-01-31 14:50:53 +01:00
Jukka Rissanen b03c3c0c48 net: socket: Start service thread from initialization function
We cannot always start the service monitor thread statically
because the static threads are started after the application
level. This means that when config library wants to start
dhcpv4 server which uses socket services, there would be a
deadlock. Simplest solution is to start the service thread
directly from socket service init function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-31 12:06:49 +00:00
Robert Lubos a147ac9a47 net: dhcpv4_server: Improve address pool range validation
Not only check if the address pool belongs to the same subnet as the
server, but also that it does not overlap with the server address -
otherwise the server might end up assigning its own address.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-31 12:06:23 +00:00
Jordan Yates 9ff1fcf7e7 net: conn_mgr: generic wifi_mgmt connectivity backend
As connectivity backends need to be bound in the same file that the
`net_if` is created in, define a common backend type for WiFi modems.
All WiFi modems should be controllable through the `wifi_mgmt` API, so
there should be no need for dedicated context.

When enabled, the particular implementation to be used is chosen through
`CONNECTIVITY_WIFI_MGMT_IMPL`. For now, the only choice is an
application defined backend.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-30 18:51:46 -05:00
Chaitanya Tata bff1b7487e wifi: shell: Add band support for STA
For a Wi-Fi station the connect API supports both band and channel
configuration, but for a shell command either channel or band makes
sense, so, overload the channel field to support band.

Rejig the band and channel validation to support all modes.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-01-30 18:00:26 +01:00
Øyvind Rønningstad 3ad47d214a lwm2m: Regenerate zcbor files
with zcbor 0.8.1

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-01-30 13:38:51 +01:00
Jordan Yates 1e1d2725a7 net: dns: option to disable auto context init
Adds an option to disable the automatic initialization of the default
dns_context. This lets applications use the default context, while also
managing the `init` and `close` functions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-29 20:20:19 -06:00
Jordan Yates e5f4fa0f4a net: dns: function to default initialize context
Adds a function that can be used to initialize a dns context to the
default Kconfig values.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-29 20:20:19 -06:00
Robert Lubos b8556d0d79 net: icmp: Don't report error on ICMP messages w/o handler
ICMPv4/6 modules print error when ICMP message handling fails, which
includes no message handler registered. This is a bit problematic, as
there are many ICMP messages that Zephyr does not process, and every
time such a message is received, an error log is printed (which wasn't
the case before ICMP rework).

Restore the old behavior (no log on unrecognized ICMP message) by
explicitly filtering out ENOENT error code from printing error. That
way, log will only be printed if an error occured within the actual
message handler.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-29 14:57:35 +00:00
Robert Lubos cefc391db3 net: dhcpv6: Move DHCPv6 files to lib directory
For consistency with DHCPv4.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-29 13:47:05 +01:00
Robert Lubos 19722aa8e8 net: dhcpv4: Move DHCPv4 files to lib directory
As discussed during DHCPv4 server integration, group DHCPv4 client files
with DHCPv4 server in a single lib directory.

Renamed internal "dhcpv4.h" header to "dhcpv4_internal.h" so that it's
not confused with the public "dhcpv4.h" header.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-29 13:47:05 +01:00
Jukka Rissanen 7da14d3129 net: shell: Clarify the name of the virtual interface
The net-shell printed virtual interface name so that it got
the impression it was the network interface name which is not
correct. Now the name is printed as "Virtual name" which is
unambiguous.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-29 10:58:33 +00:00
Jukka Rissanen a45d66c478 net: if: Do not join multicast address if IPv6 is not enabled
If IPv6 is not enabled for the interface, then do not try to
join the IPv6 solicited multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-29 10:58:24 +00:00
Fengming Ye f61a0cb1fa net: zperf: fix the calculation ratio between mbps, kbps and bps
The ratio between mbps and kbps, kbps and bps should be 1000, instead of
1024, as common sense.
The wrong ratio will decrease the Zperf throughput result.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-01-29 10:05:35 +01:00
Jukka Rissanen a1d0764922 net: wifi: Make sure scan band string is null terminated
Make sure that scan band string is properly terminated when
parsing user supplied string.

Fixes: #67944
Coverity-CID: 342930

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-26 19:40:16 +01:00
Seppo Takalo 992936300b net: lwm2m: Use CID_SUPPORTED instead of CID_ENABLED
When ENABLED flag is used, we generate 32 byte DTLS
Connection Identifier and include that in our
DTLS Client HELO. This has no benefit as client only
has one connection toward the server, it does not need
any identification.

When SUPPORTED flag is used, we just include
zero length Connection Identifier in the handshake,
which tell server that we support Connection Identifier
and server can generate one for it.
We then use the CID in the packets that we send towards
server, but response packets don't contain any CID.
This gives all the benefit of CID as server is able to
identify us even when NAT mapping have changed.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-26 12:00:51 -06:00
Sandip Dalvi 4c7eb600c6 net: wifi: add wifi driver version API
Add command to query to WiFi driver/firmware revision. The API is expected
to return the firmware revision and driver version as a string, and can be
used by the user to determine what revision of the WiFi driver is in use.

Signed-off-by: Sandip Dalvi <sandip.dalvi@nxp.com>
2024-01-26 14:29:39 +01:00
Alberto Escolar Piedras 4ff79cb74a subsys/net/lib/lwm2m: Define required source standard macros
Instead of relaying on those macros having been defined
somewhere else let's define them for this file.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Chaitanya Tata c07d648304 wifi: shell: Remove duplicate argument count checks
Now that we are using the shell macro to enforce argument count check,
both mandatory and optional arguments, these additions checks are
unnecessary.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-01-25 11:50:59 -05:00
Chaitanya Tata c53a1df138 wifi: shell: ap: Add a command to disconnect a station
The shell commands can be used to disconnect a connected station in AP
mode.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-01-25 11:50:59 -05:00
Chaitanya Tata de667a7fae wifi: ap: Add support to disconnect a STA
In AP mode, this can be used to disconnect a connected station.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-01-25 11:50:59 -05:00
Øyvind Rønningstad 1bbb0a9ddb lwm2m: Adapt to zcbor 0.8.0
Regenerate from CDDL, update patch, fix references in code.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-01-25 15:09:16 +00:00
Seppo Takalo ec3ec8cd2a net: lwm2m: Add LWM2M_ON_INIT() macro
Add macro that allows registration of initialization functions that
are called when LwM2M engine starts.

On LwM2M engine starts up, it first executes all initialization
functions in following priority order:
1. LWM2M_PRIO_ENGINE
2. LWM2M_PRIO_CORE, this is where all LwM2M core objects are initialized
3. LWM2M_PRIO_OBJ, this is where all other objects are initialized
4. LwM2M_PRIO_APP, application initialization.

Now on the initialization phase, we could rely that certain objects have
already been registered.
For example custom objects can register callbacks to core objects.
On application phase, we can initialize sensor objects and register
their callbacks because objects have already been initialized.

This LWM2M_ON_INIT() should replace all use of SYS_INIT()
with the default CONFIG_KERNEL_INIT_PRIORITY_DEFAULT.

Priority order is actually just alphabetical order of names, so
the order is set on a linkin phase, and we don't need any
runtime checking for it.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-24 10:44:28 +01:00
Vivekananda Uppunda 7eb0aa0468 net: wifi_shell: Remove TX-Injection and Promiscuous mode from Wi-Fi mode
Remove TX-Injection and Promiscuous mode setting from Wi-Fi mode shell
command. These commands are being moved to ethernet l2 layer

Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
2024-01-24 00:08:38 -05:00
Vivekananda Uppunda db4bf8d409 net: l2: ethernet: bring in TX-Injection mode to l2 ethernet
This set of changes brings in raw packet tx injection mode
feature to ethernet and removes it from being a Wi-Fi only feature.

It was earlier envisaged as Wi-Fi net management feature only.

Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
2024-01-24 00:08:38 -05:00
Seppo Takalo bf872870ea net: lwm2m: Fix segfault on failed bootstrap
If bootstrap fails, RD client will call lwm2m_engine_stop()
which will close the context.
The socket loop, however still contains a call to
hint_socket_state(context, NULL) which has a null pointer now.

Fix the segfault by allowing nullpointer on hint_socket_state().

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-22 17:25:02 +00:00
Robert Lubos 2c70c5d74a net: shell: Implement DHCPv4 server shell commands
Implement DHCPv4 shell module, which allows to start/stop DHCPv4 server
operation, and print server status (address leases).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-19 10:15:23 +00:00
Robert Lubos 3bc50871bc net: socket_services: Increase default stack size for DHCPv4 server
Increase socket services thread default stack size when DHCPv4 server is
enabled, as it uses synchronous processing.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-19 10:15:23 +00:00
Robert Lubos 1e08bbd543 net: dhcpv4: Implement DHCPv4 server
Add basic socket-based implementation of DHCPv4 sever.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-19 10:15:23 +00:00
Robert Lubos db80ed3e8d net: if: Add function to obtain IPv4 netmask
Add a helper function to obtain IPv4 netmask configured on an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-19 10:15:23 +00:00
Robert Lubos 1d14f13d75 net: arp: Make arp_update() function externally visible
So that it's possible to register ARP entries manually. Needed for DHCP
server implementation, which in unicast mode needs to reply to an IP
address that is not registered on the peer interface yet (hence no ARP
reply will be sent). It's needed to add an ARP entry manually in that
case, as hardware address is already known at that point.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-19 10:15:23 +00:00
Juha Ylinen 9eee8d2be5 net: lwm2m: Allow send operations when sleeping
Add new kconfig CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING.

When enabled and device is sleeping, Reqistration Update
message is skipped and messages from send operation and
notifications are sent right away.

Reqistration update message is also skipped when
lwm2m_engine resumes from pause state.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-01-19 09:48:46 +01:00
Bjarki Arge Andreasen 52be26a8e3 net: l2: ppp: Patch carrier lost and L2 enable/disable
L2 PPP is not able to handle the carrier being lost gracefully,
nor is it able to gracefully close the PPP connection when
net_if_down() is called.

This patch refactors the L2 PPP module to use the carrier state
to either properly close or simply terminate the PPP connection.

Additionally, it ensures that the PPP session is closed properly
before calling ppp->stop().

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-19 09:47:33 +01:00
Kapil Bhatt c22ce801e7 net: wifi_shell: Add help for maximum channels in scan
Add a line for scan's -c parameter which specify
to take care of maximum channels.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-01-19 09:44:22 +01:00
Markus Lassila 681330aaf0 net: sockets: tls: Fix crashes in get DTLS CID socket options
Get TLS_DTLS_CID_STATUS and TLS_DTLS_PEER_CID_VALUE utilize
mbedtls_ssl_get_peer_cid, which expects that mbedtls_ssl_setup
has been done.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2024-01-19 09:41:34 +01:00
Jukka Rissanen 5a933299bb net: socket: Change the printf modifier to print size_t correctly
The argument is size_t, so change the printf modifier to %zd
to avoid warning prints.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-18 20:13:31 +01:00
Jukka Rissanen 84ff0e8cdf net: socket: Allow user to tweak service dispatcher thread priority
User is able to tweak the socket service dispatcher thread
priority in order to get better performance from the system
if needed. By default the dispatcher thread runs in lowest
application thread priority (K_LOWEST_APPLICATION_THREAD_PRIO).

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-18 20:13:31 +01:00
Jukka Rissanen 38cacc7f63 net: shell: Make the thread name longer for sockets command
The thread name output field was a bit too short in "net sockets"
command, so make it 25 char long.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-18 20:13:31 +01:00