public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: development@lists.ipfire.org
Cc: Antonio Quartulli <antonio@mandelbit.com>
Subject: [PATCH 2/4] wio.cgi: Get the address of the DDNS hosts only once
Date: Tue,  1 Dec 2026 15:31:51 +0100	[thread overview]
Message-ID: <20261201143155.1798388-3-antonio@mandelbit.com> (raw)
In-Reply-To: <20261201143155.1798388-1-antonio@mandelbit.com>

GetDyndnsRedIP() can fetch the public address from a server, which was
done for each enabled host.

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 html/cgi-bin/wio.cgi | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/html/cgi-bin/wio.cgi b/html/cgi-bin/wio.cgi
index 35e8ff041..8a229c92b 100755
--- a/html/cgi-bin/wio.cgi
+++ b/html/cgi-bin/wio.cgi
@@ -1030,6 +1030,9 @@ my @dyndnsnames = ();
 if ( -s "$dyndnsconfig" ) {
 	@ddns = &General::read_file($dyndnsconfig);
 
+	# May have to be fetched from a server: only do it once
+	my $ddnsip;
+
 	foreach (@ddns) {
 		chomp;
 		@temp = split (/\,/, $_);
@@ -1037,7 +1040,8 @@ if ( -s "$dyndnsconfig" ) {
 		my $class = "has-text-info";
 
 		if ( $temp[7] eq "on" ) {
-			$class = ( &HTTPClient::DyndnsServiceSync (&HTTPClient::GetDyndnsRedIP,$temp[1],$temp[2]) ? "has-text-success" : "has-text-danger" );
+			$ddnsip //= &HTTPClient::GetDyndnsRedIP();
+			$class = ( &HTTPClient::DyndnsServiceSync ($ddnsip,$temp[1],$temp[2]) ? "has-text-success" : "has-text-danger" );
 		}
 
 		push(@dyndnsnames, "<span class='$class'>@{[ &Header::escape($temp[1]) ]}.@{[ &Header::escape($temp[2]) ]}</span>");
-- 
2.56.1



  parent reply	other threads:[~2026-12-01 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 14:31 [PATCH 0/4] Use the address ddns publishes in the DDNS sync check (#14766) Antonio Quartulli
2026-12-01 14:31 ` [PATCH 1/4] network-functions.pl: Add ip_address_is_global() Antonio Quartulli
2026-12-01 14:31 ` Antonio Quartulli [this message]
2026-12-01 14:31 ` [PATCH 3/4] ddns.cgi: Get the address of the DDNS hosts only when needed Antonio Quartulli
2026-12-01 14:31 ` [PATCH 4/4] http-client-functions.pl: Use the address ddns publishes for the sync check Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201143155.1798388-3-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox