diff options
author | Christian Hesse <mail@eworm.de> | 2022-10-08 22:38:31 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-10-08 22:38:31 +0200 |
commit | ebaa9b617d2033f50ecaeaaf6013b499f10e9a28 (patch) | |
tree | 8187c08478054baf597bf980f8494f76d46b4a02 | |
parent | dd22dfd26d01a39aab352d21db205c97a20dbcfa (diff) |
update-tunnelbroker: add error handling for fetch command
-rw-r--r-- | update-tunnelbroker | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/update-tunnelbroker b/update-tunnelbroker index 0075273..93a829c 100644 --- a/update-tunnelbroker +++ b/update-tunnelbroker @@ -38,9 +38,13 @@ $LogPrintExit2 error $0 ("Downloading required certificate failed.") true; } $LogPrintExit2 info $0 ("Local address changed, sending UPDATE to tunnelbroker! New address: " . $PublicAddress) false; - /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; + :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={ + $LogPrintExit2 error $0 ("Failed sending the local address to tunnelbroker! Wrong credentials?") true; + } /interface/6to4/set $Interface local-address=$PublicAddress; } else={ $LogPrintExit2 debug $0 ("All tunnelbroker configuration is up to date for interface " . $InterfaceVal->"name" . ".") false; |