Project

General

Profile

Download (4.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * services_igmpproxy.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2019 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14
 *
15
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18
 *
19
 * http://www.apache.org/licenses/LICENSE-2.0
20
 *
21
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26
 */
27

    
28
##|+PRIV
29
##|*IDENT=page-services-igmpproxy
30
##|*NAME=Services: IGMP Proxy
31
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
32
##|*MATCH=services_igmpproxy.php*
33
##|-PRIV
34

    
35
require_once("guiconfig.inc");
36

    
37
//igmpproxy_sort();
38

    
39
init_config_arr(array('igmpproxy', 'igmpentry'));
40
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
41

    
42
if ($_POST['apply']) {
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 (isset($config['igmpproxy']['enable'])) {
54
	$pconfig['enable'] = true;
55
}
56

    
57
if ($_POST['save']) {
58
	$pconfig = $_POST;
59
	if (isset($pconfig['enable'])) {
60
		$config['igmpproxy']['enable'] = true;
61
	} else {
62
		unset($config['igmpproxy']['enable']);
63
	}
64
	write_config();
65
	mark_subsystem_dirty('igmpproxy');
66
	header("Location: services_igmpproxy.php");
67
	exit;
68
}
69

    
70
if ($_POST['act'] == "del") {
71
	if ($a_igmpproxy[$_POST['id']]) {
72
		unset($a_igmpproxy[$_POST['id']]);
73
		write_config();
74
		mark_subsystem_dirty('igmpproxy');
75
		header("Location: services_igmpproxy.php");
76
		exit;
77
	}
78
}
79

    
80
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
81
include("head.inc");
82

    
83
if ($changes_applied) {
84
	print_apply_result_box($retval);
85
}
86

    
87
if (is_subsystem_dirty('igmpproxy')) {
88
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
89
}
90
?>
91

    
92
<?php
93

    
94
$form = new Form();
95

    
96
$section = new Form_Section('General IGMP Options');
97

    
98
$section->addInput(new Form_Checkbox(
99
	'enable',
100
	'Enable',
101
	'Enable IGMP',
102
	$pconfig['enable']
103
));
104

    
105
$form->add($section);
106

    
107
print($form);
108

    
109
?>
110
<form action="services_igmpproxy.php" method="post">
111
	<div class="panel panel-default">
112
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
113
		<div class="panel-body">
114
			<div class="table-responsive">
115
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
116
					<thead>
117
						<tr>
118
							<th><?=gettext("Name")?></th>
119
							<th><?=gettext("Type")?></th>
120
							<th><?=gettext("Values")?></th>
121
							<th><?=gettext("Description")?></th>
122
							<th><?=gettext("Actions")?></th>
123
						</tr>
124
					</thead>
125
					<tbody>
126
<?php
127
$i = 0;
128
foreach ($a_igmpproxy as $igmpentry):
129
?>
130
						<tr>
131
							<td>
132
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
133
							</td>
134
							<td>
135
								<?=htmlspecialchars($igmpentry['type'])?>
136
							</td>
137
							<td>
138
<?php
139
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
140
	print(htmlspecialchars($addresses));
141

    
142
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
143
		print(' ');
144
	} else {
145
		print('...');
146
	}
147
?>
148
							</td>
149
							<td>
150
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
151
							</td>
152
							<td>
153
								<a class="fa fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
154
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
155
							</td>
156
						</tr>
157
<?php
158
	$i++;
159
endforeach;
160
?>
161
					</tbody>
162
				</table>
163
			</div>
164
		</div>
165
	</div>
166
</form>
167

    
168
<nav class="action-buttons">
169
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
170
		<i class="fa fa-plus icon-embed-btn"></i>
171
		<?=gettext('Add')?>
172
	</a>
173
</nav>
174

    
175
<div class="infoblock">
176
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
177
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
178
</div>
179
<?php
180
include("foot.inc");
(128-128/225)