aboutsummaryrefslogtreecommitdiffstats
path: root/update-tunnelbroker
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-10-08 23:03:29 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-10-08 23:06:22 +0200
commit16e93018ef4de9400421a335b4493bee9cd198ef (patch)
treeffc3b5bd2bc5678838f16af2901e94659582fece /update-tunnelbroker
parentebaa9b617d2033f50ecaeaaf6013b499f10e9a28 (diff)
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.
Diffstat (limited to 'update-tunnelbroker')
-rw-r--r--update-tunnelbroker19
1 files changed, 14 insertions, 5 deletions
diff --git a/update-tunnelbroker b/update-tunnelbroker
index 93a829c..eecd02b 100644
--- a/update-tunnelbroker
+++ b/update-tunnelbroker
@@ -32,17 +32,26 @@
:local InterfaceVal [ /interface/6to4/get $Interface ];
:if ($PublicAddress != $InterfaceVal->"local-address") do={
+ :local I 0;
+ :local Success false;
:local Comment [ $ParseKeyValueStore ($InterfaceVal->"comment") ];
:if ([ $CertificateAvailable "Starfield Secure Certificate Authority - G2" ] = false) do={
$LogPrintExit2 error $0 ("Downloading required certificate failed.") true;
}
$LogPrintExit2 info $0 ("Local address changed, sending UPDATE to tunnelbroker! New address: " . $PublicAddress) false;
- :do {
- /tool/fetch check-certificate=yes-without-crl \
- ("https://ipv4.tunnelbroker.net/nic/update\?hostname=" . $Comment->"id") \
- user=($Comment->"user") password=($Comment->"pass") output=none as-value;
- } on-error={
+ :while ($I < 3 && $Success = false) do={
+ :do {
+ /tool/fetch check-certificate=yes-without-crl \
+ ("https://ipv4.tunnelbroker.net/nic/update\?hostname=" . $Comment->"id") \
+ user=($Comment->"user") password=($Comment->"pass") output=none as-value;
+ :set Success true;
+ } 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;
}
/interface/6to4/set $Interface local-address=$PublicAddress;