]> 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>
Fri, 6 Dec 2024 19:59:04 +0000 (19:59 +0000)
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 5a4a6cdae5d7c3da66b6184aa9cf27ec046da540..827100b93b78c6285d54e2c4eec0d84a4cf71524 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>";