]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
ovpnmain.cgi: Drop hostsinnet
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Mar 2024 13:45:14 +0000 (14:45 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 23 Sep 2024 11:10:27 +0000 (13:10 +0200)
This is no longer needed as we can use the function that lists all
addresses that are in use and count them.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 536fbb3a40573dd068d96127b6ae8a70cfabc47a..17d2fbdd189b3754f6a5b8eb0759d7b3200a6328 100755 (executable)
@@ -615,18 +615,6 @@ NEXT:
        print "</select>";
 }
 
-sub hostsinnet
-{
-       my $name=$_[0];
-       my %ccdhash=();
-       my $i=0;
-       &General::readhasharray("${General::swroot}/ovpn/ovpnconfig", \%ccdhash);
-       foreach my $key (keys %ccdhash) {
-               if ($ccdhash{$key}[32] eq $name){ $i++;}
-       }
-       return $i;
-}
-
 sub check_routes_push
 {
                        my $val=$_[0];
@@ -2996,7 +2984,7 @@ END
        foreach my $key (sort { uc($ccdconfhash{$a}[0]) cmp uc($ccdconfhash{$b}[0]) } keys %ccdconfhash) {
                @ccdconf=($ccdconfhash{$key}[0],$ccdconfhash{$key}[1]);
                $count++;
-               my $ccdhosts = &hostsinnet($ccdconf[0]);
+               my $ccdhosts = scalar &get_addresses_in_use($ccdconf[1]);
                if ($count % 2){ print" <tr bgcolor='$Header::color{'color22'}'>";}
                else{            print" <tr bgcolor='$Header::color{'color20'}'>";}
                print"<td>$ccdconf[0]</td><td align='center'>$ccdconf[1]</td><td align='center'>$ccdhosts/".(&ccdmaxclients($ccdconf[1])+1)."</td><td>";