From patchwork Tue Dec 1 14:31:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 10939 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1 raw public key) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4jf3Hs3xypz3wvg for ; Tue, 01 Dec 2026 14:32:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail02.haj.ipfire.org", Issuer "YE2" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4jf3Hq57KPz7GJ for ; Tue, 01 Dec 2026 14:32:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4jf3Hq1TyCz2yFY for ; Tue, 01 Dec 2026 14:32:07 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4jf3Hm1sBLz2xZB for ; Tue, 01 Dec 2026 14:32:04 +0000 (UTC) Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [IPv6:2001:67c:2050:102:465::112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bit raw public key) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.mailbox.org", Issuer "Thawte TLS RSA CA G1" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4jf3Hl1QH8z7Cj for ; Tue, 01 Dec 2026 14:32:03 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=Opmus28k; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::112 as permitted sender) smtp.mailfrom=antonio@mandelbit.com ARC-Seal: i=1; a=rsa-sha256; d=lists.ipfire.org; s=202003rsa; cv=none; t=1796135524; b=l9MvAOweUuIkaOiF4iSk+O+7ZCLdxOmzFmH9pe0ypo3XfzFU4FIL/Xr9XLMDlt+dU9hYSi A3jZOfAv4KhBBU2KwX9U9oZZEgR5as4WiMw+zoMsZPbbLDFrGUCJPqiUr+FCECUD9b9Yfp 9+2Huo/mEVV0H60EfgvZEfAV4N2j7p8647r9Ojk2JLsWfkbLCEQxP675K+v2RswBvn56b7 1NKnxrTfbXVh+iPsdS83fyshIihYSbazKkp9koE4xHee4XuLpx6fh1/rgA1ObzxXv2ekmL z/DX0dhBY6S1+9fY/iAWclAcG0XRMlz0YTsli9s2Fqfvjlzp1imzJ+824raC2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1796135524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TIYaJjnQaiqbSw3qBRe0sJobff0WB/GIGsnDDgjXICk=; b=wx5wtfJzl+K090F9f5bpTWX7OujwXTfgg6+Nns1Rbkpmtuy9o/4nmy0KNH23OnVewiliLa w40ylpwdcRm5WuczvRdEYR+Cz4K4t+YagbmGEQx2GTEq6K4scqNW6ni5/V9fD3BzNFjTJA 1NrfVpUwmihRty7zeAwdFOe6UIzIDbYXXLcCQrXuWz/nD17FE9FpWfyNHt2Ay+IsA0JQzA 4KWwts7ezY5BLy944ALBt7T56kX1tCcYmQumtowk0h3X2EPMUQYvLobn2yStVzE7U1pWDE ioylfZo30QOvO5yzSrpQsSrAFyuylq/C9N0wFvrAdMUynFIe/ct1Mv0WCyYhHg== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=Opmus28k; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::112 as permitted sender) smtp.mailfrom=antonio@mandelbit.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jf3Hh4CC6z5x6N; Tue, 01 Dec 2026 15:32:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796135520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TIYaJjnQaiqbSw3qBRe0sJobff0WB/GIGsnDDgjXICk=; b=Opmus28kHNw/vk9WuZwAwnJl5k+wdd3DwDafLmpcGFDZcBk4+z1Lt3TT0oEDWA2ydub96s +kfitEXJ+7cZS4pMWLMMELcybYoN2GGf2hIjKctWko6HmSzHc15E7CifsgXhnOVgCvMvTo supaJrqEGgpDur10EPHfAfyL4T0dDOJWnfWqru3f0oIXpdKglGgXAZeAk2uUJLk2cBckzK 9UiPZcd5g9DnSnwHGR023aE0NiSHkJxWV0plH0+HHZ53eGJ6uV9UqmI3lS0pzH6EfUPOrV rxCRvE7oPot8R6SAqn4AtkBfUhjwYizEOj7b+NcU7holz5IzotM8u7X/69D1gQ== From: Antonio Quartulli To: development@lists.ipfire.org Cc: Antonio Quartulli Subject: [PATCH 4/4] http-client-functions.pl: Use the address ddns publishes for the sync check Date: Tue, 1 Dec 2026 15:31:53 +0100 Message-ID: <20261201143155.1798388-5-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201143155.1798388-1-antonio@mandelbit.com> References: <20261201143155.1798388-1-antonio@mandelbit.com> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 X-Rspamd-Action: no action X-Spamd-Result: default: False [-5.30 / 11.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM(-3.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; RCVD_IN_DNSWL_LOW(-0.20)[2001:67c:2050:b231:465::102:received,2001:67c:2050:102:465::112:from]; R_SPF_ALLOW(-0.20)[+ip6:2001:67c:2050::/48]; R_DKIM_ALLOW(-0.10)[mandelbit.com:s=MBO0001]; R_DKIM_ALIGNED(-0.10)[strict]; MX_GOOD(-0.10)[mxext3.mailbox.org]; MIME_GOOD(-0.10)[text/plain]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[mandelbit.com]; IP_REPUTATION_HAM(0.00)[asn: 199118(-0.35),country: DE(-0.01),ip: 2001:67c:2050:102::(0.00)]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[mandelbit.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; DKIM_REPUTATION(0.00)[0]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:199118,ipnet:2001:67c:2050::/48,country:DE]; FROM_HAS_DN(0.00)[] X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4jf3Hl1QH8z7Cj GetDyndnsRedIP() only fetched the public address if "Fetch the public IP" was selected and RED was in RFC1918 or the shared address space. ddns uses it whenever fetching is selected, and when RED can't be reached from the Internet, e.g. in 169.254.0.0/16, so the web interface showed those hosts as out of sync. With RED behind a router, the page now fetches the address like ddns does. Bug: #14766 Signed-off-by: Antonio Quartulli --- config/cfgroot/http-client-functions.pl | 26 ++++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/config/cfgroot/http-client-functions.pl b/config/cfgroot/http-client-functions.pl index aefad7639..6a0a0fa4d 100644 --- a/config/cfgroot/http-client-functions.pl +++ b/config/cfgroot/http-client-functions.pl @@ -313,7 +313,7 @@ sub FetchPublicIp { } # -# This sub returns the red IP used to compare in DyndnsServiceSync +# This sub returns the address that ddns publishes, to compare in DyndnsServiceSync # sub GetDyndnsRedIP { my %settings; @@ -322,21 +322,15 @@ sub GetDyndnsRedIP { &General::readhash("${General::swroot}/ddns/settings", \%settings); # Try to grab the address from the local-ipaddress file. - my $ip = &Network::grab_address_from_file("${General::swroot}/red/local-ipaddress") or return 'unavailable'; - - # 100.64.0.0/10 is reserved for dual-stack lite (http://tools.ietf.org/html/rfc6598). - if (&Network::ip_address_in_network($ip, "10.0.0.0/255.0.0.0") || - &Network::ip_address_in_network($ip, "172.16.0.0/255.240.0.0") || - &Network::ip_address_in_network($ip, "192.168.0.0/255.255.0.0") || - &Network::ip_address_in_network($ip, "100.64.0.0/255.192.0.0")) - { - if ($settings{'BEHINDROUTER'} eq 'FETCH_IP') { - # Call function to omit the real address. - my $RealIP = &FetchPublicIp; - - # Check if the grabbed address is valid. - $ip = (&Network::check_ip_address ($RealIP) ? $RealIP : 'unavailable'); - } + my $ip = &Network::grab_address_from_file("${General::swroot}/red/local-ipaddress"); + + # Like ddns, use the public address if asked to, or if RED is unknown or + # can't be reached from the Internet + if ($settings{'BEHINDROUTER'} eq 'FETCH_IP' || !&Network::ip_address_is_global($ip)) { + my $RealIP = &FetchPublicIp; + + # Check if the grabbed address is valid. + $ip = (&Network::check_ip_address ($RealIP) ? $RealIP : 'unavailable'); } return $ip;