diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-22 02:57:05 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-22 02:57:05 +0000 |
commit | 12bcdc89e94842ee2411661509f7627ff39f2367 (patch) | |
tree | 45111bbe7a398ab6004e5a1119227098fc6c4f4a /usr/local/www/firewall_shaper_queues_edit.php | |
parent | 44ce4df14a21aaf47569a1c2f3755713dcc45da1 (diff) | |
download | pfsense-12bcdc89e94842ee2411661509f7627ff39f2367.zip pfsense-12bcdc89e94842ee2411661509f7627ff39f2367.tar.gz |
Commit what I have so far. Magic shaper now works 100% .. or atleast appears to!
Diffstat (limited to 'usr/local/www/firewall_shaper_queues_edit.php')
-rwxr-xr-x | usr/local/www/firewall_shaper_queues_edit.php | 251 |
1 files changed, 86 insertions, 165 deletions
diff --git a/usr/local/www/firewall_shaper_queues_edit.php b/usr/local/www/firewall_shaper_queues_edit.php index 662505f..d247025 100755 --- a/usr/local/www/firewall_shaper_queues_edit.php +++ b/usr/local/www/firewall_shaper_queues_edit.php @@ -5,7 +5,7 @@ Copyright (C) 2004, 2005 Scott Ullrich All rights reserved. - originally part of m0n0wall (http://m0n0.ch/wall) + Originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. @@ -33,7 +33,7 @@ require("guiconfig.inc"); -$a_queues = &$config['pfqueueing']['queue']; +$a_queues = &$config['shaper']['queue']; $id = $_GET['id']; if (isset($_POST['id'])) @@ -41,29 +41,30 @@ if (isset($_POST['id'])) $wan_sched = $config['interfaces']['wan']['schedulertype']; $lan_sched = $config['interfaces']['lan']['schedulertype']; +$pconfig['schedulertype'] = $config['system']['schedulertype']; +$schedulertype = $pconfig['schedulertype']; if (isset($id) && $a_queues[$id]) { $pconfig['bandwidth'] = $a_queues[$id]['bandwidth'] . $a_queues[$id]['bandwidthtype']; $pconfig['priority'] = $a_queues[$id]['priority']; $pconfig['mask'] = $a_queues[$id]['mask']; $pconfig['name'] = $a_queues[$id]['name']; - $pconfig['options'] = $a_queues[$id]['options']; - $pconfig['options']['red'] = $a_queues[$id]['options']['red']; - $pconfig['options']['ecn'] = $a_queues[$id]['options']['ecn']; - $pconfig['options']['rio'] = $a_queues[$id]['options']['rio']; - $pconfig['options']['borrow'] = $a_queues[$id]['options']['borrow']; - $pconfig['options']['defaultqueue'] = $a_queues[$id]['options']['defaultqueue']; - $pconfig['options']['parentqueue'] = $a_queues[$id]['options']['parentqueue']; - $pconfig['options']['upperlimit1'] = $a_queues[$id]['options']['upperlimit1']; - $pconfig['options']['upperlimit2'] = $a_queues[$id]['options']['upperlimit2']; - $pconfig['options']['upperlimit3'] = $a_queues[$id]['options']['upperlimit3']; - $pconfig['options']['realtime1'] = $a_queues[$id]['options']['realtime1']; - $pconfig['options']['realtime2'] = $a_queues[$id]['options']['realtime2']; - $pconfig['options']['realtime3'] = $a_queues[$id]['options']['realtime3']; - $pconfig['options']['linkshare1'] = $a_queues[$id]['options']['linkshare1']; - $pconfig['options']['linkshare2'] = $a_queues[$id]['options']['linkshare2']; - $pconfig['options']['linkshare3'] = $a_queues[$id]['options']['linkshare3']; - $pconfig['schedulertype'] = $a_queues[$id]['schedulertype']; + $pconfig = $a_queues[$id]; + $pconfig['red'] = $a_queues[$id]['red']; + $pconfig['ecn'] = $a_queues[$id]['ecn']; + $pconfig['rio'] = $a_queues[$id]['rio']; + $pconfig['borrow'] = $a_queues[$id]['borrow']; + $pconfig['defaultqueue'] = $a_queues[$id]['defaultqueue']; + $pconfig['parentqueue'] = $a_queues[$id]['parentqueue']; + $pconfig['upperlimit1'] = $a_queues[$id]['upperlimit1']; + $pconfig['upperlimit2'] = $a_queues[$id]['upperlimit2']; + $pconfig['upperlimit3'] = $a_queues[$id]['upperlimit3']; + $pconfig['realtime1'] = $a_queues[$id]['realtime1']; + $pconfig['realtime2'] = $a_queues[$id]['realtime2']; + $pconfig['realtime3'] = $a_queues[$id]['realtime3']; + $pconfig['linkshare1'] = $a_queues[$id]['linkshare1']; + $pconfig['linkshare2'] = $a_queues[$id]['linkshare2']; + $pconfig['linkshare3'] = $a_queues[$id]['linkshare3']; $pconfig['bandwidth'] = $a_queues[$id]['bandwidth']; $pconfig['bandwidthtype'] = $a_queues[$id]['bandwidthtype']; $pconfig['associatedrule'] = $a_queues[$id]['associatedrule']; @@ -87,32 +88,32 @@ if ($_POST) { if (!$input_errors) { $queue = array(); - $queue['schedulertype'] = $_POST['schedulertype']; $queue['bandwidth'] = $_POST['bandwidth']; $queue['bandwidthtype'] = $_POST['bandwidthtype']; $queue['priority'] = $_POST['priority']; $queue['name'] = ereg_replace(" ", "", $_POST['name']); - $queue['options']['borrow'] = $_POST['borrow']; - $queue['options']['linkshare'] = $_POST['linkshare']; - $queue['options']['linkshare3'] = $_POST['linkshare3']; - $queue['options']['linkshare2'] = $_POST['linkshare2']; - $queue['options']['linkshare1'] = $_POST['linkshare1']; - $queue['options']['realtime'] = $_POST['realtime']; - $queue['options']['realtime3'] = $_POST['realtime3']; - $queue['options']['realtime2'] = $_POST['realtime2']; - $queue['options']['realtime1'] = $_POST['realtime1']; - $queue['options']['upperlimit'] = $_POST['upperlimit']; - $queue['options']['upperlimit3'] = $_POST['upperlimit3']; - $queue['options']['upperlimit2'] = $_POST['upperlimit2']; - $queue['options']['upperlimit1'] = $_POST['upperlimit1']; - $queue['options']['parentqueue'] = $_POST['parentqueue']; - $queue['options']['associatedrule'] = $_POST['associatedrule']; + $queue['name'] = substr($queue['name'], 0, 14); + $queue['borrow'] = $_POST['borrow']; + $queue['linkshare'] = $_POST['linkshare']; + $queue['linkshare3'] = $_POST['linkshare3']; + $queue['linkshare2'] = $_POST['linkshare2']; + $queue['linkshare1'] = $_POST['linkshare1']; + $queue['realtime'] = $_POST['realtime']; + $queue['realtime3'] = $_POST['realtime3']; + $queue['realtime2'] = $_POST['realtime2']; + $queue['realtime1'] = $_POST['realtime1']; + $queue['upperlimit'] = $_POST['upperlimit']; + $queue['upperlimit3'] = $_POST['upperlimit3']; + $queue['upperlimit2'] = $_POST['upperlimit2']; + $queue['upperlimit1'] = $_POST['upperlimit1']; + $queue['parentqueue'] = $_POST['parentqueue']; + $queue['associatedrule'] = $_POST['associatedrule']; $scheduleroptions=""; - $queue['options']['rio'] = $_POST['rio']; - $queue['options']['red'] = $_POST['red']; - $queue['options']['ecn'] = $_POST['ecn']; - $queue['options']['defaultqueue'] = $_POST['defaultqueue']; + $queue['rio'] = $_POST['rio']; + $queue['red'] = $_POST['red']; + $queue['ecn'] = $_POST['ecn']; + $queue['defaultqueue'] = $_POST['defaultqueue']; if (isset($id) && $a_queues[$id]) $a_queues[$id] = $queue; else @@ -141,117 +142,31 @@ if ($_POST) { <title><?=gentitle("Firewall: Traffic shaper: Edit queue");?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="gui.css" rel="stylesheet" type="text/css"> - -<script language="JavaScript"> -<!-- -function sync_scheduler_options() { - var wan = '<?=$wan_sched?>'; - var lan = '<?=$lan_sched?>'; - var indexNum = document.forms[0].associatedrule.selectedIndex; - var associatedrule = document.forms[0].associatedrule.options[indexNum].text; - var tmp = associatedrule.split(" - "); - var interface_type_a = '' + eval(tmp[0]) + ''; - var interface_type = String(interface_type_a); - if(interface_type == 'priq') { - document.forms[0].rio.disabled = 0; - document.forms[0].bandwidth.disabled = 1; - document.forms[0].bandwidthtype.disabled = 1; - document.forms[0].bandwidth.value = ""; - document.forms[0].bandwidthtype.value = ""; - document.forms[0].defaultqueue.disabled = 0; - document.forms[0].borrow.disabled = 1; - document.forms[0].parentqueue.disabled = 1; - document.forms[0].red.disabled = 0; - document.forms[0].ecn.disabled = 0; - document.forms[0].upperlimit.disabled = 1; - document.forms[0].upperlimit1.disabled = 1; - document.forms[0].upperlimit2.disabled = 1; - document.forms[0].upperlimit3.disabled = 1; - document.forms[0].realtime.disabled = 1; - document.forms[0].realtime1.disabled = 1; - document.forms[0].realtime2.disabled = 1; - document.forms[0].realtime3.disabled = 1; - document.forms[0].linkshare.disabled = 1; - document.forms[0].linkshare1.disabled = 1; - document.forms[0].linkshare2.disabled = 1; - document.forms[0].linkshare3.disabled = 1; - document.forms[0].childqueue.disabled = 1; - document.forms[0].priority.disabled = 0; - } else if(interface_type == 'cbq') { - document.forms[0].rio.disabled = 0; - document.forms[0].borrow.disabled = 0; - document.forms[0].bandwidth.disabled = 0; - document.forms[0].bandwidthtype.disabled = 0; - document.forms[0].defaultqueue.disabled = 0; - document.forms[0].parentqueue.disabled = 0; - document.forms[0].red.disabled = 0; - document.forms[0].ecn.disabled = 0; - document.forms[0].upperlimit.disabled = 1; - document.forms[0].upperlimit1.disabled = 1; - document.forms[0].upperlimit2.disabled = 1; - document.forms[0].upperlimit3.disabled = 1; - document.forms[0].realtime.disabled = 1; - document.forms[0].realtime1.disabled = 1; - document.forms[0].realtime2.disabled = 1; - document.forms[0].realtime3.disabled = 1; - document.forms[0].linkshare.disabled = 1; - document.forms[0].linkshare1.disabled = 1; - document.forms[0].linkshare2.disabled = 1; - document.forms[0].linkshare3.disabled = 1; - document.forms[0].childqueue.disabled = 0; - document.forms[0].priority.disabled = 0; - } else if(interface_type == 'hfsc') { - document.forms[0].rio.disabled = 0; - document.forms[0].borrow.disabled = 0; - document.forms[0].bandwidth.disabled = 0; - document.forms[0].bandwidthtype.disabled = 0; - document.forms[0].red.disabled = 0; - document.forms[0].ecn.disabled = 0; - document.forms[0].defaultqueue.disabled = 0; - document.forms[0].parentqueue.disabled = 0; - document.forms[0].upperlimit.disabled = 0; - document.forms[0].upperlimit1.disabled = 0; - document.forms[0].upperlimit2.disabled = 0; - document.forms[0].upperlimit3.disabled = 0; - document.forms[0].realtime.disabled = 0; - document.forms[0].realtime1.disabled = 0; - document.forms[0].realtime2.disabled = 0; - document.forms[0].realtime3.disabled = 0; - document.forms[0].linkshare.disabled = 0; - document.forms[0].linkshare1.disabled = 0; - document.forms[0].linkshare2.disabled = 0; - document.forms[0].linkshare3.disabled = 0; - document.forms[0].childqueue.disabled = 0; - document.forms[0].priority.disabled = 0; - } -} ---> -</script> </head> -<body onLoad="sync_scheduler_options();" link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> <?php - $red = $pconfig['options']["red"]; - $ecn = $pconfig['options']["ecn"]; - $rio = $pconfig['options']["rio"]; - $borrow = $pconfig['options']["borrow"]; - $upperlimit = $pconfig['options']["upperlimit"]; - $upperlimit1 = $pconfig['options']["upperlimit1"]; - $upperlimit2 = $pconfig['options']["upperlimit2"]; - $upperlimit3 = $pconfig['options']["upperlimit3"]; - $realtime = $pconfig['options']["realtime"]; - $realtime1 = $pconfig['options']["realtime1"]; - $realtime2 = $pconfig['options']["realtime2"]; - $realtime3 = $pconfig['options']["realtime3"]; - $linkshare = $pconfig['options']["linkshare"]; - $linkshare1 = $pconfig['options']["linkshare1"]; - $linkshare2 = $pconfig['options']["linkshare2"]; - $linkshare3 = $pconfig['options']["linkshare3"]; - $parentqueue = $pconfig['options']["parentqueue"]; - $defaultqueue = $pconfig['options']["defaultqueue"]; - $parent = $pconfig['options']["parent"]; + $red = $pconfig["red"]; + $ecn = $pconfig["ecn"]; + $rio = $pconfig["rio"]; + $borrow = $pconfig["borrow"]; + $upperlimit = $pconfig["upperlimit"]; + $upperlimit1 = $pconfig["upperlimit1"]; + $upperlimit2 = $pconfig["upperlimit2"]; + $upperlimit3 = $pconfig["upperlimit3"]; + $realtime = $pconfig["realtime"]; + $realtime1 = $pconfig["realtime1"]; + $realtime2 = $pconfig["realtime2"]; + $realtime3 = $pconfig["realtime3"]; + $linkshare = $pconfig["linkshare"]; + $linkshare1 = $pconfig["linkshare1"]; + $linkshare2 = $pconfig["linkshare2"]; + $linkshare3 = $pconfig["linkshare3"]; + $parentqueue = $pconfig["parentqueue"]; + $defaultqueue = $pconfig["defaultqueue"]; + $parent = $pconfig["parent"]; $schedulertype = $pconfig["schedulertype"]; ?> <p class="pgtitle">Firewall: Traffic shaper: Edit queue</p> @@ -259,22 +174,16 @@ function sync_scheduler_options() { <form action="firewall_shaper_queues_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td valign="top" class="vncellreq">Associate with rule</td> + <td valign="top" class="vncellreq">Scheduler Type</td> <td class="vtable"> - <select name="associatedrule" onChange="sync_scheduler_options();"> <?php - if($pconfig['options']['associatedrule']) { - echo "<option value=\"" . $pconfig['options']['associatedrule'] ."\">" . filter_get_rule_interface($pconfig['options']['associatedrule']) . " - " . filter_get_altq_queue_scheduler_type($pconfig['options']['associatedrule']) . " - " . $pconfig['options']['associatedrule'] . "</option>"; - } - foreach ($config['filter']['rule'] as $rule) { - echo "<option value=\"" . $rule['descr'] ."\">" . $rule['interface'] . " - " . filter_get_altq_queue_scheduler_type($rule['descr']) . " - " . $rule['descr'] . "</option>"; - } + if($schedulertype == "hfsc") echo "Hierarchical Fair Service Curve queueing"; + else if($schedulertype == "priq") echo "Priority based queueing"; + else if($schedulertype == "cbq") echo "Class based queueing"; ?> - </select> - <br> - <span class="vexpl">Choose which rule to attach this queue to. - </span></td> + </td> </tr> + <?php if ($schedulertype == "cbq"): ?> <tr> <td valign="top" class="vncellreq">Bandwidth</td> <td class="vtable"> <input name="bandwidth" class="formfld" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> @@ -290,6 +199,7 @@ function sync_scheduler_options() { <span class="vexpl">Choose the amount of bandwidth for this queue </span></td> </tr> + <? endif; ?> <tr> <td width="22%" valign="top" class="vncellreq">Priority</td> <td width="78%" class="vtable"> <input name="priority" type="text" id="priority" size="5" value="<?=htmlspecialchars($pconfig['priority']);?>"> @@ -299,18 +209,31 @@ function sync_scheduler_options() { <tr> <td width="22%" valign="top" class="vncell"><b>Name</b></td> <td width="78%" class="vtable"> <input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>"> - <br> <span class="vexpl">Enter the name of the queue here. Do not use spaces! + <br> <span class="vexpl">Enter the name of the queue here. Do not use spaces and limit the size to 15 characters. </span></td> </tr> <tr> <td width="22%" valign="top" class="vncell">Scheduler options</td> <td width="78%" class="vtable"> + <?php + $isdefaultdefined = 0; + foreach($config['shaper'] as $queue) { + if(isset($queue["defaultqueue"])) $isdefaultdefined = 1; + } + ?> + <?php if ($isdefaultdefined == 0): ?> <input type="checkbox" id="defaultqueue" name="defaultqueue" <?php if($defaultqueue) echo " CHECKED";?> > Default queue<br> + <? endif; ?> + <?php if ($schedulertype == "cbq"): ?> <input type="checkbox" id="borrow" name="borrow" <?php if($borrow) echo " CHECKED";?> > Borrow from other queues when available<br> + <? endif; ?> <input type="checkbox" id="red" name="red" <?php if($red) echo " CHECKED";?> > Random Early Detection<br> <input type="checkbox" id="rio" name="rio" <?php if($rio) echo " CHECKED";?> > Random Early Detection In and Out<br> <input type="checkbox" id="ecn" name="ecn" <?php if($ecn) echo " CHECKED";?> > Explicit Congestion Notification<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 of HFSC/CBQ<br> + <?php endif; ?> + <?php if ($schedulertype == "hfsc"): ?> <input type="checkbox" id="upperlimit" name="upperlimit" <?php if($upperlimit) echo " CHECKED";?> > Upperlimit: <input size="3" value="<?=htmlspecialchars($upperlimit1);?>" name="upperlimit1"> <input size="3" value="<?=htmlspecialchars($upperlimit2);?>" name="upperlimit2"> <input size="3" value="<?=htmlspecialchars($upperlimit3);?>" name="upperlimit3"> <br> <input type="checkbox" id="realtime" name="realtime" <?php if($realtime) echo " CHECKED";?> > Real time: <input size="3" value="<?=htmlspecialchars($realtime1);?>" name="realtime1"> <input size="3" value="<?=htmlspecialchars($realtime2); ?>" name="realtime2"> <input size="3" value="<?=htmlspecialchars($realtime3);?>" name="realtime3"><br> <input type="checkbox" id="linkshare" id="linkshare" name="linkshare" <?php if($linkshare) echo " CHECKED";?> > Link share: <input size="3" value="<?=htmlspecialchars($linkshare1);?>" value="<?=htmlspecialchars($linkshare1);?>" id="linkshare1" name="linkshare1"> <input size="3" value="<?=htmlspecialchars($linkshare2);?>" id="linkshare2" name="linkshare2"> <input size="3" value="<?=htmlspecialchars($linkshare3);?>" id="linkshare3" name="linkshare3"><br> @@ -322,12 +245,12 @@ function sync_scheduler_options() { <td width="78%" class="vtable"> <select id="childqueue" name="childqueue"> <?php - if(isset($pconfig['pfqueueing']['childqueue'])) - echo "<option value=\"" . $pconfig['pfqueueing']['childqueue'] . "\">" . $pconfig['pfqueueing']['childqueue'] . "</option>"; + if(isset($pconfig['shaper']['childqueue'])) + echo "<option value=\"" . $pconfig['shaper']['childqueue'] . "\">" . $pconfig['shaper']['childqueue'] . "</option>"; else echo "<option value=\"\"></option>"; - if (is_array($config['pfqueueing']['queue'])) { - foreach ($config['pfqueueing']['queue'] as $queue) { + if (is_array($config['shaper']['queue'])) { + foreach ($config['shaper']['queue'] as $queue) { if(is_subqueue($queue['name']) == 0) echo "<option value=\"" . $queue['name'] . "\">" . $queue['name'] . "</option>"; } @@ -336,6 +259,7 @@ function sync_scheduler_options() { </select> </td> </tr> + <?php endif; ?> <tr> <td width="22%" valign="top"> </td> <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save"> @@ -347,8 +271,5 @@ function sync_scheduler_options() { </table> </form> <?php include("fend.inc"); ?> -<script language="JavaScript"> -sync_scheduler_options(); -</script> </body> </html> |