From: Florian Eckert Date: Tue, 7 Oct 2025 12:12:38 +0000 (+0200) Subject: odhcp6c: add new option to start 4in6 protos as dynamic interface X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F20368%2Fhead;p=thirdparty%2Fopenwrt.git 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 --- diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index a664aa13aa4..4a3b1b272c5 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 e6d8746a8dc..59a6021c5c1 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 \