From 38caff28860e3c028f709849814d52ed25f79df7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 25 Mar 2025 14:52:14 +0200 Subject: [PATCH] snippets: Add Wi-Fi IPv4 and IPv6 snippet Introduce a snippet for configuring IPv4 and IPv6 over Wi-Fi support in networking samples. Signed-off-by: Jukka Rissanen --- snippets/wifi-ip/README.rst | 28 ++++++++++++++++++++++++++++ snippets/wifi-ip/snippet.yml | 3 +++ snippets/wifi-ip/wifi-ip.conf | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 snippets/wifi-ip/README.rst create mode 100644 snippets/wifi-ip/snippet.yml create mode 100644 snippets/wifi-ip/wifi-ip.conf diff --git a/snippets/wifi-ip/README.rst b/snippets/wifi-ip/README.rst new file mode 100644 index 00000000000..b9d6808ce85 --- /dev/null +++ b/snippets/wifi-ip/README.rst @@ -0,0 +1,28 @@ +.. _snippet-wifi-ip: + +Wi-Fi IPv4 and IPv6 Snippet (wifi-ip) +##################################### + +.. code-block:: console + + west build -S wifi-ip [...] + +Overview +******** + +This snippet enables IPv4 and IPv6 Wi-Fi support in supported networking samples. +The sample execution is postponed until Wi-Fi connectivity is established. + +Use Wi-Fi shell to connect to the Wi-Fi network: + +.. code-block:: console + + wifi connect -s -k -p + +Requirements +************ + +Hardware support for: + +- :kconfig:option:`CONFIG_WIFI` +- :kconfig:option:`CONFIG_WIFI_USE_NATIVE_NETWORKING` diff --git a/snippets/wifi-ip/snippet.yml b/snippets/wifi-ip/snippet.yml new file mode 100644 index 00000000000..0c4b0759b60 --- /dev/null +++ b/snippets/wifi-ip/snippet.yml @@ -0,0 +1,3 @@ +name: wifi-ip +append: + EXTRA_CONF_FILE: wifi-ip.conf diff --git a/snippets/wifi-ip/wifi-ip.conf b/snippets/wifi-ip/wifi-ip.conf new file mode 100644 index 00000000000..788715d59b7 --- /dev/null +++ b/snippets/wifi-ip/wifi-ip.conf @@ -0,0 +1,32 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_NET_L2_ETHERNET=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y + +# Make sure there is enough resources for supplicant and most of the samples +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_ZVFS_OPEN_MAX=24 +CONFIG_NET_MAX_CONN=10 +CONFIG_ZVFS_POLL_MAX=10 + +# Enable both IPv4 and IPv6 +CONFIG_NET_IPV6=y +CONFIG_NET_IPV4=y + +# DHCPv4 and DHCPv6 are enabled +CONFIG_NET_DHCPV4=y +CONFIG_NET_DHCPV6=y +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_MY_IPV6_ADDR="" +CONFIG_NET_CONFIG_INIT_TIMEOUT=0 + +# DNS +CONFIG_DNS_RESOLVER=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Wi-Fi shell +CONFIG_NET_SHELL=y +CONFIG_NET_L2_WIFI_SHELL=y +CONFIG_SHELL_STACK_SIZE=5200