]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
fwhosts.cgi: properly fetch configured IPsec N2N subnets
authorPeter Müller <peter.mueller@ipfire.org>
Thu, 22 Apr 2021 20:20:00 +0000 (22:20 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Mon, 9 Aug 2021 07:50:57 +0000 (07:50 +0000)
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 <peter.mueller@ipfire.org>
Acked-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
html/cgi-bin/fwhosts.cgi

index 35611ac08765d405bf177196bbb4db9737ac2a02..0da771a5a3fac5e56ade8a4d95d331823a9a53eb 100644 (file)
@@ -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="<font style='color: $Header::colourvpn;'>$c</font>";
-                                       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="<font style='color: $Header::colourvpn;'>$c</font>";
+                                               return $tdcolor;
+                                       }
                                }
                        }
                }