From 58a559aee126e9b4a00c29f0d64b5f89ddd0144c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 30 Jul 2006 00:11:52 +0000 Subject: Default to port 3128 if user has not filled in a custom port. --- packages/squid.inc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'packages/squid.inc') diff --git a/packages/squid.inc b/packages/squid.inc index d84001ba..c7ce446a 100644 --- a/packages/squid.inc +++ b/packages/squid.inc @@ -754,20 +754,26 @@ function squid_generate_rules($type) { global $config; $squid_conf = $config['installedpackages']['squid']['config'][0]; - if (!is_service_running('squid') || ($squid_conf['transparent_proxy'] != 'on')) return; + if (!is_service_running('squid') || ($squid_conf['transparent_proxy'] != 'on')) { + log_error("SQUID is installed but not started. Not installing redirect rules."); + return; + } - $port = $squid_conf['proxy_port']; + if($squid_conf['proxy_port']) + $port = $squid_conf['proxy_port']; + else + $port = "3128"; $ifaces = explode(',', $squid_conf['active_interface']); $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); switch($type) { case 'nat': foreach ($ifaces as $iface) - $rules .= "rdr on $iface inet proto tcp to !($iface) port 80 -> ($iface) port $port\n"; + $rules .= "rdr on $iface proto tcp from any to !($iface) port 80 -> ($iface) port $port\n"; break; case 'filter': foreach ($ifaces as $iface) - $rules .= "pass quick on $iface inet proto tcp to !($iface) port 80 flags S/SA keep state\n"; + $rules .= "pass quick on $iface proto tcp from any to !($iface) port 80 flags S/SA keep state\n"; break; default: break; @@ -775,4 +781,4 @@ function squid_generate_rules($type) { return $rules; } -?> +?> \ No newline at end of file -- cgit v1.2.3