Project

General

Profile

Download (5.53 KB) Statistics
| Branch: | Tag: | Revision:
1 ce9abebd Ermal Luci
<?php
2
/*
3 c5d81585 Renato Botelho
 * services_igmpproxy.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 402c98a2 Reid Linnemann
 * Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 191cb31d Stephen Beaver
 *
11 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * 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 b9043cdc Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
20 b9043cdc Stephen Beaver
 *
21 b12ea3fb Renato Botelho
 * 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 b9043cdc Stephen Beaver
 */
27 ce9abebd Ermal Luci
28
##|+PRIV
29
##|*IDENT=page-services-igmpproxy
30 5230f468 jim-p
##|*NAME=Services: IGMP Proxy
31 0b8328c5 jim-p
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
32 ce9abebd Ermal Luci
##|*MATCH=services_igmpproxy.php*
33
##|-PRIV
34
35 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
36 ce9abebd Ermal Luci
37
//igmpproxy_sort();
38 c6c398c6 jim-p
39
init_config_arr(array('igmpproxy', 'igmpentry'));
40 ce9abebd Ermal Luci
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
41
42 1cd02ef7 PiBa-NL
if ($_POST['apply']) {
43 ce9abebd Ermal Luci
	$pconfig = $_POST;
44
45 44c42356 Phil Davis
	$changes_applied = true;
46 ce9abebd Ermal Luci
	$retval = 0;
47
	/* reload all components that use igmpproxy */
48 44c42356 Phil Davis
	$retval |= services_igmpproxy_configure();
49 6833c9cd Ermal Lu?i
50
	clear_subsystem_dirty('igmpproxy');
51 ce9abebd Ermal Luci
}
52
53 6b3e3bc5 PiBa-NL
if (isset($config['igmpproxy']['enable'])) {
54
	$pconfig['enable'] = true;
55
}
56 7f5cb422 jim-p
$pconfig['igmpxverbose'] = isset($config['syslog']['igmpxverbose']);
57 6b3e3bc5 PiBa-NL
58
if ($_POST['save']) {
59 1098cb94 Viktor G
	unset($input_errors);
60 6b3e3bc5 PiBa-NL
	$pconfig = $_POST;
61 1098cb94 Viktor G
62 6b3e3bc5 PiBa-NL
	if (isset($pconfig['enable'])) {
63 1098cb94 Viktor G
		if (is_array($config['igmpproxy']['igmpentry']) && 
64
		    !empty($config['igmpproxy']['igmpentry'])) {
65
			foreach ($config['igmpproxy']['igmpentry'] as $igmpcf) {
66
				if ($igmpcf['type'] == 'upstream') {
67
				       $upstream = true;	
68
				} else {
69
				       $downstream = true;	
70
				}
71
			}
72
		}
73
		if (!$upstream || !$downstream) {
74
			$input_errors[] = gettext("At least one upstream and one downstream interface must be added.");
75
		}
76
	}
77
78
	if (!$input_errors) {
79
		if (isset($pconfig['enable'])) {
80 721fafba Christian McDonald
			config_set_path('igmpproxy/enable', true);
81 1098cb94 Viktor G
		} else {
82 6e081414 Christian McDonald
			config_del_path('igmpproxy/enable');
83 1098cb94 Viktor G
		}
84 721fafba Christian McDonald
		config_set_path('syslog/igmpxverbose', $_POST['igmpxverbose'] ? true : false);
85 1098cb94 Viktor G
		write_config("IGMP Proxy settings saved");
86
		mark_subsystem_dirty('igmpproxy');
87
		header("Location: services_igmpproxy.php");
88
		exit;
89 6b3e3bc5 PiBa-NL
	}
90
}
91
92 13541a81 Steve Beaver
if ($_POST['act'] == "del") {
93
	if ($a_igmpproxy[$_POST['id']]) {
94
		unset($a_igmpproxy[$_POST['id']]);
95 e85ae672 Renato Botelho do Couto
		write_config("IGMP Proxy item deleted");
96 4bbfe029 Ermal Lu?i
		mark_subsystem_dirty('igmpproxy');
97 ce9abebd Ermal Luci
		header("Location: services_igmpproxy.php");
98
		exit;
99
	}
100
}
101
102 c0bf7858 Phil Davis
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
103 ce9abebd Ermal Luci
include("head.inc");
104
105 1098cb94 Viktor G
if ($input_errors) {
106
	print_input_errors($input_errors);
107
}
108
109 44c42356 Phil Davis
if ($changes_applied) {
110
	print_apply_result_box($retval);
111 20db3e1a Phil Davis
}
112 3d0f579f sbeaver
113 20db3e1a Phil Davis
if (is_subsystem_dirty('igmpproxy')) {
114 06ca4e2d NOYB
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
115 20db3e1a Phil Davis
}
116 ce9abebd Ermal Luci
?>
117
118 6b3e3bc5 PiBa-NL
<?php
119
120
$form = new Form();
121
122
$section = new Form_Section('General IGMP Options');
123
124
$section->addInput(new Form_Checkbox(
125
	'enable',
126
	'Enable',
127
	'Enable IGMP',
128
	$pconfig['enable']
129
));
130
131 e63373a6 jim-p
$section->addInput(new Form_Checkbox(
132 7f5cb422 jim-p
	'igmpxverbose',
133
	'Verbose Logging',
134
	'Enable verbose logging (Default is terse logging)',
135
	$pconfig['igmpxverbose']
136
));
137
138 6b3e3bc5 PiBa-NL
$form->add($section);
139
140
print($form);
141
142 179377b0 robjarsen
?>
143 ce9abebd Ermal Luci
<form action="services_igmpproxy.php" method="post">
144 060ed238 Stephen Beaver
	<div class="panel panel-default">
145
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
146
		<div class="panel-body">
147
			<div class="table-responsive">
148 1c10ce97 PiBa-NL
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
149 060ed238 Stephen Beaver
					<thead>
150
						<tr>
151
							<th><?=gettext("Name")?></th>
152
							<th><?=gettext("Type")?></th>
153
							<th><?=gettext("Values")?></th>
154
							<th><?=gettext("Description")?></th>
155 70dc5cd6 Phil Davis
							<th><?=gettext("Actions")?></th>
156 060ed238 Stephen Beaver
						</tr>
157
					</thead>
158
					<tbody>
159 3d0f579f sbeaver
<?php
160
$i = 0;
161
foreach ($a_igmpproxy as $igmpentry):
162
?>
163 060ed238 Stephen Beaver
						<tr>
164
							<td>
165
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
166
							</td>
167
							<td>
168
								<?=htmlspecialchars($igmpentry['type'])?>
169
							</td>
170
							<td>
171 3d0f579f sbeaver
<?php
172 ce9abebd Ermal Luci
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
173 261916e5 jim-p
	print(htmlspecialchars($addresses));
174 3d0f579f sbeaver
175 46631db4 Steve Beaver
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
176 3d0f579f sbeaver
		print(' ');
177 ce9abebd Ermal Luci
	} else {
178 3d0f579f sbeaver
		print('...');
179 ce9abebd Ermal Luci
	}
180 3d0f579f sbeaver
?>
181 060ed238 Stephen Beaver
							</td>
182
							<td>
183
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
184
							</td>
185
							<td>
186
								<a class="fa fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
187 13541a81 Steve Beaver
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
188 060ed238 Stephen Beaver
							</td>
189
						</tr>
190 3d0f579f sbeaver
<?php
191
	$i++;
192
endforeach;
193
?>
194 060ed238 Stephen Beaver
					</tbody>
195
				</table>
196
			</div>
197
		</div>
198 ac950976 Colin Fleming
	</div>
199 ce9abebd Ermal Luci
</form>
200 3d0f579f sbeaver
201 c10cb196 Stephen Beaver
<nav class="action-buttons">
202 c9679d8c Stephen Beaver
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
203 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
204 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
205
	</a>
206
</nav>
207
208 35681930 Stephen Beaver
<div class="infoblock">
209 06ca4e2d NOYB
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
210 f6aebbcc NewEraCracker
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
211 c9679d8c Stephen Beaver
</div>
212 3d0f579f sbeaver
<?php
213 5d3914a9 heper
include("foot.inc");