Project

General

Profile

Download (5.85 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-2016 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
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are met:
15
 *
16
 * 1. Redistributions of source code must retain the above copyright notice,
17
 *    this list of conditions and the following disclaimer.
18
 *
19
 * 2. Redistributions in binary form must reproduce the above copyright
20
 *    notice, this list of conditions and the following disclaimer in
21
 *    the documentation and/or other materials provided with the
22
 *    distribution.
23
 *
24
 * 3. All advertising materials mentioning features or use of this software
25
 *    must display the following acknowledgment:
26
 *    "This product includes software developed by the pfSense Project
27
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
28
 *
29
 * 4. The names "pfSense" and "pfSense Project" must not be used to
30
 *    endorse or promote products derived from this software without
31
 *    prior written permission. For written permission, please contact
32
 *    coreteam@pfsense.org.
33
 *
34
 * 5. Products derived from this software may not be called "pfSense"
35
 *    nor may "pfSense" appear in their names without prior written
36
 *    permission of the Electric Sheep Fencing, LLC.
37
 *
38
 * 6. Redistributions of any form whatsoever must retain the following
39
 *    acknowledgment:
40
 *
41
 * "This product includes software developed by the pfSense Project
42
 * for use in the pfSense software distribution (http://www.pfsense.org/).
43
 *
44
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
45
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
48
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55
 * OF THE POSSIBILITY OF SUCH DAMAGE.
56
 */
57

    
58
##|+PRIV
59
##|*IDENT=page-services-igmpproxy
60
##|*NAME=Services: IGMP Proxy
61
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
62
##|*MATCH=services_igmpproxy.php*
63
##|-PRIV
64

    
65
require_once("guiconfig.inc");
66

    
67
if (!is_array($config['igmpproxy']['igmpentry'])) {
68
	$config['igmpproxy']['igmpentry'] = array();
69
}
70

    
71
//igmpproxy_sort();
72
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
73

    
74
if ($_POST) {
75
	$pconfig = $_POST;
76

    
77
	$retval = 0;
78
	/* reload all components that use igmpproxy */
79
	$retval = services_igmpproxy_configure();
80

    
81
	if (stristr($retval, "error") <> true) {
82
		$savemsg = get_std_save_message($retval);
83
	} else {
84
		$savemsg = $retval;
85
	}
86

    
87
	clear_subsystem_dirty('igmpproxy');
88
}
89

    
90
if ($_GET['act'] == "del") {
91
	if ($a_igmpproxy[$_GET['id']]) {
92
		unset($a_igmpproxy[$_GET['id']]);
93
		write_config();
94
		mark_subsystem_dirty('igmpproxy');
95
		header("Location: services_igmpproxy.php");
96
		exit;
97
	}
98
}
99

    
100
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
101
include("head.inc");
102

    
103
if ($savemsg) {
104
	print_info_box($savemsg, 'success');
105
}
106

    
107
if (is_subsystem_dirty('igmpproxy')) {
108
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
109
}
110
?>
111

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

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

    
170
<nav class="action-buttons">
171
	<button id="submit" name="submit" type="submit" class="btn btn-primary btn-sm" value="<?=gettext("Save")?>">
172
		<i class="fa fa-save icon-embed-btn"></i>
173
		<?=gettext("Save")?>
174
	</button>
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");
(130-130/227)