From: Michael Tremer Date: Wed, 20 Mar 2024 13:45:14 +0000 (+0100) Subject: ovpnmain.cgi: Drop hostsinnet X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b379c1c52014c7705d7da5cde9a16554da19d7f;p=people%2Fms%2Fipfire-2.x.git ovpnmain.cgi: Drop hostsinnet 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 --- diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 5a4a6cdae..827100b93 100755 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -615,18 +615,6 @@ NEXT: print ""; } -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" ";} else{ print" ";} print"$ccdconf[0]$ccdconf[1]$ccdhosts/".(&ccdmaxclients($ccdconf[1])+1)."";