From patchwork Tue Dec 1 14:31:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 10940 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) (Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4jf3Hs4TCzz3www for ; Tue, 01 Dec 2026 14:32:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [IPv6:2001:678:b28::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 4jf3Hr0rYRz7P8 for ; Tue, 01 Dec 2026 14:32:08 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4jf3Hq3nYcz2xsW 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 [IPv6:2001:678:b28::25]) (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 4jf3Hm4SfSz2y0C for ; Tue, 01 Dec 2026 14:32:04 +0000 (UTC) Received: from mout-b-203.mailbox.org (mout-b-203.mailbox.org [IPv6:2001:67c:2050:102:465::203]) (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 4jf3Hk1fZ2z71B for ; Tue, 01 Dec 2026 14:32:02 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=wxRJDWBn; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::203 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=dj0fhvWUHdNnWxZWTmBlrj8RAJzpa1eq0FF+f/cdMUeeqZr+LWHDuApltrzkwRnfjaHSQy sc++IkYGGHzz4A48cF99QTL7/Y6Mu+4J0nqCcm2gR3H+AjXA9s5Wif8D9eeN/axkAEAU7B TcYLf59hMAmcyIibUiNDOtzTPxs7YxtAIm1v65IwRNfhsfN/IuxtsQzFXIpGoyERhWdFPz VUmNPpOXQm5cgBMtyaYRnyk1DuToDioR7tRNsMt16wvcPRTTPhhN2zEVUCqvF0+N35MMx6 HwCoaBDcuEbcnrsZtdPY8pxHjx03awh5FjwjxHpuTJqF8xM7tJqsTLSnRhrExg== 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=rVJjT+XLzyKrMPoib3hu1Br6xURvlEz6djZChAUDduc=; b=AAY9hb8J1ufflfdv5YEFeUZ40UH3cPJLZPxmpEyhY+Z2HKFIpVacmMQ9jqNPntnfx0NsZr 4BNNvCNBuBhNZX0xa7ZwQ+wYKQ08qmKP5kOiwLuJz98UnYsU918vhioNrIca852MujvNq+ SC6aFJL2xDsLCDX9lB4iwQLeX40c6IYbdjdqkdlZ5E6EkbZc49VamnytRvdCeyVsvAzf7t /uIggbvjhYzJHL5Bs1bR3y77WQBywss72H56f50lKhdSQkUd//uijNdS/6K8js6lGC1Xzl pSjZdZ7YPhmw0OZX2w7XgpEaNL1Y6RKSMLZTpEPjZxGYPlgDINAkvj48DS6htg== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=wxRJDWBn; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::203 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 SHA512) (No client certificate requested) by mout-b-203.mailbox.org (Postfix) with ESMTPS id 4jf3Hg45LmzLmK4; Tue, 01 Dec 2026 15:31:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796135519; 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=rVJjT+XLzyKrMPoib3hu1Br6xURvlEz6djZChAUDduc=; b=wxRJDWBndD63M5qrB15SiFUoRmujsRA88yT765HmJwxCrQkFKddGF9sPbcAwzrcRqaIVsd IxhudbQ6X2lQE4kSWPOmMWXXbdstYD8QcpXORjPuwu0ZUAw7Vsf062bm6MCNiepDhzx3Ba 79FpgAnk1BWvux1uhDOBcO3BeJ/xYi9C4QLYRw5MpRPhhJTlMPLx+WwmuNW9E/ReQbz9Ho 1bJZ72C8dPfGA94C88EXKEIwvQ/gGEi4ddI65+bZs/lqDbzU1+rUjv6nopjbKl9iia2jjZ 9usQejK8/pAJyU4hJKVaLXx4j3oWI5ZLWNHKHY3/AksFbDk7ST+b21BHKeethA== From: Antonio Quartulli To: development@lists.ipfire.org Cc: Antonio Quartulli Subject: [PATCH 1/4] network-functions.pl: Add ip_address_is_global() Date: Tue, 1 Dec 2026 15:31:50 +0100 Message-ID: <20261201143155.1798388-2-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.10 / 11.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM(-3.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:67c:2050::/48]; R_DKIM_ALIGNED(-0.10)[strict]; RCVD_IN_DNSWL_LOW(-0.10)[2001:67c:2050:b231:465::102:received]; R_DKIM_ALLOW(-0.10)[mandelbit.com:s=MBO0001]; MIME_GOOD(-0.10)[text/plain]; TO_DN_SOME(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 199118(-0.35),country: DE(-0.01),ip: 2001:67c:2050:102::(0.00)]; DMARC_NA(0.00)[mandelbit.com]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; MX_INFLIGHT(0.00)[mxext3.mailbox.org]; ARC_NA(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: 4jf3Hk1fZ2z71B Returns whether an IPv4 address can be reached from the Internet, based on the IANA special-purpose address registry. Signed-off-by: Antonio Quartulli --- config/cfgroot/network-functions.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index a90655305..9f37c490f 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -425,6 +425,23 @@ sub ip_address_in_range($$) { return (($ipaddress_bin >= $ipstart_bin) && ($ipaddress_bin <= $ipend_bin)); } +# Returns true if the IPv4 address can be reached from the Internet, i.e. it +# isn't in any of the special-purpose ranges that aren't globally reachable +# (based on the IANA registry). +sub ip_address_is_global($) { + my $address = shift; + + return 0 unless (&check_ip_address($address)); + + foreach my $network ("0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", + "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", + "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4") { + return 0 if (&ip_address_in_network($address, $network)); + } + + return 1; +} + sub check_port { $_ = $_[0]; @@ -1022,6 +1039,18 @@ sub testsuite() { $result = &ip_address_in_range("192.168.30.21", "192.168.30.10", "192.168.30.20"); assert('ip_address_in_range("192.168.30.21", "192.168.30.10", "192.168.30.20")', !$result); + # Check &ip_address_is_global() + foreach my $address ("81.3.27.37", "8.8.8.8", "1.0.0.0", "100.63.255.255", "100.128.0.0", + "169.253.255.255", "172.15.255.255", "172.32.0.0", "224.0.0.1", "239.255.255.255") { + assert("ip_address_is_global(\"$address\")", &ip_address_is_global($address)); + } + + foreach my $address ("10.1.2.3", "172.16.0.0", "172.31.255.255", "192.168.1.1", "100.64.0.0", + "100.127.255.255", "127.0.0.1", "169.254.0.0", "169.254.255.255", "0.255.255.255", + "192.0.2.1", "198.18.0.1", "240.0.0.0", "255.255.255.255", "a.b.c.d", "") { + assert("!ip_address_is_global(\"$address\")", !&ip_address_is_global($address)); + } + # Check &get_prefix() $result = &get_prefix("192.168.0.0/24"); assert('get_prefix("192.168.0.0/24")', $result == 24); From patchwork Tue Dec 1 14:31:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 10941 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) (Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4jf3Ht6KzMz3wh2 for ; Tue, 01 Dec 2026 14:32:10 +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 4jf3Hs2HSnz8Z5 for ; Tue, 01 Dec 2026 14:32:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4jf3Hr4fZTz2y3w for ; Tue, 01 Dec 2026 14:32:08 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [IPv6:2001:678:b28::25]) (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 4jf3Hn4sn6z2yFf for ; Tue, 01 Dec 2026 14:32:05 +0000 (UTC) Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [IPv6:2001:67c:2050:102:465::105]) (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 4jf3Hk28C6z71N for ; Tue, 01 Dec 2026 14:32:02 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=WfsKhBz9; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::105 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=OpijSMxifbD1fptFne0yJCB+G+uctncj8j67+ufjW9wCgTGHq07rOPkxPOQ5DF4QCSX2FQ wdYcjpYiB2mIG3jIjSsD2vpmdkQX2+qw7naxXZUDGDf0czV0CisS6ru1uIKQKIfEsh21eU Ef24nr5qknV2h/+vg848tV5m3urn6AGaHyy5xCoGuya5MwwsK7ZagmzLq9ArKpR/rp6lqH qEgdcZzI6fzx9zkZ9qZ0EcrXglmcb1s2kUcUPQjOBFDGRiYd1iMg/DTj01zqa0hCtrY8Fn 9nQf5E3vI8VvONwEBp4QEr2hhWN8imHZGXT/bj5ojDqoKRQCWsD75Dd6toegzQ== 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=Vs0D2iUdD7jMPWzwfTkb5PUaeNcGQ1bjJUR09ex553Y=; b=e4dDFdxC6tsygCEsFf4f+X6K5F6DeOEvMIs8f34rDlCfAOA/sCnl4XRE8V9oKgzsa8XmDE t1g6ZhEhrnMGIjis5RqIQ5jxqpRM7tQKD7l+5zVrV2Bh21Nmb+2nK40cDl2u9z+iUVPgS/ RBm5R+jnYKr79lxiuDeEdtWCT4Qsw3LWcLAxWn8WTbB2ilRcpElpWBAWO+nX7fekDj9SXC 79Gr2KxIIZtEayw3/NXaasxRqjE+iQySKsPypZ4IsykL2rmr7qaalgCUZRx7eEuihA0hF0 R3r1uUmyxfk28+e/BHZyTapFXA++O9eToqpbNGMHQA4rtx55+iLPYioC2AmBaA== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=WfsKhBz9; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::105 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-105.mailbox.org (Postfix) with ESMTPS id 4jf3Hh09kFz9tMf; 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=Vs0D2iUdD7jMPWzwfTkb5PUaeNcGQ1bjJUR09ex553Y=; b=WfsKhBz9/4/bl+d7qUaniU6Mixtd9aj0OiZjKz8VQpnoacVaGlAqTp2eXf0EiVrVNHvmUo 42qGQCX333i1g1iltTc4GdWqybJTWnPBlJYjKTyVIzmIyO1HxvmSF5/Kl6bhuNTS6sbaN8 uRSuwcFwz7sR/uIMzCq6kuuYjqEw1XX94z3o+mJdmOliOzvOoOM23UD711xOIWt9OPxMnz NnaDID/ZCUi4B5+eWMw+g8GqkZWznIlOWiwrgCHQNwztK4qIFLcVLbZ4ntRGiqhVnXRaHo T2VYY8uMYwUVdakLmUBPSRl4UB8mj93k1TSkzi1SoXRJohPb3w1hmWnPUYp5OA== From: Antonio Quartulli To: development@lists.ipfire.org Cc: Antonio Quartulli Subject: [PATCH 2/4] wio.cgi: Get the address of the DDNS hosts only once Date: Tue, 1 Dec 2026 15:31:51 +0100 Message-ID: <20261201143155.1798388-3-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.20 / 11.00]; NEURAL_HAM(-3.00)[-1.000]; BAYES_HAM(-3.00)[100.00%]; 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::105:from]; R_SPF_ALLOW(-0.20)[+ip6:2001:67c:2050::/48]; R_DKIM_ALIGNED(-0.10)[strict]; R_DKIM_ALLOW(-0.10)[mandelbit.com:s=MBO0001]; MIME_GOOD(-0.10)[text/plain]; TO_DN_SOME(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 199118(-0.35),country: DE(-0.01),ip: 2001:67c:2050:102::(0.00)]; DMARC_NA(0.00)[mandelbit.com]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; MX_INFLIGHT(0.00)[mxext3.mailbox.org]; ARC_NA(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: 4jf3Hk28C6z71N GetDyndnsRedIP() can fetch the public address from a server, which was done for each enabled host. Signed-off-by: Antonio Quartulli --- 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, "@{[ &Header::escape($temp[1]) ]}.@{[ &Header::escape($temp[2]) ]}"); From patchwork Tue Dec 1 14:31:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 10938 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 4jf3Hs3Ty2z3wh2 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 4jf3Hq4Qc3z8Zt 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 4jf3Hq0vJrz2xjG 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 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 mail02.haj.ipfire.org (Postfix) with ESMTPS id 4jf3Hm1dbDz2xB9 for ; Tue, 01 Dec 2026 14:32:04 +0000 (UTC) Received: from mout-b-107.mailbox.org (mout-b-107.mailbox.org [IPv6:2001:67c:2050:102:465::107]) (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 4jf3Hk5n2Sz799 for ; Tue, 01 Dec 2026 14:32:02 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=z5CRDlPY; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::107 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=Zlro6efBgGZxXOuAxDho4mrlcIfKqR3YjYPriG6zu92211anzzsR8HUNaBq8zPF4Hz8hg7 lLqoogWu4Kby/6+oiENmrSLloTI1N2AT3/SpHNNspY6KQ9gFkC39g76+1V3Kn2mD4PNnjv UrTVrPQBFrpXJr7GwdOQcr8vDCkuGwUsxxbqYyA4PbyKpkpMro2WA0Zt7jP3r0cKuAugig chowy04CoJIOB4XLn8K08BT1uczkSEip6EnLzqiod7hD9KFI99f7RK++WlgZMb0FmfnzZn DhAUjc0fxcB+fPC1G747KktMxCXwRY2N101ulEZepltTSBWh1Sgs9zIWGLPuZQ== 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=07DV5dc2qDT/VJSyhJAVOtXo1iQTiA26Ls930Bg2Bws=; b=dZgWlG2YvZCpAQxTQBUM/hAENqjWDSU00ujEkkrQMrHcheVkFifi6rBVzus7AqOWpNHAvN n7YFsRdBnXu+RYChk1U37u5xGJ8LdLey17yFk/N6Z/rgdGubFLNWOmLG8p2ljgKK449yix qGBNjUUU0ffBEVoK1CePQuTXd05zai+7Ychd4sesjkfxQr9q/fvGu7xw0mUce/iOOOys3g h6Ya4cXkQiMmEhdmfWDyyBrzRiQYyswhk5zXCPd7vsYbnSv82GSroIlYutobFUwe1qwI41 mjZUKGpL5k3Tz940rxkYNGtwQUyUMW5vOoiuOxykoR7vhy1RmVLmXD4Z2juilg== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=mandelbit.com header.s=MBO0001 header.b=z5CRDlPY; dmarc=none; spf=pass (mail01.ipfire.org: domain of antonio@mandelbit.com designates 2001:67c:2050:102:465::107 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-107.mailbox.org (Postfix) with ESMTPS id 4jf3Hh2Cb2z3y2n; 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=07DV5dc2qDT/VJSyhJAVOtXo1iQTiA26Ls930Bg2Bws=; b=z5CRDlPYylANuTTyV7MMI0mI2HX9g4FgyaO7ajy5ZDtg07Rv/pD6XIRkoOJRtOjJBCJgOv JY0pIvKIovCKWMMBVJxKm/v+8LS3cgWmRE2XndUVSMtwgpUuxg7STqFYqItHQV3zHuyu7o pvhpYC68pVkSW7hULx2tRlTY5HAPFwbofFDEvXXSN6LNOgKv9YNdOmHujRqUmCxN0XczK/ CGF/ZuyAjnWznZITHr9OKTVyJD6Okmr8c9eeq/QZAG8AF/M9vjpqhk4G18Jhsy84aQe+ph tZ/1uHJbNNjbuTQ4P9T/dw6bUaW+daamb/1OukLrJePeD3kQo75+n9xXuCVknw== From: Antonio Quartulli To: development@lists.ipfire.org Cc: Antonio Quartulli Subject: [PATCH 3/4] ddns.cgi: Get the address of the DDNS hosts only when needed Date: Tue, 1 Dec 2026 15:31:52 +0100 Message-ID: <20261201143155.1798388-4-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.20 / 11.00]; NEURAL_HAM(-3.00)[-1.000]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:67c:2050::/48]; R_DKIM_ALLOW(-0.10)[mandelbit.com:s=MBO0001]; RCVD_IN_DNSWL_LOW(-0.10)[2001:67c:2050:b231:465::102:received]; 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: 4jf3Hk5n2Sz799 GetDyndnsRedIP() can fetch the public address from a server, which was done on every page load, even without any enabled host. Signed-off-by: Antonio Quartulli --- html/cgi-bin/ddns.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi index e5fe7166f..2c075a4c8 100644 --- a/html/cgi-bin/ddns.cgi +++ b/html/cgi-bin/ddns.cgi @@ -445,8 +445,9 @@ print $form->render(); -e $datafile or die "Unable to open $datafile."; @current = &General::read_file($datafile, { keep_newlines => 1 }); -# Get IP address of the red interface. -my $ip = &HTTPClient::GetDyndnsRedIP(); +# The address of the hosts, which may have to be fetched from a server: only +# get it when needed +my $ip; my $id = 0; my $toggle_enabled; @@ -484,6 +485,7 @@ if (@current) { $fqdn =~ s/^[\*\@]\.//; if (&Network::check_fqdn($fqdn)) { + $ip //= &HTTPClient::GetDyndnsRedIP(); $sync = (&HTTPClient::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "has-text-success" : "has-text-danger"); } 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;