Project

General

Profile

Download (4.81 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-2020 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
//igmpproxy_sort();
36

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

    
40
if ($_POST['apply']) {
41
	$pconfig = $_POST;
42

    
43
	$changes_applied = true;
44
	$retval = 0;
45
	/* reload all components that use igmpproxy */
46
	$retval |= services_igmpproxy_configure();
47

    
48
	clear_subsystem_dirty('igmpproxy');
49
}
50

    
51
if (isset($config['igmpproxy']['enable'])) {
52
	$pconfig['enable'] = true;
53
}
54
$pconfig['igmpxverbose'] = isset($config['syslog']['igmpxverbose']);
55

    
56
if ($_POST['save']) {
57
	$pconfig = $_POST;
58
	if (isset($pconfig['enable'])) {
59
		$config['igmpproxy']['enable'] = true;
60
	} else {
61
		unset($config['igmpproxy']['enable']);
62
	}
63
	$config['syslog']['igmpxverbose'] = $_POST['igmpxverbose'] ? true : false;
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
$section->addInput(new Form_Checkbox(
105
	'igmpxverbose',
106
	'Verbose Logging',
107
	'Enable verbose logging (Default is terse logging)',
108
	$pconfig['igmpxverbose']
109
));
110

    
111
$form->add($section);
112

    
113
print($form);
114

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

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

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

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