mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-22 00:49:34 +00:00
ipv6-update: early exit with :exit
This commit is contained in:
parent
b37f47758a
commit
5b667c2d0a
1 changed files with 5 additions and 10 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
# update firewall and dns settings on IPv6 prefix change
|
# update firewall and dns settings on IPv6 prefix change
|
||||||
# https://rsc.eworm.de/doc/ipv6-update.md
|
# https://rsc.eworm.de/doc/ipv6-update.md
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -25,26 +24,22 @@
|
||||||
:local PdValid $"pd-valid";
|
:local PdValid $"pd-valid";
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $NaAddress ] = "str") do={
|
:if ([ :typeof $NaAddress ] = "str") do={
|
||||||
$LogPrint info $ScriptName ("An address (" . $NaAddress . ") was acquired, not a prefix. Ignoring.");
|
$LogPrint info $ScriptName ("An address (" . $NaAddress . ") was acquired, not a prefix. Ignoring.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $PdPrefix ] = "nothing" || [ :typeof $PdValid ] = "nothing") do={
|
:if ([ :typeof $PdPrefix ] = "nothing" || [ :typeof $PdValid ] = "nothing") do={
|
||||||
$LogPrint error $ScriptName ("This script is supposed to run from ipv6 dhcp-client.");
|
$LogPrint error $ScriptName ("This script is supposed to run from ipv6 dhcp-client.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ($PdValid != 1) do={
|
:if ($PdValid != 1) do={
|
||||||
$LogPrint info $ScriptName ("The prefix " . $PdPrefix . " is no longer valid. Ignoring.");
|
$LogPrint info $ScriptName ("The prefix " . $PdPrefix . " is no longer valid. Ignoring.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
|
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
|
||||||
|
|
@ -103,5 +98,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue