]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/connections.cgi
connections.cgi: Fix page crash with IPsec connections with one subnet only
[ipfire-2.x.git] / html / cgi-bin / connections.cgi
index 4eb9cd7bfe8a8cfadc953facfce9eee53e3acc5a..96f09012b7bf3c21c3456d90eab8f20adfd91ddb 100644 (file)
@@ -261,15 +261,19 @@ close(IPSEC);
 
 foreach my $line (@ipsec) {
        my @vpn = split(',', $line);
-       my ($network, $mask) = split("/", $vpn[12]);
 
-       if (!&General::validip($mask)) {
-               $mask = ipv4_cidr2msk($mask);
-       }
+       my @subnets = split(/\|/, $vpn[12]);
+       for my $subnet (@subnets) {
+               my ($network, $mask) = split("/", $subnet);
+
+               if (!&General::validip($mask)) {
+                       $mask = ipv4_cidr2msk($mask);
+               }
 
-       push(@network, $network);
-       push(@masklen, $mask);
-       push(@colour, ${Header::colourvpn});
+               push(@network, $network);
+               push(@masklen, $mask);
+               push(@colour, ${Header::colourvpn});
+       }
 }
 
 if (-e "${General::swroot}/ovpn/n2nconf") {