Project

General

Profile

Download (6.2 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
$a_gifs = &$config['gifs']['gif'] ;
49

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

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

    
59
	return false;
60
}
61

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

    
74
		write_config();
75

    
76
		header("Location: interfaces_gif.php");
77
		exit;
78
	}
79
}
80

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

    
85
?>
86

    
87
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
88
<?php include("fbegin.inc"); ?>
89
<?php if ($input_errors) print_input_errors($input_errors); ?>
90
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces gif">
91
  <tr><td>
92
<?php
93
	$tab_array = array();
94
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
95
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
96
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
97
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
98
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
99
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
100
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
101
	$tab_array[7] = array(gettext("GIF"), true, "interfaces_gif.php");
102
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
103
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
104
	display_top_tabs($tab_array);
105
?>
106
  </td></tr>
107
  <tr>
108
    <td>
109
	<div id="mainarea">
110
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
111
                <tr>
112
                  <td width="20%" class="listhdrr"><?=gettext("Interface"); ?></td>
113
                  <td width="20%" class="listhdrr"><?=gettext("Tunnel to..."); ?></td>
114
                  <td width="50%" class="listhdr"><?=gettext("Description"); ?></td>
115
                  <td width="10%" class="list"></td>
116
				</tr>
117
			  <?php $i = 0; foreach ($a_gifs as $gif): ?>
118
                <tr  ondblclick="document.location='interfaces_gif_edit.php?id=<?=$i;?>'">
119
                  <td class="listlr">
120
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']));?>
121
                  </td>
122
                  <td class="listr">
123
					<?=htmlspecialchars($gif['remote-addr']);?>
124
                  </td>
125
                  <td class="listbg">
126
                    <?=htmlspecialchars($gif['descr']);?>&nbsp;
127
                  </td>
128
                  <td valign="middle" class="list nowrap"> <a href="interfaces_gif_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
129
                     &nbsp;<a href="interfaces_gif.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this gif tunnel?"); ?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
130
				</tr>
131
			  <?php $i++; endforeach; ?>
132
                <tr>
133
                  <td class="list" colspan="3">&nbsp;</td>
134
                  <td class="list"> <a href="interfaces_gif_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
135
				</tr>
136
				<tr>
137
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
138
				  <?=gettext("Note:"); ?><br />
139
				  </strong></span>
140
				  <?=gettext("GIF tunnels are configured here."); ?>
141
				  <br /><br />
142
				  <?php echo gettext("If you are using a GIF tunnel to connect to a Hurricane Electric (he.net) Tunnel Broker on a WAN with a dynamic IP, you may want to add a"); ?> <a href="services_dyndns.php"><?php echo gettext("HE.net Tunnelbroker type DynDNS Entry"); ?></a> <?php echo gettext("to keep your tunnel functional when your IP changes."); ?></p>
143
				  </td>
144
				<td class="list">&nbsp;</td>
145
				</tr>
146
              </table>
147
	      </div>
148
	</td>
149
	</tr>
150
</table>
151
<?php include("fend.inc"); ?>
152
</body>
153
</html>
(99-99/256)