From 46bc6e545a17e77202aaf01ec0cd8d5a46567525 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 25 Aug 2015 08:08:24 -0300 Subject: Move main pfSense content to src/ --- src/usr/local/www/firewall_shaper_queues.php | 244 +++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 src/usr/local/www/firewall_shaper_queues.php (limited to 'src/usr/local/www/firewall_shaper_queues.php') diff --git a/src/usr/local/www/firewall_shaper_queues.php b/src/usr/local/www/firewall_shaper_queues.php new file mode 100644 index 0000000..6aa062b --- /dev/null +++ b/src/usr/local/www/firewall_shaper_queues.php @@ -0,0 +1,244 @@ + "") { + mwexec("killall -9 pfctl"); + exit; +} + +$shaperIFlist = get_configured_interface_with_descr(); +read_altq_config(); +$qlist =& get_unique_queue_list(); + +if (!is_array($qlist)) { + $qlist = array(); +} + +$tree = ""; + +if ($_GET) { + if ($_GET['queue']) { + $qname = htmlspecialchars(trim($_GET['queue'])); + } + if ($_GET['interface']) { + $interface = htmlspecialchars(trim($_GET['interface'])); + } + if ($_GET['action']) { + $action = htmlspecialchars($_GET['action']); + } + + switch ($action) { + case "delete": + $altq =& $altq_list_queues[$interface]; + $qtmp =& $altq->find_queue("", $qname); + if ($qtmp) { + $qtmp->delete_queue(); + if (write_config()) { + mark_subsystem_dirty('shaper'); + } + } + header("Location: firewall_shaper_queues.php"); + exit; + break; + case "add": + /* + * XXX: WARNING: This returns the first it finds. + * Maybe the user expects something else?! + */ + foreach ($altq_list_queues as $altq) { + $qtmp =& $altq->find_queue("", $qname); + if ($qtmp) { + $copycfg = array(); + $qtmp->copy_queue($interface, $copycfg); + $aq =& $altq_list_queues[$interface]; + if ($qname == $qtmp->GetInterface()) { + $config['shaper']['queue'][] = $copycfg; + } else if ($aq) { + $tmp1 =& $qtmp->find_parentqueue($interface, $qname); + if ($tmp1) { + $tmp =& $aq->find_queue($interface, $tmp1->GetQname()); + } + + if ($tmp) { + $link =& get_reference_to_me_in_config($tmp->GetLink()); + } else { + $link =& get_reference_to_me_in_config($aq->GetLink()); + } + $link['queue'][] = $copycfg; + } else { + $newroot = array(); + $newroot['name'] = $interface; + $newroot['interface'] = $interface; + $newroot['scheduler'] = $altq->GetScheduler(); + $newroot['queue'] = array(); + $newroot['queue'][] = $copycfg; + $config['shaper']['queue'][] = $newroot; + } + if (write_config()) { + mark_subsystem_dirty('shaper'); + } + break; + } + } + + header("Location: firewall_shaper_queues.php?queue=".$qname."&action=show"); + exit; + break; + case "show": + foreach ($config['interfaces'] as $if => $ifdesc) { + $altq = $altq_list_queues[$if]; + if ($altq) { + $qtmp =& $altq->find_queue("", $qname); + if ($qtmp) { + $output .= $qtmp->build_shortform(); + } else { + $output .= build_iface_without_this_queue($if, $qname); + } + } else { + if (!is_altq_capable($ifdesc['if'])) { + continue; + } + if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") { + continue; + } + $output .= build_iface_without_this_queue($if, $qname); + } + } + break; + } +} + +if ($_POST['apply']) { + write_config(); + + $retval = 0; + /* Setup pf rules since the user may have changed the optimization value */ + $retval = filter_configure(); + $savemsg = get_std_save_message($retval); + if (stristr($retval, "error") <> true) { + $savemsg = get_std_save_message($retval); + } else { + $savemsg = $retval; + } + + /* reset rrd queues */ + system("rm -f /var/db/rrd/*queuedrops.rrd"); + system("rm -f /var/db/rrd/*queues.rrd"); + enable_rrd_graphing(); + + clear_subsystem_dirty('shaper'); +} + +$pgtitle = gettext("Firewall: Shaper: By Queues View"); +$shortcut_section = "trafficshaper"; +$closehead = false; +include("head.inc"); +?> + + + + + + +
+ +
+ +

+" . gettext("You must apply the changes in order for them to take effect."));?>

+ + + + + + +
+ +
+
+ + + + + +
+ + + " . $qname . "


"; + } + echo ""; + echo $output; + echo ""; + echo "
 
"; + ?> +
+
+
+
+ + + -- cgit v1.1