From 44af9a7b3fec3929f8554af9633a5b8068189b48 Mon Sep 17 00:00:00 2001
From: "hayder.hassan" <hayder.hassan@bt.com>
Date: Wed, 28 May 2025 08:53:23 +0100
Subject: [PATCH] Fix client status for registered IP

---
 files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh | 2 ++
 files/ddns-script/usr/libexec/rpcd/ddnsmngr            | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh b/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh
index ab81abf..bc32fc4 100644
--- a/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh
+++ b/files/ddns-script/usr/lib/ddnsmngr/ddnsmngr_updater.sh
@@ -404,6 +404,8 @@ while : ; do
 		else
 			write_log 3 "IP update not accepted by DDNS Provider"
 		fi
+	elif [ "$CURRENT_IP" = "$REGISTERED_IP" ]; then
+		write_log 6 "No update needed - L: '$CURRENT_IP' == R: '$REGISTERED_IP'"
 	fi
 
 	# now we wait for check interval before testing if update was recognized
diff --git a/files/ddns-script/usr/libexec/rpcd/ddnsmngr b/files/ddns-script/usr/libexec/rpcd/ddnsmngr
index 4cd383e..786e1c3 100644
--- a/files/ddns-script/usr/libexec/rpcd/ddnsmngr
+++ b/files/ddns-script/usr/libexec/rpcd/ddnsmngr
@@ -144,13 +144,13 @@ get_client_status() {
 			if [ -f "${log_file}" ]; then
 				state="Connecting"
 				while read -r line; do
-					if [[ "${line}" =~ "Update successful" ]]; then
+					if [[ "${line}" =~ "Update successful" ]] || [[ "${line}" =~ "No update needed" ]]; then
 						state="Updated"
 					elif [[ "${line}" =~ "ERROR" ]] && [[ "${line}" =~ "Please check your configuration" ]]; then
 						state="Error_Misconfigured"
 					elif [[ "${line}" =~ "Registered IP" ]]; then
 						state="Connecting"
-					elif [[ "${line}" =~ "failed" ]]; then
+					elif [[ "${line}" =~ "ERROR" ]] || [[ "${line}" =~ "failed" ]]; then
 						state="Error"
 					fi
 				done < "${log_file}"
-- 
GitLab