Project

General

Profile

Download (4.43 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gif.php
5

    
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	Copyright (C) 2008 Ermal Luçi
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE: interfaces
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-interfaces-gif
38
##|*NAME=Interfaces: GIF page
39
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
40
##|*MATCH=interfaces_gif.php*
41
##|-PRIV
42

    
43
require("guiconfig.inc");
44

    
45
if (!is_array($config['gifs']['gif'])) {
46
	$config['gifs']['gif'] = array();
47
}
48

    
49
$a_gifs = &$config['gifs']['gif'] ;
50

    
51
function gif_inuse($num) {
52
	global $config, $a_gifs;
53

    
54
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
57
			return true;
58
		}
59
	}
60

    
61
	return false;
62
}
63

    
64
if ($_GET['act'] == "del") {
65
	if (!isset($_GET['id'])) {
66
		$input_errors[] = gettext("Wrong parameters supplied");
67
	} else if (empty($a_gifs[$_GET['id']])) {
68
		$input_errors[] = gettext("Wrong index supplied");
69
	/* check if still in use */
70
	} else if (gif_inuse($_GET['id'])) {
71
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
72
	} else {
73
		mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
74
		unset($a_gifs[$_GET['id']]);
75

    
76
		write_config();
77

    
78
		header("Location: interfaces_gif.php");
79
		exit;
80
	}
81
}
82

    
83
$pgtitle = array(gettext("Interfaces"), gettext("GIF"));
84
$shortcut_section = "interfaces";
85
include("head.inc");
86

    
87
if ($input_errors)
88
	print_input_errors($input_errors);
89

    
90
$tab_array = array();
91
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
92
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
93
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
94
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
95
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
96
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
97
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
98
$tab_array[] = array(gettext("GIF"), true, "interfaces_gif.php");
99
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
100
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
101
display_top_tabs($tab_array);
102
?>
103

    
104
<div class="table-responsive">
105
	<table class="table table-striped table-hover table-condensed">
106
		<thead>
107
			<tr>
108
				<th><?=gettext("Interface"); ?></th>
109
				<th><?=gettext("Tunnel to &hellip;"); ?></th>
110
				<th><?=gettext("Description"); ?></th>
111
				<th></th>
112
			</tr>
113
		</thead>
114
		<tbody>
115
<?php foreach ($a_gifs as $i => $gif): ?>
116
			<tr>
117
				<td>
118
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']))?>
119
				</td>
120
				<td>
121
					<?=htmlspecialchars($gif['remote-addr'])?>
122
				</td>
123
				<td>
124
					<?=htmlspecialchars($gif['descr'])?>
125
				</td>
126
				<td>
127
					<a href="interfaces_gif_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
128
					<a href="interfaces_gif.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
129
				</td>
130
			</tr>
131
<?php endforeach; ?>
132
		</tbody>
133
	</table>
134
</div>
135

    
136
<nav class="action-buttons">
137
	<a href="interfaces_gif_edit.php" class="btn btn-success">
138
		<?=gettext("Add")?>
139
	</a>
140
</nav>
141

    
142
<?php include("foot.inc");
(87-87/235)