1
|
<?php
|
2
|
/*
|
3
|
* services_igmpproxy.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
* All rights reserved.
|
12
|
*
|
13
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
* you may not use this file except in compliance with the License.
|
15
|
* You may obtain a copy of the License at
|
16
|
*
|
17
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
*
|
19
|
* Unless required by applicable law or agreed to in writing, software
|
20
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
* See the License for the specific language governing permissions and
|
23
|
* limitations under the License.
|
24
|
*/
|
25
|
|
26
|
##|+PRIV
|
27
|
##|*IDENT=page-services-igmpproxy
|
28
|
##|*NAME=Services: IGMP Proxy
|
29
|
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
|
30
|
##|*MATCH=services_igmpproxy.php*
|
31
|
##|-PRIV
|
32
|
|
33
|
require_once("guiconfig.inc");
|
34
|
|
35
|
if (!is_array($config['igmpproxy']['igmpentry'])) {
|
36
|
$config['igmpproxy']['igmpentry'] = array();
|
37
|
}
|
38
|
|
39
|
//igmpproxy_sort();
|
40
|
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
|
41
|
|
42
|
if ($_POST) {
|
43
|
$pconfig = $_POST;
|
44
|
|
45
|
$changes_applied = true;
|
46
|
$retval = 0;
|
47
|
/* reload all components that use igmpproxy */
|
48
|
$retval |= services_igmpproxy_configure();
|
49
|
|
50
|
clear_subsystem_dirty('igmpproxy');
|
51
|
}
|
52
|
|
53
|
if ($_GET['act'] == "del") {
|
54
|
if ($a_igmpproxy[$_GET['id']]) {
|
55
|
unset($a_igmpproxy[$_GET['id']]);
|
56
|
write_config();
|
57
|
mark_subsystem_dirty('igmpproxy');
|
58
|
header("Location: services_igmpproxy.php");
|
59
|
exit;
|
60
|
}
|
61
|
}
|
62
|
|
63
|
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
|
64
|
include("head.inc");
|
65
|
|
66
|
if ($changes_applied) {
|
67
|
print_apply_result_box($retval);
|
68
|
}
|
69
|
|
70
|
if (is_subsystem_dirty('igmpproxy')) {
|
71
|
print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
|
72
|
}
|
73
|
?>
|
74
|
|
75
|
<form action="services_igmpproxy.php" method="post">
|
76
|
<div class="panel panel-default">
|
77
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
|
78
|
<div class="panel-body">
|
79
|
<div class="table-responsive">
|
80
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
81
|
<thead>
|
82
|
<tr>
|
83
|
<th><?=gettext("Name")?></th>
|
84
|
<th><?=gettext("Type")?></th>
|
85
|
<th><?=gettext("Values")?></th>
|
86
|
<th><?=gettext("Description")?></th>
|
87
|
<th><?=gettext("Actions")?></th>
|
88
|
</tr>
|
89
|
</thead>
|
90
|
<tbody>
|
91
|
<?php
|
92
|
$i = 0;
|
93
|
foreach ($a_igmpproxy as $igmpentry):
|
94
|
?>
|
95
|
<tr>
|
96
|
<td>
|
97
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
|
98
|
</td>
|
99
|
<td>
|
100
|
<?=htmlspecialchars($igmpentry['type'])?>
|
101
|
</td>
|
102
|
<td>
|
103
|
<?php
|
104
|
$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
|
105
|
print($addresses);
|
106
|
|
107
|
if (count($addresses) < 10) {
|
108
|
print(' ');
|
109
|
} else {
|
110
|
print('...');
|
111
|
}
|
112
|
?>
|
113
|
</td>
|
114
|
<td>
|
115
|
<?=htmlspecialchars($igmpentry['descr'])?>
|
116
|
</td>
|
117
|
<td>
|
118
|
<a class="fa fa-pencil" title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
|
119
|
<a class="fa fa-trash" title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&id=<?=$i?>"></a>
|
120
|
</td>
|
121
|
</tr>
|
122
|
<?php
|
123
|
$i++;
|
124
|
endforeach;
|
125
|
?>
|
126
|
</tbody>
|
127
|
</table>
|
128
|
</div>
|
129
|
</div>
|
130
|
</div>
|
131
|
</form>
|
132
|
|
133
|
<nav class="action-buttons">
|
134
|
<button id="submit" name="submit" type="submit" class="btn btn-primary btn-sm" value="<?=gettext("Save")?>">
|
135
|
<i class="fa fa-save icon-embed-btn"></i>
|
136
|
<?=gettext("Save")?>
|
137
|
</button>
|
138
|
<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
|
139
|
<i class="fa fa-plus icon-embed-btn"></i>
|
140
|
<?=gettext('Add')?>
|
141
|
</a>
|
142
|
</nav>
|
143
|
|
144
|
<div class="infoblock">
|
145
|
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
|
146
|
'Only one "upstream" interface can be configured.'), 'info', false); ?>
|
147
|
</div>
|
148
|
<?php
|
149
|
include("foot.inc");
|