Project

General

Profile

Download (12.6 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 197bfe96 Ermal Luçi
	firewall_shaper.php
5 5b237745 Scott Ullrich
*/
6 fd9ebcd5 Stephen Beaver
/* ====================================================================
7
 *  Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved. 
8
 *  Copyright (c)  2004, 2005 Scott Ullrich
9
 *  Copyright (c)  2008 Ermal Luçi
10
 *
11
 *  Redistribution and use in source and binary forms, with or without modification, 
12
 *  are permitted provided that the following conditions are met: 
13
 *
14
 *  1. Redistributions of source code must retain the above copyright notice,
15
 *      this list of conditions and the following disclaimer.
16
 *
17
 *  2. Redistributions in binary form must reproduce the above copyright
18
 *      notice, this list of conditions and the following disclaimer in
19
 *      the documentation and/or other materials provided with the
20
 *      distribution. 
21
 *
22
 *  3. All advertising materials mentioning features or use of this software 
23
 *      must display the following acknowledgment:
24
 *      "This product includes software developed by the pfSense Project
25
 *       for use in the pfSense software distribution. (http://www.pfsense.org/). 
26
 *
27
 *  4. The names "pfSense" and "pfSense Project" must not be used to
28
 *       endorse or promote products derived from this software without
29
 *       prior written permission. For written permission, please contact
30
 *       coreteam@pfsense.org.
31
 *
32
 *  5. Products derived from this software may not be called "pfSense"
33
 *      nor may "pfSense" appear in their names without prior written
34
 *      permission of the Electric Sheep Fencing, LLC.
35
 *
36
 *  6. Redistributions of any form whatsoever must retain the following
37
 *      acknowledgment:
38
 *
39
 *  "This product includes software developed by the pfSense Project
40
 *  for use in the pfSense software distribution (http://www.pfsense.org/).
41
  *
42
 *  THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
43
 *  EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
46
 *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50
 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
 *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53
 *  OF THE POSSIBILITY OF SUCH DAMAGE.
54
 *
55
 *  ====================================================================
56
 *
57
 */
58 7ac5a4cb Scott Ullrich
/*
59
	pfSense_BUILDER_BINARIES:	/usr/bin/killall
60 806942d0 Stephen Beaver
	pfSense_MODULE: shaper
61 7ac5a4cb Scott Ullrich
*/
62 5b237745 Scott Ullrich
63 6b07c15a Matthew Grooms
##|+PRIV
64
##|*IDENT=page-firewall-trafficshaper
65
##|*NAME=Firewall: Traffic Shaper page
66
##|*DESCR=Allow access to the 'Firewall: Traffic Shaper' page.
67
##|*MATCH=firewall_shaper.php*
68
##|-PRIV
69
70 aef9d8fe Stephen Beaver
require('classes/Form.class.php');
71
72 5b237745 Scott Ullrich
require("guiconfig.inc");
73 7a927e67 Scott Ullrich
require_once("functions.inc");
74
require_once("filter.inc");
75
require_once("shaper.inc");
76 a5f07f09 Ermal Lu?i
require_once("rrd.inc");
77 5b237745 Scott Ullrich
78 aef9d8fe Stephen Beaver
if($_GET['reset'] != "") {
79 7ac5a4cb Scott Ullrich
	/* XXX: Huh, why are we killing php? */
80
	mwexec("killall -9 pfctl php");
81 8f8a97c8 Ermal Luçi
	exit;
82 1b2c6c29 Ermal Luçi
}
83
84 6c07db48 Phil Davis
$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"));
85 b32dd0a6 jim-p
$shortcut_section = "trafficshaper";
86 09eafb8b Scott Ullrich
87 9d5b21c6 Ermal Luçi
$shaperIFlist = get_configured_interface_with_descr();
88 197bfe96 Ermal Luçi
read_altq_config();
89 806942d0 Stephen Beaver
/*
90 197bfe96 Ermal Luçi
 * The whole logic in these code maybe can be specified.
91
 * If you find a better way contact me :).
92
 */
93 57b89461 Scott Ullrich
94 197bfe96 Ermal Luçi
if ($_GET) {
95 6aaec445 Phil Davis
	if ($_GET['queue']) {
96 e52c3c88 jim-p
		$qname = htmlspecialchars(trim($_GET['queue']));
97 6aaec445 Phil Davis
	}
98
	if ($_GET['interface']) {
99
		$interface = htmlspecialchars(trim($_GET['interface']));
100
	}
101
	if ($_GET['action']) {
102
		$action = htmlspecialchars($_GET['action']);
103
	}
104 197bfe96 Ermal Luçi
}
105 aef9d8fe Stephen Beaver
106 197bfe96 Ermal Luçi
if ($_POST) {
107 6aaec445 Phil Davis
	if ($_POST['name']) {
108
		$qname = htmlspecialchars(trim($_POST['name']));
109
	}
110
	if ($_POST['interface']) {
111
		$interface = htmlspecialchars(trim($_POST['interface']));
112
	}
113
	if ($_POST['parentqueue']) {
114 daab67a1 Scott Ullrich
		$parentqueue = htmlspecialchars(trim($_POST['parentqueue']));
115 6aaec445 Phil Davis
	}
116 57b89461 Scott Ullrich
}
117
118 197bfe96 Ermal Luçi
if ($interface) {
119
	$altq = $altq_list_queues[$interface];
120 806942d0 Stephen Beaver
121 197bfe96 Ermal Luçi
	if ($altq) {
122
		$queue =& $altq->find_queue($interface, $qname);
123 6aaec445 Phil Davis
	} else {
124 aef9d8fe Stephen Beaver
		$addnewaltq = true;
125 6aaec445 Phil Davis
	}
126 57b89461 Scott Ullrich
}
127
128 197bfe96 Ermal Luçi
$dontshow = false;
129
$newqueue = false;
130 92125c97 Ermal Luçi
$output_form = "";
131 aef9d8fe Stephen Beaver
$dfltmsg = false;
132 5b237745 Scott Ullrich
133 197bfe96 Ermal Luçi
if ($_GET) {
134
	switch ($action) {
135 6aaec445 Phil Davis
		case "delete":
136 197bfe96 Ermal Luçi
			if ($queue) {
137
				$queue->delete_queue();
138 6aaec445 Phil Davis
				if (write_config()) {
139 3a343d73 jim-p
					mark_subsystem_dirty('shaper');
140 6aaec445 Phil Davis
				}
141 197bfe96 Ermal Luçi
			}
142 3b6dedf3 Stephen Beaver
143 197bfe96 Ermal Luçi
			header("Location: firewall_shaper.php");
144
			exit;
145 6aaec445 Phil Davis
			break;
146
		case "resetall":
147
			foreach ($altq_list_queues as $altq) {
148 26dfbf80 Ermal Luçi
				$altq->delete_all();
149 6aaec445 Phil Davis
			}
150 26dfbf80 Ermal Luçi
			unset($altq_list_queues);
151
			$altq_list_queues = array();
152
			$tree = "<ul class=\"tree\" >";
153
			$tree .= get_interface_list_to_show();
154
			$tree .= "</ul>";
155
			unset($config['shaper']['queue']);
156
			unset($queue);
157
			unset($altq);
158
			$can_add = false;
159
			$can_enable = false;
160
			$dontshow = true;
161
			foreach ($config['filter']['rule'] as $key => $rule) {
162 6aaec445 Phil Davis
				if (isset($rule['wizard']) && $rule['wizard'] == "yes") {
163 26dfbf80 Ermal Luçi
					unset($config['filter']['rule'][$key]);
164 6aaec445 Phil Davis
				}
165 26dfbf80 Ermal Luçi
			}
166 806942d0 Stephen Beaver
167 3a343d73 jim-p
			if (write_config()) {
168
				$retval = 0;
169
				$retval |= filter_configure();
170
				$savemsg = get_std_save_message($retval);
171 26dfbf80 Ermal Luçi
172 6aaec445 Phil Davis
				if (stristr($retval, "error") <> true) {
173 3a343d73 jim-p
					$savemsg = get_std_save_message($retval);
174 6aaec445 Phil Davis
				} else {
175 3a343d73 jim-p
					$savemsg = $retval;
176 6aaec445 Phil Davis
				}
177 3a343d73 jim-p
			} else {
178
				$savemsg = gettext("Unable to write config.xml (Access Denied?)");
179
			}
180 806942d0 Stephen Beaver
181 aef9d8fe Stephen Beaver
			$dfltmsg = true;
182
183 26dfbf80 Ermal Luçi
184
		break;
185 3b6dedf3 Stephen Beaver
186 197bfe96 Ermal Luçi
	case "add":
187
			/* XXX: Find better way because we shouldn't know about this */
188
		if ($altq) {
189 3b6dedf3 Stephen Beaver
190 7903dd5e Stephen Beaver
			switch ($altq->GetScheduler()) {
191
				case "PRIQ":
192
					$q = new priq_queue();
193 c563b7a8 Ermal Luçi
				break;
194 7903dd5e Stephen Beaver
				case "FAIRQ":
195
					$q = new fairq_queue();
196
				break;
197
				case "HFSC":
198
					$q = new hfsc_queue();
199
				break;
200
				case "CBQ":
201
						$q = new cbq_queue();
202
				break;
203
				default:
204
					/* XXX: Happens when sched==NONE?! */
205
					$q = new altq_root_queue();
206
				break;
207
			}
208 197bfe96 Ermal Luçi
		} else if ($addnewaltq) {
209
			$q = new altq_root_queue();
210 a4af095c Renato Botelho
		} else {
211 1c52312d Jeann
			$input_errors[] = gettext("Could not create new queue/discipline!");
212 6aaec445 Phil Davis
			}
213 197bfe96 Ermal Luçi
214
			if ($q) {
215
				$q->SetInterface($interface);
216 3b6dedf3 Stephen Beaver
				$sform = $q->build_form();
217 bdb0d479 Ermal Luçi
				$newjavascript = $q->build_javascript();
218 aef9d8fe Stephen Beaver
				unset($q);
219 197bfe96 Ermal Luçi
				$newqueue = true;
220
			}
221 6aaec445 Phil Davis
			break;
222 197bfe96 Ermal Luçi
		case "show":
223 aef9d8fe Stephen Beaver
			if ($queue) {
224 806942d0 Stephen Beaver
				$sform = $queue->build_form();
225 aef9d8fe Stephen Beaver
				//$output_form .= $queue->build_form();
226
			}
227 197bfe96 Ermal Luçi
			else
228 aef9d8fe Stephen Beaver
				$input_errors[] = gettext("Queue not found!");
229 197bfe96 Ermal Luçi
		break;
230
		case "enable":
231
			if ($queue) {
232
					$queue->SetEnabled("on");
233 92125c97 Ermal Luçi
					$output_form .= $queue->build_form();
234 6c07db48 Phil Davis
					if (write_config()) {
235 3a343d73 jim-p
						mark_subsystem_dirty('shaper');
236 6c07db48 Phil Davis
					}
237 6aaec445 Phil Davis
			} else {
238 1c52312d Jeann
					$input_errors[] = gettext("Queue not found!");
239 6aaec445 Phil Davis
			}
240
			break;
241 197bfe96 Ermal Luçi
		case "disable":
242
			if ($queue) {
243 6aaec445 Phil Davis
				$queue->SetEnabled("");
244
				$output_form .= $queue->build_form();
245
				if (write_config()) {
246
					mark_subsystem_dirty('shaper');
247
				}
248
			} else {
249 1c52312d Jeann
					$input_errors[] = gettext("Queue not found!");
250 6aaec445 Phil Davis
			}
251
			break;
252 197bfe96 Ermal Luçi
		default:
253 aef9d8fe Stephen Beaver
			$dfltmsg = true;
254 197bfe96 Ermal Luçi
			$dontshow = true;
255
			break;
256 5b237745 Scott Ullrich
	}
257 aef9d8fe Stephen Beaver
}
258
259
if ($_POST) {
260 197bfe96 Ermal Luçi
	unset($input_errors);
261 5b237745 Scott Ullrich
262 197bfe96 Ermal Luçi
	if ($addnewaltq) {
263 23ca5695 Chris Buechler
		$altq =& new altq_root_queue();
264 197bfe96 Ermal Luçi
		$altq->SetInterface($interface);
265 806942d0 Stephen Beaver
266 92125c97 Ermal Luçi
		switch ($altq->GetBwscale()) {
267
				case "Mb":
268
					$factor = 1000 * 1000;
269 aef9d8fe Stephen Beaver
					break;
270 92125c97 Ermal Luçi
				case "Kb":
271
					$factor = 1000;
272
					break;
273
				case "b":
274
					$factor = 1;
275
					break;
276
				case "Gb":
277
					$factor = 1000 * 1000 * 1000;
278
					break;
279
				case "%": /* We don't use it for root_XXX queues. */
280
				default: /* XXX assume Kb by default. */
281
					$factor = 1000;
282
					break;
283 806942d0 Stephen Beaver
			}
284 aef9d8fe Stephen Beaver
285 92125c97 Ermal Luçi
		$altq->SetAvailableBandwidth($altq->GetBandwidth() * $factor);
286 197bfe96 Ermal Luçi
		$altq->ReadConfig($_POST);
287 ea51e9f8 Renato Botelho
		$altq->validate_input($_POST, $input_errors);
288 92125c97 Ermal Luçi
		if (!$input_errors) {
289
			unset($tmppath);
290
			$tmppath[] = $altq->GetInterface();
291 806942d0 Stephen Beaver
			$altq->SetLink($tmppath);
292 92125c97 Ermal Luçi
			$altq->wconfig();
293 6aaec445 Phil Davis
			if (write_config()) {
294 3a343d73 jim-p
				mark_subsystem_dirty('shaper');
295 6aaec445 Phil Davis
			}
296 92125c97 Ermal Luçi
			$can_enable = true;
297 aef9d8fe Stephen Beaver
			$can_add = true;
298 92125c97 Ermal Luçi
		}
299 aef9d8fe Stephen Beaver
300 48d418e8 Ermal Luçi
		read_altq_config();
301 92125c97 Ermal Luçi
		$output_form .= $altq->build_form();
302
303 197bfe96 Ermal Luçi
	} else if ($parentqueue) { /* Add a new queue */
304
		$qtmp =& $altq->find_queue($interface, $parentqueue);
305
		if ($qtmp) {
306
			$tmppath =& $qtmp->GetLink();
307
			array_push($tmppath, $qname);
308 ea51e9f8 Renato Botelho
			$tmp =& $qtmp->add_queue($interface, $_POST, $tmppath, $input_errors);
309 92125c97 Ermal Luçi
			if (!$input_errors) {
310
				array_pop($tmppath);
311
				$tmp->wconfig();
312
				$can_enable = true;
313 70b139a3 Chris Buechler
				if ($tmp->CanHaveChildren() && $can_enable) {
314 6aaec445 Phil Davis
					if ($tmp->GetDefault() <> "") {
315 3b6dedf3 Stephen Beaver
						$can_add = false;
316 6aaec445 Phil Davis
					} else {
317 3b6dedf3 Stephen Beaver
						$can_add = true;
318 6aaec445 Phil Davis
					}
319
				} else {
320 92125c97 Ermal Luçi
					$can_add = false;
321 6aaec445 Phil Davis
				}
322
				if (write_config()) {
323 3a343d73 jim-p
					mark_subsystem_dirty('shaper');
324 6aaec445 Phil Davis
				}
325 92125c97 Ermal Luçi
				$can_enable = true;
326 6aaec445 Phil Davis
				if ($altq->GetScheduler() != "PRIQ") { /* XXX */
327
					if ($tmp->GetDefault() <> "") {
328 3b6dedf3 Stephen Beaver
						$can_add = false;
329 6aaec445 Phil Davis
					} else {
330 3b6dedf3 Stephen Beaver
						$can_add = true;
331 6aaec445 Phil Davis
					}
332
				}
333 92125c97 Ermal Luçi
			}
334 48d418e8 Ermal Luçi
			read_altq_config();
335 806942d0 Stephen Beaver
			$output_form .= $tmp->build_form();
336 6aaec445 Phil Davis
		} else {
337 2f8fe6af Carlos Eduardo Ramos
			$input_errors[] = gettext("Could not add new queue.");
338 6aaec445 Phil Davis
		}
339 197bfe96 Ermal Luçi
	} else if ($_POST['apply']) {
340 6aaec445 Phil Davis
		write_config();
341 0df08a41 Scott Ullrich
342 6aaec445 Phil Davis
		$retval = 0;
343
		$retval = filter_configure();
344
		$savemsg = get_std_save_message($retval);
345 806942d0 Stephen Beaver
346 6aaec445 Phil Davis
		if (stristr($retval, "error") <> true) {
347 0027de0a Ermal Lu?i
			$savemsg = get_std_save_message($retval);
348 6aaec445 Phil Davis
		} else {
349
			$savemsg = $retval;
350
		}
351 5b237745 Scott Ullrich
352 806942d0 Stephen Beaver
		/* reset rrd queues */
353 7ac5a4cb Scott Ullrich
		system("rm -f /var/db/rrd/*queuedrops.rrd");
354
		system("rm -f /var/db/rrd/*queues.rrd");
355
		enable_rrd_graphing();
356 1f276138 Scott Ullrich
357 a368a026 Ermal Lu?i
		clear_subsystem_dirty('shaper');
358 806942d0 Stephen Beaver
359 6aaec445 Phil Davis
		if ($queue) {
360
			$output_form .= $queue->build_form();
361
			$dontshow = false;
362
		} else {
363
			$output_form .= $default_shaper_message;
364
			$dontshow = true;
365
		}
366 197bfe96 Ermal Luçi
	} else if ($queue) {
367 6aaec445 Phil Davis
		$queue->validate_input($_POST, $input_errors);
368
		if (!$input_errors) {
369
			$queue->update_altq_queue_data($_POST);
370
			$queue->wconfig();
371
			if (write_config()) {
372
				mark_subsystem_dirty('shaper');
373
			}
374
			$dontshow = false;
375
		}
376 48d418e8 Ermal Luçi
		read_altq_config();
377
		$output_form .= $queue->build_form();
378 806942d0 Stephen Beaver
	} else	{
379 aef9d8fe Stephen Beaver
		$dfltmsg = true;
380 92125c97 Ermal Luçi
		$dontshow = true;
381
	}
382 5f471c95 Ermal
	mwexec("killall qstats");
383 aef9d8fe Stephen Beaver
}
384
385
if(!$_POST && !$_GET){
386
	$dfltmsg = true;
387 197bfe96 Ermal Luçi
	$dontshow = true;
388
}
389 0ceb8927 Bill Marquette
390 fce82460 Ermal Luçi
if ($queue) {
391 6aaec445 Phil Davis
	if ($queue->GetEnabled()) {
392 aef9d8fe Stephen Beaver
		$can_enable = true;
393 6aaec445 Phil Davis
	} else {
394 aef9d8fe Stephen Beaver
		$can_enable = false;
395 6aaec445 Phil Davis
	}
396 806942d0 Stephen Beaver
	if ($queue->CanHaveChildren() && $can_enable) {
397 6aaec445 Phil Davis
		if ($altq->GetQname() <> $queue->GetQname() && $queue->GetDefault() <> "") {
398 aef9d8fe Stephen Beaver
			$can_add = false;
399 6aaec445 Phil Davis
		} else {
400 aef9d8fe Stephen Beaver
			$can_add = true;
401 6aaec445 Phil Davis
		}
402
	} else {
403 aef9d8fe Stephen Beaver
		$can_add = false;
404 6aaec445 Phil Davis
	}
405 fce82460 Ermal Luçi
}
406
407 aef9d8fe Stephen Beaver
//$pgtitle = "Firewall: Shaper: By Interface View";
408
$closehead = false;
409
include("head.inc");
410
411
$tree = '<ul class="tree" >';
412 fce82460 Ermal Luçi
if (is_array($altq_list_queues)) {
413 3b6dedf3 Stephen Beaver
	foreach ($altq_list_queues as $tmpaltq) {
414 6aaec445 Phil Davis
		$tree .= $tmpaltq->build_tree();
415 3b6dedf3 Stephen Beaver
	}
416 6aaec445 Phil Davis
	$tree .= get_interface_list_to_show();
417 fce82460 Ermal Luçi
}
418 0ceb8927 Bill Marquette
419 aef9d8fe Stephen Beaver
$tree .= "</ul>";
420 197bfe96 Ermal Luçi
421 a22537c7 Renato Botelho
if ($queue)
422 aef9d8fe Stephen Beaver
	print($queue->build_javascript());
423 806942d0 Stephen Beaver
424 aef9d8fe Stephen Beaver
print($newjavascript);
425
426 806942d0 Stephen Beaver
if ($input_errors)
427
	print_input_errors($input_errors);
428 aef9d8fe Stephen Beaver
429 806942d0 Stephen Beaver
if ($savemsg)
430 aef9d8fe Stephen Beaver
	print_info_box($savemsg, 'success');
431 806942d0 Stephen Beaver
432 aef9d8fe Stephen Beaver
if (is_subsystem_dirty('shaper'))
433
	print_info_box_np(gettext("The traffic shaper configuration has been changed. You must apply the changes in order for them to take effect."));
434
435
$tab_array = array();
436
$tab_array[] = array(gettext("By Interface"), true, "firewall_shaper.php");
437
$tab_array[] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
438
$tab_array[] = array(gettext("Limiter"), false, "firewall_shaper_vinterface.php");
439
$tab_array[] = array(gettext("Layer7"), false, "firewall_shaper_layer7.php");
440
$tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
441
display_top_tabs($tab_array);
442 806942d0 Stephen Beaver
443 5b237745 Scott Ullrich
?>
444 197bfe96 Ermal Luçi
<link rel="stylesheet" type="text/css" media="all" href="./tree/tree.css" />
445
<script type="text/javascript" src="./tree/tree.js"></script>
446 df5c0bc0 Colin Fleming
447 aef9d8fe Stephen Beaver
<div class="table-responsive">
448
	<table class="table">
449
		<tbody>
450
			<tr class="tabcont">
451 806942d0 Stephen Beaver
				<td class="col-md-1">
452
<?php
453
// Display the shaper tree
454 aef9d8fe Stephen Beaver
print($tree);
455 5b237745 Scott Ullrich
456 806942d0 Stephen Beaver
if (count($altq_list_queues) > 0) {
457 92125c97 Ermal Luçi
?>
458 aef9d8fe Stephen Beaver
					<a href="firewall_shaper.php?action=resetall" class="btn btn-sm btn-danger"/>
459
						<?=gettext('Remove Shaper')?>
460
					</a>
461 806942d0 Stephen Beaver
<?php
462 aef9d8fe Stephen Beaver
}
463 197bfe96 Ermal Luçi
?>
464 aef9d8fe Stephen Beaver
				</td>
465
				<td>
466
<?php
467
468
if($dfltmsg)
469 806942d0 Stephen Beaver
	print_info_box($default_shaper_msg);
470 7903dd5e Stephen Beaver
else {
471 aef9d8fe Stephen Beaver
	// Add global buttons
472
	if (!$dontshow || $newqueue) {
473
		if ($can_add || $addnewaltq) {
474
			if($queue)
475
				$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=add';
476
			else
477
				$url = 'firewall_shaper.php?interface='. $interface . '&action=add';
478 806942d0 Stephen Beaver
479 aef9d8fe Stephen Beaver
			$sform->addGlobal(new Form_Button(
480
				'add',
481
				'Add new Queue',
482
				$url
483 3b6dedf3 Stephen Beaver
			))->removeClass('btn-default')->addClass('btn-success');
484 aef9d8fe Stephen Beaver
		}
485 806942d0 Stephen Beaver
486 aef9d8fe Stephen Beaver
		if($queue)
487
			$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=delete';
488
		else
489
			$url = 'firewall_shaper.php?interface='. $interface . '&action=delete';
490 806942d0 Stephen Beaver
491 aef9d8fe Stephen Beaver
		$sform->addGlobal(new Form_Button(
492
			'delete',
493
			$queue ? 'Delete this queue':'Disable shaper on interface',
494
			$url
495 3b6dedf3 Stephen Beaver
		))->removeClass('btn-default')->addClass('btn-danger');
496 aef9d8fe Stephen Beaver
	}
497 806942d0 Stephen Beaver
498 7903dd5e Stephen Beaver
	// Print the form
499 aef9d8fe Stephen Beaver
	print($sform);
500
}
501 806942d0 Stephen Beaver
?>
502 aef9d8fe Stephen Beaver
				</td>
503
			</tr>
504
		</tbody>
505
	</table>
506 806942d0 Stephen Beaver
</div>
507
508
<?php
509 aef9d8fe Stephen Beaver
include("foot.inc");