diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index 3faffe5858..dd15c21906 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -31,7 +31,6 @@ zephyr_library_sources(net_tc.c) zephyr_library_sources(icmp.c) zephyr_library_sources_ifdef(CONFIG_NET_IP connection.c) zephyr_library_sources_ifdef(CONFIG_NET_6LO 6lo.c) -zephyr_library_sources_ifdef(CONFIG_NET_DHCPV6 dhcpv6.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV4_AUTO ipv4_autoconf.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV4 icmpv4.c ipv4.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV4_IGMP igmp.c) diff --git a/subsys/net/ip/Kconfig.ipv6 b/subsys/net/ip/Kconfig.ipv6 index 38b954a319..7a80c3ae28 100644 --- a/subsys/net/ip/Kconfig.ipv6 +++ b/subsys/net/ip/Kconfig.ipv6 @@ -183,12 +183,6 @@ config NET_MAX_6LO_CONTEXTS 6lowpan context options table size. The value depends on your network and memory consumption. More 6CO options uses more memory. -config NET_DHCPV6 - bool "DHCPv6 client" - select NET_MGMT - select NET_MGMT_EVENT - depends on NET_UDP - if NET_6LO module = NET_6LO module-dep = NET_LOG @@ -215,13 +209,5 @@ module-str = Log level for IPv6 neighbor cache module-help = Enables IPv6 Neighbor Cache code to output debug messages. source "subsys/net/Kconfig.template.log_config.net" -if NET_DHCPV6 -module = NET_DHCPV6 -module-dep = NET_LOG -module-str = Log level for DHCPv6 client -module-help = Enables DHCPv6 client code to output debug messages. -source "subsys/net/Kconfig.template.log_config.net" -endif # NET_DHCPV6 - endif # NET_NATIVE_IPV6 endif # NET_IPV6 diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index 18ee9dbd5a..cc2356cdf6 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -45,7 +45,7 @@ LOG_MODULE_REGISTER(net_core, CONFIG_NET_CORE_LOG_LEVEL); #include "ipv4.h" #include "dhcpv4/dhcpv4_internal.h" -#include "dhcpv6_internal.h" +#include "dhcpv6/dhcpv6_internal.h" #include "route.h" diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index bcfb7911e8..40795ac5a1 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory_ifdef(CONFIG_NET_CAPTURE capture) add_subdirectory_ifdef(CONFIG_NET_ZPERF zperf) add_subdirectory_ifdef(CONFIG_NET_SHELL shell) add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) +add_subdirectory_ifdef(CONFIG_NET_DHCPV6 dhcpv6) if (CONFIG_NET_DHCPV4 OR CONFIG_NET_DHCPV4_SERVER) add_subdirectory(dhcpv4) diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index 6cfa044524..b8c92030c4 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -41,6 +41,8 @@ source "subsys/net/lib/capture/Kconfig" source "subsys/net/lib/dhcpv4/Kconfig" +source "subsys/net/lib/dhcpv6/Kconfig" + source "subsys/net/lib/trickle/Kconfig" source "subsys/net/lib/zperf/Kconfig" diff --git a/subsys/net/lib/dhcpv6/CMakeLists.txt b/subsys/net/lib/dhcpv6/CMakeLists.txt new file mode 100644 index 0000000000..2f1b8cba63 --- /dev/null +++ b/subsys/net/lib/dhcpv6/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip) + +zephyr_library_sources_ifdef(CONFIG_NET_DHCPV6 dhcpv6.c) diff --git a/subsys/net/lib/dhcpv6/Kconfig b/subsys/net/lib/dhcpv6/Kconfig new file mode 100644 index 0000000000..a406f4022a --- /dev/null +++ b/subsys/net/lib/dhcpv6/Kconfig @@ -0,0 +1,24 @@ +# DHCPv4 server implementation for Zephyr + +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + + +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +config NET_DHCPV6 + bool "DHCPv6 client" + select NET_MGMT + select NET_MGMT_EVENT + depends on NET_IPV6 && NET_UDP + +if NET_DHCPV6 +module = NET_DHCPV6 +module-dep = NET_LOG +module-str = Log level for DHCPv6 client +module-help = Enables DHCPv6 client code to output debug messages. +source "subsys/net/Kconfig.template.log_config.net" +endif # NET_DHCPV6 diff --git a/subsys/net/ip/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c similarity index 100% rename from subsys/net/ip/dhcpv6.c rename to subsys/net/lib/dhcpv6/dhcpv6.c diff --git a/subsys/net/ip/dhcpv6_internal.h b/subsys/net/lib/dhcpv6/dhcpv6_internal.h similarity index 100% rename from subsys/net/ip/dhcpv6_internal.h rename to subsys/net/lib/dhcpv6/dhcpv6_internal.h diff --git a/tests/net/dhcpv6/src/main.c b/tests/net/dhcpv6/src/main.c index 02463d20a2..ace0a0128c 100644 --- a/tests/net/dhcpv6/src/main.c +++ b/tests/net/dhcpv6/src/main.c @@ -9,7 +9,7 @@ #include #include -#include "../../../subsys/net/ip/dhcpv6.c" +#include "../../../subsys/net/lib/dhcpv6/dhcpv6.c" static struct in6_addr test_addr = { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1 } } };