diff options
-rw-r--r-- | etc/inc/config.inc | 10 | ||||
-rw-r--r-- | etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | etc/inc/shaper.inc | 43 | ||||
-rwxr-xr-x | usr/local/www/firewall_shaper.php | 3 | ||||
-rwxr-xr-x | usr/local/www/firewall_shaper_edit.php | 30 | ||||
-rwxr-xr-x | usr/local/www/firewall_shaper_queues_edit.php | 93 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.xml | 219 |
7 files changed, 194 insertions, 206 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index f7b750b..a77e30a 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -744,6 +744,14 @@ function convert_config() { $config['interfaces']['wan']['gateway'] = $config['system']['gateway']; $config['version'] = "2.2"; } + /* Convert 2.2 -> 2.3 */ + if ($config['version'] == "2.2") { + if(isset($config['shaper'])) { + /* wipe previous shaper configuration */ + unset($config['shaper']); + } + $config['version'] = "2.3"; + } if ($prev_version != $config['version']) write_config("Upgraded config version level from {$prev_version} to {$config['version']}"); @@ -1434,4 +1442,4 @@ function start_devd() { exec("/sbin/devd"); } -?>
\ No newline at end of file +?> diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index eb597ee..7e03f42 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -52,7 +52,7 @@ $g = array( "n_pppoe_units" => 16, /* this value can be overriden in pppoe->n_pppoe_units */ "pppoe_subnet" => 28, /* this value can be overriden in pppoe->pppoe_subnet */ "debug" => false, - "latest_config" => "2.2", + "latest_config" => "2.3", "nopkg_platforms" => array("cdrom"), "nopccard_platforms" => array("wrap", "net48xx"), "xmlrpcbaseurl" => "www.pfsense.com", diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 6dd40e6..f043aac 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -113,13 +113,22 @@ function filter_generate_altq_queues($altq_ints) { if(isset($rule['defaultqueue']) and $rule['defaultqueue'] <> "") $options .= " default"; if(isset($rule['upperlimit']) and $rule['upperlimit'] <> "") { - $options .= " upperlimit({$rule['upperlimit1']} {$rule['upperlimit2']} {$rule['upperlimit3']})"; + if ($rule['upperlimit1'] <> "") + $options .= " upperlimit({$rule['upperlimit1']} {$rule['upperlimit2']} {$rule['upperlimit3']})"; + else + $options .= " upperlimit {$rule['upperlimit3']}"; } if(isset($rule['linkshare']) and $rule['linkshare'] <> "") { - $options .= " linkshare({$rule['linkshare1']} {$rule['linkshare2']} {$rule['linkshare3']})"; + if ($rule['linkshare1'] <> "") + $options .= " linkshare({$rule['linkshare1']} {$rule['linkshare2']} {$rule['linkshare3']})"; + else + $options .= " linkshare {$rule['linkshare3']}"; } if(isset($rule['realtime']) and $rule['realtime'] <> "") { - $options .= " realtime({$rule['realtime1']} {$rule['realtime2']} {$rule['realtime3']})"; + if ($rule['realtime1'] <> "") + $options .= " realtime({$rule['realtime1']} {$rule['realtime2']} {$rule['realtime3']})"; + else + $options .= " realtime {$rule['realtime3']}"; } $scheduler_type = $config['shaper']['schedulertype']; $altq_rules .= "{$scheduler_type} "; @@ -176,7 +185,7 @@ function filter_is_queue_being_used_on_interface($queuename, $interface) { if(!is_array($lconfig['shaper']['rule'])) return null; foreach($lconfig['shaper']['rule'] as $rule) { - if(($rule['inqueue'] == $queuename && $rule['interface'] == $interface)) + if(($rule['inqueue'] == $queuename && $rule['in-interface'] == $interface)) return $interface; } return null; @@ -267,7 +276,7 @@ function queue_interface_recursive($queuename) { } foreach($config['shaper']['rule'] as $rule) { if($rule['inqueue'] == $queuename) - return $rule['interface']; + return $rule['in-interface']; } } @@ -341,7 +350,7 @@ function filter_generate_pf_altq_rules() { continue; } - switch($rule['interface']) { + switch($rule['in-interface']) { case "pptp": /* does the rule deal with a PPTP interface? */ if ($pptpdcfg['mode'] != "server") { if (($rule['source']['network'] == "pptp") || @@ -374,8 +383,8 @@ function filter_generate_pf_altq_rules() { $ispppoe = true; break; default: - if (strstr($rule['interface'], "opt")) { - if (!array_key_exists($rule['interface'], $optcfg)) { + if (strstr($rule['in-interface'], "opt")) { + if (!array_key_exists($rule['in-interface'], $optcfg)) { $i++; continue; } @@ -419,17 +428,17 @@ function filter_generate_pf_altq_rules() { if($ispppoe) { $line .= " ng" . ($iif+1); } else { - $if = $config['interfaces'][$rule['interface']]['if']; + $if = $config['interfaces'][$rule['in-interface']]['if']; } - if ($rule['interface'] == "wan") { + if ($rule['in-interface'] == "wan") { if($direction=="in") { $if = $wanif; } else { $if = $lanif; } } else { - if($rule['interface'] == "lan") { + if($rule['in-interface'] == "lan") { if($direction=="in") { $if = $lanif; } else { @@ -587,6 +596,16 @@ function filter_generate_pf_altq_rules() { $line .= "\n"; $shaperrules .= $line; + /* setup the outbound queue on the other interface */ + switch($direction) { + case 'in': + $qouttag = "outqueue"; + break; + case 'out': + $qouttag = "inqueue"; + break; + } + $shaperrules .= "pass out on {$rule['out-interface']} all keep state tagged {$rule[$qtag]} tag {$rule[$qouttag]}"; } } @@ -596,4 +615,4 @@ function filter_generate_pf_altq_rules() { return $shaperrules; } -?>
\ No newline at end of file +?> diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 6c14c8f..60e8363 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -259,7 +259,8 @@ include("head.inc"); $iflabels = array('lan' => 'LAN', 'wan' => 'WAN', 'pptp' => 'PPTP'); for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) $iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; - echo $textss . htmlspecialchars($iflabels[$shaperent['interface']]); + echo $textss . htmlspecialchars($iflabels[$shaperent['in-interface']]) . "->" . htmlspecialchars($iflabels[$shaperent['out-interface']]); + echo "<br>"; echo "<a href=\"?act=toggle&id={$i}\">"; if ($shaperent['direction'] == "in") diff --git a/usr/local/www/firewall_shaper_edit.php b/usr/local/www/firewall_shaper_edit.php index 2fbd8a1..9fb0777 100755 --- a/usr/local/www/firewall_shaper_edit.php +++ b/usr/local/www/firewall_shaper_edit.php @@ -60,7 +60,8 @@ if (isset($_GET['dup'])) { } if (isset($id) && $a_shaper[$id]) { - $pconfig['interface'] = $a_shaper[$id]['interface']; + $pconfig['in-interface'] = $a_shaper[$id]['in-interface']; + $pconfig['out-interface'] = $a_shaper[$id]['out-interface']; if (isset($a_shaper[$id]['protocol'])) $pconfig['proto'] = $a_shaper[$id]['protocol']; @@ -245,7 +246,8 @@ if ($_POST) { if (!$input_errors) { $shaperent = array(); - $shaperent['interface'] = $_POST['interface']; + $shaperent['in-interface'] = $_POST['in-interface']; + $shaperent['out-interface'] = $_POST['out-interface']; if ($_POST['proto'] != "any") $shaperent['protocol'] = $_POST['proto']; @@ -433,20 +435,34 @@ function dst_rep_change() { <span class="vexpl">Set this option to disable this rule without removing it from the list.</span></td> </tr> <tr> - <td width="22%" valign="top" class="vncellreq">Interface</td> - <td width="78%" class="vtable"> <select name="interface" class="formfld"> + <td width="22%" valign="top" class="vncellreq">In Interface</td> + <td width="78%" class="vtable"> <select name="in-interface" class="formfld"> <?php $interfaces = array('lan' => 'LAN', 'wan' => 'WAN', 'pptp' => 'PPTP'); for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr']; } foreach ($interfaces as $iface => $ifacename): ?> - <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>> + <option value="<?=$iface;?>" <?php if ($iface == $pconfig['in-interface']) echo "selected"; ?>> <?=htmlspecialchars($ifacename);?> </option> <?php endforeach; ?> </select> <br> - <span class="vexpl">Choose which interface packets must pass - through to match this rule.</span></td> + <span class="vexpl">Choose which interface packets must pass in to match this rule.</span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Out Interface</td> + <td width="78%" class="vtable"> <select name="out-interface" class="formfld"> + <?php $interfaces = array('lan' => 'LAN', 'wan' => 'WAN', 'pptp' => 'PPTP'); + for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { + $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr']; + } + foreach ($interfaces as $iface => $ifacename): ?> + <option value="<?=$iface;?>" <?php if ($iface == $pconfig['out-interface']) echo "selected"; ?>> + <?=htmlspecialchars($ifacename);?> + </option> + <?php endforeach; ?> + </select> <br> + <span class="vexpl">Choose which interface packets must pass out to match this rule.</span></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Protocol</td> diff --git a/usr/local/www/firewall_shaper_queues_edit.php b/usr/local/www/firewall_shaper_queues_edit.php index 301d048..5e82456 100755 --- a/usr/local/www/firewall_shaper_queues_edit.php +++ b/usr/local/www/firewall_shaper_queues_edit.php @@ -105,6 +105,28 @@ if ($_POST) { $input_errors[] = "The priority must be an integer between 1 and 100."; } + switch($config['shaper']['schedulertype']) { + case 'hfsc': + /* HFSC validation */ + if ($_POST['upperlimit1'] <> "" && $_POST['upperlimit2'] == "") + $input_errors[] = "upperlimit service curve defined but missing burst (d) value"; + if ($_POST['upperlimit2'] <> "" && $_POST['upperlimit1'] == "") + $input_errors[] = "upperlimit service curve defined but missing initial bandwidth (m1) value"; + if ($_POST['linkshare1'] <> "" && $_POST['linkshare2'] == "") + $input_errors[] = "linkshare service curve defined but missing burst (d) value"; + if ($_POST['linkshare2'] <> "" && $_POST['linkshare1'] == "") + $input_errors[] = "linkshare service curve defined but missing initial bandwidth (m1) value"; + if ($_POST['realtime1'] <> "" && $_POST['realtime2'] == "") + $input_errors[] = "realtime service curve defined but missing burst (d) value"; + if ($_POST['realtime2'] <> "" && $_POST['realtime1'] == "") + $input_errors[] = "realtime service curve defined but missing initial bandwidth (m1) value"; + break; + case 'cbq': + break; + case 'priq': + break; + } + if (!$input_errors) { $queue = array(); $queue['schedulertype'] = $_POST['schedulertype']; @@ -115,8 +137,7 @@ if ($_POST) { if($_POST['bandwidthtype'] == "") unset($queue['bandwidth']); $queue['priority'] = $_POST['priority']; - $queue['name'] = ereg_replace(" ", "", $_POST['name']); - $queue['name'] = substr($queue['name'], 0, 15); + $queue['name'] = substr(ereg_replace(" ", "", $_POST['name']), 0, 15); $queue['borrow'] = $_POST['borrow']; $queue['linkshare'] = $_POST['linkshare']; $queue['linkshare3'] = $_POST['linkshare3']; @@ -189,6 +210,52 @@ include("head.inc"); ?> +<script language="JavaScript"> +function enable_realtime(enable_over) { + if (document.iform.realtime.checked || enable_over) { + document.iform.realtime1.disabled = 0; + document.iform.realtime2.disabled = 0; + document.iform.realtime3.disabled = 0; + } else { + document.iform.realtime1.disabled = 1; + document.iform.realtime2.disabled = 1; + document.iform.realtime3.disabled = 1; + } +} +function enable_linkshare(enable_over) { + if (document.iform.linkshare.checked || enable_over) { + document.iform.linkshare1.disabled = 0; + document.iform.linkshare2.disabled = 0; + document.iform.linkshare3.disabled = 0; + } else { + document.iform.linkshare1.disabled = 1; + document.iform.linkshare2.disabled = 1; + document.iform.linkshare3.disabled = 1; + } +} +function enable_upperlimit(enable_over) { + if (document.iform.upperlimit.checked || enable_over) { + document.iform.upperlimit1.disabled = 0; + document.iform.upperlimit2.disabled = 0; + document.iform.upperlimit3.disabled = 0; + } else { + document.iform.upperlimit1.disabled = 1; + document.iform.upperlimit2.disabled = 1; + document.iform.upperlimit3.disabled = 1; + } +} + +function enable_attachtoqueue(enable_over) { + if (document.iform.parentqueue.checked || enable_over) { + document.iform.attachtoqueue.disabled = 1; + } else { + document.iform.attachtoqueue.disabled = 0; + desc = document.getElementById("attachtoqueuedesc"); + desc.className = "vncellreq"; + } +} +</script> + <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> <p class="pgtitle"><?=$pgtitle?></p> @@ -229,7 +296,7 @@ include("head.inc"); </span></td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><b>Name</b></td> + <td width="22%" valign="top" class="vncellreq">Name</td> <td width="78%" class="vtable"> <input name="name" type="text" class="formfld" id="name" size="15" value="<?=htmlspecialchars($pconfig['name']);?>"> <br> <span class="vexpl">Enter the name of the queue here. Do not use spaces and limit the size to 15 characters. </span></td> @@ -246,20 +313,20 @@ include("head.inc"); <input type="checkbox" id="rio" name="rio" <?php if($rio) echo " CHECKED";?> > <a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#red">Random Early Detection In and Out</a><br> <input type="checkbox" id="ecn" name="ecn" <?php if($ecn) echo " CHECKED";?> > <a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#ecn">Explicit Congestion Notification</a><br> <?php if ($schedulertype == "hfsc" or $schedulertype == "cbq"): ?> - <input type="checkbox" id="parentqueue" name="parentqueue" <?php if($parentqueue) echo " CHECKED";?> > This is a parent queue<br> + <input type="checkbox" id="parentqueue" name="parentqueue" <?php if($parentqueue) echo " CHECKED";?> onChange="enable_attachtoqueue()" > This is a parent queue<br> <?php endif; ?> <span class="vexpl"><br>Select options for this queue </tr> <?php if ($schedulertype == "hfsc"): ?> <tr> - <td width="22%" valign="top" class="vncell"><b>Service Curve (sc)</td> + <td width="22%" valign="top" class="vncell">Service Curve (sc)</td> <td width="78%" class="vtable"> <table> - <tr><td> </td><td><b><center>m1</td><td><b><center>d</td><td><b><center>m2</td></tr> - <tr><td><input type="checkbox" id="upperlimit" name="upperlimit" <?php if($upperlimit) echo " CHECKED";?> > Upperlimit:</td><td><input size="3" value="<?=htmlspecialchars($upperlimit1);?>" name="upperlimit1"></td><td><input size="3" value="<?=htmlspecialchars($upperlimit2);?>" name="upperlimit2"></td><td><input size="3" value="<?=htmlspecialchars($upperlimit3);?>" name="upperlimit3"></td><td>The maximum allowed bandwidth for the queue.</td></tr> - <tr><td><input type="checkbox" id="realtime" name="realtime" <?php if($realtime) echo " CHECKED";?> > Real time:</td><td><input size="3" value="<?=htmlspecialchars($realtime1);?>" name="realtime1"></td><td><input size="3" value="<?=htmlspecialchars($realtime2); ?>" name="realtime2"></td><td><input size="3" value="<?=htmlspecialchars($realtime3);?>" name="realtime3"></td><td>The minimum required bandwidth for the queue.</td></tr> - <tr><td><input type="checkbox" id="linkshare" id="linkshare" name="linkshare" <?php if($linkshare) echo " CHECKED";?> > Link share:</td><td><input size="3" value="<?=htmlspecialchars($linkshare1);?>" value="<?=htmlspecialchars($linkshare1);?>" id="linkshare1" name="linkshare1"></td><td><input size="3" value="<?=htmlspecialchars($linkshare2);?>" id="linkshare2" name="linkshare2"></td><td><input size="3" value="<?=htmlspecialchars($linkshare3);?>" id="linkshare3" name="linkshare3"></td><td>The bandwidth share of a backlogged queue.</td></tr> + <tr><td> </td><td><center>m1</center></td><td><center>d</center></td><td><center><b>m2</b></center></td></tr> + <tr><td><input type="checkbox" id="upperlimit" name="upperlimit" <?php if($upperlimit) echo " CHECKED";?> onChange="enable_upperlimit()"> Upperlimit:</td><td><input size="3" value="<?=htmlspecialchars($upperlimit1);?>" id="upperlimit1" name="upperlimit1"></td><td><input size="3" value="<?=htmlspecialchars($upperlimit2);?>" id="upperlimi2" name="upperlimit2"></td><td><input size="3" value="<?=htmlspecialchars($upperlimit3);?>" id="upperlimit3" name="upperlimit3"></td><td>The maximum allowed bandwidth for the queue.</td></tr> + <tr><td><input type="checkbox" id="realtime" name="realtime" <?php if($realtime) echo " CHECKED";?> onChange="enable_realtime()"> Real time:</td><td><input size="3" value="<?=htmlspecialchars($realtime1);?>" id="realtime1" name="realtime1"></td><td><input size="3" value="<?=htmlspecialchars($realtime2); ?>" id="realtime2" name="realtime2"></td><td><input size="3" value="<?=htmlspecialchars($realtime3);?>" id="realtime3" name="realtime3"></td><td>The minimum required bandwidth for the queue.</td></tr> + <tr><td><input type="checkbox" id="linkshare" id="linkshare" name="linkshare" <?php if($linkshare) echo " CHECKED";?> onChange="enable_linkshare()"> Link share:</td><td><input size="3" value="<?=htmlspecialchars($linkshare1);?>" value="<?=htmlspecialchars($linkshare1);?>" id="linkshare1" name="linkshare1"></td><td><input size="3" value="<?=htmlspecialchars($linkshare2);?>" id="linkshare2" name="linkshare2"></td><td><input size="3" value="<?=htmlspecialchars($linkshare3);?>" id="linkshare3" name="linkshare3"></td><td>The bandwidth share of a backlogged queue - this overrides priority.</td></tr> </table><br> The format for service curve specifications is (m1, d, m2). m2 controls the bandwidth assigned to the queue. m1 and d are optional and can be @@ -273,7 +340,7 @@ include("head.inc"); <?php if ($schedulertype == "hfsc" or $schedulertype == "cbq"): ?> <tr> - <td width="22%" valign="top" class="vncell">Parent queue:</td> + <td width="22%" valign="top" class="vncell" id="attachtoqueuedesc">Parent queue:</td> <td width="78%" class="vtable"> <select id="attachtoqueue" name="attachtoqueue"> <?php @@ -303,5 +370,11 @@ include("head.inc"); </table> </form> <?php include("fend.inc"); ?> +<script language="javascript"> +enable_realtime(); +enable_linkshare(); +enable_upperlimit(); +enable_attachtoqueue(); +</script> </body> </html> diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml index 64e8cf3..bb1e0d4 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard.xml @@ -67,7 +67,7 @@ </javascriptafterformdisplay> <fields> <field> - <name>Setup network speeds - Please note that the wizard will automatically subtract 20% for the queues.</name> + <name>Setup network speeds</name> <type>listtopic</type> </field> <field> @@ -79,7 +79,7 @@ </field> <field> <name>Download</name> - <description>The download speed of your WAN link in Kbits/second.</description> + <description>The download speed of your WAN link in Kbits/second. Note: PPPOE users should take into account PPPOE overhead and put a lower speed here.</description> <type>input</type> <validate>^[0-9]*$</validate> <message>Download speed must be numerical</message> @@ -94,7 +94,7 @@ </field> <field> <name>Upload</name> - <description>The upload speed of your WAN link in Kbits/second.</description> + <description>The upload speed of your WAN link in Kbits/second. Note: PPPOE users should take into account PPPOE overhead and put a lower speed here.</description> <type>input</type> <validate>^[0-9]*$</validate> <message>Upload speed must be numerical</message> @@ -124,7 +124,8 @@ $queue['associatedrule'] = 0; $queue['priority'] = 0; $queue['parentqueue'] = "on"; - $queue['bandwidth'] = (int)$_POST['upload'] * .8; + /* $queue['bandwidth'] = (int)$_POST['upload'] * .8; */ + $queue['bandwidth'] = (int)$_POST['upload']; $queue['bandwidthtype'] = "Kb"; $config['shaper']['queue'][] = $queue; @@ -134,7 +135,8 @@ $queue['associatedrule'] = 0; $queue['priority'] = 0; $queue['parentqueue'] = "on"; - $queue['bandwidth'] = (int)$_POST['download'] * .8; + /* $queue['bandwidth'] = (int)$_POST['download'] * .8; */ + $queue['bandwidth'] = (int)$_POST['download']; $queue['bandwidthtype'] = "Kb"; $config['shaper']['queue'][] = $queue; @@ -147,17 +149,7 @@ $queue['priority'] = 3; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "10%"; - $queue['realtime2'] = "1"; - $queue['realtime3'] = "10%"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "80%"; - $queue['upperlimit2'] = "100"; - $queue['upperlimit3'] = "80%"; + $queue['realtime3'] = "1%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -178,17 +170,7 @@ $queue['defaultqueue'] = 'true'; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "10%"; - $queue['realtime2'] = "1"; - $queue['realtime3'] = "10%"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "80%"; - $queue['upperlimit2'] = "100"; - $queue['upperlimit3'] = "80%"; + $queue['realtime3'] = "1%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -208,17 +190,7 @@ $queue['priority'] = 7; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "10%"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "10%"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "80%"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = "80%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -237,17 +209,7 @@ $queue['priority'] = 7; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "10%"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "10%"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "80%"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = "80%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -435,17 +397,7 @@ $queue['priority'] = 7; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = $_POST['bandwidth'] . "Kb"; - $queue['realtime2'] = "1"; - $queue['realtime3'] = $_POST['bandwidth'] . "Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "1"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = $_POST['bandwidth'] . "Kb"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = $_POST['bandwidth'] . "Kb"; + $queue['realtime3'] = $_POST['bandwidth'] . "Kb"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -462,17 +414,7 @@ $queue['priority'] = 7; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = $_POST['bandwidth'] . "Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = $_POST['bandwidth'] . "Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "1"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = $_POST['bandwidth'] . "Kb"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = $_POST['bandwidth'] . "Kb"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -490,7 +432,8 @@ $rule['descr'] = "VOIP Adapter"; $rule['inqueue'] = "qVOIPDown"; $rule['outqueue'] = "qVOIPUp"; - $rule['interface'] = $downint; + $rule['in-interface'] = $downint; + $rule['out-interface'] = $upint; /* $rule['source']['network'] = $downint; */ $rule['source']['address'] = $_POST['address']; $rule['destination']['any'] = TRUE; @@ -500,7 +443,8 @@ $rule['descr'] = "VOIP Adapter"; $rule['inqueue'] = "qVOIPUp"; $rule['outqueue'] = "qVOIPDown"; - $rule['interface'] = $upint; + $rule['in-interface'] = $upint; + $rule['out-interface'] = $downint; $rule['source']['any'] = TRUE; $rule['destination']['address'] = $_POST['address']; $config['shaper']['rule'][] = $rule; @@ -510,7 +454,8 @@ $rule['descr'] = "DiffServ/Lowdelay/Upload"; $rule['inqueue'] = "qVOIPDown"; $rule['outqueue'] = "qVOIPUp"; - $rule['interface'] = $downint; + $rule['in-interface'] = $downint; + $rule['out-interface'] = $upint; $rule['source']['network'] = $downint; $rule['destination']['any'] = TRUE; $rule['iptos'] = "lowdelay"; @@ -520,7 +465,8 @@ $rule['descr'] = "DiffServ/Lowdelay/Download"; $rule['inqueue'] = "qVOIPUp"; $rule['outqueue'] = "qVOIPDown"; - $rule['interface'] = $upint; + $rule['in-interface'] = $upint; + $rule['out-interface'] = $downint; $rule['source']['any'] = TRUE; $rule['destination']['network'] = $downint; $rule['iptos'] = "lowdelay"; @@ -529,14 +475,10 @@ $voiplist = array(); - /* setup vonage rule */ - if( $_POST['provider'] == "Vonage") - $voiplist[] = array('Vonage', 'udp', '5060', '5069', 'both'); - - /* asterisk server / same as vonage somewhat */ - if( $_POST['provider'] == "Asterisk") { + /* asterisk server / same as vonage */ + if( $_POST['provider'] == "Asterisk") || ($_POST['provider'] == "Vonage")) { $voiplist[] = array('Asterisk', 'udp', '5060', '5069', 'both'); - $voiplist[] = array('Asterisk', 'udp', '10000', '17226', 'both'); + $voiplist[] = array('Asterisk', 'udp', '10000', '20000', 'both'); } /* VoicePulse server */ @@ -559,17 +501,19 @@ $rule = array(); if ($srcdest == 'source') { $destsrc = 'destination'; - $rule['outqueue'] = 'qVOIPUp'; $rule['inqueue'] = 'qVOIPDown'; - $rule['interface'] = $downint; + $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['outqueue'] = 'qVOIPDown'; $rule['inqueue'] = 'qVOIPUp'; - $rule['interface'] = $upint; + $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"; @@ -807,17 +751,20 @@ $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; - $rule['outqueue'] = 'qP2PUp'; $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['outqueue'] = 'qP2PDown'; $rule['inqueue'] = 'qP2PUp'; - $rule['interface'] = $upint; + $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"; @@ -842,17 +789,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "10"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "100"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -873,17 +810,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "10"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "100"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "100"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -1066,17 +993,7 @@ $queue['priority'] = 5; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "1"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -1094,17 +1011,7 @@ $queue['priority'] = 5; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "1"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "1"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -1272,17 +1179,19 @@ $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; - $rule['outqueue'] = 'qGamesUp'; $rule['inqueue'] = 'qGamesDown'; - $rule['interface'] = $downint; + $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['outqueue'] = 'qGamesDown'; $rule['inqueue'] = 'qGamesUp'; - $rule['interface'] = $upint; + $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"; @@ -1827,17 +1736,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "10"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "10"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -1857,17 +1756,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "10"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "10"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; } elseif ($config['shaper']['schedulertype'] == "cbq") { @@ -1888,17 +1777,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "10"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "10"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -1919,17 +1798,7 @@ $queue['ecn'] = "on"; if ($config['shaper']['schedulertype'] == "hfsc") { $queue['realtime'] = "on"; - $queue['realtime1'] = "1Kb"; - $queue['realtime2'] = "1"; $queue['realtime3'] = "1Kb"; - $queue['linkshare'] = "on"; - $queue['linkshare1'] = "10%"; - $queue['linkshare2'] = "10"; - $queue['linkshare3'] = "10%"; - $queue['upperlimit'] = "on"; - $queue['upperlimit1'] = "90%"; - $queue['upperlimit2'] = "10"; - $queue['upperlimit3'] = "90%"; $queue['bandwidth'] = 1; $queue['bandwidthtype'] = '%'; $queue['qlimit'] = 500; @@ -2086,17 +1955,19 @@ $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; - $rule['outqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ $rule['inqueue'] = 'qOthersDown' . $otherclient[5]; /* posted value H or L */ - $rule['interface'] = $downint; + $rule['outqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ + $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'; - $rule['outqueue'] = 'qOthersDown' . $otherclient[5]; /* posted value H or L */ $rule['inqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ - $rule['interface'] = $upint; + $rule['outqueue'] = 'qOthersDown' . $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'] = "m_Other {$otherclient[0]} inbound"; |