From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CB21690705 for ; Wed, 24 Jan 2024 12:39:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ABA82AA4C for ; Wed, 24 Jan 2024 12:39:01 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 24 Jan 2024 12:39:00 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7498349262 for ; Wed, 24 Jan 2024 12:39:00 +0100 (CET) From: Friedrich Weber To: pve-devel@lists.proxmox.com Date: Wed, 24 Jan 2024 12:38:56 +0100 Message-Id: <20240124113856.126256-1-f.weber@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.096 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH http-server] access control: avoid "uninitialized value" warning if using IP ranges X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2024 11:39:31 -0000 ALLOW_FROM/DENY_FROM accept any syntax understood by Net::IP. However, if an IP range like "10.1.1.1-10.1.1.3" is configured, a confusing Perl warning is printed to the syslog on a match: Use of uninitialized value in concatenation (.) or string at [...] The reason is that we use Net::IP::prefix to prepare a debug message, but this returns undef if a range was specified. To avoid the warning, use Net::IP::print to obtain a string representation instead. Signed-off-by: Friedrich Weber --- src/PVE/APIServer/AnyEvent.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index cebd9ba..b60b825 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -1761,7 +1761,7 @@ sub check_host_access { foreach my $t (@{$self->{allow_from}}) { if ($t->overlaps($cip)) { $match_allow = 1; - $self->dprint("client IP allowed: ". $t->prefix()); + $self->dprint("client IP allowed: ". $t->print()); last; } } @@ -1770,7 +1770,7 @@ sub check_host_access { if ($self->{deny_from}) { foreach my $t (@{$self->{deny_from}}) { if ($t->overlaps($cip)) { - $self->dprint("client IP denied: ". $t->prefix()); + $self->dprint("client IP denied: ". $t->print()); $match_deny = 1; last; } -- 2.39.2