2.8 KiB
Run other scripts on IPv6 DHCP client lease
ℹ️ Info: This script can not be used on its own but requires the base installation. See main README for details.
Description
This script is supposed to run from IPv6 DHCP client as lease script. On a
DHCP leasse it runs each script containing the following line, where ## is
a decimal number for ordering:
# provides: dhcpv6-client-lease, order=##
The lease script is started with some variables injected, but these are not available in child scripts. However this script makes these variables available with a global variable. This code is required in child script:
:global EitherOr;
: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") ];
The values are available under different name then, use $PdPrefix instead
of $"pd-prefix", and so on. The resulting script supports both, being a
lease script itself or being run as child.
Currently it runs if available, in order:
Requirements and installation
Just install the script:
$ScriptInstallUpdate dhcpv6-client-lease;
... and add it as lease-script to your dhcp client:
/ipv6/dhcp-client/set lease-script="dhcpv6-client-lease" [ find ];