1 |
ce9abebd
|
Ermal Luci
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
da7f6588
|
Phil Davis
|
services_igmpproxy_edit.php
|
5 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
6 |
1d7ba683
|
ayvis
|
Copyright (C) 2009 Ermal Luçi
|
7 |
ce9abebd
|
Ermal Luci
|
Copyright (C) 2004 Scott Ullrich
|
8 |
|
|
All rights reserved.
|
9 |
|
|
|
10 |
d47fac4a
|
Chris Buechler
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
11 |
ce9abebd
|
Ermal Luci
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12 |
|
|
All rights reserved.
|
13 |
|
|
|
14 |
|
|
Redistribution and use in source and binary forms, with or without
|
15 |
|
|
modification, are permitted provided that the following conditions are met:
|
16 |
|
|
|
17 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
18 |
|
|
this list of conditions and the following disclaimer.
|
19 |
|
|
|
20 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
21 |
|
|
notice, this list of conditions and the following disclaimer in the
|
22 |
|
|
documentation and/or other materials provided with the distribution.
|
23 |
|
|
|
24 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
25 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
26 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
27 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
28 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
29 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
30 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
31 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
32 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
34 |
|
|
*/
|
35 |
1d333258
|
Scott Ullrich
|
/*
|
36 |
|
|
pfSense_MODULE: igmpproxy
|
37 |
|
|
*/
|
38 |
ce9abebd
|
Ermal Luci
|
|
39 |
|
|
##|+PRIV
|
40 |
7997ed44
|
Renato Botelho
|
##|*IDENT=page-services-igmpproxy-edit
|
41 |
ce9abebd
|
Ermal Luci
|
##|*NAME=Firewall: Igmpproxy: Edit page
|
42 |
7997ed44
|
Renato Botelho
|
##|*DESCR=Allow access to the 'Services: Igmpproxy: Edit' page.
|
43 |
ce9abebd
|
Ermal Luci
|
##|*MATCH=services_igmpproxy_edit.php*
|
44 |
|
|
##|-PRIV
|
45 |
|
|
|
46 |
12a489b3
|
Rafael Lucas
|
$pgtitle = array(gettext("Firewall"),gettext("IGMP Proxy"), gettext("Edit"));
|
47 |
ce9abebd
|
Ermal Luci
|
|
48 |
|
|
require("guiconfig.inc");
|
49 |
|
|
|
50 |
|
|
if (!is_array($config['igmpproxy']['igmpentry']))
|
51 |
|
|
$config['igmpproxy']['igmpentry'] = array();
|
52 |
|
|
|
53 |
|
|
//igmpproxy_sort();
|
54 |
|
|
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
|
55 |
|
|
|
56 |
e41ec584
|
Renato Botelho
|
if (is_numericint($_GET['id']))
|
57 |
|
|
$id = $_GET['id'];
|
58 |
|
|
if (isset($_POST['id']) && is_numericint($_POST['id']))
|
59 |
ce9abebd
|
Ermal Luci
|
$id = $_POST['id'];
|
60 |
|
|
|
61 |
|
|
if (isset($id) && $a_igmpproxy[$id]) {
|
62 |
|
|
$pconfig['ifname'] = $a_igmpproxy[$id]['ifname'];
|
63 |
|
|
$pconfig['threshold'] = $a_igmpproxy[$id]['threshold'];
|
64 |
|
|
$pconfig['type'] = $a_igmpproxy[$id]['type'];
|
65 |
|
|
$pconfig['address'] = $a_igmpproxy[$id]['address'];
|
66 |
|
|
$pconfig['descr'] = html_entity_decode($a_igmpproxy[$id]['descr']);
|
67 |
|
|
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
if ($_POST) {
|
71 |
|
|
|
72 |
|
|
unset($input_errors);
|
73 |
|
|
$pconfig = $_POST;
|
74 |
|
|
|
75 |
20989f5a
|
Ermal Lu?i
|
if ($_POST['type'] == "upstream") {
|
76 |
|
|
foreach ($a_igmpproxy as $pid => $proxyentry) {
|
77 |
|
|
if (isset($id) && $id == $pid)
|
78 |
|
|
continue;
|
79 |
ce9abebd
|
Ermal Luci
|
if ($proxyentry['type'] == "upstream" && $proxyentry['ifname'] != $_POST['interface'])
|
80 |
12a489b3
|
Rafael Lucas
|
$input_errors[] = gettext("Only one 'upstream' interface can be configured.");
|
81 |
20989f5a
|
Ermal Lu?i
|
}
|
82 |
|
|
}
|
83 |
ce9abebd
|
Ermal Luci
|
$igmpentry = array();
|
84 |
|
|
$igmpentry['ifname'] = $_POST['ifname'];
|
85 |
|
|
$igmpentry['threshold'] = $_POST['threshold'];
|
86 |
|
|
$igmpentry['type'] = $_POST['type'];
|
87 |
|
|
$address = "";
|
88 |
|
|
$isfirst = 0;
|
89 |
|
|
/* item is a normal igmpentry type */
|
90 |
|
|
for($x=0; $x<4999; $x++) {
|
91 |
|
|
if($_POST["address{$x}"] <> "") {
|
92 |
|
|
if ($isfirst > 0)
|
93 |
|
|
$address .= " ";
|
94 |
|
|
$address .= $_POST["address{$x}"];
|
95 |
|
|
$address .= "/" . $_POST["address_subnet{$x}"];
|
96 |
|
|
$isfirst++;
|
97 |
|
|
}
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
if (!$input_errors) {
|
101 |
|
|
$igmpentry['address'] = $address;
|
102 |
d865241e
|
jim-p
|
$igmpentry['descr'] = $_POST['descr'];
|
103 |
ce9abebd
|
Ermal Luci
|
|
104 |
|
|
if (isset($id) && $a_igmpproxy[$id])
|
105 |
|
|
$a_igmpproxy[$id] = $igmpentry;
|
106 |
|
|
else
|
107 |
|
|
$a_igmpproxy[] = $igmpentry;
|
108 |
|
|
|
109 |
|
|
write_config();
|
110 |
|
|
|
111 |
b211666f
|
Ermal
|
mark_subsystem_dirty('igmpproxy');
|
112 |
ce9abebd
|
Ermal Luci
|
header("Location: services_igmpproxy.php");
|
113 |
|
|
exit;
|
114 |
|
|
}
|
115 |
|
|
//we received input errors, copy data to prevent retype
|
116 |
|
|
else
|
117 |
|
|
{
|
118 |
d865241e
|
jim-p
|
$pconfig['descr'] = $_POST['descr'];
|
119 |
ce9abebd
|
Ermal Luci
|
$pconfig['address'] = $address;
|
120 |
|
|
$pconfig['type'] = $_POST['type'];
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
include("head.inc");
|
125 |
|
|
|
126 |
|
|
?>
|
127 |
|
|
|
128 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
|
129 |
|
|
<?php
|
130 |
|
|
include("fbegin.inc");
|
131 |
|
|
?>
|
132 |
|
|
|
133 |
f51d5d57
|
Darren Embry
|
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js">
|
134 |
|
|
</script>
|
135 |
625dcc40
|
Bill Marquette
|
<script type="text/javascript" src="/javascript/row_helper.js">
|
136 |
ce9abebd
|
Ermal Luci
|
</script>
|
137 |
|
|
|
138 |
1fb1117c
|
Colin Fleming
|
<input type="hidden" name="address_type" value="textbox" class="formfld unknown" />
|
139 |
|
|
<input type="hidden" name="address_subnet_type" value="select" />
|
140 |
ce9abebd
|
Ermal Luci
|
|
141 |
|
|
<script type="text/javascript">
|
142 |
1fb1117c
|
Colin Fleming
|
//<![CDATA[
|
143 |
ce9abebd
|
Ermal Luci
|
rowname[0] = "address";
|
144 |
a8fe61f1
|
Darren Embry
|
rowtype[0] = "textbox,ipv4v6";
|
145 |
ce9abebd
|
Ermal Luci
|
rowsize[0] = "30";
|
146 |
|
|
|
147 |
|
|
rowname[1] = "address_subnet";
|
148 |
a8fe61f1
|
Darren Embry
|
rowtype[1] = "select,ipv4v6";
|
149 |
ce9abebd
|
Ermal Luci
|
rowsize[1] = "1";
|
150 |
|
|
|
151 |
|
|
rowname[2] = "detail";
|
152 |
|
|
rowtype[2] = "textbox";
|
153 |
|
|
rowsize[2] = "50";
|
154 |
1fb1117c
|
Colin Fleming
|
//]]>
|
155 |
ce9abebd
|
Ermal Luci
|
</script>
|
156 |
|
|
|
157 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
158 |
|
|
<div id="inputerrors"></div>
|
159 |
|
|
|
160 |
|
|
<form action="services_igmpproxy_edit.php" method="post" name="iform" id="iform">
|
161 |
1fb1117c
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="igmp proxy edit">
|
162 |
ce9abebd
|
Ermal Luci
|
<tr>
|
163 |
12a489b3
|
Rafael Lucas
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("IGMP Proxy Edit");?></td>
|
164 |
ce9abebd
|
Ermal Luci
|
</tr>
|
165 |
|
|
<tr>
|
166 |
12a489b3
|
Rafael Lucas
|
<td valign="top" class="vncellreq"><?=gettext("Interface");?></td>
|
167 |
ce9abebd
|
Ermal Luci
|
<td class="vtable"> <select name="ifname" id="ifname" >
|
168 |
|
|
<?php $iflist = get_configured_interface_with_descr();
|
169 |
|
|
foreach ($iflist as $ifnam => $ifdescr) {
|
170 |
1fb1117c
|
Colin Fleming
|
echo "<option value=\"{$ifnam}\"";
|
171 |
ce9abebd
|
Ermal Luci
|
if ($ifnam == $pconfig['ifname'])
|
172 |
1fb1117c
|
Colin Fleming
|
echo " selected=\"selected\"";
|
173 |
ce9abebd
|
Ermal Luci
|
echo ">{$ifdescr}</option>";
|
174 |
|
|
}
|
175 |
|
|
?>
|
176 |
|
|
</select>
|
177 |
|
|
</td>
|
178 |
|
|
</tr>
|
179 |
|
|
<tr>
|
180 |
12a489b3
|
Rafael Lucas
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
|
181 |
ce9abebd
|
Ermal Luci
|
<td width="78%" class="vtable">
|
182 |
dd5bf424
|
Scott Ullrich
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
|
183 |
ce9abebd
|
Ermal Luci
|
<br />
|
184 |
|
|
<span class="vexpl">
|
185 |
12a489b3
|
Rafael Lucas
|
<?=gettext("You may enter a description here for your reference (not parsed).");?>
|
186 |
ce9abebd
|
Ermal Luci
|
</span>
|
187 |
|
|
</td>
|
188 |
|
|
</tr>
|
189 |
|
|
<tr>
|
190 |
12a489b3
|
Rafael Lucas
|
<td valign="top" class="vncellreq"><?=gettext("Type");?></td>
|
191 |
ce9abebd
|
Ermal Luci
|
<td class="vtable">
|
192 |
|
|
<select name="type" class="formselect" id="type" >
|
193 |
1fb1117c
|
Colin Fleming
|
<option value="upstream" <?php if ($pconfig['type'] == "upstream") echo "selected=\"selected\""; ?>><?=gettext("Upstream Interface");?></option>
|
194 |
|
|
<option value="downstream" <?php if ($pconfig['type'] == "downstream") echo "selected=\"selected\""; ?>><?=gettext("Downstream Interface");?></option>
|
195 |
ce9abebd
|
Ermal Luci
|
</select>
|
196 |
|
|
<br />
|
197 |
|
|
<span class="vexpl">
|
198 |
12a489b3
|
Rafael Lucas
|
<?=gettext("The <b>upstream</b> network interface is the outgoing interface which is".
|
199 |
|
|
" responsible for communicating to available multicast data sources.".
|
200 |
|
|
" There can only be one upstream interface.");?>
|
201 |
ce9abebd
|
Ermal Luci
|
</span>
|
202 |
|
|
<br />
|
203 |
|
|
<span class="vexpl">
|
204 |
0abd5ad3
|
Carlos Eduardo Ramos
|
<b><?=gettext("Downstream"); ?></b> <?=gettext("network interfaces are the distribution interfaces to the".
|
205 |
12a489b3
|
Rafael Lucas
|
" destination networks, where multicast clients can join groups and".
|
206 |
|
|
" receive multicast data. One or more downstream interfaces must be configured.");?>
|
207 |
ce9abebd
|
Ermal Luci
|
</span>
|
208 |
|
|
</td>
|
209 |
|
|
</tr>
|
210 |
|
|
<tr>
|
211 |
12a489b3
|
Rafael Lucas
|
<td valign="top" class="vncell"><?=gettext("Threshold");?></td>
|
212 |
ce9abebd
|
Ermal Luci
|
<td class="vtable">
|
213 |
1fb1117c
|
Colin Fleming
|
<input name="threshold" class="formfld unknown" id="threshold" value="<?php echo htmlspecialchars($pconfig['threshold']);?>" />
|
214 |
ce9abebd
|
Ermal Luci
|
<br />
|
215 |
|
|
<span class="vexpl">
|
216 |
12a489b3
|
Rafael Lucas
|
<?=gettext("Defines the TTL threshold for the network interface. Packets".
|
217 |
d47fac4a
|
Chris Buechler
|
" with a lower TTL than the threshold value will be ignored. This".
|
218 |
12a489b3
|
Rafael Lucas
|
" setting is optional, and by default the threshold is 1.");?>
|
219 |
ce9abebd
|
Ermal Luci
|
</span>
|
220 |
|
|
</td>
|
221 |
|
|
</tr>
|
222 |
|
|
<tr>
|
223 |
12a489b3
|
Rafael Lucas
|
<td width="22%" valign="top" class="vncellreq"><div id="addressnetworkport"><?=gettext("Network (s)");?></div></td>
|
224 |
ce9abebd
|
Ermal Luci
|
<td width="78%" class="vtable">
|
225 |
|
|
<table id="maintable">
|
226 |
|
|
<tbody>
|
227 |
|
|
<tr>
|
228 |
12a489b3
|
Rafael Lucas
|
<td><div id="onecolumn"><?=gettext("Network");?></div></td>
|
229 |
|
|
<td><div id="twocolumn"><?=gettext("CIDR");?></div></td>
|
230 |
ce9abebd
|
Ermal Luci
|
</tr>
|
231 |
|
|
|
232 |
|
|
<?php
|
233 |
|
|
$counter = 0;
|
234 |
|
|
$address = $pconfig['address'];
|
235 |
|
|
if ($address <> "") {
|
236 |
|
|
$item = explode(" ", $address);
|
237 |
|
|
foreach($item as $ww) {
|
238 |
|
|
$address = $item[$counter];
|
239 |
|
|
$address_subnet = "";
|
240 |
|
|
$item2 = explode("/", $address);
|
241 |
|
|
foreach($item2 as $current) {
|
242 |
|
|
if($item2[1] <> "") {
|
243 |
|
|
$address = $item2[0];
|
244 |
|
|
$address_subnet = $item2[1];
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
$item4 = $item3[$counter];
|
248 |
|
|
$tracker = $counter;
|
249 |
|
|
?>
|
250 |
|
|
<tr>
|
251 |
|
|
<td>
|
252 |
|
|
<input name="address<?php echo $tracker; ?>" type="text" class="formfld unknown" id="address<?php echo $tracker; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
|
253 |
|
|
</td>
|
254 |
|
|
<td>
|
255 |
|
|
<select name="address_subnet<?php echo $tracker; ?>" class="formselect" id="address_subnet<?php echo $tracker; ?>">
|
256 |
|
|
<option></option>
|
257 |
|
|
<?php for ($i = 32; $i >= 1; $i--): ?>
|
258 |
1fb1117c
|
Colin Fleming
|
<option value="<?=$i;?>" <?php if ($i == $address_subnet) echo "selected=\"selected\""; ?>><?=$i;?></option>
|
259 |
ce9abebd
|
Ermal Luci
|
<?php endfor; ?>
|
260 |
|
|
</select>
|
261 |
|
|
</td>
|
262 |
|
|
<td>
|
263 |
1fb1117c
|
Colin Fleming
|
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
|
264 |
ce9abebd
|
Ermal Luci
|
</td>
|
265 |
|
|
</tr>
|
266 |
|
|
<?php
|
267 |
|
|
$counter++;
|
268 |
|
|
|
269 |
|
|
} // end foreach
|
270 |
|
|
} // end if
|
271 |
|
|
?>
|
272 |
|
|
</tbody>
|
273 |
|
|
</table>
|
274 |
|
|
<a onclick="javascript:addRowTo('maintable'); return false;" href="#">
|
275 |
1fb1117c
|
Colin Fleming
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="add" title="<?=gettext("add another entry");?>" />
|
276 |
ce9abebd
|
Ermal Luci
|
</a>
|
277 |
|
|
</td>
|
278 |
|
|
</tr>
|
279 |
|
|
<tr>
|
280 |
|
|
<td width="22%" valign="top"> </td>
|
281 |
|
|
<td width="78%">
|
282 |
12a489b3
|
Rafael Lucas
|
<input id="submit" name="submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
283 |
|
|
<a href="services_igmpproxy.php"><input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="<?=gettext("Cancel");?>" /></a>
|
284 |
ce9abebd
|
Ermal Luci
|
<?php if (isset($id) && $a_igmpproxy[$id]): ?>
|
285 |
225a2f0b
|
Scott Ullrich
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
|
286 |
ce9abebd
|
Ermal Luci
|
<?php endif; ?>
|
287 |
|
|
</td>
|
288 |
|
|
</tr>
|
289 |
|
|
</table>
|
290 |
|
|
</form>
|
291 |
|
|
|
292 |
|
|
<script type="text/javascript">
|
293 |
1fb1117c
|
Colin Fleming
|
//<![CDATA[
|
294 |
ce9abebd
|
Ermal Luci
|
field_counter_js = 2;
|
295 |
|
|
rows = 1;
|
296 |
|
|
totalrows = <?php echo $counter; ?>;
|
297 |
|
|
loaded = <?php echo $counter; ?>;
|
298 |
1fb1117c
|
Colin Fleming
|
//]]>
|
299 |
ce9abebd
|
Ermal Luci
|
</script>
|
300 |
|
|
|
301 |
|
|
<?php include("fend.inc"); ?>
|
302 |
|
|
</body>
|
303 |
|
|
</html>
|