]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
BUG 11786 - squid: Remove setting for filter processes the number of Squid processes
authorDaniel Weismüller <daniel.weismueller@ipfire.org>
Tue, 30 Oct 2018 11:06:59 +0000 (12:06 +0100)
committerroot <root@ipfire.test>
Tue, 8 Jan 2019 01:02:05 +0000 (02:02 +0100)
I added a function to determine the number of cores.
Now the number of squid processes will be equal to the number of logical cores.
Further I removed the possibility of changing the number
of squid processes in the proxy.cgi

Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: root <root@ipfire.test>
config/cfgroot/general-functions.pl
html/cgi-bin/proxy.cgi

index 0577afe2809e62b3de113f96b3819ab04a43d917..e8495e88543c860af953c6238f6291021ede66e9 100644 (file)
@@ -1165,5 +1165,12 @@ sub dnssec_status() {
 
        return $status;
 }
 
        return $status;
 }
+sub number_cpu_cores() {
+       open my $cpuinfo, "/proc/cpuinfo" or die "Can't open cpuinfo: $!\n";
+       my $cores = scalar (map /^processor/, <$cpuinfo>);
+       close $cpuinfo;
+
+       return $cores;
+}
 
 1;
 
 1;
index 738425b9ad7139ce003ee8da1904e8d3d68650f2..92bebfe188aac8d18fd3859f937116140074fa04 100644 (file)
@@ -287,7 +287,6 @@ $proxysettings{'IDENT_USER_ACL'} = 'positive';
 $proxysettings{'ENABLE_FILTER'} = 'off';
 $proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
 $proxysettings{'ENABLE_CLAMAV'} = 'off';
 $proxysettings{'ENABLE_FILTER'} = 'off';
 $proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
 $proxysettings{'ENABLE_CLAMAV'} = 'off';
-$proxysettings{'CHILDREN'} = '10';
 
 $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
 
 
 $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
 
@@ -436,11 +435,6 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
        {
                $errormessage = $Lang::tr{'invalid maximum incoming size'};
                goto ERROR;
        {
                $errormessage = $Lang::tr{'invalid maximum incoming size'};
                goto ERROR;
-       }
-               if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1))
-       {
-               $errormessage = $Lang::tr{'advproxy invalid num of children'};
-               goto ERROR;
        }
        if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on')
        {
        }
        if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on')
        {
@@ -1034,12 +1028,8 @@ print <<END
 </table>
 <hr size='1'>
 <table width='100%'>
 </table>
 <hr size='1'>
 <table width='100%'>
-<tr><td class='base' colspan='4'><b>$Lang::tr{'advproxy redirector children'}</b></td></tr>
-<tr><td class='base' >$Lang::tr{'processes'}:&nbsp;<img src='/blob.gif' alt='*' /><input type='text' name='CHILDREN' value='$proxysettings{'CHILDREN'}' size='5' /></td>
 END
 ;
 END
 ;
-my $count = `ip n| wc -l`;
-if ( $count < 1 ){$count = 1;}
 if ( -e "/usr/bin/squidclamav" ) {
        print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />";
        if ( ! -e "/var/run/clamav/clamd.pid" ){
 if ( -e "/usr/bin/squidclamav" ) {
        print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />";
        if ( ! -e "/var/run/clamav/clamd.pid" ){
@@ -1048,18 +1038,16 @@ if ( -e "/usr/bin/squidclamav" ) {
                }
        else {
                print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'}." /><br />";
                }
        else {
                print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'}." /><br />";
-               print "+ ".int(( $count**(1/3)) * 8);}
+}
        print "</td>";
 } else {
        print "<td></td>";
 }
 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>".$Lang::tr{'advproxy url filter'}."</a></b><br />";
 print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'}." /><br />";
        print "</td>";
 } else {
        print "<td></td>";
 }
 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>".$Lang::tr{'advproxy url filter'}."</a></b><br />";
 print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'}." /><br />";
-print "+ ".int(($count**(1/3)) * 6);
 print "</td>";
 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>".$Lang::tr{'advproxy update accelerator'}."</a></b><br />";
 print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'}." /><br />";
 print "</td>";
 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>".$Lang::tr{'advproxy update accelerator'}."</a></b><br />";
 print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'}." /><br />";
-print "+ ".int(($count**(1/3)) * 5);
 print "</td></tr>";
 print <<END
 </table>
 print "</td></tr>";
 print <<END
 </table>
@@ -4095,7 +4083,7 @@ END
        if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on'))
        {
                print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n";
        if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on'))
        {
                print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n";
-               print FILE "url_rewrite_children $proxysettings{'CHILDREN'}\n\n";
+               print FILE "url_rewrite_children ", &General::number_cpu_cores(), "\n\n";
        }
 
        # Include file with user defined settings.
        }
 
        # Include file with user defined settings.