1 |
ce9abebd
|
Ermal Luci
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
services_igmpproxy.php
|
4 |
|
|
*/
|
5 |
b9043cdc
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
|
|
*
|
8 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
9 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10 |
191cb31d
|
Stephen Beaver
|
*
|
11 |
b9043cdc
|
Stephen Beaver
|
* 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 |
ce9abebd
|
Ermal Luci
|
|
59 |
|
|
##|+PRIV
|
60 |
|
|
##|*IDENT=page-services-igmpproxy
|
61 |
5230f468
|
jim-p
|
##|*NAME=Services: IGMP Proxy
|
62 |
0b8328c5
|
jim-p
|
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
|
63 |
ce9abebd
|
Ermal Luci
|
##|*MATCH=services_igmpproxy.php*
|
64 |
|
|
##|-PRIV
|
65 |
|
|
|
66 |
|
|
require("guiconfig.inc");
|
67 |
|
|
|
68 |
c0bf7858
|
Phil Davis
|
if (!is_array($config['igmpproxy']['igmpentry'])) {
|
69 |
ce9abebd
|
Ermal Luci
|
$config['igmpproxy']['igmpentry'] = array();
|
70 |
c0bf7858
|
Phil Davis
|
}
|
71 |
ce9abebd
|
Ermal Luci
|
|
72 |
|
|
//igmpproxy_sort();
|
73 |
|
|
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
|
74 |
|
|
|
75 |
|
|
if ($_POST) {
|
76 |
|
|
$pconfig = $_POST;
|
77 |
|
|
|
78 |
|
|
$retval = 0;
|
79 |
|
|
/* reload all components that use igmpproxy */
|
80 |
|
|
$retval = services_igmpproxy_configure();
|
81 |
|
|
|
82 |
c0bf7858
|
Phil Davis
|
if (stristr($retval, "error") <> true) {
|
83 |
3d0f579f
|
sbeaver
|
$savemsg = get_std_save_message($retval);
|
84 |
c0bf7858
|
Phil Davis
|
} else {
|
85 |
3d0f579f
|
sbeaver
|
$savemsg = $retval;
|
86 |
c0bf7858
|
Phil Davis
|
}
|
87 |
6833c9cd
|
Ermal Lu?i
|
|
88 |
|
|
clear_subsystem_dirty('igmpproxy');
|
89 |
ce9abebd
|
Ermal Luci
|
}
|
90 |
|
|
|
91 |
|
|
if ($_GET['act'] == "del") {
|
92 |
|
|
if ($a_igmpproxy[$_GET['id']]) {
|
93 |
|
|
unset($a_igmpproxy[$_GET['id']]);
|
94 |
|
|
write_config();
|
95 |
4bbfe029
|
Ermal Lu?i
|
mark_subsystem_dirty('igmpproxy');
|
96 |
ce9abebd
|
Ermal Luci
|
header("Location: services_igmpproxy.php");
|
97 |
|
|
exit;
|
98 |
|
|
}
|
99 |
|
|
}
|
100 |
|
|
|
101 |
c0bf7858
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
|
102 |
ce9abebd
|
Ermal Luci
|
include("head.inc");
|
103 |
|
|
|
104 |
20db3e1a
|
Phil Davis
|
if ($savemsg) {
|
105 |
3d0f579f
|
sbeaver
|
print_info_box($savemsg, 'success');
|
106 |
20db3e1a
|
Phil Davis
|
}
|
107 |
3d0f579f
|
sbeaver
|
|
108 |
20db3e1a
|
Phil Davis
|
if (is_subsystem_dirty('igmpproxy')) {
|
109 |
a152de2a
|
NewEraCracker
|
print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('You must apply the changes in order for them to take effect.'));
|
110 |
20db3e1a
|
Phil Davis
|
}
|
111 |
ce9abebd
|
Ermal Luci
|
?>
|
112 |
|
|
|
113 |
|
|
<form action="services_igmpproxy.php" method="post">
|
114 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
115 |
|
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
|
116 |
|
|
<div class="panel-body">
|
117 |
|
|
<div class="table-responsive">
|
118 |
|
|
<table class="table table-striped table-hover table-condensed">
|
119 |
|
|
<thead>
|
120 |
|
|
<tr>
|
121 |
|
|
<th><?=gettext("Name")?></th>
|
122 |
|
|
<th><?=gettext("Type")?></th>
|
123 |
|
|
<th><?=gettext("Values")?></th>
|
124 |
|
|
<th><?=gettext("Description")?></th>
|
125 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Actions")?></th>
|
126 |
060ed238
|
Stephen Beaver
|
</tr>
|
127 |
|
|
</thead>
|
128 |
|
|
<tbody>
|
129 |
3d0f579f
|
sbeaver
|
<?php
|
130 |
|
|
$i = 0;
|
131 |
|
|
foreach ($a_igmpproxy as $igmpentry):
|
132 |
|
|
?>
|
133 |
060ed238
|
Stephen Beaver
|
<tr>
|
134 |
|
|
<td>
|
135 |
|
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
|
136 |
|
|
</td>
|
137 |
|
|
<td>
|
138 |
|
|
<?=htmlspecialchars($igmpentry['type'])?>
|
139 |
|
|
</td>
|
140 |
|
|
<td>
|
141 |
3d0f579f
|
sbeaver
|
<?php
|
142 |
ce9abebd
|
Ermal Luci
|
$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
|
143 |
3d0f579f
|
sbeaver
|
print($addresses);
|
144 |
|
|
|
145 |
20db3e1a
|
Phil Davis
|
if (count($addresses) < 10) {
|
146 |
3d0f579f
|
sbeaver
|
print(' ');
|
147 |
ce9abebd
|
Ermal Luci
|
} else {
|
148 |
3d0f579f
|
sbeaver
|
print('...');
|
149 |
ce9abebd
|
Ermal Luci
|
}
|
150 |
3d0f579f
|
sbeaver
|
?>
|
151 |
060ed238
|
Stephen Beaver
|
</td>
|
152 |
|
|
<td>
|
153 |
|
|
<?=htmlspecialchars($igmpentry['descr'])?>
|
154 |
|
|
</td>
|
155 |
|
|
<td>
|
156 |
|
|
<a class="fa fa-pencil" title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
|
157 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&id=<?=$i?>"></a>
|
158 |
|
|
</td>
|
159 |
|
|
</tr>
|
160 |
3d0f579f
|
sbeaver
|
<?php
|
161 |
|
|
$i++;
|
162 |
|
|
endforeach;
|
163 |
|
|
?>
|
164 |
060ed238
|
Stephen Beaver
|
</tbody>
|
165 |
|
|
</table>
|
166 |
|
|
</div>
|
167 |
|
|
</div>
|
168 |
ac950976
|
Colin Fleming
|
</div>
|
169 |
ce9abebd
|
Ermal Luci
|
</form>
|
170 |
3d0f579f
|
sbeaver
|
|
171 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
172 |
c9679d8c
|
Stephen Beaver
|
<button id="submit" name="submit" type="submit" class="btn btn-primary btn-sm" value="<?=gettext("Save")?>">
|
173 |
9d5a20cf
|
heper
|
<i class="fa fa-save icon-embed-btn"></i>
|
174 |
c9679d8c
|
Stephen Beaver
|
<?=gettext("Save")?>
|
175 |
|
|
</button>
|
176 |
|
|
<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
|
177 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
178 |
c9679d8c
|
Stephen Beaver
|
<?=gettext('Add')?>
|
179 |
|
|
</a>
|
180 |
|
|
</nav>
|
181 |
|
|
|
182 |
35681930
|
Stephen Beaver
|
<div class="infoblock">
|
183 |
f6aebbcc
|
NewEraCracker
|
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces you would like the proxy to allow. ' .
|
184 |
|
|
'Only one "upstream" interface can be configured.'), 'info', false); ?>
|
185 |
c9679d8c
|
Stephen Beaver
|
</div>
|
186 |
3d0f579f
|
sbeaver
|
<?php
|
187 |
5d3914a9
|
heper
|
include("foot.inc");
|