Project

General

Profile

Download (5.94 KB) Statistics
| Branch: | Tag: | Revision:
1 ead45104 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gre.php
5
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 1d7ba683 ayvis
	Copyright (C) 2008 Ermal Luçi
8 ead45104 Ermal Luçi
	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 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE:	interfaces
34
*/
35 ead45104 Ermal Luçi
36 6b07c15a Matthew Grooms
##|+PRIV
37
##|*IDENT=page-interfaces-gre
38
##|*NAME=Interfaces: GRE page
39
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
40
##|*MATCH=interfaces_gre.php*
41
##|-PRIV
42
43 ead45104 Ermal Luçi
require("guiconfig.inc");
44 cea05ee9 Carlos Eduardo Ramos
require_once("functions.inc");
45 ead45104 Ermal Luçi
46
if (!is_array($config['gres']['gre']))
47
	$config['gres']['gre'] = array();
48
49
$a_gres = &$config['gres']['gre'] ;
50
51
function gre_inuse($num) {
52 c059940b Erik Fonnesbeck
	global $config, $a_gres;
53 ead45104 Ermal Luçi
54
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56 2eedb548 Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_gres[$num]['greif']) 
57 ead45104 Ermal Luçi
			return true;
58
	}
59
60
	return false;
61
}
62
63
if ($_GET['act'] == "del") {
64 0e22dda5 Ermal
	if (!isset($_GET['id']))
65 29af6265 Phil Davis
                $input_errors[] = gettext("Wrong parameters supplied");
66 0e22dda5 Ermal
        else if (empty($a_gres[$_GET['id']]))
67 29af6265 Phil Davis
                $input_errors[] = gettext("Wrong index supplied");
68 ead45104 Ermal Luçi
	/* check if still in use */
69 0e22dda5 Ermal
	else if (gre_inuse($_GET['id'])) {
70 dcc85b42 Rafael Lucas
		$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
71 ead45104 Ermal Luçi
	} else {
72
		mwexec("/sbin/ifconfig " . $a_gres[$_GET['id']]['greif'] . " destroy");
73
		unset($a_gres[$_GET['id']]);
74
75
		write_config();
76
77
		header("Location: interfaces_gre.php");
78
		exit;
79
	}
80
}
81
82 dcc85b42 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("GRE"));
83 b32dd0a6 jim-p
$shortcut_section = "interfaces";
84 ead45104 Ermal Luçi
include("head.inc");
85
86
?>
87
88
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
89
<?php include("fbegin.inc"); ?>
90
<?php if ($input_errors) print_input_errors($input_errors); ?>
91 d9ad41af Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces gre">
92 ead45104 Ermal Luçi
  <tr><td>
93
<?php
94
	$tab_array = array();
95 dcc85b42 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
96
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
97
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
98
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
99
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
100
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
101
	$tab_array[6] = array(gettext("GRE"), true, "interfaces_gre.php");
102
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
103
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
104
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
105 ead45104 Ermal Luçi
	display_top_tabs($tab_array);
106
?>
107
  </td></tr>
108
  <tr>
109
    <td>
110
	<div id="mainarea">
111 d9ad41af Colin Fleming
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
112 ead45104 Ermal Luçi
                <tr>
113 dcc85b42 Rafael Lucas
                  <td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
114
                  <td width="20%" class="listhdrr"><?=gettext("Tunnel to...");?></td>
115
                  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
116 ead45104 Ermal Luçi
                  <td width="10%" class="list"></td>
117
				</tr>
118
			  <?php $i = 0; foreach ($a_gres as $gre): ?>
119 503f3c65 jim-p
                <tr  ondblclick="document.location='interfaces_gre_edit.php?id=<?=$i;?>'">
120 ead45104 Ermal Luçi
                  <td class="listlr">
121 d76f45b1 Ermal
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));?>
122 ead45104 Ermal Luçi
                  </td>
123
                  <td class="listr">
124
					<?=htmlspecialchars($gre['remote-addr']);?>
125
                  </td>
126
                  <td class="listbg">
127
                    <?=htmlspecialchars($gre['descr']);?>&nbsp;
128
                  </td>
129 d9ad41af Colin Fleming
                  <td valign="middle" class="list nowrap"> <a href="interfaces_gre_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
130
                     &nbsp;<a href="interfaces_gre.php?act=del&amp;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" alt="delete" /></a></td>
131 ead45104 Ermal Luçi
				</tr>
132
			  <?php $i++; endforeach; ?>
133
                <tr>
134
                  <td class="list" colspan="3">&nbsp;</td>
135 d9ad41af Colin Fleming
                  <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" alt="add" /></a></td>
136 ead45104 Ermal Luçi
				</tr>
137 b040124a Chris Buechler
        <tr>
138
                <td class="tabcont" colspan="3">
139 1d7ba683 ayvis
                    <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>
140 b040124a Chris Buechler
                    </td>
141
                </tr>
142 ead45104 Ermal Luçi
              </table>
143
	      </div>
144
	</td>
145
	</tr>
146
</table>
147
<?php include("fend.inc"); ?>
148
</body>
149
</html>