From 2d7df3e4ffab7e382875e65d8b3e201d1fddd08f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 20 Mar 2024 14:45:14 +0100 Subject: [PATCH] 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 --- html/cgi-bin/ovpnmain.cgi | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 60c83ef0c..3cb62b6de 100644 --- 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]; @@ -2997,7 +2985,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).""; -- 2.39.5