aboutsummaryrefslogtreecommitdiffstats
path: root/update-tunnelbroker
diff options
context:
space:
mode:
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;