Project

General

Profile

Download (4.9 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-2020 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
$pconfig['igmpxverbose'] = isset($config['syslog']['igmpxverbose']);
57

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

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

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

    
85
if ($changes_applied) {
86
	print_apply_result_box($retval);
87
}
88

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

    
94
<?php
95

    
96
$form = new Form();
97

    
98
$section = new Form_Section('General IGMP Options');
99

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

    
107
$section->addInput(new Form_Checkbox(
108
	'igmpxverbose',
109
	'Verbose Logging',
110
	'Enable verbose logging (Default is terse logging)',
111
	$pconfig['igmpxverbose']
112
));
113

    
114
$form->add($section);
115

    
116
print($form);
117

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

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

    
177
<nav class="action-buttons">
178
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
179
		<i class="fa fa-plus icon-embed-btn"></i>
180
		<?=gettext('Add')?>
181
	</a>
182
</nav>
183

    
184
<div class="infoblock">
185
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
186
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
187
</div>
188
<?php
189
include("foot.inc");
(132-132/230)