Project

General

Profile

Download (4.74 KB) Statistics
| Branch: | Tag: | Revision:
1 589f92bb gnhb
<?php
2 919d91f9 Phil Davis
/*
3 c5d81585 Renato Botelho
 * interfaces_ppps.php
4 191cb31d Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 402c98a2 Reid Linnemann
 * Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 b9043cdc Stephen Beaver
 *
11 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18 b9043cdc Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
20 b9043cdc Stephen Beaver
 *
21 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26 b9043cdc Stephen Beaver
 */
27 589f92bb gnhb
28
##|+PRIV
29 42809b4a gnhb
##|*IDENT=page-interfaces-ppps
30 9599211d jim-p
##|*NAME=Interfaces: PPPs
31
##|*DESCR=Allow access to the 'Interfaces: PPPs' page.
32 42809b4a gnhb
##|*MATCH=interfaces_ppps.php*
33 589f92bb gnhb
##|-PRIV
34
35 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
36 cfb9eb9f Carlos Eduardo Ramos
require_once("functions.inc");
37 589f92bb gnhb
38 e51cea69 gnhb
function ppp_inuse($num) {
39 c5ce8398 jim-p
	global $config, $g;
40 006d23d4 sbeaver
41 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
42 2af86dda Phil Davis
	if (!is_array($config['ppps']['ppp'])) {
43 c5ce8398 jim-p
		return false;
44 2af86dda Phil Davis
	}
45 c5ce8398 jim-p
46 42809b4a gnhb
	foreach ($iflist as $if) {
47 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
48 42809b4a gnhb
			return true;
49 2af86dda Phil Davis
		}
50 42809b4a gnhb
	}
51 006d23d4 sbeaver
52 42809b4a gnhb
	return false;
53 589f92bb gnhb
}
54
55 f34455d8 Steve Beaver
if ($_POST['act'] == "del") {
56 589f92bb gnhb
	/* check if still in use */
57 f34455d8 Steve Beaver
	if (ppp_inuse($_POST['id'])) {
58 f2047bd0 Rafael Lucas
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
59 f34455d8 Steve Beaver
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_POST['id']])) {
60 c5ce8398 jim-p
61 7e3ea4a8 Christian McDonald
		config_del_path("ppps/ppp/{$_POST['id']}/pppoe-reset-type");
62 f34455d8 Steve Beaver
		handle_pppoe_reset($config['ppps']['ppp'][$_POST['id']]);
63 7e3ea4a8 Christian McDonald
		config_del_path("ppps/ppp/{$_POST['id']}");
64 e85ae672 Renato Botelho do Couto
		write_config("PPP interface deleted");
65 42809b4a gnhb
		header("Location: interfaces_ppps.php");
66 589f92bb gnhb
		exit;
67
	}
68
}
69
70 1a5e85f6 Steve Beaver
if (!is_array($config['ppps'])) {
71 721fafba Christian McDonald
	config_set_path('ppps', array());
72 1a5e85f6 Steve Beaver
}
73
74 2af86dda Phil Davis
if (!is_array($config['ppps']['ppp'])) {
75 721fafba Christian McDonald
	config_set_path('ppps/ppp', array());
76 2af86dda Phil Davis
}
77 1a5e85f6 Steve Beaver
78 1e45d13f Christian McDonald
$a_ppps = config_get_path('ppps/ppp');
79 c5ce8398 jim-p
80 aa82505e Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
81 b32dd0a6 jim-p
$shortcut_section = "interfaces";
82 589f92bb gnhb
include("head.inc");
83
84 fc19062e Viktor G
if ($input_errors) {
85
	print_input_errors($input_errors);
86
}
87
88 68a7712c sbeaver
$tab_array = array();
89 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
90 006d23d4 sbeaver
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
91
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
92
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
93
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
94
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
95 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
96
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
97 006d23d4 sbeaver
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
98 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
99 68a7712c sbeaver
display_top_tabs($tab_array);
100 589f92bb gnhb
?>
101 060ed238 Stephen Beaver
<div class="panel panel-default">
102 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
103 060ed238 Stephen Beaver
	<div class="panel-body">
104
		<div class="table-responsive">
105 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
106 060ed238 Stephen Beaver
				<thead>
107
					<tr>
108 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
109
						<th><?=gettext("Interface(s)/Port(s)"); ?></th>
110
						<th><?=gettext("Description"); ?></th>
111
						<th><?=gettext("Actions")?></th>
112 060ed238 Stephen Beaver
					</tr>
113
				</thead>
114
				<tbody>
115 68a7712c sbeaver
<?php
116
117
$i = 0;
118 589f92bb gnhb
119 82db8285 Steve Beaver
120
if (is_array($a_ppps)) {
121 d35a18fc Christian McDonald
	foreach ($a_ppps as $ppp) {
122 68a7712c sbeaver
?>
123 060ed238 Stephen Beaver
					<tr>
124
						<td>
125
							<?=htmlspecialchars($ppp['if'])?>
126
						</td>
127
						<td>
128 68a7712c sbeaver
<?php
129
	$portlist = explode(",", $ppp['ports']);
130
	foreach ($portlist as $portid => $port) {
131 aa82505e Phil Davis
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
132 68a7712c sbeaver
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
133 aa82505e Phil Davis
		}
134 68a7712c sbeaver
	}
135 060ed238 Stephen Beaver
							echo htmlspecialchars(implode(",", $portlist));
136 68a7712c sbeaver
?>
137 060ed238 Stephen Beaver
						</td>
138
						<td>
139
							<?=htmlspecialchars($ppp['descr'])?>
140
						</td>
141
						<td>
142 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
143 f34455d8 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>" usepost></a>
144 060ed238 Stephen Beaver
						</td>
145
					</tr>
146 589f92bb gnhb
<?php
147 68a7712c sbeaver
	$i++;
148 82db8285 Steve Beaver
	}
149 68a7712c sbeaver
}
150 589f92bb gnhb
?>
151 060ed238 Stephen Beaver
				</tbody>
152
			</table>
153
		</div>
154
	</div>
155 68a7712c sbeaver
</div>
156 060ed238 Stephen Beaver
157
<nav class="action-buttons">
158 4401107f Steve Beaver
	<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
159 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
160
		<?=gettext("Add")?>
161
	</a>
162
</nav>
163
164 68a7712c sbeaver
<?php
165
include("foot.inc");