1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
197bfe96
|
Ermal Luçi
|
firewall_shaper.php
|
5 |
|
|
Copyright (C) 2004, 2005 Scott Ullrich
|
6 |
|
|
Copyright (C) 2008 Ermal Lu?i
|
7 |
|
|
All rights reserved.
|
8 |
b49448ac
|
Scott Ullrich
|
|
9 |
197bfe96
|
Ermal Luçi
|
Redistribution and use in source and binary forms, with or without
|
10 |
|
|
modification, are permitted provided that the following conditions are met:
|
11 |
b49448ac
|
Scott Ullrich
|
|
12 |
197bfe96
|
Ermal Luçi
|
1. Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
this list of conditions and the following disclaimer.
|
14 |
b49448ac
|
Scott Ullrich
|
|
15 |
197bfe96
|
Ermal Luçi
|
2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
documentation and/or other materials provided with the distribution.
|
18 |
b49448ac
|
Scott Ullrich
|
|
19 |
197bfe96
|
Ermal Luçi
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
29 |
5b237745
|
Scott Ullrich
|
*/
|
30 |
7ac5a4cb
|
Scott Ullrich
|
/*
|
31 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/killall
|
32 |
|
|
pfSense_MODULE: shaper
|
33 |
|
|
*/
|
34 |
5b237745
|
Scott Ullrich
|
|
35 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
36 |
|
|
##|*IDENT=page-firewall-trafficshaper
|
37 |
|
|
##|*NAME=Firewall: Traffic Shaper page
|
38 |
|
|
##|*DESCR=Allow access to the 'Firewall: Traffic Shaper' page.
|
39 |
|
|
##|*MATCH=firewall_shaper.php*
|
40 |
|
|
##|-PRIV
|
41 |
|
|
|
42 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
43 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
44 |
|
|
require_once("filter.inc");
|
45 |
|
|
require_once("shaper.inc");
|
46 |
a5f07f09
|
Ermal Lu?i
|
require_once("rrd.inc");
|
47 |
5b237745
|
Scott Ullrich
|
|
48 |
1b2c6c29
|
Ermal Luçi
|
if($_GET['reset'] <> "") {
|
49 |
7ac5a4cb
|
Scott Ullrich
|
/* XXX: Huh, why are we killing php? */
|
50 |
|
|
mwexec("killall -9 pfctl php");
|
51 |
8f8a97c8
|
Ermal Luçi
|
exit;
|
52 |
1b2c6c29
|
Ermal Luçi
|
}
|
53 |
|
|
|
54 |
fce82460
|
Ermal Luçi
|
$pgtitle = array("Firewall","Traffic Shaper");
|
55 |
09eafb8b
|
Scott Ullrich
|
|
56 |
9d5b21c6
|
Ermal Luçi
|
$shaperIFlist = get_configured_interface_with_descr();
|
57 |
197bfe96
|
Ermal Luçi
|
read_altq_config();
|
58 |
|
|
/*
|
59 |
|
|
* The whole logic in these code maybe can be specified.
|
60 |
|
|
* If you find a better way contact me :).
|
61 |
|
|
*/
|
62 |
57b89461
|
Scott Ullrich
|
|
63 |
197bfe96
|
Ermal Luçi
|
if ($_GET) {
|
64 |
|
|
if ($_GET['queue'])
|
65 |
|
|
$qname = trim($_GET['queue']);
|
66 |
|
|
if ($_GET['interface'])
|
67 |
|
|
$interface = trim($_GET['interface']);
|
68 |
|
|
if ($_GET['action'])
|
69 |
|
|
$action = $_GET['action'];
|
70 |
|
|
}
|
71 |
|
|
if ($_POST) {
|
72 |
|
|
if ($_POST['name'])
|
73 |
|
|
$qname = trim($_POST['name']);
|
74 |
|
|
if ($_POST['interface'])
|
75 |
|
|
$interface = trim($_POST['interface']);
|
76 |
|
|
if ($_POST['parentqueue'])
|
77 |
|
|
$parentqueue = trim($_POST['parentqueue']);
|
78 |
57b89461
|
Scott Ullrich
|
}
|
79 |
|
|
|
80 |
197bfe96
|
Ermal Luçi
|
if ($interface) {
|
81 |
|
|
$altq = $altq_list_queues[$interface];
|
82 |
|
|
if ($altq) {
|
83 |
|
|
$queue =& $altq->find_queue($interface, $qname);
|
84 |
|
|
} else $addnewaltq = true;
|
85 |
57b89461
|
Scott Ullrich
|
}
|
86 |
|
|
|
87 |
197bfe96
|
Ermal Luçi
|
$dontshow = false;
|
88 |
|
|
$newqueue = false;
|
89 |
92125c97
|
Ermal Luçi
|
$output_form = "";
|
90 |
5b237745
|
Scott Ullrich
|
|
91 |
197bfe96
|
Ermal Luçi
|
if ($_GET) {
|
92 |
|
|
switch ($action) {
|
93 |
|
|
case "delete":
|
94 |
|
|
if ($queue) {
|
95 |
|
|
$queue->delete_queue();
|
96 |
|
|
write_config();
|
97 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
98 |
197bfe96
|
Ermal Luçi
|
}
|
99 |
|
|
header("Location: firewall_shaper.php");
|
100 |
|
|
exit;
|
101 |
|
|
break;
|
102 |
26dfbf80
|
Ermal Luçi
|
case "resetall":
|
103 |
|
|
foreach ($altq_list_queues as $altq)
|
104 |
|
|
$altq->delete_all();
|
105 |
|
|
unset($altq_list_queues);
|
106 |
|
|
$altq_list_queues = array();
|
107 |
|
|
$tree = "<ul class=\"tree\" >";
|
108 |
|
|
$tree .= get_interface_list_to_show();
|
109 |
|
|
$tree .= "</ul>";
|
110 |
|
|
unset($config['shaper']['queue']);
|
111 |
|
|
unset($queue);
|
112 |
|
|
unset($altq);
|
113 |
|
|
$can_add = false;
|
114 |
|
|
$can_enable = false;
|
115 |
|
|
$dontshow = true;
|
116 |
|
|
foreach ($config['filter']['rule'] as $key => $rule) {
|
117 |
|
|
if (isset($rule['wizard']) && $rule['wizard'] == "yes")
|
118 |
|
|
unset($config['filter']['rule'][$key]);
|
119 |
|
|
}
|
120 |
|
|
write_config();
|
121 |
|
|
|
122 |
|
|
$retval = 0;
|
123 |
0027de0a
|
Ermal Lu?i
|
$retval |= filter_configure();
|
124 |
26dfbf80
|
Ermal Luçi
|
$savemsg = get_std_save_message($retval);
|
125 |
|
|
|
126 |
|
|
if (stristr($retval, "error") <> true)
|
127 |
|
|
$savemsg = get_std_save_message($retval);
|
128 |
|
|
else
|
129 |
|
|
$savemsg = $retval;
|
130 |
|
|
|
131 |
|
|
$output_form = $default_shaper_message;
|
132 |
|
|
|
133 |
|
|
break;
|
134 |
197bfe96
|
Ermal Luçi
|
case "add":
|
135 |
|
|
/* XXX: Find better way because we shouldn't know about this */
|
136 |
|
|
if ($altq) {
|
137 |
|
|
switch ($altq->GetScheduler()) {
|
138 |
|
|
case "PRIQ":
|
139 |
|
|
$q = new priq_queue();
|
140 |
|
|
break;
|
141 |
c563b7a8
|
Ermal Luçi
|
case "FAIRQ":
|
142 |
|
|
$q = new fairq_queue();
|
143 |
|
|
break;
|
144 |
197bfe96
|
Ermal Luçi
|
case "HFSC":
|
145 |
|
|
$q = new hfsc_queue();
|
146 |
|
|
break;
|
147 |
|
|
case "CBQ":
|
148 |
|
|
$q = new cbq_queue();
|
149 |
|
|
break;
|
150 |
|
|
default:
|
151 |
|
|
/* XXX: Happens when sched==NONE?! */
|
152 |
|
|
$q = new altq_root_queue();
|
153 |
|
|
break;
|
154 |
|
|
}
|
155 |
|
|
} else if ($addnewaltq) {
|
156 |
|
|
$q = new altq_root_queue();
|
157 |
|
|
} else
|
158 |
|
|
$input_errors[] = "Could not create new queue/discipline!";
|
159 |
|
|
|
160 |
|
|
if ($q) {
|
161 |
|
|
$q->SetInterface($interface);
|
162 |
92125c97
|
Ermal Luçi
|
$output_form .= $q->build_form();
|
163 |
|
|
$output_form .= "<input type=\"hidden\" name=\"parentqueue\" id=\"parentqueue\"";
|
164 |
|
|
$output_form .= " value=\"".$qname."\">";
|
165 |
bdb0d479
|
Ermal Luçi
|
$newjavascript = $q->build_javascript();
|
166 |
197bfe96
|
Ermal Luçi
|
unset($q);
|
167 |
|
|
$newqueue = true;
|
168 |
|
|
}
|
169 |
|
|
break;
|
170 |
|
|
case "show":
|
171 |
|
|
if ($queue)
|
172 |
92125c97
|
Ermal Luçi
|
$output_form .= $queue->build_form();
|
173 |
197bfe96
|
Ermal Luçi
|
else
|
174 |
|
|
$input_errors[] = "Queue not found!";
|
175 |
|
|
break;
|
176 |
|
|
case "enable":
|
177 |
|
|
if ($queue) {
|
178 |
|
|
$queue->SetEnabled("on");
|
179 |
92125c97
|
Ermal Luçi
|
$output_form .= $queue->build_form();
|
180 |
197bfe96
|
Ermal Luçi
|
write_config();
|
181 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
182 |
197bfe96
|
Ermal Luçi
|
} else
|
183 |
|
|
$input_errors[] = "Queue not found!";
|
184 |
|
|
break;
|
185 |
|
|
case "disable":
|
186 |
|
|
if ($queue) {
|
187 |
|
|
$queue->SetEnabled("");
|
188 |
92125c97
|
Ermal Luçi
|
$output_form .= $queue->build_form();
|
189 |
197bfe96
|
Ermal Luçi
|
write_config();
|
190 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
191 |
197bfe96
|
Ermal Luçi
|
} else
|
192 |
|
|
$input_errors[] = "Queue not found!";
|
193 |
|
|
break;
|
194 |
|
|
default:
|
195 |
92125c97
|
Ermal Luçi
|
$output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
|
196 |
197bfe96
|
Ermal Luçi
|
$dontshow = true;
|
197 |
|
|
break;
|
198 |
5b237745
|
Scott Ullrich
|
}
|
199 |
197bfe96
|
Ermal Luçi
|
} else if ($_POST) {
|
200 |
|
|
unset($input_errors);
|
201 |
5b237745
|
Scott Ullrich
|
|
202 |
197bfe96
|
Ermal Luçi
|
if ($addnewaltq) {
|
203 |
|
|
$altq =& new altq_root_queue();
|
204 |
|
|
$altq->SetInterface($interface);
|
205 |
92125c97
|
Ermal Luçi
|
|
206 |
|
|
switch ($altq->GetBwscale()) {
|
207 |
|
|
case "Mb":
|
208 |
|
|
$factor = 1000 * 1000;
|
209 |
|
|
brak;
|
210 |
|
|
case "Kb":
|
211 |
|
|
$factor = 1000;
|
212 |
|
|
break;
|
213 |
|
|
case "b":
|
214 |
|
|
$factor = 1;
|
215 |
|
|
break;
|
216 |
|
|
case "Gb":
|
217 |
|
|
$factor = 1000 * 1000 * 1000;
|
218 |
|
|
break;
|
219 |
|
|
case "%": /* We don't use it for root_XXX queues. */
|
220 |
|
|
default: /* XXX assume Kb by default. */
|
221 |
|
|
$factor = 1000;
|
222 |
|
|
break;
|
223 |
|
|
}
|
224 |
|
|
$altq->SetAvailableBandwidth($altq->GetBandwidth() * $factor);
|
225 |
197bfe96
|
Ermal Luçi
|
$altq->ReadConfig($_POST);
|
226 |
92125c97
|
Ermal Luçi
|
$altq->validate_input($_POST, &$input_errors);
|
227 |
|
|
if (!$input_errors) {
|
228 |
|
|
unset($tmppath);
|
229 |
|
|
$tmppath[] = $altq->GetInterface();
|
230 |
|
|
$altq->SetLink(&$tmppath);
|
231 |
|
|
$altq->wconfig();
|
232 |
|
|
write_config();
|
233 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
234 |
92125c97
|
Ermal Luçi
|
$can_enable = true;
|
235 |
fce82460
|
Ermal Luçi
|
$can_add = true;
|
236 |
92125c97
|
Ermal Luçi
|
}
|
237 |
48d418e8
|
Ermal Luçi
|
read_altq_config();
|
238 |
92125c97
|
Ermal Luçi
|
$output_form .= $altq->build_form();
|
239 |
|
|
|
240 |
197bfe96
|
Ermal Luçi
|
} else if ($parentqueue) { /* Add a new queue */
|
241 |
|
|
$qtmp =& $altq->find_queue($interface, $parentqueue);
|
242 |
|
|
if ($qtmp) {
|
243 |
|
|
$tmppath =& $qtmp->GetLink();
|
244 |
|
|
array_push($tmppath, $qname);
|
245 |
cedae3d3
|
Ermal Luçi
|
$tmp =& $qtmp->add_queue($interface, $_POST, $tmppath, &$input_errors);
|
246 |
92125c97
|
Ermal Luçi
|
if (!$input_errors) {
|
247 |
|
|
array_pop($tmppath);
|
248 |
|
|
$tmp->wconfig();
|
249 |
|
|
$can_enable = true;
|
250 |
70b139a3
|
Chris Buechler
|
if ($tmp->CanHaveChildren() && $can_enable) {
|
251 |
fce82460
|
Ermal Luçi
|
if ($tmp->GetDefault() <> "")
|
252 |
96d1d4ad
|
Ermal Luçi
|
$can_add = false;
|
253 |
|
|
else
|
254 |
|
|
$can_add = true;
|
255 |
|
|
} else
|
256 |
92125c97
|
Ermal Luçi
|
$can_add = false;
|
257 |
|
|
write_config();
|
258 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
259 |
92125c97
|
Ermal Luçi
|
$can_enable = true;
|
260 |
|
|
if ($altq->GetScheduler() != "PRIQ") /* XXX */
|
261 |
fce82460
|
Ermal Luçi
|
if ($tmp->GetDefault() <> "")
|
262 |
96d1d4ad
|
Ermal Luçi
|
$can_add = false;
|
263 |
|
|
else
|
264 |
|
|
$can_add = true;
|
265 |
92125c97
|
Ermal Luçi
|
}
|
266 |
48d418e8
|
Ermal Luçi
|
read_altq_config();
|
267 |
92125c97
|
Ermal Luçi
|
$output_form .= $tmp->build_form();
|
268 |
197bfe96
|
Ermal Luçi
|
} else
|
269 |
|
|
$input_errors[] = "Could not add new queue.";
|
270 |
|
|
} else if ($_POST['apply']) {
|
271 |
92125c97
|
Ermal Luçi
|
write_config();
|
272 |
0df08a41
|
Scott Ullrich
|
|
273 |
92125c97
|
Ermal Luçi
|
$retval = 0;
|
274 |
|
|
$retval = filter_configure();
|
275 |
0027de0a
|
Ermal Lu?i
|
$savemsg = get_std_save_message($retval);
|
276 |
92125c97
|
Ermal Luçi
|
|
277 |
|
|
if (stristr($retval, "error") <> true)
|
278 |
|
|
$savemsg = get_std_save_message($retval);
|
279 |
|
|
else
|
280 |
|
|
$savemsg = $retval;
|
281 |
5b237745
|
Scott Ullrich
|
|
282 |
96b777d6
|
Ermal Luçi
|
/* reset rrd queues */
|
283 |
7ac5a4cb
|
Scott Ullrich
|
system("rm -f /var/db/rrd/*queuedrops.rrd");
|
284 |
|
|
system("rm -f /var/db/rrd/*queues.rrd");
|
285 |
|
|
enable_rrd_graphing();
|
286 |
1f276138
|
Scott Ullrich
|
|
287 |
a368a026
|
Ermal Lu?i
|
clear_subsystem_dirty('shaper');
|
288 |
92125c97
|
Ermal Luçi
|
|
289 |
|
|
if ($queue) {
|
290 |
|
|
$output_form .= $queue->build_form();
|
291 |
|
|
$dontshow = false;
|
292 |
|
|
}
|
293 |
|
|
else {
|
294 |
|
|
$output_form .= $default_shaper_message;
|
295 |
|
|
$dontshow = true;
|
296 |
|
|
}
|
297 |
1f276138
|
Scott Ullrich
|
|
298 |
197bfe96
|
Ermal Luçi
|
} else if ($queue) {
|
299 |
|
|
$queue->validate_input($_POST, &$input_errors);
|
300 |
|
|
if (!$input_errors) {
|
301 |
92125c97
|
Ermal Luçi
|
$queue->update_altq_queue_data($_POST);
|
302 |
|
|
$queue->wconfig();
|
303 |
197bfe96
|
Ermal Luçi
|
write_config();
|
304 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('shaper');
|
305 |
92125c97
|
Ermal Luçi
|
$dontshow = false;
|
306 |
|
|
}
|
307 |
48d418e8
|
Ermal Luçi
|
read_altq_config();
|
308 |
|
|
$output_form .= $queue->build_form();
|
309 |
92125c97
|
Ermal Luçi
|
} else {
|
310 |
|
|
$output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
|
311 |
|
|
$dontshow = true;
|
312 |
|
|
}
|
313 |
0ceb8927
|
Bill Marquette
|
} else {
|
314 |
92125c97
|
Ermal Luçi
|
$output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg."</p>";
|
315 |
197bfe96
|
Ermal Luçi
|
$dontshow = true;
|
316 |
|
|
}
|
317 |
0ceb8927
|
Bill Marquette
|
|
318 |
fce82460
|
Ermal Luçi
|
if ($queue) {
|
319 |
|
|
if ($queue->GetEnabled())
|
320 |
|
|
$can_enable = true;
|
321 |
|
|
else
|
322 |
|
|
$can_enable = false;
|
323 |
70b139a3
|
Chris Buechler
|
if ($queue->CanHaveChildren() && $can_enable) {
|
324 |
58dc3a03
|
Ermal Luçi
|
if ($altq->GetQname() <> $queue->GetQname() && $queue->GetDefault() <> "")
|
325 |
fce82460
|
Ermal Luçi
|
$can_add = false;
|
326 |
|
|
else
|
327 |
|
|
$can_add = true;
|
328 |
|
|
} else
|
329 |
|
|
$can_add = false;
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
$tree = "<ul class=\"tree\" >";
|
333 |
|
|
if (is_array($altq_list_queues)) {
|
334 |
a843b04f
|
Ermal Luçi
|
foreach ($altq_list_queues as $tmpaltq) {
|
335 |
|
|
$tree .= $tmpaltq->build_tree();
|
336 |
fce82460
|
Ermal Luçi
|
}
|
337 |
|
|
$tree .= get_interface_list_to_show();
|
338 |
|
|
}
|
339 |
|
|
$tree .= "</ul>";
|
340 |
0ceb8927
|
Bill Marquette
|
|
341 |
197bfe96
|
Ermal Luçi
|
if (!$dontshow || $newqueue) {
|
342 |
0ceb8927
|
Bill Marquette
|
|
343 |
92125c97
|
Ermal Luçi
|
$output_form .= "<tr><td width=\"22%\" valign=\"top\" class=\"vncellreq\">";
|
344 |
|
|
$output_form .= "Queue Actions";
|
345 |
|
|
$output_form .= "</td><td valign=\"top\" class=\"vncellreq\" width=\"78%\">";
|
346 |
197bfe96
|
Ermal Luçi
|
|
347 |
92125c97
|
Ermal Luçi
|
$output_form .= "<input type=\"submit\" name=\"Submit\" value=\"" . gettext("Save") . "\" class=\"formbtn\" />";
|
348 |
197bfe96
|
Ermal Luçi
|
if ($can_add || $addnewaltq) {
|
349 |
92125c97
|
Ermal Luçi
|
$output_form .= "<a href=\"firewall_shaper.php?interface=";
|
350 |
|
|
$output_form .= $interface;
|
351 |
|
|
if ($queue) {
|
352 |
|
|
$output_form .= "&queue=" . $queue->GetQname();
|
353 |
|
|
}
|
354 |
|
|
$output_form .= "&action=add\">";
|
355 |
58dc3a03
|
Ermal Luçi
|
$output_form .= "<input type=\"button\" class=\"formbtn\" name=\"add\" value=\"Add new queue\">";
|
356 |
92125c97
|
Ermal Luçi
|
$output_form .= "</a>";
|
357 |
|
|
$output_form .= "<a href=\"firewall_shaper.php?interface=";
|
358 |
|
|
$output_form .= $interface . "&queue=";
|
359 |
|
|
if ($queue) {
|
360 |
|
|
$output_form .= "&queue=" . $queue->GetQname();
|
361 |
|
|
}
|
362 |
|
|
$output_form .= "&action=delete\">";
|
363 |
37f5fcf6
|
Ermal Luçi
|
$output_form .= "<input type=\"button\" class=\"formbtn\" name=\"delete\"";
|
364 |
92125c97
|
Ermal Luçi
|
if ($queue)
|
365 |
58dc3a03
|
Ermal Luçi
|
$output_form .= " value=\"Delete this queue\">";
|
366 |
92125c97
|
Ermal Luçi
|
else
|
367 |
37f5fcf6
|
Ermal Luçi
|
$output_form .= " value=\"Disable shaper on interface\">";
|
368 |
92125c97
|
Ermal Luçi
|
$output_form .= "</a>";
|
369 |
5b237745
|
Scott Ullrich
|
}
|
370 |
92125c97
|
Ermal Luçi
|
$output_form .= "</td></tr>";
|
371 |
|
|
$output_form .= "</div>";
|
372 |
197bfe96
|
Ermal Luçi
|
}
|
373 |
|
|
else
|
374 |
92125c97
|
Ermal Luçi
|
$output_form .= "</div>";
|
375 |
|
|
|
376 |
|
|
$output = "<div id=\"shaperarea\" style=\"position:relative\">";
|
377 |
|
|
if (!$dontshow) {
|
378 |
5e1531d9
|
Ermal Luçi
|
if ($queue || $altq || $newqueue) {
|
379 |
92125c97
|
Ermal Luçi
|
$output .= "<tr><td valign=\"top\" class=\"vncellreq\"><br>";
|
380 |
|
|
$output .= "Enable/Disable";
|
381 |
|
|
$output .= "</td><td class=\"vncellreq\">";
|
382 |
f5881023
|
Ermal Lu?i
|
$output .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"enabled\"";
|
383 |
92125c97
|
Ermal Luçi
|
if ($queue)
|
384 |
|
|
if ($queue->GetEnabled())
|
385 |
|
|
$output .= " CHECKED";
|
386 |
|
|
else if ($altq)
|
387 |
|
|
if ($altq->GetEnabled())
|
388 |
|
|
$output .= " CHECKED";
|
389 |
|
|
$output .= " ><span class=\"vexpl\"> Enable/Disable queue and its childs</span>";
|
390 |
|
|
$output .= "</td></tr>";
|
391 |
|
|
}
|
392 |
|
|
}
|
393 |
|
|
$output .= $output_form;
|
394 |
52380979
|
Scott Ullrich
|
|
395 |
58dc3a03
|
Ermal Luçi
|
//$pgtitle = "Firewall: Shaper: By Interface View";
|
396 |
52380979
|
Scott Ullrich
|
|
397 |
197bfe96
|
Ermal Luçi
|
include("head.inc");
|
398 |
5b237745
|
Scott Ullrich
|
?>
|
399 |
92125c97
|
Ermal Luçi
|
|
400 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
|
401 |
197bfe96
|
Ermal Luçi
|
<link rel="stylesheet" type="text/css" media="all" href="./tree/tree.css" />
|
402 |
|
|
<script type="text/javascript" src="./tree/tree.js"></script>
|
403 |
92125c97
|
Ermal Luçi
|
<?php
|
404 |
|
|
if ($queue) {
|
405 |
|
|
echo "<script type=\"text/javascript\">";
|
406 |
|
|
echo $queue->build_javascript();
|
407 |
|
|
echo "</script>";
|
408 |
|
|
}
|
409 |
bdb0d479
|
Ermal Luçi
|
echo $newjavascript;
|
410 |
5b237745
|
Scott Ullrich
|
|
411 |
92125c97
|
Ermal Luçi
|
include("fbegin.inc");
|
412 |
|
|
?>
|
413 |
197bfe96
|
Ermal Luçi
|
<div id="inputerrors"></div>
|
414 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
415 |
|
|
|
416 |
92125c97
|
Ermal Luçi
|
<form action="firewall_shaper.php" method="post" id="iform" name="iform">
|
417 |
197bfe96
|
Ermal Luçi
|
|
418 |
5b237745
|
Scott Ullrich
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
419 |
a368a026
|
Ermal Lu?i
|
<?php if (is_subsystem_dirty('shaper')): ?><p>
|
420 |
5b237745
|
Scott Ullrich
|
<?php print_info_box_np("The traffic shaper configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
421 |
|
|
<?php endif; ?>
|
422 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
423 |
|
|
<tr><td>
|
424 |
52380979
|
Scott Ullrich
|
<?php
|
425 |
|
|
$tab_array = array();
|
426 |
502c545d
|
Ermal Luçi
|
$tab_array[0] = array("By Interface", true, "firewall_shaper.php");
|
427 |
|
|
$tab_array[1] = array("By Queue", false, "firewall_shaper_queues.php");
|
428 |
6d0c07ea
|
Ermal Luçi
|
$tab_array[2] = array("Limiter", false, "firewall_shaper_vinterface.php");
|
429 |
f63d5b66
|
Helder Pereira
|
$tab_array[3] = array("Layer7", false, "firewall_shaper_layer7.php");
|
430 |
|
|
$tab_array[4] = array("Wizards", false, "firewall_shaper_wizards.php");
|
431 |
52380979
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
432 |
197bfe96
|
Ermal Luçi
|
?>
|
433 |
5b237745
|
Scott Ullrich
|
</td></tr>
|
434 |
|
|
<tr>
|
435 |
d732f186
|
Bill Marquette
|
<td>
|
436 |
|
|
<div id="mainarea">
|
437 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
438 |
26dfbf80
|
Ermal Luçi
|
<?php if (count($altq_list_queues) > 0): ?>
|
439 |
|
|
<tr class="tabcont"><td width="25%" align="left">
|
440 |
|
|
<a href="firewall_shaper.php?action=resetall" >
|
441 |
|
|
<input type="button" value="Remove Shaper" class="formbtn">
|
442 |
|
|
</a>
|
443 |
|
|
</td><td width="75%"> </td></tr>
|
444 |
|
|
<? endif; ?>
|
445 |
197bfe96
|
Ermal Luçi
|
<tr>
|
446 |
|
|
<td width="25%" valign="top" algin="left">
|
447 |
|
|
<?php
|
448 |
|
|
echo $tree;
|
449 |
|
|
?>
|
450 |
|
|
</td>
|
451 |
|
|
<td width="75%" valign="top" align="center">
|
452 |
|
|
<table>
|
453 |
|
|
<?
|
454 |
|
|
echo $output;
|
455 |
|
|
?>
|
456 |
|
|
</table>
|
457 |
e295675f
|
Scott Ullrich
|
|
458 |
197bfe96
|
Ermal Luçi
|
</td></tr>
|
459 |
d732f186
|
Bill Marquette
|
</table>
|
460 |
|
|
</div>
|
461 |
|
|
</td>
|
462 |
5b237745
|
Scott Ullrich
|
</tr>
|
463 |
|
|
</table>
|
464 |
|
|
</form>
|
465 |
197bfe96
|
Ermal Luçi
|
<?php include("fend.inc");
|
466 |
|
|
?>
|
467 |
5b237745
|
Scott Ullrich
|
</body>
|
468 |
|
|
</html>
|