odhcp6c: add new option to start 4in6 protos as dynamic interface
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run

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>
This commit is contained in:
Florian Eckert 2025-10-07 14:12:38 +02:00
parent 73e21749ba
commit 32c46b569f
2 changed files with 14 additions and 2 deletions

View file

@ -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=""

View file

@ -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 \