ddns-scripts: netcup.com adjust update error path
authorTim Flubshi <redacted>
Sun, 26 Apr 2026 16:00:44 +0000 (18:00 +0200)
committerFlorian Eckert <redacted>
Mon, 27 Apr 2026 12:26:29 +0000 (14:26 +0200)
Adjust the update error handling path to avoid hard failures on
recoverable errors. This allows ddns to retry updates after the
configured retry interval and improves reliability.

Signed-off-by: Tim Flubshi <redacted>
net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/update_netcup_com.sh

index 296602de12cd33781851e8905f6d008af69594d5..d90b1fcc502fb645382535c1550a4f074b18ea81 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=2.8.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_LICENSE:=GPL-2.0
 
index 5ad204f0963b1f747df0c1598ee25bf52f47b265..dfb3670b1d18f16639c4885e099de71e84f1f36a 100755 (executable)
@@ -134,8 +134,10 @@ netcup_check_response() {
 
        if [ "$__status" != "success" ]; then
                json_cleanup
-               write_log 14 "netcup DDNS: $__context failed (status='$__status' code=$__statuscode): $__shortmsg"
+               write_log 3 "netcup DDNS: $__context failed (status='$__status' code=$__statuscode): $__shortmsg"
+               return 1
        fi
+       return 0
 }
 
 # ---------------------------------------------------------------------------
@@ -154,16 +156,21 @@ json_add_object "param"
        json_add_string "apipassword"    "$password"
 json_close_object
 
-netcup_post || write_log 14 "netcup DDNS: HTTP request failed during login"
-netcup_check_response "login"
+if ! netcup_post; then
+       write_log 3 "netcup DDNS: HTTP request failed during login"
+       return 1
+fi
+netcup_check_response "login" || return 1
 
 json_select "responsedata"
 json_get_var __SESSION_ID "apisessionid"
 json_select ".."
 json_cleanup
 
-[ -z "$__SESSION_ID" ] && \
-       write_log 14 "netcup DDNS: login succeeded but no session ID was returned"
+if [ -z "$__SESSION_ID" ]; then
+       write_log 3 "netcup DDNS: login succeeded but no session ID was returned"
+       return 1
+fi
 
 write_log 6 "netcup DDNS: login successful"
 
@@ -178,8 +185,11 @@ json_add_object "param"
        json_add_string "apisessionid"   "$__SESSION_ID"
 json_close_object
 
-netcup_post || write_log 14 "netcup DDNS: HTTP request failed during infoDnsRecords"
-netcup_check_response "infoDnsRecords"
+if ! netcup_post; then
+       write_log 3 "netcup DDNS: HTTP request failed during infoDnsRecords"
+       return 1
+fi
+netcup_check_response "infoDnsRecords" || return 1
 
 # --- Step 3: Find the record matching our hostname and type ----------------
 #
@@ -216,8 +226,10 @@ done
 
 json_cleanup
 
-[ -z "$__MATCH_ID" ] && \
-       write_log 14 "netcup DDNS: no [$__RRTYPE] record found for hostname '$__REC_HOSTNAME' in zone '$__ZONE'"
+if [ -z "$__MATCH_ID" ]; then
+       write_log 3 "netcup DDNS: no [$__RRTYPE] record found for hostname '$__REC_HOSTNAME' in zone '$__ZONE'"
+       return 1
+fi
 
 # --- Step 4: Update the matched record with the new IP ---------------------
 
@@ -242,8 +254,12 @@ json_add_object "param"
        json_close_object
 json_close_object
 
-netcup_post || write_log 14 "netcup DDNS: HTTP request failed during updateDnsRecords"
-netcup_check_response "updateDnsRecords"
+if ! netcup_post; then
+       write_log 3 "netcup DDNS: HTTP request failed during updateDnsRecords"
+       return 1
+fi
+
+netcup_check_response "updateDnsRecords" || return 1
 json_cleanup
 
 write_log 6 "netcup DDNS: '$__REC_HOSTNAME.$__ZONE' [$__RRTYPE] updated to $__IP"
git clone https://git.99rst.org/PROJECT