From f05e3049e1e4ba1d4c2f65fe65e8f20d1b8e16fd Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Thu, 21 Aug 2008 20:20:40 +0000 Subject: add support for external cache managers such as sqstat (http://forum.pfsense.org/index.php/topic,11027.0.html) --- packages/squid/squid.inc | 31 +++++++++++++++++++++++++++---- packages/squid/squid.xml | 4 ++-- packages/squid/squid_nac.xml | 7 +++++++ packages/squid3/squid.inc | 30 ++++++++++++++++++++++++++---- packages/squid3/squid_nac.xml | 7 +++++++ 5 files changed, 69 insertions(+), 10 deletions(-) (limited to 'packages') diff --git a/packages/squid/squid.inc b/packages/squid/squid.inc index 9f08f7a9..1db19bd8 100644 --- a/packages/squid/squid.inc +++ b/packages/squid/squid.inc @@ -314,13 +314,10 @@ function squid_validate_general($post, $input_errors) { if(!empty($post['dns_nameservers'])) { $altdns = explode(";", ($post['dns_nameservers'])); -// $conf .= "# Custom options\n"; foreach ($altdns as $dnssrv) { -// $conf .= $custopt."\n"; if (!is_ipaddr($dnssrv)) $input_errors[] = 'You must enter a valid IP address in the \'Alternate DNS servers\' field'; }} - } function squid_validate_upstream($post, $input_errors) { @@ -413,6 +410,13 @@ function squid_validate_nac($post, $input_errors) { if (!empty($time) && !squid_is_timerange($time)) $input_errors[] = "The time range '$time' is not a valid time range"; } + + if(!empty($post['ext_cachemanager'])) { + $extmgr = explode(";", ($post['ext_cachemanager'])); + foreach ($extmgr as $mgr) { + if (!is_ipaddr($mgr)) + $input_errors[] = 'You must enter a valid IP address in the \'External Cache Manager\' field'; + }} } function squid_validate_traffic($post, $input_errors) { @@ -572,7 +576,7 @@ EOD; foreach ($altdns as $dnssrv) { $conf .= $dnssrv." "; } -// $conf .= "\n"; + $conf .= "\n"; } return $conf; @@ -696,8 +700,27 @@ EOD; } $conf .= <<disable_squidversion If set, suppress Squid version string info in HTTP headers and HTML error pages. checkbox - - + + Custom Options custom_options You can put your own custom options here, separated by semi-colons (;). They'll be added to the configuration. They need to be squid.conf native options, otherwise squid will NOT work. diff --git a/packages/squid/squid_nac.xml b/packages/squid/squid_nac.xml index 435671a2..8b1741d6 100644 --- a/packages/squid/squid_nac.xml +++ b/packages/squid/squid_nac.xml @@ -126,6 +126,13 @@ 5 base64 + + Allow an external host as a cachemanager + ext_cachemanager + Enter the IPs for the external Cache Managers here, separated by semi-colons (;). + input + 60 + squid_validate_nac($_POST, &$input_errors); diff --git a/packages/squid3/squid.inc b/packages/squid3/squid.inc index 9b87ce80..fc647481 100644 --- a/packages/squid3/squid.inc +++ b/packages/squid3/squid.inc @@ -314,13 +314,10 @@ function squid_validate_general($post, $input_errors) { if(!empty($post['dns_nameservers'])) { $altdns = explode(";", ($post['dns_nameservers'])); -// $conf .= "# Custom options\n"; foreach ($altdns as $dnssrv) { -// $conf .= $custopt."\n"; if (!is_ipaddr($dnssrv)) $input_errors[] = 'You must enter a valid IP address in the \'Alternate DNS servers\' field'; }} - } function squid_validate_upstream($post, $input_errors) { @@ -413,6 +410,13 @@ function squid_validate_nac($post, $input_errors) { if (!empty($time) && !squid_is_timerange($time)) $input_errors[] = "The time range '$time' is not a valid time range"; } + + if(!empty($post['ext_cachemanager'])) { + $extmgr = explode(";", ($post['ext_cachemanager'])); + foreach ($extmgr as $mgr) { + if (!is_ipaddr($mgr)) + $input_errors[] = 'You must enter a valid IP address in the \'External Cache Manager\' field'; + }} } function squid_validate_traffic($post, $input_errors) { @@ -572,7 +576,7 @@ EOD; foreach ($altdns as $dnssrv) { $conf .= $dnssrv." "; } -// $conf .= "\n"; + $conf .= "\n"; } return $conf; @@ -697,6 +701,24 @@ EOD; $conf .= <<5 base64 + + Allow an external host as a cachemanager + ext_cachemanager + Enter the IPs for the external Cache Managers here, separated by semi-colons (;). + input + 60 + squid_validate_nac($_POST, &$input_errors); -- cgit v1.2.3