1 |
c9f0b1c2
|
Ermal Luçi
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
firewall_shaper.php
|
5 |
|
|
Copyright (C) 2004, 2005 Scott Ullrich
|
6 |
|
|
Copyright (C) 2008 Ermal Lu?i
|
7 |
|
|
All rights reserved.
|
8 |
|
|
|
9 |
|
|
Redistribution and use in source and binary forms, with or without
|
10 |
|
|
modification, are permitted provided that the following conditions are met:
|
11 |
|
|
|
12 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
this list of conditions and the following disclaimer.
|
14 |
|
|
|
15 |
|
|
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 |
|
|
|
19 |
|
|
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 |
|
|
*/
|
30 |
|
|
|
31 |
|
|
require("guiconfig.inc");
|
32 |
|
|
|
33 |
|
|
if($_GET['reset'] <> "") {
|
34 |
|
|
mwexec("killall -9 pfctl php");
|
35 |
|
|
exit;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
96b777d6
|
Ermal Luçi
|
if ($_POST['apply']) {
|
39 |
|
|
write_config();
|
40 |
|
|
|
41 |
|
|
$retval = 0;
|
42 |
|
|
$savemsg = get_std_save_message($retval);
|
43 |
|
|
/* Setup pf rules since the user may have changed the optimization value */
|
44 |
|
|
|
45 |
|
|
config_lock();
|
46 |
|
|
$retval = filter_configure();
|
47 |
|
|
config_unlock();
|
48 |
|
|
if (stristr($retval, "error") <> true)
|
49 |
|
|
$savemsg = get_std_save_message($retval);
|
50 |
|
|
else
|
51 |
|
|
$savemsg = $retval;
|
52 |
|
|
|
53 |
|
|
/* reset rrd queues */
|
54 |
|
|
system("rm -f /var/db/rrd/*queuedrops.rrd");
|
55 |
|
|
system("rm -f /var/db/rrd/*queues.rrd");
|
56 |
|
|
enable_rrd_graphing();
|
57 |
|
|
|
58 |
|
|
unlink($d_shaperconfdirty_path);
|
59 |
|
|
}
|
60 |
|
|
|
61 |
07f35d57
|
Ermal Luçi
|
$pgtitle = array("Firewall", "Traffic Shaper", "Wizards");
|
62 |
c9f0b1c2
|
Ermal Luçi
|
|
63 |
|
|
$wizards = array("Single Lan multi Wan" => "traffic_shaper_wizard.xml",
|
64 |
|
|
"Single Wan multi Lan" => "traffic_shaper_wizard_multi_lan.xml",
|
65 |
|
|
"Multiple Lan/Wan" => "traffic_shaper_wizard_multi_all.xml",
|
66 |
|
|
"Dedicated Links" => "traffic_shaper_wizard_dedicated.xml",
|
67 |
|
|
);
|
68 |
|
|
|
69 |
|
|
include("head.inc");
|
70 |
|
|
?>
|
71 |
|
|
|
72 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
|
73 |
|
|
<link rel="stylesheet" type="text/css" media="all" href="./tree/tree.css" />
|
74 |
|
|
<?php
|
75 |
|
|
include("fbegin.inc");
|
76 |
|
|
?>
|
77 |
|
|
<p class="pgtitle"><?=$pgtitle?></p>
|
78 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
79 |
|
|
|
80 |
|
|
<form action="firewall_shaper_wizards.php" method="post" id="iform" name="iform">
|
81 |
|
|
|
82 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
83 |
|
|
<?php if (file_exists($d_shaperconfdirty_path)): ?><p>
|
84 |
|
|
<?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>
|
85 |
|
|
<?php endif; ?>
|
86 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
87 |
|
|
<tr><td>
|
88 |
|
|
<?php
|
89 |
|
|
$tab_array = array();
|
90 |
|
|
$tab_array[0] = array("By Interface", false, "firewall_shaper.php");
|
91 |
|
|
$tab_array[1] = array("By Queue", false, "firewall_shaper_queues.php");
|
92 |
07f35d57
|
Ermal Luçi
|
$tab_array[2] = array("Wizards", true, "firewall_shaper_wizards.php");
|
93 |
c9f0b1c2
|
Ermal Luçi
|
display_top_tabs($tab_array);
|
94 |
|
|
?>
|
95 |
|
|
</td></tr>
|
96 |
|
|
<tr>
|
97 |
|
|
<td>
|
98 |
|
|
<div id="mainarea">
|
99 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
100 |
|
|
<tr>
|
101 |
|
|
<td class="listhdrr" width="25%" align="center" >Wizard function</td>
|
102 |
|
|
<td class="listhdrr" width="75%" align="center">Wizard Link</td>
|
103 |
|
|
</tr>
|
104 |
|
|
<?php foreach ($wizards as $key => $wizard): ?>
|
105 |
|
|
<tr class="tabcont"><td class="listlr" style="background-color: #e0e0e0" width="25%" align="center">
|
106 |
|
|
<?php echo $key;?>
|
107 |
|
|
</td><td class="listr" style="background-color: #e0e0e0" width="75%" align="center">
|
108 |
|
|
<?php echo "<a href=\"wizard.php?xml=" . $wizard ."\" >" .$wizard . "</a>"; ?>
|
109 |
|
|
</td></tr>
|
110 |
|
|
<?php endforeach; ?>
|
111 |
|
|
</table>
|
112 |
|
|
</div>
|
113 |
|
|
</td>
|
114 |
|
|
</tr>
|
115 |
|
|
</table>
|
116 |
|
|
</form>
|
117 |
|
|
<?php include("fend.inc");
|
118 |
|
|
?>
|
119 |
|
|
</body>
|
120 |
|
|
</html>
|