Project

General

Profile

Download (5.55 KB) Statistics
| Branch: | Tag: | Revision:
1 ead45104 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gre.php
5
6
	Copyright (C) 2008 Ermal Lu?i
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30 7ac5a4cb Scott Ullrich
/*
31
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
32
	pfSense_MODULE:	interfaces
33
*/
34 ead45104 Ermal Luçi
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-interfaces-gre
37
##|*NAME=Interfaces: GRE page
38
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
39
##|*MATCH=interfaces_gre.php*
40
##|-PRIV
41
42 ead45104 Ermal Luçi
require("guiconfig.inc");
43 cea05ee9 Carlos Eduardo Ramos
require_once("functions.inc");
44 ead45104 Ermal Luçi
45
if (!is_array($config['gres']['gre']))
46
	$config['gres']['gre'] = array();
47
48
$a_gres = &$config['gres']['gre'] ;
49
50
function gre_inuse($num) {
51 c059940b Erik Fonnesbeck
	global $config, $a_gres;
52 ead45104 Ermal Luçi
53
	$iflist = get_configured_interface_list(false, true);
54
	foreach ($iflist as $if) {
55 2eedb548 Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) 
56 ead45104 Ermal Luçi
			return true;
57
	}
58
59
	return false;
60
}
61
62
if ($_GET['act'] == "del") {
63
	/* check if still in use */
64
	if (gre_inuse($_GET['id'])) {
65 dcc85b42 Rafael Lucas
		$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
66 ead45104 Ermal Luçi
	} else {
67
		mwexec("/sbin/ifconfig " . $a_gres[$_GET['id']]['greif'] . " destroy");
68
		unset($a_gres[$_GET['id']]);
69
70
		write_config();
71
72
		header("Location: interfaces_gre.php");
73
		exit;
74
	}
75
}
76
77 dcc85b42 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("GRE"));
78 ead45104 Ermal Luçi
include("head.inc");
79
80
?>
81
82
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
83
<?php include("fbegin.inc"); ?>
84
<?php if ($input_errors) print_input_errors($input_errors); ?>
85
<table width="100%" border="0" cellpadding="0" cellspacing="0">
86
  <tr><td>
87
<?php
88
	$tab_array = array();
89 dcc85b42 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
90
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
91
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
92
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
93
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
94
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
95
	$tab_array[6] = array(gettext("GRE"), true, "interfaces_gre.php");
96
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
97
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
98
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
99 ead45104 Ermal Luçi
	display_top_tabs($tab_array);
100
?>
101
  </td></tr>
102
  <tr>
103
    <td>
104
	<div id="mainarea">
105
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
106
                <tr>
107 dcc85b42 Rafael Lucas
                  <td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
108
                  <td width="20%" class="listhdrr"><?=gettext("Tunnel to...");?></td>
109
                  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
110 ead45104 Ermal Luçi
                  <td width="10%" class="list"></td>
111
				</tr>
112
			  <?php $i = 0; foreach ($a_gres as $gre): ?>
113 503f3c65 jim-p
                <tr  ondblclick="document.location='interfaces_gre_edit.php?id=<?=$i;?>'">
114 ead45104 Ermal Luçi
                  <td class="listlr">
115 d76f45b1 Ermal
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));?>
116 ead45104 Ermal Luçi
                  </td>
117
                  <td class="listr">
118
					<?=htmlspecialchars($gre['remote-addr']);?>
119
                  </td>
120
                  <td class="listbg">
121
                    <?=htmlspecialchars($gre['descr']);?>&nbsp;
122
                  </td>
123
                  <td valign="middle" nowrap class="list"> <a href="interfaces_gre_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
124 e686e4d9 Vinicius Coque
                     &nbsp;<a href="interfaces_gre.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this GRE tunnel?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
125 ead45104 Ermal Luçi
				</tr>
126
			  <?php $i++; endforeach; ?>
127
                <tr>
128
                  <td class="list" colspan="3">&nbsp;</td>
129
                  <td class="list"> <a href="interfaces_gre_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
130
				</tr>
131 b040124a Chris Buechler
        <tr>
132
                <td class="tabcont" colspan="3">
133 49f1f471 Vinicius Coque
                    <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br></strong></span><?=gettext("Here you can configure Generic Routing Encapsulation (GRE - RFC 2784) tunnels.");?></span></p>
134 b040124a Chris Buechler
                    </td>
135
                </tr>
136 ead45104 Ermal Luçi
              </table>
137
	      </div>
138
	</td>
139
	</tr>
140
</table>
141
<?php include("fend.inc"); ?>
142
</body>
143
</html>