]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/fwhosts.cgi
vpn-statistic: change title of ovpn RW statistic page
[ipfire-2.x.git] / html / cgi-bin / fwhosts.cgi
index 1f96336a6b4d9b964b80572504aeacf5089c5cf3..f42947e8c7e99d056375fbd8165801ea9c68db44 100644 (file)
@@ -291,42 +291,13 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        $errormessage=$errormessage.$Lang::tr{'fwhost err sub32'};
                }
                if($fwhostsettings{'error'} ne 'on'){
-                       #check if we use one of ipfire's networks (green,orange,blue)
-                       if (($ownnet{'GREEN_NETADDRESS'}        ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'GREEN_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'GREEN_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err green'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'ORANGE_NETADDRESS'}       ne '' && $ownnet{'ORANGE_NETADDRESS'}   ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'ORANGE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'ORANGE_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err orange'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'BLUE_NETADDRESS'}         ne '' && $ownnet{'BLUE_NETADDRESS'}     ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'BLUE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'BLUE_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err blue'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'RED_NETADDRESS'}  ne '' && $ownnet{'RED_NETADDRESS'}              ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'RED_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'RED_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err red'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
+                               my $fullip="$fwhostsettings{'IP'}/".&General::iporsubtocidr($fwhostsettings{'SUBNET'});
+                               $errormessage=$errormessage.&General::checksubnets($fwhostsettings{'HOSTNAME'},$fullip,"");
                }
                #only check plausi when no error till now
                if (!$errormessage){
                        &plausicheck("editnet");
                }
-               #check if network ip is part of an already used one 
-               if(&checksubnet(\%customnetwork))
-               {
-                       $errormessage=$errormessage.$Lang::tr{'fwhost err partofnet'};
-                       $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-               }                               
                if($fwhostsettings{'actualize'} eq 'on' && $fwhostsettings{'newnet'} ne 'on' && $errormessage)
                {
                        $fwhostsettings{'actualize'} = '';
@@ -338,9 +309,8 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        $customnetwork{$key}[3] = $fwhostsettings{'orgnetremark'};
                        &General::writehasharray("$confignet", \%customnetwork);
                        undef %customnetwork;
-               }                       
+               }
                if (!$errormessage){
-                       
                        &General::readhasharray("$confignet", \%customnetwork);
                        if ($fwhostsettings{'ACTION'} eq 'updatenet'){
                                if ($fwhostsettings{'update'} == '0'){
@@ -392,7 +362,7 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                                                &General::writehasharray("$fwconfiginp", \%fwinp);
                                        }
                                }
-                       }                                       
+                       }
                        my $key = &General::findhasharraykey (\%customnetwork);
                        foreach my $i (0 .. 3) { $customnetwork{$key}[$i] = "";}
                        $fwhostsettings{'SUBNET'}       = &General::iporsubtocidr($fwhostsettings{'SUBNET'});
@@ -416,7 +386,8 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        }
                        &addnet;
                        &viewtablenet;
-               }else           {
+               }else{
+                       $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
                        &addnet;
                        &viewtablenet;
                }
@@ -757,10 +728,10 @@ if ($fwhostsettings{'ACTION'} eq 'saveservicegrp')
                        }
                }
        }
-       if ($tcpcounter > 15){
+       if ($tcpcounter > 14){
                $errormessage=$Lang::tr{'fwhost err maxservicetcp'};
        }
-       if ($udpcounter > 15){
+       if ($udpcounter > 14){
                $errormessage=$Lang::tr{'fwhost err maxserviceudp'};
        }
        $tcpcounter=0;
@@ -1644,7 +1615,10 @@ sub getcolor
                        $tdcolor="<font style='color: $Header::colourblue;'>$c</font>";
                        return $tdcolor;
                }
-
+               if ("$sip/$scidr" eq "0.0.0.0/0"){
+                       $tdcolor="<font style='color: $Header::colourred;'>$c</font>";
+                       return $tdcolor;
+               }
                #Check if IP is part of OpenVPN N2N subnet
                foreach my $key (sort keys %ccdhost){
                        if ($ccdhost{$key}[3] eq 'net'){
@@ -2501,6 +2475,9 @@ sub getipforgroup
                        &General::readhash("${General::swroot}/vpn/settings",\%hash);
                        return $hash{'RW_NET'};
                }
+               if ($name eq 'RED'){
+                       return "0.0.0.0/0";
+               }
        }
 }
 sub decrease