[openwrt/openwrt] odhcp6c: add new option to start 4in6 protos as dynamic interface

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 3 03:23:35 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/32c46b569fa350be9edb2b0bf2c37c4525a34190

commit 32c46b569fa350be9edb2b0bf2c37c4525a34190
Author: Florian Eckert <fe at dev.tdt.de>
AuthorDate: Tue Oct 7 14:12:38 2025 +0200

    odhcp6c: add new option to start 4in6 protos as dynamic interface
    
    If proto 'dhcpv6' is set for an interface, dynamic interfaces are created
    for the protocols map, dslite or 464xlat if this netifd protocols are
    installed and the interface option is not explicitly set to '0'.
    
    The problem is that this option cannot be configured via LuCI, which means
    that the dynamic protocols are started. In my case, that is the '464xlat'
    '6in4' protocol. I see the follwing log messages continuously in the log as
    I do not have a '464xlat' in my network.
    
    Fri Aug 22 10:36:33 2025 daemon.notice netifd: Interface 'wan6_4' is now down
    Fri Aug 22 10:36:33 2025 daemon.notice netifd: Interface 'wan6_4' is setting up now
    Fri Aug 22 10:36:36 2025 daemon.notice netifd: Interface 'wan6_4' is now down
    Fri Aug 22 10:36:36 2025 daemon.notice netifd: Interface 'wan6_4' is setting up now
    
    To fix this by adding a new option to disable the dynamic interface creation
    for '4in6' if needed. The option is named '4in6_dynamic' and is a boolean.
    
    If the new option is 'true' (default) dynamic interfaces are create.
    If the new option set to 'false' no dynamic 4in6 interface are created.
    
    Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 package/network/ipv6/odhcp6c/files/dhcpv6.script |  5 +++++
 package/network/ipv6/odhcp6c/files/dhcpv6.sh     | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script
index a664aa13aa..4a3b1b272c 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script
@@ -149,6 +149,11 @@ setup_interface () {
 
 	proto_send_update "$INTERFACE"
 
+	# If the flag '$DYNAMIC' is set to '0' (default=1), then the dynamic
+	# interfaces for the proto 'map', 'dslite' or '464xlat' are not
+	# created, even if the requirements are met.
+	[ "$DYNAMIC" = 0 ] && return
+
 	MAPTYPE=""
 	MAPRULE=""
 
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index e6d8746a8d..59a6021c5c 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -43,6 +43,7 @@ proto_dhcpv6_init_config() {
 	proto_config_add_boolean keep_ra_dnslifetime
 	proto_config_add_int "ra_holdoff"
 	proto_config_add_boolean verbose
+	proto_config_add_boolean dynamic
 }
 
 proto_dhcpv6_add_prefix() {
@@ -63,7 +64,7 @@ proto_dhcpv6_setup() {
 	local iface_map iface_464xlat ip6ifaceid userclass vendorclass
 	local delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite
 	local encaplimit_map skpriority soltimeout fakeroutes sourcefilter
-	local keep_ra_dnslifetime ra_holdoff verbose mtu_dslite
+	local keep_ra_dnslifetime ra_holdoff verbose mtu_dslite dynamic
 
 	local ip6prefix ip6prefixes
 
@@ -73,7 +74,7 @@ proto_dhcpv6_setup() {
 	json_get_vars iface_map iface_464xlat ip6ifaceid userclass vendorclass
 	json_get_vars delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite
 	json_get_vars encaplimit_map skpriority soltimeout fakeroutes sourcefilter
-	json_get_vars keep_ra_dnslifetime ra_holdoff verbose mtu_dslite
+	json_get_vars keep_ra_dnslifetime ra_holdoff verbose mtu_dslite dynamic
 
 	json_for_each_item proto_dhcpv6_add_prefix ip6prefix ip6prefixes
 
@@ -154,6 +155,12 @@ proto_dhcpv6_setup() {
 	[ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1"
 	[ "$extendprefix" = "1" ] && proto_export "EXTENDPREFIX=1"
 
+	if [ "$dynamic" = 0 ]; then
+		proto_export "DYNAMIC=0"
+	else
+		proto_export "DYNAMIC=1"
+	fi
+
 	proto_export "INTERFACE=$config"
 	proto_run_command "$config" odhcp6c \
 		-s /lib/netifd/dhcpv6.script \




More information about the lede-commits mailing list