]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
odhcp6c: add new option to start 4in6 protos as dynamic interface 20368/head
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 7 Oct 2025 12:12:38 +0000 (14:12 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 3 Nov 2025 11:06:18 +0000 (12:06 +0100)
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@dev.tdt.de>
package/network/ipv6/odhcp6c/files/dhcpv6.script
package/network/ipv6/odhcp6c/files/dhcpv6.sh

index a664aa13aa4159fe62b8f87bd78d253ac2b97f77..4a3b1b272c5ddabc79aba62733998f60b104bd89 100755 (executable)
@@ -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=""
 
index e6d8746a8dc53c9b493ff13c0d08051d837c2fa1..59a6021c5c1fcd99911a9cfdb41a385d97b85c91 100755 (executable)
@@ -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 \