From patchwork Thu Apr 22 20:20:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 4206 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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4FR81635twz44R4 for ; Thu, 22 Apr 2021 20:20: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 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4FR8150kCkz12M; Thu, 22 Apr 2021 20:20:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4FR8144QZRz2yN4; Thu, 22 Apr 2021 20:20:08 +0000 (UTC) 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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4FR8124F60z2xS8 for ; Thu, 22 Apr 2021 20:20:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4FR8111psszHt for ; Thu, 22 Apr 2021 20:20:04 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1619122805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K4hRlf6o+8u+bK6zOYlfMou7pv1nzD8nRJ82bcpug/o=; b=hdbwinuah9CUJG3SPDn45HQj/M2P69PgeZe+0ferm2wlze+GBGGUOJZK48l5OfFW4i6WH4 vd1fgn7IeWAFfzCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1619122805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K4hRlf6o+8u+bK6zOYlfMou7pv1nzD8nRJ82bcpug/o=; b=oFbXM1zddPM7iXw6kWlUuSzLsJYqJRRv0SekvHRjrN1H3vzrwBFJeDTOCPYFy1DF+EtROw fK3JaZ97VjMB57IO8joDaktzIHuEcSWb3PoUjH2yIZv5Z8+PjJzsJM4VgaSXVdu9Hb3kwo bPhm3Dptl+yUObQyrVheu/KDVRGnIGwbId4r7p1qo238Gj8CM3mfWJDIfUTpW/xkBRViCF 52rEzmaLIyeq8OBeXjIKfh9cECQib6FTsXHAvaP+cq1TdKU3n54NswomH1pC17GuSlTPLE 9z3R6U3hm1//pVLphjLeEBDe1JEOZiTw0M38gEutNHKXeq9q5eR6x5rE4x0cFQ== To: "IPFire: Development" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] fwhosts.cgi: properly fetch configured IPsec N2N subnets Message-ID: Date: Thu, 22 Apr 2021 22:20:00 +0200 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Previously, the getcolor() function did not correctly process IPsec N2N connections with more than one remote network configured, resulting in networks mistakenly marked as being part of a VPN connection, or vice versa. Fixes: #11235 Signed-off-by: Peter Müller Acked-by: Stefan Schantl Reviewed-by: Michael Tremer --- html/cgi-bin/fwhosts.cgi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index 84b018459..648fc7c8e 100644 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -1974,11 +1974,13 @@ sub getcolor #Check if IP is part of a IPsec N2N network foreach my $key (sort keys %ipsecconf){ if ($ipsecconf{$key}[11]){ - my ($a,$b) = split("/",$ipsecconf{$key}[11]); - $b=&General::iporsubtodec($b); - if (&General::IpInSubnet($sip,$a,$b)){ - $tdcolor="$c"; - return $tdcolor; + foreach my $ipsecsubitem (split(/\|/, $ipsecconf{$key}[11])) { + my ($a,$b) = split("/",$ipsecsubitem); + $b=&General::iporsubtodec($b); + if (&General::IpInSubnet($sip,$a,$b)){ + $tdcolor="$c"; + return $tdcolor; + } } } }