From ebaa9b617d2033f50ecaeaaf6013b499f10e9a28 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Oct 2022 22:38:31 +0200 Subject: update-tunnelbroker: add error handling for fetch command --- update-tunnelbroker | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'update-tunnelbroker') 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; -- cgit v1.2.3-70-g09d2