From b64ef7e3577003b74ea29ecb40fc36220508f8a5 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 22 Dec 2006 16:35:25 +0000 Subject: More fixes by Umberto from the forum. We can now run transparent proxy eventhough the webgui uses the same. http://forum.pfsense.org/index.php/topic,3089.msg18804.html#msg18804 --- packages/squid/squid.inc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/squid/squid.inc b/packages/squid/squid.inc index adb55630..fc705d52 100644 --- a/packages/squid/squid.inc +++ b/packages/squid/squid.inc @@ -210,18 +210,12 @@ function squid_validate_general($post, $input_errors) { if (strlen($post['log_dir']) <= 3) $input_errors[] = "That is not a valid log location dir"; - if (($post['transparent_proxy'] == 'on')) { - $port = 80; - } else { - $port = trim($post['proxy_port']); - } - $webgui_port = $config['system']['webgui']['port']; if(($config['system']['webgui']['port'] == "") && ($config['system']['webgui']['protocol'] == "http")) { $webgui_port = 80; } - if ($port == $webgui_port) { + if (($post['transparent_proxy'] != 'on') && ($port == $webgui_port)) { $input_errors[] = "You can not run squid on the same port as the webgui"; } } @@ -382,12 +376,12 @@ function squid_resync_general() { $real_ifaces = array(); foreach (explode(',', $ifaces) as $i => $iface) { $real_ifaces[] = squid_get_real_interface_address($iface); - if($real_ifaces[$i][0]) - $conf .= "http_port {$real_ifaces[$i][0]}"; + if($real_ifaces[$i][0]) { if (($settings['transparent_proxy'] == 'on')) { - $conf .= ":80 transparent\n"; + $conf .= "http_port 127.0.0.1:80 transparent\n"; } else { - $conf .= ":$port\n"; + $conf .= "http_port {$real_ifaces[$i][0]}:$port\n"; + } } } @@ -912,7 +906,7 @@ function squid_generate_rules($type) { case 'nat': foreach ($ifaces as $iface) $rules .= "# Setup Squid transparent proxy redirect\n"; - $rules .= "rdr on $iface proto tcp from any to !($iface) port 80 -> ($iface) port 80\n"; + $rules .= "rdr on $iface proto tcp from any to !($iface) port 80 -> 127.0.0.1 port 80\n"; $rules .= "\n"; break; case 'filter': -- cgit v1.2.3