diff options
author | Ermal <eri@pfsense.org> | 2011-07-22 17:27:51 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-07-22 17:27:51 +0000 |
commit | 8fd84f8778dde3f1c62934c1c2ae687bc5c0f51f (patch) | |
tree | e6b783221774cb0d4c4d09b6fefec20fdba76f78 /usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc | |
parent | cdfd39e2b9df28910e4b339c9589ab5377a5933c (diff) | |
download | pfsense-8fd84f8778dde3f1c62934c1c2ae687bc5c0f51f.zip pfsense-8fd84f8778dde3f1c62934c1c2ae687bc5c0f51f.tar.gz |
Ticket #749. Make the rules of the traffic shaper wizard select the wan side of the interfaces to not make the intra-lan traffic classifible in this way.
Diffstat (limited to 'usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc')
-rwxr-xr-x | usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc | 329 |
1 files changed, 170 insertions, 159 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index 9707d06..bb25f79 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -625,13 +625,16 @@ function apply_all_choosen_items() { $altq_list_queues = array(); $steps = intval($config['ezshaper']['step1']['numberofconnections']); - + + $interfacelist = array(); + for ($i = 0; $i < $steps; $i++) { $tmppath = array(); $altq =& new altq_root_queue(); $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); + $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); @@ -1394,175 +1397,183 @@ function apply_all_choosen_items() { if (!is_array($config['filter']['rule'])) $config['filter']['rule'] = array(); - /* Rules */ - if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = gettext("Penalty Box"); - $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } + $interfacelist = implode(",", $interfacelist); + + /* Rules */ + if ($penalty) { + if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Penalty Box"); + $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qOthersLow"; + $rule['source']['address'] = $config['ezshaper']['step4']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + } + } + + /* If user specifies an IP, we don't bother with providers */ + if ($voip) { + if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { + /* create VOIP rules */ + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("VOIP Adapter"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['address'] = $config['ezshaper']['step3']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { + /* create VOIP rules */ + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = "DiffServ/Lowdelay/Upload"; + $rule['protocol'] = "udp"; + $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qVoIP"; + $rule['destination']['any'] = TRUE; + $rule['iptos'] = "lowdelay"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + + } else { + /* loop through voiplist[] */ + foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qVoIP'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_voip {$voip[0]} outbound"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['destination']['port'] = $voip[2]."-".$voip[3]; + if($voip[1] != '') + $rule['protocol'] = $voip[1]; + $config['filter']['rule'][] = $rule; } + } + } - /* If user specifies an IP, we don't bother with providers */ - if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = gettext("VOIP Adapter"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['address'] = $config['ezshaper']['step3']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = "DiffServ/Lowdelay/Upload"; - $rule['protocol'] = "udp"; + /* loop through p2plist[] */ + if ($p2p) { + foreach($config['ezshaper']['step5'] as $key => $val) { + if (!is_array($p2plist[$key])) + continue; + foreach ($p2plist[$key] as $p2pclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qP2P'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; + if($p2pclient[1] != '') + $rule['protocol'] = $p2pclient[1]; + $config['filter']['rule'][] = $rule; + } + } + } + + /* loop through gamesplist[] */ + if ($games) { + foreach($config['ezshaper']['step6'] as $key => $val) { + if (!is_array($gamesplist[$key])) + continue; + foreach ($gamesplist[$key] as $Gameclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qGames'; + if ($Gameclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; + $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; + if($Gameclient[1] != '') + $rule['protocol'] = $Gameclient[1]; + $config['filter']['rule'][] = $rule; + } + } + } + + /* loop through othersplist[] */ + if ($otherpriority) { + foreach($config['ezshaper']['step7'] as $key => $val) { + if (!is_array($othersplist[$key])) + continue; + foreach ($othersplist[$key] as $otherclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + switch ($val) { + case "H": + $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "L": + $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "D": + if ($p2pcatchall) { + $loop = 0; + $rule['defaultqueue'] = 'qOthersDefault'; + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + } else + $loop = 1; /* It automitaclly goes to default queue */ + break; + default: + $loop = 1; + } + if (!$loop) { $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qVoIP"; $rule['destination']['any'] = TRUE; - $rule['iptos'] = "lowdelay"; $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } else { - /* loop through voiplist[] */ - foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qVoIP'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_voip {$voip[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') - $rule['protocol'] = $voip[1]; - $config['filter']['rule'][] = $rule; - } - } - } + $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - /* loop through p2plist[] */ - if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { - if (!is_array($p2plist[$key])) - continue; - foreach ($p2plist[$key] as $p2pclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qP2P'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') - $rule['protocol'] = $p2pclient[1]; - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through gamesplist[] */ - if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { - if (!is_array($gamesplist[$key])) - continue; - foreach ($gamesplist[$key] as $Gameclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qGames'; - if ($Gameclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; - $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') - $rule['protocol'] = $Gameclient[1]; - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through othersplist[] */ - if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { - if (!is_array($othersplist[$key])) - continue; - foreach ($othersplist[$key] as $otherclient) { - $rule = array(); - $rule['type'] = "match"; - switch ($val) { - case "H": - $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "L": - $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "D": - if ($p2pcatchall) { - $loop = 0; - $rule['defaultqueue'] = 'qOthersDefault'; - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - } else - $loop = 1; /* It automitaclly goes to default queue */ - break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; - } + if($otherclient[2] or $otherclient[3]) { + $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } + if($otherclient[1] != '') + $rule['protocol'] = $otherclient[1]; + + $config['filter']['rule'][] = $rule; } } - write_config(); + } + } + write_config(); } function wizard_get_bandwidthtype_scale($type = "b") { |