From c2d458fa716269e77678c31c6df5b84d75a6b6cd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 13 Apr 2026 16:28:31 +0200 Subject: [PATCH] ipv6-update: support dhcpv6-client-lease script... ... by adding a provide, and handling global variable $DHCPv6ClientLeaseVars. --- doc/ipv6-update.md | 1 + doc/ppp-on-up.md | 1 + ipv6-update.rsc | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/ipv6-update.md b/doc/ipv6-update.md index 672b5fac..a8d2c7e7 100644 --- a/doc/ipv6-update.md +++ b/doc/ipv6-update.md @@ -77,6 +77,7 @@ start with "`ipv6-pool-`" and actual pool name, followed by a comma, See also -------- +* [Run other scripts on IPv6 DHCP client lease](dhcpv6-client-lease.md) * [Run scripts on ppp connection](ppp-on-up.md) --- diff --git a/doc/ppp-on-up.md b/doc/ppp-on-up.md index 51c8bc96..e492eb1b 100644 --- a/doc/ppp-on-up.md +++ b/doc/ppp-on-up.md @@ -36,6 +36,7 @@ Just install the script: See also -------- +* [Run other scripts on IPv6 DHCP client lease](dhcpv6-client-lease.md) * [Update configuration on IPv6 prefix change](ipv6-update.md) * [Update tunnelbroker configuration](update-tunnelbroker.md) diff --git a/ipv6-update.rsc b/ipv6-update.rsc index 7b4e1c3f..54c08179 100644 --- a/ipv6-update.rsc +++ b/ipv6-update.rsc @@ -4,6 +4,7 @@ # https://rsc.eworm.de/COPYING.md # # requires RouterOS, version=7.22 +# provides: dhcpv6-client-lease, order=40 # # update firewall and dns settings on IPv6 prefix change # https://rsc.eworm.de/doc/ipv6-update.md @@ -14,14 +15,17 @@ do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50; :local ScriptName [ :jobname ]; + :global EitherOr; :global LogPrint; :global ParseKeyValueStore; :global ScriptLock; - :local NaAddress $"na-address"; - :local NaValid $"na-valid"; - :local PdPrefix $"pd-prefix"; - :local PdValid $"pd-valid"; + :global DHCPv6ClientLeaseVars; + + :local NaAddress [ $EitherOr $"na-address" ($DHCPv6ClientLeaseVars->"na-address") ]; + :local NaValid [ $EitherOr $"na-valid" ($DHCPv6ClientLeaseVars->"na-valid") ]; + :local PdPrefix [ $EitherOr $"pd-prefix" ($DHCPv6ClientLeaseVars->"pd-prefix") ]; + :local PdValid [ $EitherOr $"pd-valid" ($DHCPv6ClientLeaseVars->"pd-valid") ]; :if ([ $ScriptLock $ScriptName ] = false) do={ :exit;