1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
interfaces_assign.php
|
4 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
5 |
|
|
Written by Jim McBeath based on existing m0n0wall files
|
6 |
|
|
|
7 |
94a77286
|
Scott Ullrich
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
8 |
5b237745
|
Scott Ullrich
|
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: /bin/rm
|
33 |
|
|
pfSense_MODULE: interfaces
|
34 |
|
|
*/
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-interfaces-assignnetworkports
|
38 |
|
|
##|*NAME=Interfaces: Assign network ports page
|
39 |
|
|
##|*DESCR=Allow access to the 'Interfaces: Assign network ports' page.
|
40 |
|
|
##|*MATCH=interfaces_assign.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
94a77286
|
Scott Ullrich
|
$pgtitle = array("Interfaces", "Assign network ports");
|
44 |
af1e2031
|
jim-p
|
$statusurl = "status_interfaces.php";
|
45 |
|
|
|
46 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
47 |
5a7d827b
|
sullrich
|
require("functions.inc");
|
48 |
|
|
require("filter.inc");
|
49 |
|
|
require("shaper.inc");
|
50 |
|
|
require("ipsec.inc");
|
51 |
|
|
require("vpn.inc");
|
52 |
4c86a165
|
sullrich
|
require("captiveportal.inc");
|
53 |
6e6233d0
|
sullrich
|
require("rrd.inc");
|
54 |
5b237745
|
Scott Ullrich
|
|
55 |
|
|
/*
|
56 |
|
|
In this file, "port" refers to the physical port name,
|
57 |
|
|
while "interface" refers to LAN, WAN, or OPTn.
|
58 |
|
|
*/
|
59 |
|
|
|
60 |
|
|
/* get list without VLAN interfaces */
|
61 |
|
|
$portlist = get_interface_list();
|
62 |
|
|
|
63 |
7c53bc7b
|
Erik Fonnesbeck
|
/* add wireless clone interfaces */
|
64 |
|
|
if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) {
|
65 |
|
|
foreach ($config['wireless']['clone'] as $clone) {
|
66 |
|
|
$portlist[$clone['cloneif']] = $clone;
|
67 |
|
|
$portlist[$clone['cloneif']]['iswlclone'] = true;
|
68 |
|
|
}
|
69 |
|
|
}
|
70 |
|
|
|
71 |
5b237745
|
Scott Ullrich
|
/* add VLAN interfaces */
|
72 |
|
|
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
|
73 |
|
|
foreach ($config['vlans']['vlan'] as $vlan) {
|
74 |
d59557dc
|
Ermal Luçi
|
$portlist[$vlan['vlanif']] = $vlan;
|
75 |
|
|
$portlist[$vlan['vlanif']]['isvlan'] = true;
|
76 |
5b237745
|
Scott Ullrich
|
}
|
77 |
|
|
}
|
78 |
|
|
|
79 |
38738505
|
Ermal Luçi
|
/* add Bridge interfaces */
|
80 |
b47c94bd
|
Ermal Luçi
|
if (is_array($config['bridges']['bridged']) && count($config['bridges']['bridged'])) {
|
81 |
|
|
foreach ($config['bridges']['bridged'] as $bridge) {
|
82 |
38738505
|
Ermal Luçi
|
$portlist[$bridge['bridgeif']] = $bridge;
|
83 |
|
|
$portlist[$bridge['bridgeif']]['isbridge'] = true;
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
/* add GIF interfaces */
|
88 |
|
|
if (is_array($config['gifs']['gif']) && count($config['gifs']['gif'])) {
|
89 |
|
|
foreach ($config['gifs']['gif'] as $gif) {
|
90 |
|
|
$portlist[$gif['gifif']] = $gif;
|
91 |
|
|
$portlist[$gif['gifif']]['isgif'] = true;
|
92 |
|
|
}
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
/* add GRE interfaces */
|
96 |
|
|
if (is_array($config['gres']['gre']) && count($config['gres']['gre'])) {
|
97 |
|
|
foreach ($config['gres']['gre'] as $gre) {
|
98 |
|
|
$portlist[$gre['greif']] = $gre;
|
99 |
|
|
$portlist[$gre['greif']]['isgre'] = true;
|
100 |
|
|
}
|
101 |
|
|
}
|
102 |
|
|
|
103 |
dbdd08af
|
Ermal Luçi
|
/* add LAGG interfaces */
|
104 |
c720925c
|
Ermal Luçi
|
if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) {
|
105 |
|
|
foreach ($config['laggs']['lagg'] as $lagg) {
|
106 |
|
|
$portlist[$lagg['laggif']] = $lagg;
|
107 |
|
|
$portlist[$lagg['laggif']]['islagg'] = true;
|
108 |
dbdd08af
|
Ermal Luçi
|
/* LAGG members cannot be assigned */
|
109 |
|
|
$lagifs = explode(',', $lagg['members']);
|
110 |
|
|
foreach ($lagifs as $lagif)
|
111 |
|
|
if (isset($portlist[$lagif]))
|
112 |
|
|
unset($portlist[$lagif]);
|
113 |
c720925c
|
Ermal Luçi
|
}
|
114 |
|
|
}
|
115 |
|
|
|
116 |
265188ea
|
Ermal Lu?i
|
/* add QinQ interfaces */
|
117 |
|
|
if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) {
|
118 |
|
|
foreach ($config['qinqs']['qinqentry'] as $qinq) {
|
119 |
08057ba6
|
Ermal Lu?i
|
$portlist["vlan{$qinq['tag']}"]['descr'] = "VLAN {$qinq['tag']}";
|
120 |
265188ea
|
Ermal Lu?i
|
$portlist["vlan{$qinq['tag']}"]['isqinq'] = true;
|
121 |
|
|
/* QinQ members */
|
122 |
|
|
$qinqifs = explode(' ', $qinq['members']);
|
123 |
|
|
foreach ($qinqifs as $qinqif) {
|
124 |
|
|
$portlist["vlan{$qinq['tag']}_{$qinqif}"]['descr'] = "QinQ {$qinqif}";
|
125 |
|
|
$portlist["vlan{$qinq['tag']}_{$qinqif}"]['isqinq'] = true;
|
126 |
|
|
}
|
127 |
|
|
}
|
128 |
|
|
}
|
129 |
c720925c
|
Ermal Luçi
|
|
130 |
860c4e80
|
Chris Buechler
|
/* add PPP interfaces */
|
131 |
|
|
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
132 |
611ae852
|
Ermal
|
foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
|
133 |
99c26d44
|
gnhb
|
$portname = $ppp['if'];
|
134 |
860c4e80
|
Chris Buechler
|
$portlist[$portname] = $ppp;
|
135 |
|
|
$portlist[$portname]['isppp'] = true;
|
136 |
3f2ef8d7
|
gnhb
|
$ports_base = basename($ppp['ports']);
|
137 |
42809b4a
|
gnhb
|
if (isset($ppp['descr']))
|
138 |
99c26d44
|
gnhb
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['descr']}";
|
139 |
00b702cc
|
gnhb
|
else if (isset($ppp['username']))
|
140 |
99c26d44
|
gnhb
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['username']}";
|
141 |
42809b4a
|
gnhb
|
else
|
142 |
99c26d44
|
gnhb
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base})";
|
143 |
860c4e80
|
Chris Buechler
|
}
|
144 |
|
|
}
|
145 |
|
|
|
146 |
d59557dc
|
Ermal Luçi
|
if ($_POST['apply']) {
|
147 |
|
|
if (file_exists("/var/run/interface_mismatch_reboot_needed"))
|
148 |
eef52225
|
jim-p
|
system_reboot();
|
149 |
d59557dc
|
Ermal Luçi
|
else {
|
150 |
|
|
write_config();
|
151 |
|
|
|
152 |
|
|
$retval = 0;
|
153 |
|
|
$retval = filter_configure();
|
154 |
0027de0a
|
Ermal Lu?i
|
$savemsg = get_std_save_message($retval);
|
155 |
d59557dc
|
Ermal Luçi
|
|
156 |
|
|
if (stristr($retval, "error") <> true)
|
157 |
|
|
$savemsg = get_std_save_message($retval);
|
158 |
|
|
else
|
159 |
|
|
$savemsg = $retval;
|
160 |
|
|
|
161 |
4a166751
|
Ermal Luçi
|
unlink_if_exists("/tmp/reload_interfaces");
|
162 |
d59557dc
|
Ermal Luçi
|
}
|
163 |
|
|
|
164 |
|
|
} else if ($_POST) {
|
165 |
5b237745
|
Scott Ullrich
|
|
166 |
|
|
unset($input_errors);
|
167 |
|
|
|
168 |
|
|
/* input validation */
|
169 |
|
|
|
170 |
|
|
/* Build a list of the port names so we can see how the interfaces map */
|
171 |
|
|
$portifmap = array();
|
172 |
|
|
foreach ($portlist as $portname => $portinfo)
|
173 |
|
|
$portifmap[$portname] = array();
|
174 |
|
|
|
175 |
|
|
/* Go through the list of ports selected by the user,
|
176 |
|
|
build a list of port-to-interface mappings in portifmap */
|
177 |
|
|
foreach ($_POST as $ifname => $ifport) {
|
178 |
|
|
if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt'))
|
179 |
|
|
$portifmap[$ifport][] = strtoupper($ifname);
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
/* Deliver error message for any port with more than one assignment */
|
183 |
|
|
foreach ($portifmap as $portname => $ifnames) {
|
184 |
|
|
if (count($ifnames) > 1) {
|
185 |
|
|
$errstr = "Port " . $portname .
|
186 |
|
|
" was assigned to " . count($ifnames) .
|
187 |
|
|
" interfaces:";
|
188 |
|
|
|
189 |
|
|
foreach ($portifmap[$portname] as $ifn)
|
190 |
|
|
$errstr .= " " . $ifn;
|
191 |
|
|
|
192 |
|
|
$input_errors[] = $errstr;
|
193 |
|
|
}
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
if (!$input_errors) {
|
198 |
|
|
/* No errors detected, so update the config */
|
199 |
|
|
foreach ($_POST as $ifname => $ifport) {
|
200 |
|
|
|
201 |
|
|
if (($ifname == 'lan') || ($ifname == 'wan') ||
|
202 |
|
|
(substr($ifname, 0, 3) == 'opt')) {
|
203 |
|
|
|
204 |
|
|
if (!is_array($ifport)) {
|
205 |
e7bfa231
|
Ermal Lu?i
|
$reloadif = false;
|
206 |
44088ce8
|
Ermal Lu?i
|
if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] <> $ifport) {
|
207 |
|
|
interface_bring_down($ifname);
|
208 |
e7bfa231
|
Ermal Lu?i
|
/* Mark this to be reconfigured in any case. */
|
209 |
|
|
$reloadif = true;
|
210 |
44088ce8
|
Ermal Lu?i
|
}
|
211 |
5b237745
|
Scott Ullrich
|
$config['interfaces'][$ifname]['if'] = $ifport;
|
212 |
99c26d44
|
gnhb
|
if (isset($portlist[$ifport]['isppp']))
|
213 |
c86e8f76
|
gnhb
|
$config['interfaces'][$ifname]['ipaddr'] = $portlist[$ifport]['type'];
|
214 |
42809b4a
|
gnhb
|
|
215 |
5b237745
|
Scott Ullrich
|
/* check for wireless interfaces, set or clear ['wireless'] */
|
216 |
94a77286
|
Scott Ullrich
|
if (preg_match($g['wireless_regex'], $ifport)) {
|
217 |
5b237745
|
Scott Ullrich
|
if (!is_array($config['interfaces'][$ifname]['wireless']))
|
218 |
|
|
$config['interfaces'][$ifname]['wireless'] = array();
|
219 |
|
|
} else {
|
220 |
|
|
unset($config['interfaces'][$ifname]['wireless']);
|
221 |
|
|
}
|
222 |
|
|
|
223 |
d59557dc
|
Ermal Luçi
|
/* make sure there is a descr for all interfaces */
|
224 |
|
|
if (!isset($config['interfaces'][$ifname]['descr']))
|
225 |
|
|
$config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
|
226 |
c86e8f76
|
gnhb
|
|
227 |
b13efb03
|
Erik Fonnesbeck
|
if ($reloadif == true) {
|
228 |
|
|
if (preg_match($g['wireless_regex'], $ifport))
|
229 |
|
|
interface_sync_wireless_clones($config['interfaces'][$ifname], false);
|
230 |
e7bfa231
|
Ermal Lu?i
|
/* Reload all for the interface. */
|
231 |
|
|
interface_configure($ifname, true);
|
232 |
b13efb03
|
Erik Fonnesbeck
|
}
|
233 |
5b237745
|
Scott Ullrich
|
}
|
234 |
6e5eadf8
|
Ermal Lu?i
|
|
235 |
|
|
touch("/tmp/reload_interfaces");
|
236 |
5b237745
|
Scott Ullrich
|
}
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
write_config();
|
240 |
6e6233d0
|
sullrich
|
|
241 |
|
|
enable_rrd_graphing();
|
242 |
5b237745
|
Scott Ullrich
|
}
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
if ($_GET['act'] == "del") {
|
246 |
|
|
$id = $_GET['id'];
|
247 |
3c43a344
|
Scott Ullrich
|
|
248 |
7ec05d27
|
Ermal Luçi
|
if (link_interface_to_bridge($id))
|
249 |
1723f72d
|
Ermal Luçi
|
$input_errors[] = "The interface is part of a bridge. Please remove it from the bridge to continue";
|
250 |
c6bacfe5
|
Ermal Luçi
|
else if (link_interface_to_gre($id))
|
251 |
|
|
$input_errors[] = "The interface is part of a gre tunnel. Please delete the tunnel to continue";
|
252 |
|
|
else if (link_interface_to_gif($id))
|
253 |
|
|
$input_errors[] = "The interface is part of a gif tunnel. Please delete the tunnel to continue";
|
254 |
1723f72d
|
Ermal Luçi
|
else {
|
255 |
|
|
unset($config['interfaces'][$id]['enable']);
|
256 |
fa4a331f
|
Ermal
|
$realid = get_real_interface($id);
|
257 |
1723f72d
|
Ermal Luçi
|
interface_bring_down($id); /* down the interface */
|
258 |
3c43a344
|
Scott Ullrich
|
|
259 |
1723f72d
|
Ermal Luçi
|
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
|
260 |
|
|
|
261 |
|
|
if($id == "lan") {
|
262 |
|
|
unset($config['interfaces']['lan']);
|
263 |
|
|
if (is_array($config['dhcpd']))
|
264 |
|
|
unset($config['dhcpd']['lan']);
|
265 |
|
|
unset($config['shaper']);
|
266 |
|
|
unset($config['ezshaper']);
|
267 |
|
|
unset($config['nat']);
|
268 |
|
|
system("rm /var/dhcpd/var/db/*");
|
269 |
|
|
services_dhcpd_configure();
|
270 |
|
|
}
|
271 |
c3bc7432
|
Ermal Luçi
|
|
272 |
05855d1d
|
Ermal
|
if (count($config['filter']['rule']) > 0) {
|
273 |
c86e8f76
|
gnhb
|
foreach ($config['filter']['rule'] as $x => $rule) {
|
274 |
|
|
if($rule['interface'] == $id)
|
275 |
|
|
unset($config['filter']['rule'][$x]);
|
276 |
e27d0494
|
Ermal
|
}
|
277 |
1723f72d
|
Ermal Luçi
|
}
|
278 |
05855d1d
|
Ermal
|
if (is_array($config['nat']['advancedoutbound']) && count($config['nat']['advancedoutbound']['rule']) > 0) {
|
279 |
c86e8f76
|
gnhb
|
foreach ($config['nat']['advancedoutbound']['rule'] as $x => $rule) {
|
280 |
|
|
if($rule['interface'] == $id)
|
281 |
|
|
unset($config['nat']['advancedoutbound']['rule'][$x]['interface']);
|
282 |
e27d0494
|
Ermal
|
}
|
283 |
|
|
}
|
284 |
c86e8f76
|
gnhb
|
if (is_array($config['nat']['rule']) && count($config['nat']['rule']) > 0) {
|
285 |
|
|
foreach ($config['nat']['rule'] as $x => $rule) {
|
286 |
|
|
if($rule['interface'] == $id)
|
287 |
|
|
unset($config['nat']['rule'][$x]['interface']);
|
288 |
e27d0494
|
Ermal
|
}
|
289 |
c86e8f76
|
gnhb
|
}
|
290 |
c3bc7432
|
Ermal Luçi
|
|
291 |
1723f72d
|
Ermal Luçi
|
write_config();
|
292 |
21eebbb0
|
Scott Ullrich
|
|
293 |
b3a07b12
|
sullrich
|
/* If we are in firewall/routing mode (not single interface)
|
294 |
|
|
* then ensure that we are not running DHCP on the wan which
|
295 |
|
|
* will make a lot of ISP's unhappy.
|
296 |
|
|
*/
|
297 |
1723f72d
|
Ermal Luçi
|
if($config['interfaces']['lan']) {
|
298 |
|
|
unset($config['dhcpd']['wan']);
|
299 |
|
|
}
|
300 |
7850de1c
|
Ermal Lu?i
|
|
301 |
fa4a331f
|
Ermal
|
link_interface_to_vlans($realid, "update");
|
302 |
98a0128c
|
Scott Ullrich
|
|
303 |
1723f72d
|
Ermal Luçi
|
$savemsg = "Interface has been deleted.";
|
304 |
|
|
}
|
305 |
5b237745
|
Scott Ullrich
|
}
|
306 |
|
|
|
307 |
|
|
if ($_GET['act'] == "add") {
|
308 |
|
|
/* find next free optional interface number */
|
309 |
bda86e8f
|
Scott Ullrich
|
if(!$config['interfaces']['lan']) {
|
310 |
|
|
$newifname = "lan";
|
311 |
cec4323f
|
Erik Fonnesbeck
|
$descr = "LAN";
|
312 |
0d21552c
|
Scott Ullrich
|
$config['interfaces'][$newifname] = array();
|
313 |
d59557dc
|
Ermal Luçi
|
$config['interfaces'][$newifname]['descr'] = $descr;
|
314 |
bda86e8f
|
Scott Ullrich
|
} else {
|
315 |
8a648100
|
Ermal Luçi
|
for ($i = 1; $i <= count($config['interfaces']); $i++) {
|
316 |
|
|
if (!$config['interfaces']["opt{$i}"])
|
317 |
|
|
break;
|
318 |
|
|
}
|
319 |
bda86e8f
|
Scott Ullrich
|
$newifname = 'opt' . $i;
|
320 |
d59557dc
|
Ermal Luçi
|
$descr = "OPT{$i}";
|
321 |
0d21552c
|
Scott Ullrich
|
$config['interfaces'][$newifname] = array();
|
322 |
d59557dc
|
Ermal Luçi
|
$config['interfaces'][$newifname]['descr'] = $descr;
|
323 |
bda86e8f
|
Scott Ullrich
|
}
|
324 |
cec4323f
|
Erik Fonnesbeck
|
|
325 |
|
|
uksort($config['interfaces'], "compare_interface_names");
|
326 |
|
|
|
327 |
5b237745
|
Scott Ullrich
|
/* Find an unused port for this interface */
|
328 |
|
|
foreach ($portlist as $portname => $portinfo) {
|
329 |
|
|
$portused = false;
|
330 |
|
|
foreach ($config['interfaces'] as $ifname => $ifdata) {
|
331 |
|
|
if ($ifdata['if'] == $portname) {
|
332 |
|
|
$portused = true;
|
333 |
|
|
break;
|
334 |
|
|
}
|
335 |
|
|
}
|
336 |
|
|
if (!$portused) {
|
337 |
|
|
$config['interfaces'][$newifname]['if'] = $portname;
|
338 |
8f0289e7
|
Erik Fonnesbeck
|
if (preg_match($g['wireless_regex'], $portname)) {
|
339 |
5b237745
|
Scott Ullrich
|
$config['interfaces'][$newifname]['wireless'] = array();
|
340 |
8f0289e7
|
Erik Fonnesbeck
|
interface_sync_wireless_clones($config['interfaces'][$newifname], false);
|
341 |
|
|
}
|
342 |
5b237745
|
Scott Ullrich
|
break;
|
343 |
|
|
}
|
344 |
|
|
}
|
345 |
|
|
|
346 |
d59557dc
|
Ermal Luçi
|
/* XXX: Do not remove this. */
|
347 |
7ac5a4cb
|
Scott Ullrich
|
mwexec("/bin/rm -f /tmp/config.cache");
|
348 |
d59557dc
|
Ermal Luçi
|
|
349 |
5b237745
|
Scott Ullrich
|
write_config();
|
350 |
093a01b0
|
Scott Ullrich
|
|
351 |
21eebbb0
|
Scott Ullrich
|
$savemsg = "Interface has been added.";
|
352 |
|
|
|
353 |
5b237745
|
Scott Ullrich
|
}
|
354 |
|
|
|
355 |
cec4323f
|
Erik Fonnesbeck
|
function compare_interface_names($a, $b) {
|
356 |
|
|
if ($a == $b)
|
357 |
|
|
return 0;
|
358 |
|
|
else if ($a == 'wan')
|
359 |
|
|
return -1;
|
360 |
|
|
else if ($b == 'wan')
|
361 |
|
|
return 1;
|
362 |
|
|
else if ($a == 'lan')
|
363 |
|
|
return -1;
|
364 |
|
|
else if ($b == 'lan')
|
365 |
|
|
return 1;
|
366 |
|
|
|
367 |
|
|
return strnatcmp($a, $b);
|
368 |
|
|
}
|
369 |
|
|
|
370 |
7f43ca88
|
Scott Ullrich
|
include("head.inc");
|
371 |
|
|
|
372 |
23be6f1b
|
Scott Ullrich
|
if(file_exists("/var/run/interface_mismatch_reboot_needed"))
|
373 |
d59557dc
|
Ermal Luçi
|
if ($_POST)
|
374 |
|
|
$savemsg = "Reboot is needed. Please apply the settings in order to reboot.";
|
375 |
c35e12af
|
Scott Ullrich
|
else
|
376 |
00404818
|
Chris Buechler
|
$savemsg = "Interface mismatch detected. Please resolve the mismatch and click Save. The firewall will reboot afterwards.";
|
377 |
23be6f1b
|
Scott Ullrich
|
|
378 |
5b237745
|
Scott Ullrich
|
?>
|
379 |
6eb47218
|
Scott Ullrich
|
|
380 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
381 |
5b237745
|
Scott Ullrich
|
<?php include("fbegin.inc"); ?>
|
382 |
a2dab9bc
|
Bill Marquette
|
|
383 |
5b237745
|
Scott Ullrich
|
<form action="interfaces_assign.php" method="post" name="iform" id="iform">
|
384 |
f2cb6a9f
|
Scott Ullrich
|
|
385 |
d59557dc
|
Ermal Luçi
|
<?php if (file_exists("/tmp/reload_interfaces")): ?><p>
|
386 |
f2cb6a9f
|
Scott Ullrich
|
<?php print_info_box_np("The interface configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
387 |
b100b85d
|
Scott Ullrich
|
<?php elseif($savemsg): ?>
|
388 |
|
|
<?php print_info_box($savemsg); ?>
|
389 |
d59557dc
|
Ermal Luçi
|
<?php endif; ?>
|
390 |
|
|
|
391 |
f2cb6a9f
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
392 |
|
|
|
393 |
5b237745
|
Scott Ullrich
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
394 |
94a77286
|
Scott Ullrich
|
<tr><td class="tabnavtbl">
|
395 |
c8b8ff69
|
Scott Ullrich
|
<?php
|
396 |
|
|
$tab_array = array();
|
397 |
931066a8
|
Bill Marquette
|
$tab_array[0] = array("Interface assignments", true, "interfaces_assign.php");
|
398 |
0ec2fdf0
|
Ermal Lu?i
|
$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
|
399 |
79637b03
|
Erik Fonnesbeck
|
$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
|
400 |
|
|
$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
|
401 |
|
|
$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
|
402 |
42809b4a
|
gnhb
|
$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
|
403 |
d02951e9
|
gnhb
|
$tab_array[7] = array("GRE", false, "interfaces_gre.php");
|
404 |
|
|
$tab_array[8] = array("GIF", false, "interfaces_gif.php");
|
405 |
|
|
$tab_array[9] = array("Bridges", false, "interfaces_bridge.php");
|
406 |
|
|
$tab_array[10] = array("LAGG", false, "interfaces_lagg.php");
|
407 |
c8b8ff69
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
408 |
|
|
?>
|
409 |
5b237745
|
Scott Ullrich
|
</td></tr>
|
410 |
|
|
<tr>
|
411 |
d732f186
|
Bill Marquette
|
<td>
|
412 |
|
|
<div id="mainarea">
|
413 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
414 |
|
|
<tr>
|
415 |
5b237745
|
Scott Ullrich
|
<td class="listhdrr">Interface</td>
|
416 |
|
|
<td class="listhdr">Network port</td>
|
417 |
|
|
<td class="list"> </td>
|
418 |
|
|
</tr>
|
419 |
|
|
<?php foreach ($config['interfaces'] as $ifname => $iface):
|
420 |
|
|
if ($iface['descr'])
|
421 |
|
|
$ifdescr = $iface['descr'];
|
422 |
|
|
else
|
423 |
|
|
$ifdescr = strtoupper($ifname);
|
424 |
|
|
?>
|
425 |
|
|
<tr>
|
426 |
|
|
<td class="listlr" valign="middle"><strong><?=$ifdescr;?></strong></td>
|
427 |
|
|
<td valign="middle" class="listr">
|
428 |
34834d88
|
Scott Ullrich
|
<select name="<?=$ifname;?>" id="<?=$ifname;?>">
|
429 |
5b237745
|
Scott Ullrich
|
<?php foreach ($portlist as $portname => $portinfo): ?>
|
430 |
99c26d44
|
gnhb
|
<option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected";?>>
|
431 |
|
|
<?php if ($portinfo['isvlan']) {
|
432 |
c86e8f76
|
gnhb
|
$descr = "VLAN {$portinfo['tag']} on {$portinfo['if']}";
|
433 |
91a5b98a
|
gnhb
|
if ($portinfo['descr'])
|
434 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
435 |
|
|
echo htmlspecialchars($descr);
|
436 |
|
|
} elseif ($portinfo['iswlclone']) {
|
437 |
|
|
$descr = $portinfo['cloneif'];
|
438 |
|
|
if ($portinfo['descr'])
|
439 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
440 |
|
|
echo htmlspecialchars($descr);
|
441 |
|
|
} elseif ($portinfo['isppp']) {
|
442 |
|
|
echo htmlspecialchars($portinfo['descr']);
|
443 |
|
|
} elseif ($portinfo['isbridge']) {
|
444 |
|
|
$descr = strtoupper($portinfo['bridgeif']);
|
445 |
|
|
if ($portinfo['descr'])
|
446 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
447 |
|
|
echo htmlspecialchars($descr);
|
448 |
|
|
} elseif ($portinfo['isgre']) {
|
449 |
|
|
$descr = "GRE {$portinfo['remote-addr']}";
|
450 |
|
|
if ($portinfo['descr'])
|
451 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
452 |
|
|
echo htmlspecialchars($descr);
|
453 |
|
|
} elseif ($portinfo['isgif']) {
|
454 |
|
|
$descr = "GRE {$portinfo['remote-addr']}";
|
455 |
|
|
if ($portinfo['descr'])
|
456 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
457 |
|
|
echo htmlspecialchars($descr);
|
458 |
|
|
} elseif ($portinfo['islagg']) {
|
459 |
|
|
$descr = strtoupper($portinfo['laggif']);
|
460 |
|
|
if ($portinfo['descr'])
|
461 |
|
|
$descr .= " (" . $portinfo['descr'] . ")";
|
462 |
|
|
echo htmlspecialchars($descr);
|
463 |
|
|
} elseif ($portinfo['isqinq']) {
|
464 |
|
|
echo htmlspecialchars($portinfo['descr']);
|
465 |
|
|
} else
|
466 |
|
|
echo htmlspecialchars($portname . " (" . $portinfo['mac'] . ")");
|
467 |
c86e8f76
|
gnhb
|
?></option>
|
468 |
265188ea
|
Ermal Lu?i
|
<?php endforeach; ?>
|
469 |
|
|
</select>
|
470 |
|
|
</td>
|
471 |
|
|
<td valign="middle" class="list">
|
472 |
b0d756ba
|
Scott Ullrich
|
<?php if ($ifname != 'wan'): ?>
|
473 |
677c0869
|
Erik Kristensen
|
<a href="interfaces_assign.php?act=del&id=<?=$ifname;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete interface" width="17" height="17" border="0"></a>
|
474 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
475 |
|
|
</td>
|
476 |
|
|
</tr>
|
477 |
|
|
<?php endforeach; ?>
|
478 |
|
|
<?php if (count($config['interfaces']) < count($portlist)): ?>
|
479 |
|
|
<tr>
|
480 |
|
|
<td class="list" colspan="2"></td>
|
481 |
|
|
<td class="list" nowrap>
|
482 |
677c0869
|
Erik Kristensen
|
<a href="interfaces_assign.php?act=add"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add interface" width="17" height="17" border="0"></a>
|
483 |
5b237745
|
Scott Ullrich
|
</td>
|
484 |
|
|
</tr>
|
485 |
|
|
<?php else: ?>
|
486 |
|
|
<tr>
|
487 |
|
|
<td class="list" colspan="3" height="10"></td>
|
488 |
|
|
</tr>
|
489 |
|
|
<?php endif; ?>
|
490 |
|
|
</table>
|
491 |
d732f186
|
Bill Marquette
|
</div>
|
492 |
0d21552c
|
Scott Ullrich
|
<br/>
|
493 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save"><br><br>
|
494 |
56afcab6
|
Scott Ullrich
|
<p>
|
495 |
bd705fb8
|
Scott Ullrich
|
</p>
|
496 |
94a77286
|
Scott Ullrich
|
<ul>
|
497 |
|
|
<li><span class="vexpl">change the IP address of your computer</span></li>
|
498 |
|
|
<li><span class="vexpl">renew its DHCP lease</span></li>
|
499 |
709cc6e0
|
Bill Marquette
|
<li><span class="vexpl">access the webConfigurator with the new IP address</span></li>
|
500 |
30c1b51e
|
Ermal Luçi
|
<li><span class="vexpl">interfaces that are configured as members of a lagg(4) interface will not be shown.</span></li>
|
501 |
94a77286
|
Scott Ullrich
|
</ul></td>
|
502 |
5b237745
|
Scott Ullrich
|
</tr>
|
503 |
|
|
</table>
|
504 |
|
|
</form>
|
505 |
|
|
<?php include("fend.inc"); ?>
|
506 |
c8b8ff69
|
Scott Ullrich
|
</body>
|
507 |
|
|
</html>
|