Project

General

Profile

Download (5.81 KB) Statistics
| Branch: | Tag: | Revision:
1 0ec2fdf0 Ermal Lu?i
<?php
2
/*
3
	Copyright (C) 2009 Ermal Lu?i
4
	Copyright (C) 2004 Scott Ullrich
5
	All rights reserved.
6
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28 7ac5a4cb Scott Ullrich
/*
29
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
30
	pfSense_MODULE:	interfaces
31
*/
32 0ec2fdf0 Ermal Lu?i
33
##|+PRIV
34
##|*IDENT=page-interfaces-groups
35
##|*NAME=Interfaces: Groups page
36
##|*DESCR=Create interface groups
37
##|*MATCH=interfaces_groups.php*
38
##|-PRIV
39
40
require("guiconfig.inc");
41
42
if (!is_array($config['ifgroups']['ifgroupentry']))
43
	$config['ifgroups']['ifgroupentry'] = array();
44
45
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
46
47
if ($_GET['act'] == "del") {
48
	if ($a_ifgroups[$_GET['id']]) {
49 42753d25 Ermal Lu?i
		$members = explode(" ", $a_ifgroups[$_GET[$id]]);
50
		foreach ($members as $ifs) {
51
			$realif = get_real_interface($ifs);
52
			if ($realif)
53
				mwexec("/sbin/ifconfig  {$realif} -group " . $a_ifgroups[$_GET[$id]]['ifname']);
54
		}
55 0ec2fdf0 Ermal Lu?i
		unset($a_ifgroups[$_GET['id']]);
56
		write_config();
57
		header("Location: interfaces_groups.php");
58
		exit;
59
	}
60
}
61
62
$pgtitle = array("Interfaces","Groups");
63
include("head.inc");
64
65
?>
66
67
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
68
<?php include("fbegin.inc"); ?>
69
70
<table width="100%" border="0" cellpadding="0" cellspacing="0">
71
  <tr><td>
72
<?php
73 d02951e9 gnhb
	$tab_array = array();
74
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
75 0ec2fdf0 Ermal Lu?i
	$tab_array[1] = array("Interface Groups", true, "interfaces_groups.php");
76 79637b03 Erik Fonnesbeck
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
77 d02951e9 gnhb
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
78
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
79 42809b4a gnhb
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
80 0661b194 gnhb
	$tab_array[6] = array("GRE", false, "interfaces_gre.php");
81
	$tab_array[7] = array("GIF", false, "interfaces_gif.php");
82
	$tab_array[8] = array("Bridges", false, "interfaces_bridge.php");
83
	$tab_array[9] = array("LAGG", false, "interfaces_lagg.php");
84 d02951e9 gnhb
	display_top_tabs($tab_array);
85 0ec2fdf0 Ermal Lu?i
?>
86
  </td></tr>
87
<tr>
88
    <td>
89
        <div id="mainarea">
90
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
91
92
<tr>
93
  <td width="15%" class="listhdrr">Name</td>
94
  <td width="35%" class="listhdrr">Members</td>
95
  <td width="25%" class="listhdr">Description</td>
96
  <td width="5%" class="list"></td>
97
</tr>
98
	  <?php if (count ($a_ifgroups)):
99
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
100
<tr>
101
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
102 22e6d572 Ermal Lu?i
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
103 0ec2fdf0 Ermal Lu?i
  </td>
104
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
105
      <?php
106 42753d25 Ermal Lu?i
	$members_arr = explode(" ", $ifgroupentry['members']);
107 0ec2fdf0 Ermal Lu?i
	$iflist = get_configured_interface_with_descr();
108 22e6d572 Ermal Lu?i
	$memberses_arr = array();
109 0ec2fdf0 Ermal Lu?i
	foreach ($members_arr as $memb)
110
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
111
	$memberses = implode(", ", $memberses_arr);
112
	echo $memberses;
113
	if(count($members_arr) < 10) {
114
		echo " ";
115
	} else {
116
		echo "...";
117
	}
118
    ?>
119
  </td>
120
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
121
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
122
  </td>
123
  <td valign="middle" nowrap class="list">
124
    <table border="0" cellspacing="0" cellpadding="1">
125
      <tr>
126
        <td valign="middle"><a href="interfaces_groups_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit group"></a></td>
127 42753d25 Ermal Lu?i
        <td><a href="interfaces_groups.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete ifgroupentry"></a></td>
128 0ec2fdf0 Ermal Lu?i
      </tr>
129
    </table>
130
  </td>
131
</tr>
132
	  <?php $i++; endforeach; endif;?>
133
<tr>
134
  <td class="list" colspan="3"></td>
135
  <td class="list">
136
    <table border="0" cellspacing="0" cellpadding="1">
137
      <tr>
138
	<td valign="middle" width="17">&nbsp;</td>
139
        <td valign="middle"><a href="interfaces_groups_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add a new group"></a></td>
140
        </td>
141
      </tr>
142
    </table>
143
  </td>
144
</tr>
145
<tr>
146
  <td class="tabcont" colspan="3">
147 d8ba56f6 Chris Buechler
	<p><span class="vexpl"><span class="red"><strong>Note:<br></strong></span>Interface Groups allow you to create rules that apply to multiple interfaces without duplicating the rules. If you remove members from an interface group, the group rules no longer apply to that interface.</span></p>
148 0ec2fdf0 Ermal Lu?i
	</td>
149
</tr>
150
	</table>
151
	</div>
152
 </td>
153
</tr>
154
</table>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>