mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-04 15:14:28 +02:00
update-tunnelbroker: work around timing issue
Looks like fetch command has a timing issue with the tunnelbroker endpoint... We have to try several times to work around this. Consider the update failed on third error.
This commit is contained in:
parent
ebaa9b617d
commit
16e93018ef
1 changed files with 14 additions and 5 deletions
|
@ -32,17 +32,26 @@
|
||||||
:local InterfaceVal [ /interface/6to4/get $Interface ];
|
:local InterfaceVal [ /interface/6to4/get $Interface ];
|
||||||
|
|
||||||
:if ($PublicAddress != $InterfaceVal->"local-address") do={
|
:if ($PublicAddress != $InterfaceVal->"local-address") do={
|
||||||
|
:local I 0;
|
||||||
|
:local Success false;
|
||||||
:local Comment [ $ParseKeyValueStore ($InterfaceVal->"comment") ];
|
:local Comment [ $ParseKeyValueStore ($InterfaceVal->"comment") ];
|
||||||
|
|
||||||
:if ([ $CertificateAvailable "Starfield Secure Certificate Authority - G2" ] = false) do={
|
:if ([ $CertificateAvailable "Starfield Secure Certificate Authority - G2" ] = false) do={
|
||||||
$LogPrintExit2 error $0 ("Downloading required certificate failed.") true;
|
$LogPrintExit2 error $0 ("Downloading required certificate failed.") true;
|
||||||
}
|
}
|
||||||
$LogPrintExit2 info $0 ("Local address changed, sending UPDATE to tunnelbroker! New address: " . $PublicAddress) false;
|
$LogPrintExit2 info $0 ("Local address changed, sending UPDATE to tunnelbroker! New address: " . $PublicAddress) false;
|
||||||
|
:while ($I < 3 && $Success = false) do={
|
||||||
:do {
|
:do {
|
||||||
/tool/fetch check-certificate=yes-without-crl \
|
/tool/fetch check-certificate=yes-without-crl \
|
||||||
("https://ipv4.tunnelbroker.net/nic/update\?hostname=" . $Comment->"id") \
|
("https://ipv4.tunnelbroker.net/nic/update\?hostname=" . $Comment->"id") \
|
||||||
user=($Comment->"user") password=($Comment->"pass") output=none as-value;
|
user=($Comment->"user") password=($Comment->"pass") output=none as-value;
|
||||||
|
:set Success true;
|
||||||
} on-error={
|
} on-error={
|
||||||
|
:delay 10s;
|
||||||
|
:set I ($I + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:if ($Success = false) do={
|
||||||
$LogPrintExit2 error $0 ("Failed sending the local address to tunnelbroker! Wrong credentials?") true;
|
$LogPrintExit2 error $0 ("Failed sending the local address to tunnelbroker! Wrong credentials?") true;
|
||||||
}
|
}
|
||||||
/interface/6to4/set $Interface local-address=$PublicAddress;
|
/interface/6to4/set $Interface local-address=$PublicAddress;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue