From d3e5e7df159b190f28072953c610f652281ed199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Wed, 16 Jul 2008 19:33:25 +0000 Subject: Make dummynet page visible in the frontend under the "Virtual Interfaces" tab. So people can think of pipes as virtual interfaces as it seem easier to grok. --- usr/local/www/firewall_shaper.php | 3 +- usr/local/www/firewall_shaper_queues.php | 3 +- usr/local/www/firewall_shaper_vinterface.php | 131 +++++++++++++-------------- 3 files changed, 67 insertions(+), 70 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 245ecd3..50e587a 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -414,7 +414,8 @@ include("fbegin.inc"); $tab_array = array(); $tab_array[0] = array("By Interface", true, "firewall_shaper.php"); $tab_array[1] = array("By Queue", false, "firewall_shaper_queues.php"); - $tab_array[2] = array("Wizards", false, "firewall_shaper_wizards.php"); + $tab_array[2] = array("Virtual Interfaces", false, "firewall_shaper_vinterface.php"); + $tab_array[3] = array("Wizards", false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/firewall_shaper_queues.php b/usr/local/www/firewall_shaper_queues.php index a5f5b4a..e61555f 100755 --- a/usr/local/www/firewall_shaper_queues.php +++ b/usr/local/www/firewall_shaper_queues.php @@ -174,7 +174,8 @@ include("head.inc"); $tab_array = array(); $tab_array[0] = array("By Interface", false, "firewall_shaper.php"); $tab_array[1] = array("By Queue", true, "firewall_shaper_queues.php"); - $tab_array[2] = array("Wizards", false, "firewall_shaper_wizards.php"); + $tab_array[2] = array("Virtual Interfaces", false, "firewall_shaper_vinterface.php"); + $tab_array[3] = array("Wizards", false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); ?> diff --git a/usr/local/www/firewall_shaper_vinterface.php b/usr/local/www/firewall_shaper_vinterface.php index 6dade9c..6f31e56 100644 --- a/usr/local/www/firewall_shaper_vinterface.php +++ b/usr/local/www/firewall_shaper_vinterface.php @@ -35,7 +35,7 @@ if($_GET['reset'] <> "") { exit; } -$pgtitle = array("Firewall","Traffic Shaper"); +$pgtitle = array("Firewall","Traffic Shaper", "Virtual Interfaces"); read_dummynet_config(); /* @@ -55,9 +55,9 @@ if ($_POST) { if ($_POST['name']) $qname = trim($_POST['name']); if ($_POST['pipe']) - $pipe = trim($_POST['pipe']); - else - $pipe = trim($_POST['name']); + $pipe = trim($_POST['pipe']); + else + $pipe = trim($_POST['name']); if ($_POST['parentqueue']) $parentqueue = trim($_POST['parentqueue']); } @@ -86,7 +86,7 @@ if ($_GET) { break; case "resetall": foreach ($dummynet_pipe_list as $dn) - $dn->delete_all(); + $dn->delete_queue(); unset($dummynet_pipe_list); $dummynet_pipe_list = array(); unset($config['dnshaper']['queue']); @@ -119,12 +119,11 @@ if ($_GET) { break; case "add": - /* XXX: Find better way because we shouldn't know about this */ if ($dnpipe) { - $q = new dnqueue_class(); - $q->SetPipe($pipe); - $output_form .= ""; + $q = new dnqueue_class(); + $q->SetPipe($pipe); + $output_form .= ""; } else if ($addnewpipe) { $q = new dnpipe_class(); $q->SetQname($pipe); @@ -137,34 +136,34 @@ if ($_GET) { $newqueue = true; } break; - case "show": - if ($queue) - $output_form .= $queue->build_form(); - else - $input_errors[] = "Queue not found!"; + case "show": + if ($queue) + $output_form .= $queue->build_form(); + else + $input_errors[] = "Queue not found!"; break; - case "enable": - if ($queue) { - $queue->SetEnabled("on"); - $output_form .= $queue->build_form(); - write_config(); - touch($d_shaperconfdirty_path); - } else - $input_errors[] = "Queue not found!"; + case "enable": + if ($queue) { + $queue->SetEnabled("on"); + $output_form .= $queue->build_form(); + write_config(); + touch($d_shaperconfdirty_path); + } else + $input_errors[] = "Queue not found!"; break; - case "disable": - if ($queue) { - $queue->SetEnabled(""); - $output_form .= $queue->build_form(); - write_config(); - touch($d_shaperconfdirty_path); - } else - $input_errors[] = "Queue not found!"; + case "disable": + if ($queue) { + $queue->SetEnabled(""); + $output_form .= $queue->build_form(); + write_config(); + touch($d_shaperconfdirty_path); + } else + $input_errors[] = "Queue not found!"; + break; + default: + $output_form .= "

" . $dn_default_shaper_msg."

"; + $dontshow = true; break; - default: - $output_form .= "

" . $dn_default_shaper_msg."

"; - $dontshow = true; - break; } } else if ($_POST) { unset($input_errors); @@ -182,9 +181,9 @@ if ($_GET) { write_config(); touch($d_shaperconfdirty_path); $can_enable = true; - $can_add = true; - read_dummynet_config(); + $can_add = true; } + read_dummynet_config(); $output_form .= $dnpipe->build_form(); } else if ($parentqueue) { /* Add a new queue */ @@ -197,11 +196,11 @@ if ($_GET) { $tmp->wconfig(); write_config(); $can_enable = true; - read_dummynet_config(); - $can_add = false; + $can_add = false; touch($d_shaperconfdirty_path); $can_enable = true; } + read_dummynet_config(); $output_form .= $tmp->build_form(); } else $input_errors[] = "Could not add new queue."; @@ -220,10 +219,8 @@ if ($_GET) { 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(); + /* XXX: TODO Make dummynet pretty graphs */ + // enable_rrd_graphing(); unlink($d_shaperconfdirty_path); @@ -239,14 +236,14 @@ if ($_GET) { } else if ($queue) { $queue->validate_input($_POST, &$input_errors); if (!$input_errors) { - $queue->update_dn_data($_POST); - $queue->wconfig(); - write_config(); + $queue->update_dn_data($_POST); + $queue->wconfig(); + write_config(); touch($d_shaperconfdirty_path); $dontshow = false; - read_dummynet_config(); } - $output_form .= $queue->build_form(); + read_dummynet_config(); + $output_form .= $queue->build_form(); } else { $output_form .= "

" . $dn_default_shaper_msg."

"; $dontshow = true; @@ -262,7 +259,7 @@ if ($queue) { else $can_enable = false; if ($queue->CanHaveChilds()) { - $can_add = true; + $can_add = true; } else $can_add = false; } @@ -291,19 +288,19 @@ if ($can_add || $addnewaltq) { $output_form .= "&action=add\">"; $output_form .= ""; $output_form .= ""; - $output_form .= ""; - $output_form .= ""; - else - $output_form .= " value=\"Disable shaper on interface\">"; - $output_form .= ""; } +$output_form .= ""; +$output_form .= ""; +else + $output_form .= " value=\"Delete virtual interface\">"; +$output_form .= ""; $output_form .= ""; $output_form .= ""; } @@ -326,8 +323,6 @@ if ($queue || $dnpipe || $newqueue) { } $output .= $output_form; -//$pgtitle = "Firewall: Shaper: By Interface View"; - include("head.inc"); ?> @@ -363,9 +358,6 @@ include("fbegin.inc"); 0): ?> @@ -373,9 +365,12 @@ include("fbegin.inc"); -
+

- +
+ + +
- - -
-- cgit v1.1