Project

General

Profile

Download (5.48 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 a68f7a3d Luiz Otavio O Souza
 * Copyright (c) 2014-2024 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 63d6bb4f Marcos Mendoza
config_init_path('igmpproxy/igmpentry');
40 ce9abebd Ermal Luci
41 1cd02ef7 PiBa-NL
if ($_POST['apply']) {
42 ce9abebd Ermal Luci
	$pconfig = $_POST;
43
44 44c42356 Phil Davis
	$changes_applied = true;
45 ce9abebd Ermal Luci
	/* reload all components that use igmpproxy */
46 a38aa6d7 Kristof Provost
	if (services_igmpproxy_configure()) {
47
		$retval = 0;
48
	} else {
49
		$retval = 1;
50
	}
51 6833c9cd Ermal Lu?i
52
	clear_subsystem_dirty('igmpproxy');
53 ce9abebd Ermal Luci
}
54
55 63d6bb4f Marcos Mendoza
if (config_path_enabled('igmpproxy')) {
56 6b3e3bc5 PiBa-NL
	$pconfig['enable'] = true;
57
}
58 63d6bb4f Marcos Mendoza
$pconfig['igmpxverbose'] = config_path_enabled('syslog', 'igmpxverbose');
59 6b3e3bc5 PiBa-NL
60
if ($_POST['save']) {
61 1098cb94 Viktor G
	unset($input_errors);
62 6b3e3bc5 PiBa-NL
	$pconfig = $_POST;
63 1098cb94 Viktor G
64 6b3e3bc5 PiBa-NL
	if (isset($pconfig['enable'])) {
65 63d6bb4f Marcos Mendoza
		foreach (config_get_path('igmpproxy/igmpentry', []) as $igmpcf) {
66
			if ($igmpcf['type'] == 'upstream') {
67
				$upstream = true;	
68
			} else {
69
				$downstream = true;	
70 1098cb94 Viktor G
			}
71
		}
72
		if (!$upstream || !$downstream) {
73
			$input_errors[] = gettext("At least one upstream and one downstream interface must be added.");
74
		}
75
	}
76
77
	if (!$input_errors) {
78
		if (isset($pconfig['enable'])) {
79 721fafba Christian McDonald
			config_set_path('igmpproxy/enable', true);
80 1098cb94 Viktor G
		} else {
81 6e081414 Christian McDonald
			config_del_path('igmpproxy/enable');
82 1098cb94 Viktor G
		}
83 721fafba Christian McDonald
		config_set_path('syslog/igmpxverbose', $_POST['igmpxverbose'] ? true : false);
84 1098cb94 Viktor G
		write_config("IGMP Proxy settings saved");
85
		mark_subsystem_dirty('igmpproxy');
86
		header("Location: services_igmpproxy.php");
87
		exit;
88 6b3e3bc5 PiBa-NL
	}
89
}
90
91 13541a81 Steve Beaver
if ($_POST['act'] == "del") {
92 63d6bb4f Marcos Mendoza
	if (config_get_path("igmpproxy/igmpentry/{$_POST['id']}")) {
93
		config_del_path("igmpproxy/igmpentry/{$_POST['id']}");
94 e85ae672 Renato Botelho do Couto
		write_config("IGMP Proxy item deleted");
95 4bbfe029 Ermal Lu?i
		mark_subsystem_dirty('igmpproxy');
96 ce9abebd Ermal Luci
		header("Location: services_igmpproxy.php");
97
		exit;
98
	}
99
}
100
101 c0bf7858 Phil Davis
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
102 ce9abebd Ermal Luci
include("head.inc");
103
104 1098cb94 Viktor G
if ($input_errors) {
105
	print_input_errors($input_errors);
106
}
107
108 44c42356 Phil Davis
if ($changes_applied) {
109
	print_apply_result_box($retval);
110 20db3e1a Phil Davis
}
111 3d0f579f sbeaver
112 20db3e1a Phil Davis
if (is_subsystem_dirty('igmpproxy')) {
113 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.'));
114 20db3e1a Phil Davis
}
115 ce9abebd Ermal Luci
?>
116
117 6b3e3bc5 PiBa-NL
<?php
118
119
$form = new Form();
120
121
$section = new Form_Section('General IGMP Options');
122
123
$section->addInput(new Form_Checkbox(
124
	'enable',
125
	'Enable',
126
	'Enable IGMP',
127
	$pconfig['enable']
128
));
129
130 e63373a6 jim-p
$section->addInput(new Form_Checkbox(
131 7f5cb422 jim-p
	'igmpxverbose',
132
	'Verbose Logging',
133
	'Enable verbose logging (Default is terse logging)',
134
	$pconfig['igmpxverbose']
135
));
136
137 6b3e3bc5 PiBa-NL
$form->add($section);
138
139
print($form);
140
141 179377b0 robjarsen
?>
142 ce9abebd Ermal Luci
<form action="services_igmpproxy.php" method="post">
143 060ed238 Stephen Beaver
	<div class="panel panel-default">
144
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
145
		<div class="panel-body">
146
			<div class="table-responsive">
147 1c10ce97 PiBa-NL
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
148 060ed238 Stephen Beaver
					<thead>
149
						<tr>
150
							<th><?=gettext("Name")?></th>
151
							<th><?=gettext("Type")?></th>
152
							<th><?=gettext("Values")?></th>
153
							<th><?=gettext("Description")?></th>
154 70dc5cd6 Phil Davis
							<th><?=gettext("Actions")?></th>
155 060ed238 Stephen Beaver
						</tr>
156
					</thead>
157
					<tbody>
158 3d0f579f sbeaver
<?php
159
$i = 0;
160 4b9165e5 Marcos Mendoza
foreach (config_get_path('igmpproxy/igmpentry', []) as $igmpentry):
161 3d0f579f sbeaver
?>
162 060ed238 Stephen Beaver
						<tr>
163
							<td>
164
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
165
							</td>
166
							<td>
167
								<?=htmlspecialchars($igmpentry['type'])?>
168
							</td>
169
							<td>
170 3d0f579f sbeaver
<?php
171 ce9abebd Ermal Luci
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
172 261916e5 jim-p
	print(htmlspecialchars($addresses));
173 3d0f579f sbeaver
174 46631db4 Steve Beaver
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
175 3d0f579f sbeaver
		print(' ');
176 ce9abebd Ermal Luci
	} else {
177 3d0f579f sbeaver
		print('...');
178 ce9abebd Ermal Luci
	}
179 3d0f579f sbeaver
?>
180 060ed238 Stephen Beaver
							</td>
181
							<td>
182
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
183
							</td>
184
							<td>
185 e0cb987c Marcos Mendoza
								<a class="fa-solid fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
186 c1d304b3 Marcos Mendoza
								<a class="fa-solid fa-trash-can"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
187 060ed238 Stephen Beaver
							</td>
188
						</tr>
189 3d0f579f sbeaver
<?php
190
	$i++;
191
endforeach;
192
?>
193 060ed238 Stephen Beaver
					</tbody>
194
				</table>
195
			</div>
196
		</div>
197 ac950976 Colin Fleming
	</div>
198 ce9abebd Ermal Luci
</form>
199 3d0f579f sbeaver
200 c10cb196 Stephen Beaver
<nav class="action-buttons">
201 c9679d8c Stephen Beaver
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
202 e0cb987c Marcos Mendoza
		<i class="fa-solid fa-plus icon-embed-btn"></i>
203 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
204
	</a>
205
</nav>
206
207 35681930 Stephen Beaver
<div class="infoblock">
208 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. ' .
209 f6aebbcc NewEraCracker
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
210 c9679d8c Stephen Beaver
</div>
211 3d0f579f sbeaver
<?php
212 5d3914a9 heper
include("foot.inc");