Project

General

Profile

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

    
62
##|+PRIV
63
##|*IDENT=page-services-igmpproxy
64
##|*NAME=Services: IGMP Proxy
65
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
66
##|*MATCH=services_igmpproxy.php*
67
##|-PRIV
68

    
69
require("guiconfig.inc");
70

    
71
if (!is_array($config['igmpproxy']['igmpentry'])) {
72
	$config['igmpproxy']['igmpentry'] = array();
73
}
74

    
75
//igmpproxy_sort();
76
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
77

    
78
if ($_POST) {
79
	$pconfig = $_POST;
80

    
81
	$retval = 0;
82
	/* reload all components that use igmpproxy */
83
	$retval = services_igmpproxy_configure();
84

    
85
	if (stristr($retval, "error") <> true) {
86
		$savemsg = get_std_save_message($retval);
87
	} else {
88
		$savemsg = $retval;
89
	}
90

    
91
	clear_subsystem_dirty('igmpproxy');
92
}
93

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

    
104
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
105
include("head.inc");
106

    
107
if ($savemsg)
108
	print_info_box($savemsg, 'success');
109

    
110
if (is_subsystem_dirty('igmpproxy'))
111
	print_info_box_np(gettext('The IGMP entry list has been changed.' . '<br />' . 'You must apply the changes in order for them to take effect.'));
112
?>
113

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

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

    
167
<nav class="action-buttons">
168
	<button id="submit" name="submit" type="submit" class="btn btn-primary btn-sm" value="<?=gettext("Save")?>">
169
		<i class="fa fa-save icon-embed-btn"></i>
170
		<?=gettext("Save")?>
171
	</button>
172
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
173
		<i class="fa fa-plus icon-embed-btn"></i>
174
		<?=gettext('Add')?>
175
	</a>
176
</nav>
177

    
178
<div id="infoblock">
179
<?=print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces you would like the proxy to allow. ' .
180
					   'Only one "upstream" interface can be configured.'), info)?>
181
</div>
182
<?php
183
include("foot.inc");
(141-141/228)