Project

General

Profile

Download (5.94 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gre.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-gre
38
##|*NAME=Interfaces: GRE page
39
##|*DESCR=Allow access to the 'Interfaces: GRE' page.
40
##|*MATCH=interfaces_gre.php*
41
##|-PRIV
42

    
43
require("guiconfig.inc");
44
require_once("functions.inc");
45

    
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
	global $config, $a_gres;
53

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

    
60
	return false;
61
}
62

    
63
if ($_GET['act'] == "del") {
64
	if (!isset($_GET['id']))
65
                $input_errors[] = gettext("Wrong parameters supplied");
66
        else if (empty($a_gres[$_GET['id']]))
67
                $input_errors[] = gettext("Wrong index supplied");
68
	/* check if still in use */
69
	else if (gre_inuse($_GET['id'])) {
70
		$input_errors[] = gettext("This GRE tunnel cannot be deleted because it is still being used as an interface.");
71
	} 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
$pgtitle = array(gettext("Interfaces"),gettext("GRE"));
83
$shortcut_section = "interfaces";
84
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
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces gre">
92
  <tr><td>
93
<?php
94
	$tab_array = array();
95
	$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
	display_top_tabs($tab_array);
106
?>
107
  </td></tr>
108
  <tr>
109
    <td>
110
	<div id="mainarea">
111
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
112
                <tr>
113
                  <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
                  <td width="10%" class="list"></td>
117
				</tr>
118
			  <?php $i = 0; foreach ($a_gres as $gre): ?>
119
                <tr  ondblclick="document.location='interfaces_gre_edit.php?id=<?=$i;?>'">
120
                  <td class="listlr">
121
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));?>
122
                  </td>
123
                  <td class="listr">
124
					<?=htmlspecialchars($gre['remote-addr']);?>
125
                  </td>
126
                  <td class="listbg">
127
                    <?=htmlspecialchars($gre['descr']);?>&nbsp;
128
                  </td>
129
                  <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
				</tr>
132
			  <?php $i++; endforeach; ?>
133
                <tr>
134
                  <td class="list" colspan="3">&nbsp;</td>
135
                  <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
				</tr>
137
        <tr>
138
                <td class="tabcont" colspan="3">
139
                    <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
                    </td>
141
                </tr>
142
              </table>
143
	      </div>
144
	</td>
145
	</tr>
146
</table>
147
<?php include("fend.inc"); ?>
148
</body>
149
</html>
(101-101/256)