diff options
author | Ermal Luçi <eri@pfsense.org> | 2008-01-11 21:07:25 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2008-01-11 21:07:25 +0000 |
commit | 197bfe966c677a4ffca27610cdf1dc2a22a6a289 (patch) | |
tree | ecf9230a6fc3d92822c1b7ba974a9fbc72a091d0 /usr/local/www/wizards | |
parent | 9daeb964853d3251c3304cb6dfbc05bda843987a (diff) | |
download | pfsense-197bfe966c677a4ffca27610cdf1dc2a22a6a289.zip pfsense-197bfe966c677a4ffca27610cdf1dc2a22a6a289.tar.gz |
Bring in the new traffic shaper.
It is capable of multi interface shaping.
Also bring the wizard up-to-date. Now it is capable of doing multi interface too.
Diffstat (limited to 'usr/local/www/wizards')
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.inc | 1865 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.xml | 182 |
2 files changed, 814 insertions, 1233 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index 9626c43..bf3565e 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -1,5 +1,4 @@ <?php - /* $Id$ */ /* traffic_shaper_wizard.inc @@ -7,6 +6,7 @@ Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com. Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com. + Copyright (C) 2008 Ermal Lu\xe7i All rights reserved. Redistribution and use in source and binary forms, with or without @@ -31,301 +31,123 @@ POSSIBILITY OF SUCH DAMAGE. */ + + +function step1_stepbeforeformdisplay() { + global $g, $config; + + $pkg = parse_xml_config_pkg("{$g['www_path']}/wizards/traffic_shaper_wizard.xml", "pfsensewizard"); + unset($pkg['step'][1]['fields']); + $fields =& $pkg['step'][1]['fields']['field']; + + $fields = array(); + $field = array(); + $field['name'] = "Setup network speeds"; + $field['type'] = "listtopic"; + $fields[] = $field; + + foreach ($config['interfaces'] as $if => $ifdesc) { + if (!is_altq_capable($ifdesc['if'])) + continue; + if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") + continue; + $field = array(); + $field['name'] = "{$if}scheduler"; + $field['type'] = "select"; + $field['typehint'] = "Queueing discipline to apply on this interface"; + $field['options']['option'] = array(); + $opts = array(); + $opts['name'] = "HFSC"; + $opts['value'] = "HFSC"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "CBQ"; + $opts['value'] = "CBQ"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['name'] = "PRIQ"; + $opts['value'] = "PRIQ"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step2->{$if}->scheduler"; + $fields[] = $field; + + $field = array(); + $field['name'] = $if; + $field['type'] = "input"; + $field['typehint'] = "Bandwidth in Kbit/sec on this interface"; + $field['validate'] = "^[0-9]*$"; + $field['bindstofield'] = "ezshaper->step2->{$if}->bandwidth"; + $fields[] = $field; + } + $field = array(); + $field['name'] = "Next"; + $field['type'] = "submit"; + $fields[] = $field; + + conf_mount_rw(); + + $xmlcf = dump_xml_config_pkg($pkg, "pfsensewizard"); + /* write new configuration */ + $fd = fopen("{$g['www_path']}/wizards/traffic_shaper_wizard.xml", "w"); + if (!$fd) + die("Unable to open {$g['www_path']}/wizards/traffic_shaper_wizard.xml for writing in write_config()\n"); + fwrite($fd, $xmlcf); + fclose($fd); + + conf_mount_ro(); + +} function step1_stepsubmitphpaction() { global $g, $config; /* wipe previous */ - unset($config['shaper']['queue']); - unset($config['shaper']['rule']); - $config['shaper']['enable'] = FALSE; - $config['shaper']['itemsshaped'] = "0"; + if(isset($config['shaper']['queue'])) + unset($config['shaper']['queue']); + if(isset($config['shaper']['rule'])) + unset($config['shaper']['rule']); + foreach ($config['filter']['rule'] as $key => $rule) + if ($rule['wizard'] == "yes") + unset($config['filter']['rule'][$key]); + write_config(); } function step2_stepsubmitphpaction() { - global $g, $config; - if(!is_numeric($_POST['upload']) or !is_numeric($_POST['download'])) { - $message="Upload and download speeds must be a number only! Values should be Kbits/second."; - header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); - exit; - } - if ($config['ezshaper']['step2']['inside_int'] == $config['ezshaper']['step2']['outside_int']) { - $message="Inside and Outside interfaces cannot be the same. Please select a unique interface for both."; - header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); - exit; - } - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - - /* Magic shaper scheduler */ - $config['shaper']['schedulertype'] = "hfsc"; - - /* Create queues */ - /* WAN root queue */ - $queue = array(); - $queue['name'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 0; - $queue['parentqueue'] = "on"; - /* $queue['bandwidth'] = (int)$_POST['upload'] * .8; */ - $queue['bandwidth'] = (int)$_POST['upload']; - $queue['bandwidthtype'] = "Kb"; - $config['shaper']['queue'][] = $queue; - - /* LAN root queue */ - $queue = array(); - $queue['name'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 0; - $queue['parentqueue'] = "on"; - /* $queue['bandwidth'] = (int)$_POST['download'] * .8; */ - $queue['bandwidth'] = (int)$_POST['download']; - $queue['bandwidthtype'] = "Kb"; - $config['shaper']['queue'][] = $queue; - - /* WAN default queue */ - $queue = array(); - $queue['name'] = "{$upq}def"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['defaultqueue'] = 'true'; - $queue['priority'] = 1; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1%"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - - /* LAN default queue */ - $queue = array(); - $queue['name'] = "{$downq}def"; - $queue['priority'] = 1; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['defaultqueue'] = 'true'; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1%"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* WAN ack queue */ - $queue = array(); - $queue['name'] = "{$upq}acks"; - $queue['ack'] = TRUE; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 7; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "10%"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - $queue = array(); - - /* LAN ack queue */ - $queue['name'] = "{$downq}acks"; - $queue['ack'] = TRUE; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 7; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "10%"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; + global $config; + foreach ($config['interfaces'] as $if => $ifdesc) { + if (!is_altq_capable($ifdesc['if'])) + continue; + if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") + continue; + if (isset($_POST['bandwidth']) && $_POST['bandwidth'] < 128) { + $message=gettext("We do not support Bandwidths smaller than 128Kbit/s. Please correct this value to continue."); + header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}"); + } + } } function step3_stepsubmitphpaction() { - global $g, $config; + if($_POST['address']) { if(!is_ipaddr($_POST['address'])) { if(!is_alias($_POST['address'])) { /* item is not an ip or alias. error out */ - $message="Address must be a valid IP address or Firewall Alias. Please correct this value to continue."; + $message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}"); - exit; - } - } - } - - if ( $_POST['enable'] ) { - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - - /* create qVOIPUp */ - $queue = array(); - $queue['name'] = "qVOIPUp"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 7; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = $_POST['bandwidth'] . "Kb"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['bandwidth'] = $_POST['bandwidth']; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qVOIPDown */ - $queue = array(); - $queue['name'] = "qVOIPDown"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 7; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = $_POST['bandwidth'] . "Kb"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['bandwidth'] = $_POST['bandwidth']; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - $config['shaper']['itemsshaped']++; - - /* If user specifies an IP, we don't bother with providers */ - if( is_ipaddr($_POST['address']) or is_alias($_POST['address'])) { - /* create VOIP rules */ - $rule = array(); - $rule['descr'] = "VOIP Adapter"; - $rule['inqueue'] = "qVOIPDown"; - $rule['outqueue'] = "qVOIPUp"; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - /* $rule['source']['network'] = $downint; */ - $rule['source']['address'] = $_POST['address']; - $rule['destination']['any'] = TRUE; - $config['shaper']['rule'][] = $rule; - - $rule = array(); - $rule['descr'] = "VOIP Adapter"; - $rule['inqueue'] = "qVOIPUp"; - $rule['outqueue'] = "qVOIPDown"; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['address'] = $_POST['address']; - $config['shaper']['rule'][] = $rule; - } elseif( $_POST['provider'] == "Generic" ) { - /* create VOIP rules */ - $rule = array(); - $rule['descr'] = "DiffServ/Lowdelay/Upload"; - $rule['inqueue'] = "qVOIPDown"; - $rule['outqueue'] = "qVOIPUp"; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['source']['network'] = $downint; - $rule['destination']['any'] = TRUE; - $rule['iptos'] = "lowdelay"; - $config['shaper']['rule'][] = $rule; - - $rule = array(); - $rule['descr'] = "DiffServ/Lowdelay/Download"; - $rule['inqueue'] = "qVOIPUp"; - $rule['outqueue'] = "qVOIPDown"; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['iptos'] = "lowdelay"; - $config['shaper']['rule'][] = $rule; - } else { - - $voiplist = array(); - - /* asterisk server / same as vonage */ - if(($_POST['provider'] == "Asterisk") || ($_POST['provider'] == "Vonage")) { - $voiplist[] = array('Asterisk', 'udp', '5060', '5069', 'both'); - $voiplist[] = array('Asterisk', 'udp', '10000', '20000', 'both'); - } - /* VoicePulse server */ - if( $_POST['provider'] == "VoicePulse") { - $voiplist[] = array('VoicePulse', 'udp', '16384', '16482', 'both'); - $voiplist[] = array('VoicePulse', 'udp', '4569', '4569', 'both'); - } - - /* Panasonic Hybrid PBX */ - if( $_POST['provider'] == "Panasonic") { - $voiplist[] = array('Panasonic1', 'udp', '8000', '8063', 'both'); - $voiplist[] = array('Panasonic2', 'udp', '9300', '9301', 'both'); - $voiplist[] = array('Panasonic3', 'udp', '2747', '2747', 'both'); - } - - /* Set up/down VOIP as higher weight */ - /* loop through voiplist[] */ - foreach ($voiplist as $voip) { - foreach (array('source', 'destination') as $srcdest) { - $rule = array(); - if ($srcdest == 'source') { - $destsrc = 'destination'; - $rule['inqueue'] = 'qVOIPDown'; - $rule['outqueue'] = 'qVOIPUp'; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['source']['network'] = $downint; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_voip {$voip[0]} outbound"; - } else { - $destsrc = 'source'; - $rule['inqueue'] = 'qVOIPUp'; - $rule['outqueue'] = 'qVOIPDown'; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['descr'] = "m_voip {$voip[0]} inbound"; - } - - $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') - $rule['protocol'] = $voip[1]; - - $config['shaper']['rule'][] = $rule; } - } } } } function step4_stepsubmitphpaction() { - global $g, $config; + if ( $_POST['enable'] ) { - if(!is_numeric($_POST['bandwidthup']) or !is_numeric($_POST['bandwidthdown'])) { - $message="Upload and download speeds must be a number only! Values should be Kbits/second."; + if(!is_numeric($_POST['bandwidth'])) { + $message="Speed must be a number only! Values should be in percentage."; + header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}"); + exit; + } + if(!$_POST['bandwidth']) { + $message="You need to specify a value for bandwidth! Values should be in percentage."; header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}"); exit; } @@ -339,901 +161,802 @@ function step4_stepsubmitphpaction() { } } - if ( $_POST['enable'] ) { - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - - /* create qPenaltyUp queue */ - $queue = array(); - $queue['name'] = "qPenaltyUp"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 2; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['upperlimit'] = "on"; - $queue['upperlimit3'] = $_POST['bandwidthup'] . "Kb"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "off"; - $queue['bandwidth'] = $_POST['bandwidthup']; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qPenaltyDown queue */ - $queue = array(); - $queue['name'] = "qPenaltyDown"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 2; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['upperlimit'] = "on"; - $queue['upperlimit3'] = $_POST['bandwidthdown'] . "Kb"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "off"; - $queue['bandwidth'] = $_POST['bandwidthdown']; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - $config['shaper']['itemsshaped']++; - - /* If user specifies an IP, we don't bother with providers */ - if( is_ipaddr($_POST['address']) or is_alias($_POST['address'])) { - /* create Penalty rules */ - $rule = array(); - $rule['descr'] = gettext("Penalty IP"); - $rule['inqueue'] = "qPenaltyDown"; - $rule['outqueue'] = "qPenaltyUp"; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - /* $rule['source']['network'] = $downint; */ - $rule['source']['address'] = $_POST['address']; - $rule['destination']['any'] = TRUE; - $config['shaper']['rule'][] = $rule; - - $rule = array(); - $rule['descr'] = gettext("Penalty IP"); - $rule['inqueue'] = "qPenaltyUp"; - $rule['outqueue'] = "qPenaltyDown"; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['address'] = $_POST['address']; - $config['shaper']['rule'][] = $rule; - } - } } function step5_stepsubmitphpaction() { - global $g, $config; if ( $_POST['enable'] ) { - if (( $_POST['bandwidthup'] ) || ($_POST['bandwidthdown'])) { - if(!is_numeric($_POST['bandwidthup']) or !is_numeric($_POST['bandwidthdown'])) { - $message="Upload and download speeds must be a number only! Values should be Kbits/second."; + if (( $_POST['bandwidth'] )) { + if(!is_numeric($_POST['bandwidth'])) { + $message="Speed must be a number only! Values should be in percentage."; header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}"); exit; } } } - /* XXX - billm - needs to actually honor what the user selects still */ - if ( $_POST['enable'] ) { - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - if($_POST['p2pcatchall'] != "") - $config['shaper']['itemsshaped']++; +} - $p2plist = array(); +function step8_stepsubmitphpaction() { + global $g, $config, $d_shaperconfdirty_path; - /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */ - if($_POST['aimster'] != "") - $p2plist[] = array('Aimster', 'tcp', '7668', '7668', 'both'); - if($_POST['bittorrent'] != "") { - $p2plist[] = array('BitTorrent', 'tcp', '6881', '6999', 'both'); - $p2plist[] = array('BitTorrent', 'udp', '6881', '6999', 'both'); - } - if($_POST['buddyshare'] != "") - $p2plist[] = array('BuddyShare', 'tcp', '7788', '7788', 'both'); - if($_POST['cutemx'] != "") - $p2plist[] = array('CuteMX', 'tcp', '2340', '2340', 'both'); - if($_POST['dc++'] != "") - $p2plist[] = array('DC++', 'tcp', '1412', '1412', 'both'); - if($_POST['dcc'] != "") - $p2plist[] = array('dcc', 'tcp', '6666', '6668', 'both'); - if($_POST['directconnect'] != "") - $p2plist[] = array('DirectConnect', 'tcp', '412', '412', 'both'); - if($_POST['directfileexpress'] != "") - $p2plist[] = array('DirectFileExpress', 'tcp', '1044', '1045', 'both'); - if($_POST['edonkey2000'] != "") - $p2plist[] = array('EDonkey2000', 'tcp', '4661', '4665', 'both'); - if($_POST['fastTrack'] != "") - $p2plist[] = array('FastTrack', 'tcp', '1214', '1214', 'both'); - if($_POST['gnutella'] != "") { - $p2plist[] = array('Gnutella-TCP', 'tcp', '6346', '6346', 'both'); - $p2plist[] = array('Gnutella-UDP', 'udp', '6346', '6346', 'both'); - } - if($_POST['grouper'] != "") - $p2plist[] = array('grouper', 'tcp', '8038', '8039', 'both'); - if($_POST['hotcomm'] != "") - $p2plist[] = array('hotComm', 'tcp', '28864', '28865', 'both'); - if($_POST['hotlineconnect'] != "") - $p2plist[] = array('HotlineConnect', 'tcp', '5500', '5503', 'both'); - if($_POST['imesh'] != "") - $p2plist[] = array('iMesh', 'tcp', '4329', '4329', 'both'); - if($_POST['napster'] != "") - $p2plist[] = array('Napster', 'tcp', '6699', '6701', 'both'); - if($_POST['opennap'] != "") - $p2plist[] = array('OpenNap', 'tcp', '8888', '8889', 'both'); - if($_POST['scour'] != "") - $p2plist[] = array('Scour', 'tcp', '8311', '8311', 'both'); - if($_POST['shareaza'] != "") - $p2plist[] = array('Shareaza', 'tcp', '6346', '6346', 'both'); - if($_POST['songspy'] != "") - $p2plist[] = array('SongSpy', 'tcp', '5190', '5190', 'both'); - if($_POST['winmx'] != "") - $p2plist[] = array('WinMX', 'tcp', '6699', '6699', 'both'); - - /* Set up/down p2p as lowest weight */ - /* loop through p2plist[] */ - foreach ($p2plist as $p2pclient) { - foreach (array('source', 'destination') as $srcdest) { - $rule = array(); - $config['shaper']['itemsshaped']++; - if ($srcdest == 'source') { - $destsrc = 'destination'; - $rule['inqueue'] = 'qP2PDown'; - $rule['outqueue'] = 'qP2PUp'; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['interface'] = $downint; - $rule['source']['network'] = $downint; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; - } else { - $destsrc = 'source'; - $rule['inqueue'] = 'qP2PUp'; - $rule['outqueue'] = 'qP2PDown'; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['descr'] = "m_P2P {$p2pclient[0]} inbound"; - } + /* Prepare for next ezshaper wizard run */ + unset($config['shaper']['itemsshaped']); + + /* create configuration */ + apply_all_choosen_items(); + /* reset rrd queues */ + system("rm -f /var/db/rrd/wan-queuesdrop.rrd"); + system("rm -f /var/db/rrd/wan-queues.rrd"); + enable_rrd_graphing(); - $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') - $rule['protocol'] = $p2pclient[1]; + /* Create new rules */ + filter_configure(); - $config['shaper']['rule'][] = $rule; - } - } + /* And we're no longer dirty! */ + unlink_if_exists($d_shaperconfdirty_path); - /* create qP2PUp */ - $queue = array(); - $queue['name'] = "qP2PUp"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 1; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - if($_POST['bandwidthup'] <> "") { - $queue['upperlimit'] = "on"; - $queue['upperlimit3'] = $_POST['bandwidthup'] . "Kb"; - } - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qP2PDown */ - $queue = array(); - $queue['name'] = "qP2PDown"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 1; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - if($_POST['bandwidthdown'] <> "") { - $queue['upperlimit'] = "on"; - $queue['upperlimit3'] = $_POST['bandwidthdown'] . "Kb"; - } - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - } + update_filter_reload_status("Initializing"); + + /* Head over and check out the groovy queue stats */ + header("Location: status_filter_reload.php"); } -function step6_stepsubmitphpaction() { +function step9_stepsubmitphpaction() { global $g, $config; - /* XXX - billm - needs to actually honor what the user selects still */ - if ( $_POST['enable'] ) { - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - - /* create qGamesUp queue */ - $queue = array(); - $queue['name'] = "qGamesUp"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 5; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 15; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qGamesDown queue */ - $queue = array(); - $queue['name'] = "qGamesDown"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 5; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 15; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - $gamesplist = array(); - - if($_POST['battlefield2'] != "") { - /* Battlefield 2 */ - $gamesplist[] = array('BF2-1500-4999', 'udp', '1500', '4999', 'both'); - $gamesplist[] = array('BF2-4711', 'tcp', '4711', '4711', 'both'); - $gamesplist[] = array('BF2-16567', 'udp', '16567', '16567', 'both'); - $gamesplist[] = array('BF2-27900', 'udp', '27900', '27900', 'both'); - $gamesplist[] = array('BF2-28910', 'tcp', '28910', '28910', 'both'); - $gamesplist[] = array('BF2-29900-29901-UDP', 'udp', '29900', '29901', 'both'); - $gamesplist[] = array('BF2-29900-29901-TCP', 'tcp', '29900', '29901', 'both'); - $gamesplist[] = array('BF2-27900', 'udp', '27900', '27900', 'both'); - $gamesplist[] = array('BF2-55123-55125', 'udp', '55123', '55125', 'both'); - } + header("Location: status_filter_reload.php"); +} - if($_POST['counterstrike'] != "") { - /* counter strike */ - $gamesplist[] = array('Titan', 'udp', '6003', '6003', 'both'); - $gamesplist[] = array('Authentication', 'udp', '7002', '7002', 'both'); - $gamesplist[] = array('Client', 'udp', '6003', '6003', 'both'); - $gamesplist[] = array('Masterserver', 'udp', '27010', '27010', 'both'); - $gamesplist[] = array('Mod-Server', 'udp', '27011', '27011', 'both'); - $gamesplist[] = array('Chat', 'udp', '27012', '27012', 'both'); - $gamesplist[] = array('HL-Serverport1', 'udp', '27013', '27013', 'both'); - $gamesplist[] = array('HL-Serverport2', 'udp', '27014', '27014', 'both'); - $gamesplist[] = array('HL-Serverport', 'udp', '27015', '27015', 'both'); - } +function apply_all_choosen_items() { + global $pkg, $config, $g, $altq_list_queues; + +$gamesplist = array(); - if($_POST['deltaforce'] != "") { +$gamesplist['battlefield2'] = array(); + /* Battlefield 2 */ + $gamesplist['battlefield2'][] = array('BF2-1500-4999', 'udp', '1500', '4999', 'both'); + $gamesplist['battlefield2'][] = array('BF2-4711', 'tcp', '4711', '4711', 'both'); + $gamesplist['battlefield2'][] = array('BF2-16567', 'udp', '16567', '16567', 'both'); + $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both'); + $gamesplist['battlefield2'][] = array('BF2-28910', 'tcp', '28910', '28910', 'both'); + $gamesplist['battlefield2'][] = array('BF2-29900-29901-UDP', 'udp', '29900', '29901', 'both'); + $gamesplist['battlefield2'][] = array('BF2-29900-29901-TCP', 'tcp', '29900', '29901', 'both'); + $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both'); + $gamesplist['battlefield2'][] = array('BF2-55123-55125', 'udp', '55123', '55125', 'both'); + +$gamesplist['counterstrike'] = array(); + /* counter strike */ + $gamesplist['counterstrike'][] = array('Titan', 'udp', '6003', '6003', 'both'); + $gamesplist['counterstrike'][] = array('Authentication', 'udp', '7002', '7002', 'both'); + $gamesplist['counterstrike'][] = array('Client', 'udp', '6003', '6003', 'both'); + $gamesplist['counterstrike'][] = array('Masterserver', 'udp', '27010', '27010', 'both'); + $gamesplist['counterstrike'][] = array('Mod-Server', 'udp', '27011', '27011', 'both'); + $gamesplist['counterstrike'][] = array('Chat', 'udp', '27012', '27012', 'both'); + $gamesplist['counterstrike'][] = array('HL-Serverport1', 'udp', '27013', '27013', 'both'); + $gamesplist['counterstrike'][] = array('HL-Serverport2', 'udp', '27014', '27014', 'both'); + $gamesplist['counterstrike'][] = array('HL-Serverport', 'udp', '27015', '27015', 'both'); + +$gamesplist['deltaforce'] = array(); /* delta force */ - $gamesplist[] = array('Delta1', 'udp', '17478', '17488', 'both'); - } + $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both'); - if($_POST['quakeiii'] != "") { + +$gamesplist['quakeiii'] = array(); /* quake3 */ - $gamesplist[] = array('quakeiii', 'udp', '27910', '27919', 'both'); - } + $gamesplist['quakeiii'][] = array('quakeiii', 'udp', '27910', '27919', 'both'); - if($_POST['tigerwoods2004ps2'] != "") { + +$gamesplist['tigerwoods2004ps2'] = array(); /* tiger woods 2004 ps2 */ - $gamesplist[] = array('Outbound2Player', 'udp', '3658', '3658', 'both'); - $gamesplist[] = array('Outbound2Player2', 'udp', '6000', '6000', 'both'); - $gamesplist[] = array('Outbound2EA', 'tcp', '10300', '10301', 'both'); - } + $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player', 'udp', '3658', '3658', 'both'); + $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player2', 'udp', '6000', '6000', 'both'); + $gamesplist['tigerwoods2004ps2'][] = array('Outbound2EA', 'tcp', '10300', '10301', 'both'); + + +$gamesplist['callofduty'] = array(); + $gamesplist['callofduty'][] = array('CallOfDuty1', 'tcp', '28960', '28960', 'both'); + $gamesplist['callofduty'][] = array('CallOfDuty2', 'udp', '28960', '28960', 'both'); - if($_POST['callofduty'] != "") { - $gamesplist[] = array('CallOfDuty1', 'tcp', '28960', '28960', 'both'); - $gamesplist[] = array('CallOfDuty2', 'udp', '28960', '28960', 'both'); - } - if($_POST['planetside'] != "") { +$gamesplist['planetside'] = array(); /* PlanetSide */ - $gamesplist[] = array('PlanetSide', 'tcp', '7000', '7000', 'both'); - $gamesplist[] = array('PlanetSide', 'tcp', '7080', '7080', 'both'); - $gamesplist[] = array('PlanetSide2', 'udp', '3016', '3021', 'both'); - $gamesplist[] = array('PlanetSide2', 'udp', '45000', '45010', 'both'); - $gamesplist[] = array('PlanetSide2', 'udp', '30000', '30500', 'both'); - } + $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7000', '7000', 'both'); + $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7080', '7080', 'both'); + $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '3016', '3021', 'both'); + $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '45000', '45010', 'both'); + $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '30000', '30500', 'both'); + - if($_POST['halo2'] != "") { +$gamesplist['halo2'] = array(); /* Halo2 + XBOX Live */ - $gamesplist[] = array('Halo2-1', 'udp', '88', '88', 'both'); - $gamesplist[] = array('Halo2-2', 'udp', '3074', '3074', 'both'); - $gamesplist[] = array('Halo2-3', 'tcp', '3074', '3074', 'both'); - } + $gamesplist['halo2'][] = array('Halo2-1', 'udp', '88', '88', 'both'); + $gamesplist['halo2'][] = array('Halo2-2', 'udp', '3074', '3074', 'both'); + $gamesplist['halo2'][] = array('Halo2-3', 'tcp', '3074', '3074', 'both'); + - if($_POST['unrealtournament'] != "") { +$gamesplist['unrealtournament'] = array(); /* Unreal Tournament */ - $gamesplist[] = array('ur1', 'udp', '7777', '7787', 'both'); - $gamesplist[] = array('ur2', 'tcp', '7777', '7787', 'both'); - } + $gamesplist['unrealtournament'][] = array('ur1', 'udp', '7777', '7787', 'both'); + $gamesplist['unrealtournament'][] = array('ur2', 'tcp', '7777', '7787', 'both'); - if($_POST['doom3'] != "") { + +$gamesplist['doom3'] = array(); /* doom3 */ - $gamesplist[] = array('DOOM3-1', 'udp', '27650', '27650', 'both'); - $gamesplist[] = array('DOOM3-2', 'udp', '27666', '27666', 'both'); - } + $gamesplist['doom3'][] = array('DOOM3-1', 'udp', '27650', '27650', 'both'); + $gamesplist['doom3'][] = array('DOOM3-2', 'udp', '27666', '27666', 'both'); - if($_POST['empireearth'] != "") { + +$gamesplist['empireearth'] = array(); /* empire earth */ - $gamesplist[] = array('EmpireEarth-1', 'tcp', '33335', '33336', 'both'); - $gamesplist[] = array('EmpireEarth-2', 'udp', '33334', '33334', 'both'); - } + $gamesplist['empireearth'][] = array('EmpireEarth-1', 'tcp', '33335', '33336', 'both'); + $gamesplist['empireearth'][] = array('EmpireEarth-2', 'udp', '33334', '33334', 'both'); + - if($_POST['everquest'] != "") { +$gamesplist['everquest'] = array(); /* everquest */ - $gamesplist[] = array('Everquest-1', 'tcp', '1024', '6000', 'both'); - $gamesplist[] = array('Everquest-2', 'tcp', '7000', '7000', 'both'); - $gamesplist[] = array('Everquest-3', 'udp', '1024', '6000', 'both'); - $gamesplist[] = array('Everquest-4', 'udp', '7000', '7000', 'both'); - } + $gamesplist['everquest'][] = array('Everquest-1', 'tcp', '1024', '6000', 'both'); + $gamesplist['everquest'][] = array('Everquest-2', 'tcp', '7000', '7000', 'both'); + $gamesplist['everquest'][] = array('Everquest-3', 'udp', '1024', '6000', 'both'); + $gamesplist['everquest'][] = array('Everquest-4', 'udp', '7000', '7000', 'both'); + - if($_POST['everquest2'] != "") { +$gamesplist['everquest2'] = array(); /* everquest2 */ - $gamesplist[] = array('Everquest2-1', 'tcp', '7000', '7000', 'both'); - $gamesplist[] = array('Everquest2-2', 'udp', '3016', '3021', 'both'); - $gamesplist[] = array('Everquest2-3', 'udp', '9100', '9100', 'both'); - $gamesplist[] = array('Everquest2-4', 'udp', '9700', '9703', 'both'); - $gamesplist[] = array('Everquest2-5', 'udp', '32800', '33000', 'both'); - } - - if($_POST['farcry'] != "") { + $gamesplist['everquest2'][] = array('Everquest2-1', 'tcp', '7000', '7000', 'both'); + $gamesplist['everquest2'][] = array('Everquest2-2', 'udp', '3016', '3021', 'both'); + $gamesplist['everquest2'][] = array('Everquest2-3', 'udp', '9100', '9100', 'both'); + $gamesplist['everquest2'][] = array('Everquest2-4', 'udp', '9700', '9703', 'both'); + $gamesplist['everquest2'][] = array('Everquest2-5', 'udp', '32800', '33000', 'both'); + + +$gamesplist['farcry'] = array(); /* far cry */ - $gamesplist[] = array('FarCry-1', 'tcp', '49001', '49002', 'both'); - $gamesplist[] = array('FarCry-2', 'udp', '49001', '49002', 'both'); - } + $gamesplist['farcry'][] = array('FarCry-1', 'tcp', '49001', '49002', 'both'); + $gamesplist['farcry'][] = array('FarCry-2', 'udp', '49001', '49002', 'both'); + - if($_POST['halflife2'] != "") { +$gamesplist['halflife2'] = array(); /* halflife 2 */ - $gamesplist[] = array('HL2-1', 'tcp', '27020', '27050', 'both'); - $gamesplist[] = array('HL2-2', 'udp', '1200', '1200', 'both'); - $gamesplist[] = array('HL2-3', 'udp', '27000', '27015', 'both'); - } + $gamesplist['halflife2'][] = array('HL2-1', 'tcp', '27020', '27050', 'both'); + $gamesplist['halflife2'][] = array('HL2-2', 'udp', '1200', '1200', 'both'); + $gamesplist['halflife2'][] = array('HL2-3', 'udp', '27000', '27015', 'both'); + - if($_POST['halflife'] != "") { +$gamesplist['halflife'] = array(); /* halflife */ - $gamesplist[] = array('HL-1', 'tcp', '27015', '27015', 'both'); - $gamesplist[] = array('HL-2', 'udp', '27650', '27650', 'both'); - $gamesplist[] = array('HL-3', 'udp', '27666', '27666', 'both'); - } + $gamesplist['halflife'][] = array('HL-1', 'tcp', '27015', '27015', 'both'); + $gamesplist['halflife'][] = array('HL-2', 'udp', '27650', '27650', 'both'); + $gamesplist['halflife'][] = array('HL-3', 'udp', '27666', '27666', 'both'); - if($_POST['wolfet'] != "") { + +$gamesplist['wolfet'] = array(); /* wolfenstein enemy territory */ - $gamesplist[] = array('WolfET-1', 'tcp', '27960', '27960', 'both'); - } + $gamesplist['wolfet'][] = array('WolfET-1', 'tcp', '27960', '27960', 'both'); - if($_POST['lineage2'] != "") { - /* Lineage II */ - $gamesplist[] = array('Lineage2-2009', 'tcp', '2009', '2009', 'both'); - $gamesplist[] = array('Lineage2-2106', 'tcp', '2106', '2106', 'both'); - $gamesplist[] = array('Lineage2-7777', 'tcp', '7777', '7777', 'both'); - } - if($_POST['battlenet'] != "") { +$gamesplist['lineage2'] = array(); + /* Lineage II */ + $gamesplist['lineage2'][] = array('Lineage2-2009', 'tcp', '2009', '2009', 'both'); + $gamesplist['lineage2'][] = array('Lineage2-2106', 'tcp', '2106', '2106', 'both'); + $gamesplist['lineage2'][] = array('Lineage2-7777', 'tcp', '7777', '7777', 'both'); +$gamesplist['battlenet'] = array(); /* Blizzard Publishing games */ - $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both'); - } - if($_POST['worldofwarcraft'] != "") { - /* World of WarCract */ - if ($_POST['battlenet'] == "") { - /* Add battle.net only if WoW is selected and battle.net isn't */ - $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both'); - } - $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both'); - } - - if($_POST['archlord'] != "") { - /* ArchLord */ - $gamesplist[] = array('AL-1', 'tcp', '11000', '11000', 'both'); - $gamesplist[] = array('AL-2', 'tcp', '11002', '11002', 'both'); - $gamesplist[] = array('AL-3', 'tcp', '11008', '11008', 'both'); - } - - if($_POST['gunzonline'] != "") { - /* GunZ Online */ - $gamesplist[] = array('GunZOnline', 'udp', '7700', '7700', 'both'); - } + $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both'); +/* World of WarCract */ +$gamesplist['worldofwarcraft'] = array(); + $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both'); - if($_POST['xbox360'] != "") { - /* XBox360 */ - $gamesplist[] = array('xbox360-1', 'udp', '88', '88', 'both'); - $gamesplist[] = array('xbox360-2', 'udp', '3074', '3074', 'both'); - $gamesplist[] = array('xbox360-3', 'tcp', '3074', '3074', 'both'); - } +/* Add battle.net only if WoW is selected and battle.net isn't */ +$gamesplist['battlenet'] = array(); + $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both'); - if($_POST['xbox360'] != "") { - /* XBox360 */ - $gamesplist[] = array('xbox360-1', 'udp', '88', '88', 'both'); - $gamesplist[] = array('xbox360-2', 'udp', '3074', '3074', 'both'); - $gamesplist[] = array('xbox360-3', 'tcp', '3074', '3074', 'both'); - } +/* ArchLord */ +$gamesplist['archlord'] = array(); + $gamesplist[] = array('AL-1', 'tcp', '11000', '11000', 'both'); + $gamesplist[] = array('AL-2', 'tcp', '11002', '11002', 'both'); + $gamesplist[] = array('AL-3', 'tcp', '11008', '11008', 'both'); - /* XXX: add some more games before this line!! */ +/* GunZ Online */ +$gamesplist['gunzonline'] = array(); + $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both'); - /* Set up/down games as higher weight */ - /* loop through p2plist[] */ - foreach ($gamesplist as $Gameclient) { - foreach (array('source', 'destination') as $srcdest) { - $rule = array(); - $config['shaper']['itemsshaped']++; - if ($srcdest == 'source') { - $destsrc = 'destination'; - $rule['inqueue'] = 'qGamesDown'; - $rule['outqueue'] = 'qGamesUp'; - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['source']['network'] = $downint; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; - } else { - $destsrc = 'source'; - $rule['inqueue'] = 'qGamesUp'; - $rule['outqueue'] = 'qGamesDown'; - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['descr'] = "m_Game {$Gameclient[0]} inbound"; - } +/* XBox360 */ +$gamesplist['xbox360'] = array(); + $gamesplist['xbox360'][] = array('xbox360-1', 'udp', '88', '88', 'both'); + $gamesplist['xbox360'][] = array('xbox360-2', 'udp', '3074', '3074', 'both'); + $gamesplist['xbox360'][] = array('xbox360-3', 'tcp', '3074', '3074', 'both'); - $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') - $rule['protocol'] = $Gameclient[1]; +$voiplist = array(); + + /* asterisk server / same as vonage */ +$voiplist['Asterisk'] = array(); + $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '5060', '5069', 'both'); + $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '10000', '20000', 'both'); + + /* VoicePulse server */ +$voiplist['VoicePulse'] = array(); + $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both'); + $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both'); + + /* Panasonic Hybrid PBX */ +$voiplist['Panasonic'] = array(); + $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both'); + $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both'); + $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both'); - $config['shaper']['rule'][] = $rule; - } - } - } -} -function step7_stepsubmitphpaction() { - global $g, $config; - if ( $_POST['enable'] ) { - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - /* create qOthersUp queue */ - $queue = array(); - $queue['name'] = "qOthersUpH"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 4; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qOthersDown queue */ - $queue = array(); - $queue['name'] = "qOthersDownH"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 4; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 25; - $queue['bandwidthtype'] = '%'; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - - /* create qOthersUp queue */ - $queue = array(); - $queue['name'] = "qOthersUpL"; - $queue['attachtoqueue'] = "{$upq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 2; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - /* create qOthersDown queue */ - $queue = array(); - $queue['name'] = "qOthersDownL"; - $queue['attachtoqueue'] = "{$downq}Root"; - $queue['associatedrule'] = 0; - $queue['priority'] = 2; - $queue['red'] = "on"; - $queue['ecn'] = "on"; - if ($config['shaper']['schedulertype'] == "hfsc") { - $queue['realtime'] = "on"; - $queue['realtime3'] = "1Kb"; - $queue['bandwidth'] = 1; - $queue['bandwidthtype'] = '%'; - $queue['qlimit'] = 500; - } elseif ($config['shaper']['schedulertype'] == "cbq") { - $queue['borrow'] = "on"; - $queue['bandwidth'] = 6; - $queue['bandwidthtype'] = 'Kb'; - } - $config['shaper']['queue'][] = $queue; - - $othersplist = array(); +$p2plist = array(); + /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */ + $p2plist['aimster'] = array(); + $p2plist['aimster'][] = array('Aimster', 'tcp', '7668', '7668', 'both'); + $p2plist['bittorrent'] = array(); + $p2plist['bittorrent'][] = array('BitTorrent', 'tcp', '6881', '6999', 'both'); + $p2plist['bittorrent'][] = array('BitTorrent', 'udp', '6881', '6999', 'both'); + $p2plist['buddyshare'] = array(); + $p2plist['buddyshare'][] = array('BuddyShare', 'tcp', '7788', '7788', 'both'); + $p2plist['cutemx'] = array(); + $p2plist['cutemx'][] = array('CuteMX', 'tcp', '2340', '2340', 'both'); + $p2plist['dc++'] = array(); + $p2plist['dc++'][] = array('DC++', 'tcp', '1412', '1412', 'both'); + $p2plist['dcc'] = array(); + $p2plist['dcc'][] = array('dcc', 'tcp', '6666', '6668', 'both'); + $p2plist['directconnect'] = array(); + $p2plist['directconnect'][] = array('DirectConnect', 'tcp', '412', '412', 'both'); + $p2plist['directfileexpress'] = array(); + $p2plist['directfileexpress'][] = array('DirectFileExpress', 'tcp', '1044', '1045', 'both'); + $p2plist['edonkey2000'] = array(); + $p2plist['edonkey2000'][] = array('EDonkey2000', 'tcp', '4661', '4665', 'both'); + $p2plist['fastTrack'] = array(); + $p2plist['fastTrack'][] = array('FastTrack', 'tcp', '1214', '1214', 'both'); + $p2plist['gnutella'] = array(); + $p2plist['gnutella'][] = array('Gnutella-TCP', 'tcp', '6346', '6346', 'both'); + $p2plist['gnutella'][] = array('Gnutella-UDP', 'udp', '6346', '6346', 'both'); + $p2plist['grouper'] = array(); + $p2plist['grouper'][] = array('grouper', 'tcp', '8038', '8039', 'both'); + $p2plist['hotcomm'] = array(); + $p2plist['hotcomm'][] = array('hotComm', 'tcp', '28864', '28865', 'both'); + $p2plist['hotlineconnect'] = array(); + $p2plist['hotlineconnect'][] = array('HotlineConnect', 'tcp', '5500', '5503', 'both'); + $p2plist['imesh'] = array(); + $p2plist['imesh'][] = array('iMesh', 'tcp', '4329', '4329', 'both'); + $p2plist['napster'] = array(); + $p2plist['napster'][] = array('Napster', 'tcp', '6699', '6701', 'both'); + $p2plist['opennap'] = array(); + $p2plist['opennap'][] = array('OpenNap', 'tcp', '8888', '8889', 'both'); + $p2plist['scour'] = array(); + $p2plist['scour'][] = array('Scour', 'tcp', '8311', '8311', 'both'); + $p2plist['shareaza'] = array(); + $p2plist['shareaza'][] = array('Shareaza', 'tcp', '6346', '6346', 'both'); + $p2plist['songspy'] = array(); + $p2plist['songspy'][] = array('SongSpy', 'tcp', '5190', '5190', 'both'); + $p2plist['winmx'] = array(); + $p2plist['winmx'][] = array('WinMX', 'tcp', '6699', '6699', 'both'); + + + +$othersplist = array(); /* Unlike other areas we are posting the queue H or L or BLANK */ - if($_POST['msrdp'] != "") { + $othersplist['msrdp'] = array(); /* MSRDP */ - $othersplist[] = array('MSRDP', 'tcp', '3389', '3389', 'both', $_POST['msrdp']); - } - - if($_POST['pptp'] != "") { + $othersplist['msrdp'][] = array('MSRDP', 'tcp', '3389', '3389', 'both'); + $othersplist['pptp'] = array(); /* PPTP */ - $othersplist[] = array('PPTP', 'tcp', '1723', '1723', 'both', $_POST['pptp']); - $othersplist[] = array('PPTPGRE', 'gre', '', '', 'both', $_POST['pptp']); - } - - if($_POST['ipsec'] != "") { - /* IPsec */ - $othersplist[] = array('IPsec', 'udp', '500', '500', 'both', $_POST['ipsec']); - $othersplist[] = array('IPsec', 'ah', '', '', 'both', $_POST['ipsec']); - $othersplist[] = array('IPsec', 'esp', '', '', 'both', $_POST['ipsec']); - } - - if($_POST['streamingmp3'] != "") { + $othersplist['pptp'][] = array('PPTP', 'tcp', '1723', '1723', 'both'); + $othersplist['pptp'][] = array('PPTPGRE', 'gre', '', '', 'both'); + $othersplist['ipsec'] = array(); + /* IPSEC */ + $othersplist['ipsec'][] = array('IPSEC', 'udp', '500', '500', 'both'); + $othersplist['ipsec'][] = array('IPSEC', 'ah', '', '', 'both'); + $othersplist['ipsec'][] = array('IPSEC', 'esp', '', '', 'both'); + $othersplist['streamingmp3'] = array(); /* streaming mp3 media aka shoutcast */ - $othersplist[] = array('STREAMINGMP3', 'tcp', '8000', '8100', 'both', $_POST['streamingmp3']); - } - - if($_POST['irc'] != "") { + $othersplist['streamingmp3'][] = array('STREAMINGMP3', 'tcp', '8000', '8100', 'both'); + $othersplist['irc'] = array(); /* internet relay chat */ - $othersplist[] = array('IRC', 'tcp', '6667', '6670', 'both', $_POST['irc']); - } - - if($_POST['jabber'] != "") { + $othersplist['irc'][] = array('IRC', 'tcp', '6667', '6670', 'both'); + $othersplist['jabber'] = array(); /* jabber */ - $othersplist[] = array('IRC', 'tcp', '5222', '5222', 'both', $_POST['jabber']); - $othersplist[] = array('IRC', 'tcp', '5223', '5223', 'both', $_POST['jabber']); - $othersplist[] = array('IRC', 'tcp', '5269', '5269', 'both', $_POST['jabber']); - } - - if($_POST['dns'] != "") { + $othersplist['jabber'][] = array('IRC', 'tcp', '5222', '5222', 'both'); + $othersplist['jabber'][] = array('IRC', 'tcp', '5223', '5223', 'both'); + $othersplist['jabber'][] = array('IRC', 'tcp', '5269', '5269', 'both'); + $othersplist['dns'] = array(); /* domain name system */ - $othersplist[] = array('DNS1', 'tcp', '53', '53', 'both', $_POST['dns']); - $othersplist[] = array('DNS2', 'udp', '53', '53', 'both', $_POST['dns']); - } - - if($_POST['http'] != "") { + $othersplist['dns'][] = array('DNS1', 'tcp', '53', '53', 'both'); + $othersplist['dns'][] = array('DNS2', 'udp', '53', '53', 'both'); + $othersplist['http'] = array(); /* HTTP aka Web Traffic */ - $othersplist[] = array('HTTP', 'tcp', '80', '80', 'both', $_POST['http']); - $othersplist[] = array('HTTPS', 'tcp', '443', '443', 'both', $_POST['http']); - } - - if($_POST['smtp'] != "") { + $othersplist['http'][] = array('HTTP', 'tcp', '80', '80', 'both'); + $othersplist['http'][] = array('HTTPS', 'tcp', '443', '443', 'both'); + $othersplist['smtp'] = array(); /* Secure shell traffic */ - $othersplist[] = array('SMTP', 'tcp', '25', '25', 'both', $_POST['smtp']); - } - - if($_POST['pop3'] != "") { + $othersplist['smtp'][] = array('SMTP', 'tcp', '25', '25', 'both'); + $othersplist['pop3'] = array(); /* Post Office Protocol - POP3 */ - $othersplist[] = array('POP3', 'tcp', '110', '110', 'both', $_POST['pop3']); - } - - if($_POST['icmp'] != "") { + $othersplist['pop3'][] = array('POP3', 'tcp', '110', '110', 'both'); + $othersplist['icmp'] = array(); /* ICMP */ - $othersplist[] = array('ICMP', 'icmp', '', '', 'both', $_POST['icmp']); - } - - if($_POST['imap'] != "") { + $othersplist['icmp'][] = array('ICMP', 'icmp', '', '', 'both'); + $othersplist['imap'] = array(); /* IMAP */ - $othersplist[] = array('IMAP', 'tcp', '143', '143', 'both', $_POST['imap']); - } - - if($_POST['smb'] != "") { + $othersplist['imap'][] = array('IMAP', 'tcp', '143', '143', 'both'); + $othersplist['smb'] = array(); /* Microsoft SMB and friends */ - $othersplist[] = array('SMB1', 'tcp', '445', '445', 'both', $_POST['smb']); - $othersplist[] = array('SMB2', 'tcp', '137-139', '137-139', 'both', $_POST['smb']); - - if($_POST['rtsp'] != "") { + $othersplist['smb'][] = array('SMB1', 'tcp', '445', '445', 'both'); + $othersplist['smb'][] = array('SMB2', 'tcp', '137-139', '137-139', 'both'); + $othersplist['rtsp'] = array(); /* realtime streaming protocol */ - $othersplist[] = array('RTSP1', 'tcp', '554', '554', 'both', $_POST['rtsp']); - } } - - if($_POST['snmp'] != "") { + $othersplist['rtsp'][] = array('RTSP1', 'tcp', '554', '554', 'both'); + $othersplist['snmp'] = array(); /* Simple network management protocol */ - $othersplist[] = array('SNMP', 'tcp', '161', '161', 'both', $_POST['snmp']); - $othersplist[] = array('SNMP2', 'udp', '161', '161', 'both', $_POST['snmp']); - } - - if($_POST['vnc'] != "") { + $othersplist['snmp'][] = array('SNMP', 'tcp', '161', '161', 'both'); + $othersplist['snmp'][] = array('SNMP2', 'udp', '161', '161', 'both'); + $othersplist['vnc'] = array(); /* virtual network control */ - $othersplist[] = array('VNC', 'tcp', '5900', '5930', 'both', $_POST['vnc']); - } - - if($_POST['appleremotedesktop'] != "") { + $othersplist['vnc'][] = array('VNC', 'tcp', '5900', '5930', 'both'); + $othersplist['appleremotedesktop'] = array(); /* apple remote desktop */ - $othersplist[] = array('AppleRemoteDesktop1', 'tcp', '3283', '3283', 'both', $_POST['appleremotedesktop']); - $othersplist[] = array('AppleRemoteDesktop2', 'tcp', '5900', '5900', 'both', $_POST['appleremotedesktop']); - $othersplist[] = array('AppleRemoteDesktop3', 'udp', '3283', '3283', 'both', $_POST['appleremotedesktop']); - $othersplist[] = array('AppleRemoteDesktop4', 'udp', '5900', '5900', 'both', $_POST['appleremotedesktop']); - } - - if($_POST['icq'] != "") { + $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop1', 'tcp', '3283', '3283', 'both'); + $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop2', 'tcp', '5900', '5900', 'both'); + $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop3', 'udp', '3283', '3283', 'both'); + $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop4', 'udp', '5900', '5900', 'both'); + $othersplist['icq'] = array(); /* icq */ - $othersplist[] = array('ICQ1', 'tcp', '5190', '5190', 'both', $_POST['icq']); - $othersplist[] = array('ICQ2', 'udp', '5190', '5190', 'both', $_POST['icq']); - } - - if($_POST['lotusnotes'] != "") { + $othersplist['icq'][] = array('ICQ1', 'tcp', '5190', '5190', 'both'); + $othersplist['icq'][] = array('ICQ2', 'udp', '5190', '5190', 'both'); + $othersplist['lotusnotes'] = array(); /* lotus notes */ - $othersplist[] = array('LotusNotes1', 'tcp', '1352', '1352', 'both', $_POST['lotusnotes']); - $othersplist[] = array('LotusNotes2', 'udp', '1352', '1352', 'both', $_POST['lotusnotes']); - } - if($_POST['aolinstantmessenger'] != "") { + $othersplist['lotusnotes'][] = array('LotusNotes1', 'tcp', '1352', '1352', 'both'); + $othersplist['lotusnotes'][] = array('LotusNotes2', 'udp', '1352', '1352', 'both'); + $othersplist['aolinstantmessenger'] = array(); /* AIM */ - $othersplist[] = array('AIM', 'tcp', '5190', '5190', 'both', $_POST['aolinstantmessenger']); - } - - if($_POST['msnmessenger'] != "") { + $othersplist['aolinstantmessenger'][] = array('AIM', 'tcp', '5190', '5190', 'both'); + $othersplist['msnmessenger'] = array(); /* msn messenger */ - $othersplist[] = array('MSN1', 'tcp', '1863', '1863', 'both', $_POST['msnmessenger']); - $othersplist[] = array('MSN2', 'tcp', '6891', '6900', 'both', $_POST['msnmessenger']); - $othersplist[] = array('MSN3', 'tcp', '6901', '6901', 'both', $_POST['msnmessenger']); - $othersplist[] = array('MSN4', 'udp', '6901', '6901', 'both', $_POST['msnmessenger']); - } - - if($_POST['mysqlserver'] != "") { + $othersplist['msnmessenger'][] = array('MSN1', 'tcp', '1863', '1863', 'both'); + $othersplist['msnmessenger'][] = array('MSN2', 'tcp', '6891', '6900', 'both'); + $othersplist['msnmessenger'][] = array('MSN3', 'tcp', '6901', '6901', 'both'); + $othersplist['msnmessenger'][] = array('MSN4', 'udp', '6901', '6901', 'both'); + $othersplist['mysqlserver'] = array(); /* mysql server */ - $othersplist[] = array('MySQL1', 'tcp', '3306', '3306', 'both', $_POST['mysqlserver']); - } - - if($_POST['nntp'] != "") { + $othersplist['mysqlserver'][] = array('MySQL1', 'tcp', '3306', '3306', 'both'); + $othersplist['nntp'] = array(); /* nntp */ - $othersplist[] = array('NNTP1', 'tcp', '119', '119', 'both', $_POST['mysqlserver']); - $othersplist[] = array('NNTP2', 'udp', '119', '119', 'both', $_POST['mysqlserver']); - } - - if($_POST['pcanywhere'] != "") { + $othersplist['nntp'][] = array('NNTP1', 'tcp', '119', '119', 'both'); + $othersplist['nntp'][] = array('NNTP2', 'udp', '119', '119', 'both'); + $othersplist['pcanywhere'] = array(); /* symantec pc anywhere */ - $othersplist[] = array('pcany1', 'tcp', '5631', '5631', 'both', $_POST['pcanywhere']); - $othersplist[] = array('pcany2', 'udp', '5632', '5632', 'both', $_POST['pcanywhere']); - } - - if($_POST['teamspeak'] != "") { + $othersplist['pcanywhere'][] = array('pcany1', 'tcp', '5631', '5631', 'both'); + $othersplist['pcanywhere'][] = array('pcany2', 'udp', '5632', '5632', 'both'); + $othersplist['teamspeak'] = array(); /* teamspeak */ - $othersplist[] = array('teamspeak1', 'tcp', '14534', '14534', 'both', $_POST['teamspeak']); - $othersplist[] = array('teamspeak2', 'tcp', '51234', '51234', 'both', $_POST['teamspeak']); - $othersplist[] = array('teamspeak3', 'udp', '8767', '8768', 'both', $_POST['teamspeak']); - } + $othersplist['teamspeak'][] = array('teamspeak1', 'tcp', '14534', '14534', 'both'); + $othersplist['teamspeak'][] = array('teamspeak2', 'tcp', '51234', '51234', 'both'); + $othersplist['teamspeak'][] = array('teamspeak3', 'udp', '8767', '8768', 'both'); + $othersplist['cvsup'] = array(); + /* cvs */ + $othersplist['cvsup'][] = array('cvsup', 'tcp', '5999', '5999', 'both'); + $othersplist['hbci'] = array(); + /* HBCI */ + $othersplist['hbci'][] = array('HBCI', 'tcp', '3000', '3000', 'both'); + $othersplist['p2pCatchAll'] = array(); + $othersplist['p2pCatchAll'][] = array('p2pCatchAll', 'udp', '', '', 'both', ''); + $othersplist['p2pCatchAll'][] = array('p2pCatchAll2', 'tcp', '', '', 'both', ''); + + + unset($altq_list_queues); + + $altq_list_queues = array(); + $tmppath = array(); + + foreach ($config['ezshaper']['step2'] as $ifkey => $if) { + + $altq =& new altq_root_queue(); + + $altq->SetInterface($ifkey); + $altq->SetScheduler($if['scheduler']); + $altq->SetBandwidth($if['bandwidth']); + $altq->SetBwscale("Kb"); + $altq->SetEnabled("on"); + $altq_list_queues[$altq->GetQname()] =& $altq; + array_push($tmppath, $ifkey); + $altq->SetLink($tmppath); + $altq->wconfig(); + + + $sched = $if['scheduler']; + /* Values are in percent */ + if ($sched == "CBQ" || $sched == "HFSC") { + if (isset($config['ezshaper']['step3']['bandwidth'])) { + $voip = TRUE; + $voipbw = $config['ezshaper']['step3']['bandwidth']; + } else { + $voip = FALSE; + $voipbw = 20; + } + if (isset($config['ezshaper']['step4']['enable'])) { + $penalty = TRUE; + $penaltybw = $config['ezshaper']['step4']['bandwidth']; + } else { + $penalty = FALSE; + $penaltybw = 0; + } + if (isset($config['ezshaper']['step5']['p2pcatchall'])) { + $p2pcatchall = TRUE; + $p2pcatchbw = $config['ezshaper']['step5']['bandwidth']; + } else { + $p2pcatchall = FALSE; + $p2pcatchbw = 0; + } + + + if ($voipbw + $penaltybw + $p2pcatchbw > 40) { + $message=gettext("Custom Bandwidths are greater than 70%. Please make them more reasonable to continue."); + header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}"); + } + $remainbw = 100 - $voipbw - $penaltybw - $p2pcatchbw; + } + + if ($sched == "PRIQ" || $sched == "CBQ" || $sched == "HFSC") { + if ($sched != "HFSC") { + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qACK"; + $tmpcf['priority'] = 6; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 30/100; /* 30% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qACK"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + } else { + /* If you find out how to make qACK for HFSC work be my guest */ + $remainbw = $remainbw + 30; + } - if($_POST['cvsup'] != "") { - /* cvsup */ - $othersplist[] = array('cvs', 'tcp', '5999', '5999', 'both', $_POST['cvsup']); - } - if($_POST['hbci'] != "") { - /* HBCI */ - $othersplist[] = array('HBCI', 'tcp', '3000', '3000', 'both', $_POST['hbci']); - } + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qDefault"; + $tmpcf['priority'] = 3; + if (!$p2pcatchall) + $tmpcf['default'] = "on"; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 7/100; /* 7% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $remainbw * 7/100; /* 7% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qDefault"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qP2P"; + $tmpcf['priority'] = 1; + $tmpcf['red'] = "on"; + if ($p2pcatchall) { + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $p2pcatchbw; + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $p2pcatchbw; + $tmpcf['bandwidthtype'] = "%"; + } + $tmpcf['default'] = "on"; + } else { + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + } + array_push($tmppath, "qP2P"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qVoIP"; + $tmpcf['priority'] = 7; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + if ($voip) + $tmpcf['bandwidth'] = $voipbw; + else + $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + if ($voip) { + $tmpcf['realtime'] = "on"; + $tmpcf['realtime1'] = "10%"; + $tmpcf['realtime2'] = "50ms"; + $tmpcf['realtime3'] = "{$voipbw}%"; + } else { + $tmpcf['realtime'] = "on"; + $tmpcf['realtime1'] = "10%"; + $tmpcf['realtime2'] = "50ms"; + $voipbw = ($remainbw * 20/100); /* 20% bandwidth */ + $tmpcf['realtime3'] = "{$voipbw}%"; + } + } + array_push($tmppath, "qVoIP"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qGames"; + $tmpcf['priority'] = 5; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $remainbw * 20/100; /* 20% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qGames"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qOthersHigh"; + $tmpcf['priority'] = 4; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 8/100; /* 8% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $remainbw * 8/100; /* 8% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qOthersHigh"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qOthersLow"; + $tmpcf['priority'] = 2; + $tmpcf['red'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + if ($penalty) + $tmpcf['bandwidth'] = $penaltybw; + else + $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + if ($penalty) + $tmpcf['bandwidth'] = $penaltybw; + else + $tmpcf['bandwidth'] = $remainbw * 5/100; /* 5% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qOthersLow"); + $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath); + array_pop($tmppath); + $qtmp->wconfig(); + + if (!is_array($config['filter']['rule'])) + $config['filter']['rule'] = array(); + + } + array_pop($tmppath); + + /* Rules */ + if ($penalty) { + if( is_ipaddr($config['ezshaper']['step4']['address']) or is_alias($config['ezshaper']['step4']['address'])) { + $rule = array(); + $rule['descr'] = gettext("Penalty Box"); + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qOthersLow"; + $rule['source']['address'] = $config['ezshaper']['step4']['address']; + $rule['destination']['any'] = TRUE; + $rule['wizard'] = "yes"; + $config['filter']['rule'][] = $rule; + + } + } - /* XXX: add some more protocols here! */ + /* If user specifies an IP, we don't bother with providers */ + if( is_ipaddr($config['ezshaper']['step3']['address']) or is_alias($config['ezshaper']['step3']['address'])) { + /* create VOIP rules */ + $rule = array(); + $rule['descr'] = gettext("VOIP Adapter"); + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['address'] = $config['ezshaper']['step3']['address']; + $rule['destination']['any'] = TRUE; + $rule['wizard'] = "yes"; + $config['filter']['rule'][] = $rule; - /* Set up/down protocols as higher weight */ - /* loop through othersplist[] */ - foreach ($othersplist as $otherclient) { - foreach (array('source', 'destination') as $srcdest) { + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { + /* create VOIP rules */ $rule = array(); - $config['shaper']['itemsshaped']++; - if ($srcdest == 'source') { - $destsrc = 'destination'; - switch ($otherclient[5]) { - case "H": - case "L": - $rule['inqueue'] = 'qOthersDown' . $otherclient[5]; /* posted value H or L */ - $rule['outqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ - break; - case "D": - $rule['inqueue'] = "q${downint}def"; /* posted value H or L */ - $rule['outqueue'] = "q${upint}def"; /* posted value H or L */ - break; - } - - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['source']['network'] = $downint; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - } else { - $destsrc = 'source'; - switch ($otherclient[5]) { - case "H": - case "L": - $rule['inqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ - $rule['outqueue'] = 'qOthersDown' . $otherclient[5]; /* posted value H or L */ - break; - case "D": - $rule['inqueue'] = "q${upint}def"; /* posted value H or L */ - $rule['outqueue'] = "q${downint}def"; /* posted value H or L */ - break; - } - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['descr'] = "m_Other {$otherclient[0]} inbound"; - } + $rule['descr'] = "DiffServ/Lowdelay/Upload"; + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['network'] = $altq->GetInterface(); + $rule['destination']['any'] = TRUE; + $rule['iptos'] = "lowdelay"; + $rule['wizard'] = "yes"; + $config['filter']['rule'][] = $rule; - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; + } else { + /* loop through voiplist[] */ + foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { + $rule = array(); + $rule['interface'] = $altq->GetInterface(); + $rule['defaultqueue'] = 'qVoIP'; + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_voip {$voip[0]} outbound"; + $rule['wizard'] = "yes"; + $rule['destination']['port'] = $voip[2]."-".$voip[3]; + if($voip[1] != '') + $rule['protocol'] = $voip[1]; + $config['filter']['rule'][] = $rule; + } + } + - $config['shaper']['rule'][] = $rule; - } - } - } -} -function step8_stepbeforeformdisplay() { - global $g, $config; - if($config['shaper']['itemsshaped'] == "0") { - /* no shaper items have been selected - * wipe previous - */ - unset($config['shaper']['queue']); - unset($config['shaper']['rule']); - unset($config['shaper']); - $config['shaper']['enable'] = FALSE; - $message = "No items have been selected to shape. Exiting traffic shaper wizard."; - write_config("No shaper items picked, unsetting shaper configuration"); - header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=8&message={$message}"); - exit; - } -} + /* loop through p2plist[] */ + foreach($config['ezshaper']['step5'] as $key => $val) { + if (!is_array($p2plist[$key])) + continue; + foreach ($p2plist[$key] as $p2pclient) { + $rule = array(); + $rule['defaultqueue'] = 'qP2P'; + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['source']['network'] = $altq->GetInterface(); + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; + $rule['wizard'] = "yes"; + $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; + if($p2pclient[1] != '') + $rule['protocol'] = $p2pclient[1]; + $config['filter']['rule'][] = $rule; + } + } -function step8_stepsubmitphpaction() { - global $g, $config, $d_shaperconfdirty_path; - /* Sort rules by queue priority */ - sort_rule_by_queue_priority(); - - $downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']); - $upq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['outside_int']); - $downint = strtolower($config['ezshaper']['step2']['inside_int']); - $upint = strtolower($config['ezshaper']['step2']['outside_int']); - - /* install default p2p catch all rule if user has enabled option (MUST BE LAST!) */ - if($config['ezshaper']['step5']['p2pcatchall'] == "on") { - $othersplist = array(); - $othersplist[] = array('p2pCatchAll', 'tcp', '', '', 'both', ''); - $othersplist[] = array('p2pCatchAll2', 'udp', '', '', 'both', ''); - } else { - $othersplist = array(); - } + /* loop through gamesplist[] */ + foreach($config['ezshaper']['step6'] as $key => $val) { + if (!is_array($gamesplist[$key])) + continue; + foreach ($gamesplist[$key] as $Gameclient) { + $rule = array(); + $rule['defaultqueue'] = 'qGames'; + if ($sched != "HFSC") + $rule['ackqueue'] = 'qACK'; + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['wizard'] = "yes"; + $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; + } + } - /* Set up/down protocols as p2p weight */ - /* loop through othersplist[] */ - foreach ($othersplist as $otherclient) { - foreach (array('source', 'destination') as $srcdest) { + /* loop through othersplist[] */ + foreach($config['ezshaper']['step7'] as $key => $val) { + if (!is_array($othersplist[$key])) + continue; + foreach ($othersplist[$key] as $otherclient) { $rule = array(); - $config['shaper']['itemsshaped']++; - if ($srcdest == 'source') { - $destsrc = 'destination'; - $rule['inqueue'] = 'qP2PDown' . $otherclient[5]; /* posted value H or L */ - $rule['outqueue'] = 'qP2PUp' . $otherclient[5]; /* posted value H or L */ - $rule['in-interface'] = $downint; - $rule['out-interface'] = $upint; - $rule['source']['network'] = $downint; + switch ($val) { + case "H": + $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ + if ($sched != "HFSC") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "L": + $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ + $loop = 0; + break; + case "D": + if ($p2pcatchall) { + $loop = 0; + $rule['defaultqueue'] = 'qDefault'; + if ($sched != "HFSC") + $rule['ackqueue'] = 'qACK'; + } else + $loop = 1; /* It automitaclly goes to default queue */ + break; + default: + $loop = 1; + } + if (!$loop) { + $rule['interface'] = $altq->GetInterface(); + $rule['source']['network'] = $altq->GetInterface(); +// $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; - $rule['descr'] = "p2pCatchAll outbound"; - } else { - $destsrc = 'source'; - $rule['inqueue'] = 'qP2PUp' . $otherclient[5]; /* posted value H or L */ - $rule['outqueue'] = 'qP2PDown' . $otherclient[5]; /* posted value H or L */ - $rule['in-interface'] = $upint; - $rule['out-interface'] = $downint; - $rule['source']['any'] = TRUE; - $rule['destination']['network'] = $downint; - $rule['descr'] = "p2pCatchAll inbound"; - } + $rule['wizard'] = "yes"; + $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; + if($otherclient[2] or $otherclient[3]) { + $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; + } if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - } - if($rule['inqueue'] != "" and $rule['in-interface'] != "" and $rule['out-interface'] != "") - $config['shaper']['rule'][] = $rule; - - } - } - - /* Enable shaper */ - $config['shaper']['enable'] = TRUE; - - /* Prepare for next ezshaper wizard run */ - unset($config['shaper']['itemsshaped']); - - /* Create new rules */ - filter_configure(); - - /* reset rrd queues */ - system("rm -f /var/db/rrd/wan-queues.rrd"); - enable_rrd_graphing(); - - /* And we're no longer dirty! */ - unlink_if_exists($d_shaperconfdirty_path); - - update_filter_reload_status("Initializing"); + $rule['protocol'] = $otherclient[1]; - /* Head over and check out the groovy queue stats */ - header("Location: status_filter_reload.php"); -} -function step9_stepsubmitphpaction() { - global $g, $config; - header("Location: status_filter_reload.php"); + $config['filter']['rule'][] = $rule; + } + } + } + } + write_config(); } - - ?> diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml index e98bf3d..3335f53 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard.xml @@ -41,15 +41,11 @@ <field> <name>Next</name> <type>submit</type> - <warning>Going any further will wipe your existing shaper config! If you do not wish to continue, please click the pfSense logo at the top to return to the webConfigurator. Also note that currently the traffic shaper is not compatible with bridging.</warning> + <warning>Going any further will wipe your existing shaper config! If you do not wish to continue, please click the pfSense logo at the top to return to the webConfigurator.</warning> </field> </fields> <stepbeforeformdisplay> - /* Check to see if ALTQ can even be used */ - if(!is_altq_capable($config['interfaces']['wan']['if']) or !is_altq_capable($config['interfaces']['lan']['if'])) { - $message="Either your LAN or WAN interface doesn't support ALTQ. The wizard cannot continue."; - header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=7&message={$message}"); - } + step1_stepbeforeformdisplay(); </stepbeforeformdisplay> <stepsubmitphpaction> step1_stepsubmitphpaction(); @@ -103,8 +99,8 @@ </field> </fields> <stepsubmitphpaction> - step2_stepsubmitphpaction(); - </stepsubmitphpaction> + step2_stepsubmitphpaction(); + </stepsubmitphpaction> <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile> </step> <step> @@ -142,11 +138,7 @@ <value>VoicePulse</value> </option> <option> - <name>Vonage</name> - <value>Vonage</value> - </option> - <option> - <name>Asterisk</name> + <name>Asterisk/Vonage</name> <value>Asterisk</value> </option> <option> @@ -164,92 +156,9 @@ </field> <field> <name>Bandwidth</name> - <type>select</type> - <typehint>Total bandwidth guarantee for VOIP phone(s)</typehint> - <default>128</default> + <type>input</type> + <typehint>Total bandwidth(in percentage %) guarantee for VOIP phone(s)</typehint> <bindstofield>ezshaper->step3->bandwidth</bindstofield> - <options> - <option> - <name>32Kbits/sec</name> - <value>32</value> - </option> - <option> - <name>64Kbits/sec</name> - <value>64</value> - </option> - <option> - <name>96Kbits/sec</name> - <value>96</value> - </option> - <option> - <name>128Kbits/sec</name> - <value>128</value> - </option> - <option> - <name>256Kbits/sec</name> - <value>256</value> - </option> - <option> - <name>384Kbits/sec</name> - <value>384</value> - </option> - <option> - <name>512Kbits/sec</name> - <value>512</value> - </option> - <option> - <name>768Kbits/sec</name> - <value>768</value> - </option> - <option> - <name>1024Kbits/sec</name> - <value>1024</value> - </option> - <option> - <name>1500Kbits/sec</name> - <value>1500</value> - </option> - <option> - <name>3000Kbits/sec</name> - <value>3000</value> - </option> - <option> - <name>4000Kbits/sec</name> - <value>4000</value> - </option> - <option> - <name>5000Kbits/sec</name> - <value>5000</value> - </option> - <option> - <name>6000Kbits/sec</name> - <value>6000</value> - </option> - <option> - <name>7000Kbits/sec</name> - <value>7000</value> - </option> - <option> - <name>8000Kbits/sec</name> - <value>8000</value> - </option> - <option> - <name>9000Kbits/sec</name> - <value>9000</value> - </option> - <option> - <name>10000Kbits/sec</name> - <value>10000</value> - </option> - <option> - <name>11000Kbits/sec</name> - <value>11000</value> - </option> - <option> - <name>12000Kbits/sec</name> - <value>12000</value> - </option> - </options> </field> <field> <name>Next</name> @@ -273,7 +182,7 @@ <type>checkbox</type> <typehint>Penalize IP or Alias</typehint> <description>This will lower the priority of traffic from this IP or alias.</description> - <enablefields>Address,BandwidthUp,BandwidthDown</enablefields> + <enablefields>Address,Bandwidth</enablefields> <bindstofield>ezshaper->step4->enable</bindstofield> </field> <field> @@ -292,20 +201,12 @@ <message>IP Address field is non-blank and doesn't look like an IP address.</message> </field> <field> - <name>BandwidthUp</name> - <description>The upload limit in Kbits/second.</description> + <name>Bandwidth</name> + <description>The limit in percentage.</description> <type>input</type> <validate>^[0-9]*$</validate> <message>Upload speed must be numerical</message> - <bindstofield>ezshaper->step4->bandwidthup</bindstofield> - </field> - <field> - <name>BandwidthDown</name> - <description>The download limit Kbits/second.</description> - <type>input</type> - <validate>^[0-9]*$</validate> - <message>Download speed must be numerical</message> - <bindstofield>ezshaper->step4->bandwidthdown</bindstofield> + <bindstofield>ezshaper->step4->bandwidth</bindstofield> </field> <field> <name>Next</name> @@ -329,7 +230,7 @@ <type>checkbox</type> <typehint>Lower priority of Peer-to-Peer traffic</typehint> <description>This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic.</description> - <enablefields>p2pCatchAll,BandwidthUp,BandwidthDown,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX</enablefields> + <enablefields>p2pCatchAll,Bandwidth,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX</enablefields> <bindstofield>ezshaper->step5->enable</bindstofield> </field> <field> @@ -347,20 +248,12 @@ <bindstofield>ezshaper->step5->p2pcatchall</bindstofield> </field> <field> - <name>BandwidthUp</name> - <description>The upload limit in Kbits/second.</description> + <name>Bandwidth</name> + <description>The upload limit in percentage.</description> <type>input</type> <validate>^[0-9]*$</validate> - <message>Upload speed must be numerical</message> - <bindstofield>ezshaper->step5->bandwidthup</bindstofield> - </field> - <field> - <name>BandwidthDown</name> - <description>The download limit Kbits/second.</description> - <type>input</type> - <validate>^[0-9]*$</validate> - <message>Download speed must be numerical</message> - <bindstofield>ezshaper->step5->bandwidthdown</bindstofield> + <message>Speed must be numerical and in percentage of parent</message> + <bindstofield>ezshaper->step5->bandwidth</bindstofield> </field> <field> <name>Enable/Disable specific P2P protocols</name> @@ -513,7 +406,7 @@ <type>checkbox</type> <typehint>Prioritize network gaming traffic</typehint> <description>This will raise the priority of gaming traffic to higher than most traffic.</description> - <enablefields>BattleNET,Battlefield2,CallOfDuty,Counterstrike,DeltaForce,DOOM3,EmpireEarth,Everquest,Everquest2,FarCry,GunZOnline,HalfLife,HalfLife2,Halo2,Lineage2,PlanetSide,QuakeIII,TigerWoods2004PS2,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft,ArchLord,XBox360</enablefields> + <enablefields>BattleNET,Battlefield2,CallOfDuty,Counterstrike,DeltaForce,DOOM3,EmpireEarth,Everquest,Everquest2,FarCry,GunZOnline,HalfLife,HalfLife2,Halo2,Lineage2,PlanetSide,QuakeIII,TigerWoods2004PS2,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft,XBox360</enablefields> <donotdisable>true</donotdisable> <bindstofield>ezshaper->step6->enable</bindstofield> </field> @@ -651,12 +544,6 @@ <typehint>World of Warcraft</typehint> <bindstofield>ezshaper->step6->wow</bindstofield> </field> - <field> - <name>ArchLord</name> - <type>checkbox</type> - <typehint>ArchLord</typehint> - <bindstofield>ezshaper->step6->archlord</bindstofield> - </field> <field> <name>Xbox360</name> <type>checkbox</type> @@ -668,9 +555,6 @@ <type>submit</type> </field> </fields> - <stepsubmitphpaction> - step6_stepsubmitphpaction(); - </stepsubmitphpaction> <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile> </step> <step> @@ -684,7 +568,7 @@ <type>checkbox</type> <typehint>Other networking protocols</typehint> <description>This will help raise or lower the priority of other protocols higher than most traffic.</description> - <enablefields>AIM,AppleRemoteDesktop,DNS,HTTP,ICMP,ICQ,IMAP,IPsec,IRC,Jabber,LotusNotes,MSN,MSRDP,MySqlServer,PCAnywhere,POP3,PPTP,RTSP,SMB,SMTP,SNMP,StreamingMP3,TeamSpeak,VNC,NNTP,CVSUP,HBCI</enablefields> + <enablefields>AIM,AppleRemoteDesktop,DNS,HTTP,ICMP,ICQ,IMAP,IPSEC,IRC,Jabber,LotusNotes,MSN,MSRDP,MySqlServer,PCAnywhere,POP3,PPTP,RTSP,SMB,SMTP,SNMP,StreamingMP3,TeamSpeak,VNC,NNTP,CVSUP</enablefields> <donotdisable>true</donotdisable> <bindstofield>ezshaper->step7->enable</bindstofield> </field> @@ -925,7 +809,7 @@ <typehint>Microsoft Point to Point tunneling protocol</typehint> </field> <field> - <name>IPsec</name> + <name>IPSEC</name> <type>select</type> <bindstofield>ezshaper->step7->ipsec</bindstofield> <options> @@ -942,7 +826,7 @@ <value>L</value> </option> </options> - <typehint>IPsec VPN traffic</typehint> + <typehint>IPSEC VPN traffic</typehint> </field> <field> <name>Multimedia/Streaming</name> @@ -1241,33 +1125,10 @@ <typehint>CVSUP</typehint> </field> <field> - <name>HBCI</name> - <bindstofield>ezshaper->step7->hbci</bindstofield> - <type>select</type> - <options> - <option> - <name>Default priority</name> - <value>D</value> - </option> - <option> - <name>Higher priority</name> - <value>H</value> - </option> - <option> - <name>Lower priority</name> - <value>L</value> - </option> - </options> - <typehint>HBCI</typehint> - </field> - <field> <name>Next</name> <type>submit</type> </field> </fields> - <stepsubmitphpaction> - step7_stepsubmitphpaction(); - </stepsubmitphpaction> <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile> </step> <step> @@ -1289,9 +1150,6 @@ <type>submit</type> </field> </fields> - <stepbeforeformdisplay> - step8_stepbeforeformdisplay(); - </stepbeforeformdisplay> <stepsubmitphpaction> step8_stepsubmitphpaction(); </stepsubmitphpaction> |