| 1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
| 2 |
03b92764
|
Scott Ullrich
|
<?php
|
| 3 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
| 4 |
5b237745
|
Scott Ullrich
|
/*
|
| 5 |
|
|
interfaces_opt.php
|
| 6 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
| 7 |
03b92764
|
Scott Ullrich
|
|
| 8 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
| 9 |
|
|
All rights reserved.
|
| 10 |
03b92764
|
Scott Ullrich
|
|
| 11 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
| 12 |
|
|
modification, are permitted provided that the following conditions are met:
|
| 13 |
03b92764
|
Scott Ullrich
|
|
| 14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
| 15 |
|
|
this list of conditions and the following disclaimer.
|
| 16 |
03b92764
|
Scott Ullrich
|
|
| 17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
| 18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
| 19 |
|
|
documentation and/or other materials provided with the distribution.
|
| 20 |
03b92764
|
Scott Ullrich
|
|
| 21 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
| 22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
| 23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
| 24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
| 25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
|
|
*/
|
| 32 |
|
|
|
| 33 |
|
|
require("guiconfig.inc");
|
| 34 |
|
|
|
| 35 |
|
|
unset($index);
|
| 36 |
|
|
if ($_GET['index'])
|
| 37 |
|
|
$index = $_GET['index'];
|
| 38 |
|
|
else if ($_POST['index'])
|
| 39 |
|
|
$index = $_POST['index'];
|
| 40 |
03b92764
|
Scott Ullrich
|
|
| 41 |
5b237745
|
Scott Ullrich
|
if (!$index)
|
| 42 |
|
|
exit;
|
| 43 |
|
|
|
| 44 |
6cec4795
|
Scott Ullrich
|
function remove_bad_chars($string) {
|
| 45 |
ab72b53b
|
Scott Ullrich
|
return preg_replace('/[^a-z|_|0-9]/i','',$string);
|
| 46 |
6cec4795
|
Scott Ullrich
|
}
|
| 47 |
|
|
|
| 48 |
5b237745
|
Scott Ullrich
|
$optcfg = &$config['interfaces']['opt' . $index];
|
| 49 |
6cec4795
|
Scott Ullrich
|
$optcfg['descr'] = remove_bad_chars($optcfg['descr']);
|
| 50 |
fc959b55
|
Scott Ullrich
|
|
| 51 |
6cec4795
|
Scott Ullrich
|
$pconfig['descr'] = $optcfg['descr'];
|
| 52 |
5b237745
|
Scott Ullrich
|
$pconfig['bridge'] = $optcfg['bridge'];
|
| 53 |
03b92764
|
Scott Ullrich
|
|
| 54 |
|
|
$pconfig['bandwidth'] = $optcfg['bandwidth'];
|
| 55 |
|
|
$pconfig['bandwidthtype'] = $optcfg['bandwidthtype'];
|
| 56 |
|
|
|
| 57 |
5b237745
|
Scott Ullrich
|
$pconfig['enable'] = isset($optcfg['enable']);
|
| 58 |
|
|
|
| 59 |
0311dbd5
|
Scott Ullrich
|
$pconfig['blockpriv'] = isset($optcfg['blockpriv']);
|
| 60 |
|
|
$pconfig['blockbogons'] = isset($optcfg['blockbogons']);
|
| 61 |
|
|
$pconfig['spoofmac'] = $optcfg['spoofmac'];
|
| 62 |
|
|
$pconfig['mtu'] = $optcfg['mtu'];
|
| 63 |
|
|
|
| 64 |
c1ec2c2f
|
Scott Ullrich
|
$pconfig['disableftpproxy'] = isset($optcfg['disableftpproxy']);
|
| 65 |
99586fca
|
Scott Ullrich
|
|
| 66 |
5b237745
|
Scott Ullrich
|
/* Wireless interface? */
|
| 67 |
|
|
if (isset($optcfg['wireless'])) {
|
| 68 |
|
|
require("interfaces_wlan.inc");
|
| 69 |
|
|
wireless_config_init();
|
| 70 |
|
|
}
|
| 71 |
|
|
|
| 72 |
0311dbd5
|
Scott Ullrich
|
if ($optcfg['ipaddr'] == "dhcp") {
|
| 73 |
|
|
$pconfig['type'] = "DHCP";
|
| 74 |
99586fca
|
Scott Ullrich
|
$pconfig['dhcphostname'] = $optcfg['dhcphostname'];
|
| 75 |
0311dbd5
|
Scott Ullrich
|
} else {
|
| 76 |
|
|
$pconfig['type'] = "Static";
|
| 77 |
|
|
$pconfig['ipaddr'] = $optcfg['ipaddr'];
|
| 78 |
|
|
$pconfig['subnet'] = $optcfg['subnet'];
|
| 79 |
|
|
$pconfig['gateway'] = $optcfg['gateway'];
|
| 80 |
|
|
$pconfig['pointtopoint'] = $optcfg['pointtopoint'];
|
| 81 |
|
|
}
|
| 82 |
|
|
|
| 83 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
| 84 |
|
|
|
| 85 |
|
|
unset($input_errors);
|
| 86 |
|
|
|
| 87 |
8698218d
|
Scott Ullrich
|
/* filter out spaces from descriptions */
|
| 88 |
6cec4795
|
Scott Ullrich
|
$POST['descr'] = remove_bad_chars($POST['descr']);
|
| 89 |
8698218d
|
Scott Ullrich
|
|
| 90 |
f169d6ca
|
Scott Ullrich
|
$pconfig = $_POST;
|
| 91 |
|
|
|
| 92 |
5b237745
|
Scott Ullrich
|
/* input validation */
|
| 93 |
|
|
if ($_POST['enable']) {
|
| 94 |
03b92764
|
Scott Ullrich
|
|
| 95 |
5b237745
|
Scott Ullrich
|
/* description unique? */
|
| 96 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
| 97 |
|
|
if ($i != $index) {
|
| 98 |
|
|
if ($config['interfaces']['opt' . $i]['descr'] == $_POST['descr']) {
|
| 99 |
|
|
$input_errors[] = "An interface with the specified description already exists.";
|
| 100 |
|
|
}
|
| 101 |
|
|
}
|
| 102 |
|
|
}
|
| 103 |
03b92764
|
Scott Ullrich
|
|
| 104 |
5b237745
|
Scott Ullrich
|
if ($_POST['bridge']) {
|
| 105 |
|
|
/* double bridging? */
|
| 106 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
| 107 |
|
|
if ($i != $index) {
|
| 108 |
|
|
if ($config['interfaces']['opt' . $i]['bridge'] == $_POST['bridge']) {
|
| 109 |
62ce3b9a
|
Scott Ullrich
|
//$input_errors[] = "Optional interface {$i} " .
|
| 110 |
|
|
// "({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
|
| 111 |
|
|
// "the specified interface.";
|
| 112 |
5b237745
|
Scott Ullrich
|
} else if ($config['interfaces']['opt' . $i]['bridge'] == "opt{$index}") {
|
| 113 |
62ce3b9a
|
Scott Ullrich
|
//$input_errors[] = "Optional interface {$i} " .
|
| 114 |
|
|
// "({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
|
| 115 |
|
|
// "this interface.";
|
| 116 |
5b237745
|
Scott Ullrich
|
}
|
| 117 |
|
|
}
|
| 118 |
|
|
}
|
| 119 |
|
|
if ($config['interfaces'][$_POST['bridge']]['bridge']) {
|
| 120 |
62ce3b9a
|
Scott Ullrich
|
//$input_errors[] = "The specified interface is already bridged to " .
|
| 121 |
|
|
// "another interface.";
|
| 122 |
5b237745
|
Scott Ullrich
|
}
|
| 123 |
|
|
/* captive portal on? */
|
| 124 |
|
|
if (isset($config['captiveportal']['enable'])) {
|
| 125 |
c2c399a4
|
Scott Ullrich
|
//$input_errors[] = "Interfaces cannot be bridged while the captive portal is enabled.";
|
| 126 |
5b237745
|
Scott Ullrich
|
}
|
| 127 |
|
|
} else {
|
| 128 |
e4065f5b
|
Scott Ullrich
|
if ($_POST['type'] <> "DHCP") {
|
| 129 |
|
|
$reqdfields = explode(" ", "descr ipaddr subnet");
|
| 130 |
|
|
$reqdfieldsn = explode(",", "Description,IP address,Subnet bit count");
|
| 131 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
| 132 |
|
|
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
|
| 133 |
|
|
$input_errors[] = "A valid IP address must be specified.";
|
| 134 |
|
|
}
|
| 135 |
|
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
|
| 136 |
|
|
$input_errors[] = "A valid subnet bit count must be specified.";
|
| 137 |
|
|
}
|
| 138 |
|
|
if($_POST['gateway'] <> "" && !is_ipaddr($_POST['gateway'])) {
|
| 139 |
|
|
$input_errors[] = "A valid gateway must be specified.";
|
| 140 |
|
|
}
|
| 141 |
92b17aed
|
Scott Ullrich
|
}
|
| 142 |
5b237745
|
Scott Ullrich
|
}
|
| 143 |
3cb6ab88
|
Bill Marquette
|
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
|
| 144 |
|
|
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
|
| 145 |
0138d492
|
Scott Ullrich
|
}
|
| 146 |
|
|
if($_POST['bandwidth'] <> "" && !is_numeric($_POST['bandwidth'])) {
|
| 147 |
|
|
$input_errors[] = "A valid bandwidth value is required 1-999999.";
|
| 148 |
3cb6ab88
|
Bill Marquette
|
}
|
| 149 |
3a843b96
|
Scott Ullrich
|
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
|
| 150 |
|
|
$input_errors[] = "A valid MAC address must be specified.";
|
| 151 |
|
|
}
|
| 152 |
5b237745
|
Scott Ullrich
|
}
|
| 153 |
03b92764
|
Scott Ullrich
|
|
| 154 |
f691bc2f
|
Scott Ullrich
|
if($_POST['mtu']) {
|
| 155 |
|
|
if($_POST['mtu'] < 24 or $_POST['mtu'] > 1501)
|
| 156 |
|
|
$input_errors[] = "A valid MTU is required 24-1500.";
|
| 157 |
|
|
}
|
| 158 |
|
|
|
| 159 |
5b237745
|
Scott Ullrich
|
/* Wireless interface? */
|
| 160 |
|
|
if (isset($optcfg['wireless'])) {
|
| 161 |
|
|
$wi_input_errors = wireless_config_post();
|
| 162 |
|
|
if ($wi_input_errors) {
|
| 163 |
|
|
$input_errors = array_merge($input_errors, $wi_input_errors);
|
| 164 |
|
|
}
|
| 165 |
|
|
}
|
| 166 |
03b92764
|
Scott Ullrich
|
|
| 167 |
5b237745
|
Scott Ullrich
|
if (!$input_errors) {
|
| 168 |
0311dbd5
|
Scott Ullrich
|
|
| 169 |
9a6757a1
|
Scott Ullrich
|
$bridge = discover_bridge($optcfg['if'], filter_translate_type_to_real_interface($optcfg['bridge']));
|
| 170 |
0d429e43
|
Scott Ullrich
|
if($bridge <> "-1") {
|
| 171 |
1665e79c
|
Scott Ullrich
|
destroy_bridge($bridge);
|
| 172 |
91e8aab2
|
Scott Ullrich
|
}
|
| 173 |
|
|
|
| 174 |
99586fca
|
Scott Ullrich
|
unset($optcfg['dhcphostname']);
|
| 175 |
c1ec2c2f
|
Scott Ullrich
|
unset($optcfg['disableftpproxy']);
|
| 176 |
|
|
|
| 177 |
|
|
/* per interface pftpx helper */
|
| 178 |
|
|
if($_POST['disableftpproxy'] == "yes") {
|
| 179 |
|
|
$optcfg['disableftpproxy'] = true;
|
| 180 |
|
|
system_start_ftp_helpers();
|
| 181 |
|
|
} else {
|
| 182 |
|
|
system_start_ftp_helpers();
|
| 183 |
|
|
}
|
| 184 |
99586fca
|
Scott Ullrich
|
|
| 185 |
6cec4795
|
Scott Ullrich
|
$optcfg['descr'] = remove_bad_chars($_POST['descr']);
|
| 186 |
5b237745
|
Scott Ullrich
|
$optcfg['bridge'] = $_POST['bridge'];
|
| 187 |
|
|
$optcfg['enable'] = $_POST['enable'] ? true : false;
|
| 188 |
0311dbd5
|
Scott Ullrich
|
|
| 189 |
001fdeea
|
Scott Ullrich
|
if($_POST['bandwidth'] <> "" and $_POST['bandwidthtype'] <> "") {
|
| 190 |
|
|
$optcfg['bandwidth'] = $_POST['bandwidth'];
|
| 191 |
|
|
$optcfg['bandwidthtype'] = $_POST['bandwidthtype'];
|
| 192 |
|
|
} else {
|
| 193 |
|
|
unset($optcfg['bandwidth']);
|
| 194 |
|
|
unset($optcfg['bandwidthtype']);
|
| 195 |
|
|
}
|
| 196 |
0311dbd5
|
Scott Ullrich
|
|
| 197 |
|
|
if ($_POST['type'] == "Static") {
|
| 198 |
|
|
$optcfg['ipaddr'] = $_POST['ipaddr'];
|
| 199 |
|
|
$optcfg['subnet'] = $_POST['subnet'];
|
| 200 |
|
|
$optcfg['gateway'] = $_POST['gateway'];
|
| 201 |
|
|
if (isset($optcfg['ispointtopoint']))
|
| 202 |
|
|
$optcfg['pointtopoint'] = $_POST['pointtopoint'];
|
| 203 |
|
|
} else if ($_POST['type'] == "DHCP") {
|
| 204 |
|
|
$optcfg['ipaddr'] = "dhcp";
|
| 205 |
|
|
$optcfg['dhcphostname'] = $_POST['dhcphostname'];
|
| 206 |
|
|
}
|
| 207 |
a12d2145
|
Scott Ullrich
|
|
| 208 |
2dfb79a4
|
Scott Ullrich
|
$optcfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
|
| 209 |
|
|
$optcfg['blockbogons'] = $_POST['blockbogons'] ? true : false;
|
| 210 |
|
|
$optcfg['spoofmac'] = $_POST['spoofmac'];
|
| 211 |
|
|
$optcfg['mtu'] = $_POST['mtu'];
|
| 212 |
|
|
|
| 213 |
5b237745
|
Scott Ullrich
|
write_config();
|
| 214 |
03b92764
|
Scott Ullrich
|
|
| 215 |
f5fe693c
|
Scott Ullrich
|
$retval = interfaces_optional_configure();
|
| 216 |
|
|
|
| 217 |
|
|
/* is this the captive portal interface? */
|
| 218 |
|
|
if (isset($config['captiveportal']['enable']) &&
|
| 219 |
|
|
($config['captiveportal']['interface'] == ('opt' . $index))) {
|
| 220 |
|
|
captiveportal_configure();
|
| 221 |
5b237745
|
Scott Ullrich
|
}
|
| 222 |
1f8caa36
|
Scott Ullrich
|
|
| 223 |
|
|
/* setup carp interfaces */
|
| 224 |
|
|
interfaces_carp_configure();
|
| 225 |
|
|
|
| 226 |
f5fe693c
|
Scott Ullrich
|
/* sync filter configuration */
|
| 227 |
|
|
filter_configure();
|
| 228 |
|
|
|
| 229 |
824edb6c
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
| 230 |
5b237745
|
Scott Ullrich
|
}
|
| 231 |
|
|
}
|
| 232 |
7f43ca88
|
Scott Ullrich
|
|
| 233 |
|
|
|
| 234 |
931066a8
|
Bill Marquette
|
$pgtitle = "Interfaces: Optional {$index} (" . htmlspecialchars($optcfg['descr']) . ")";
|
| 235 |
7f43ca88
|
Scott Ullrich
|
include("head.inc");
|
| 236 |
|
|
|
| 237 |
5b237745
|
Scott Ullrich
|
?>
|
| 238 |
b9e255dd
|
Bill Marquette
|
|
| 239 |
|
|
<script type="text/javascript" language="javascript" src="ip_helper.js">
|
| 240 |
|
|
</script>
|
| 241 |
5b237745
|
Scott Ullrich
|
<script language="JavaScript">
|
| 242 |
|
|
<!--
|
| 243 |
|
|
function enable_change(enable_over) {
|
| 244 |
a23d7248
|
Scott Ullrich
|
var endis;
|
| 245 |
|
|
endis = !((document.iform.bridge.selectedIndex == 0) || enable_over);
|
| 246 |
|
|
document.iform.ipaddr.disabled = endis;
|
| 247 |
|
|
document.iform.subnet.disabled = endis;
|
| 248 |
5b237745
|
Scott Ullrich
|
}
|
| 249 |
|
|
function ipaddr_change() {
|
| 250 |
6846116e
|
Scott Ullrich
|
document.iform.subnet.selectedIndex = gen_bits_opt(document.iform.ipaddr.value);
|
| 251 |
5b237745
|
Scott Ullrich
|
}
|
| 252 |
0311dbd5
|
Scott Ullrich
|
function type_change(enable_change,enable_change_pptp) {
|
| 253 |
|
|
switch (document.iform.type.selectedIndex) {
|
| 254 |
|
|
case 0:
|
| 255 |
57e97d71
|
Scott Ullrich
|
document.iform.ipaddr.type.disabled = 0;
|
| 256 |
0311dbd5
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 0;
|
| 257 |
|
|
document.iform.subnet.disabled = 0;
|
| 258 |
|
|
document.iform.gateway.disabled = 0;
|
| 259 |
|
|
break;
|
| 260 |
|
|
case 1:
|
| 261 |
57e97d71
|
Scott Ullrich
|
document.iform.ipaddr.type.disabled = 1;
|
| 262 |
0311dbd5
|
Scott Ullrich
|
document.iform.ipaddr.disabled = 1;
|
| 263 |
|
|
document.iform.subnet.disabled = 1;
|
| 264 |
|
|
document.iform.gateway.disabled = 1;
|
| 265 |
|
|
break;
|
| 266 |
|
|
}
|
| 267 |
|
|
}
|
| 268 |
5b237745
|
Scott Ullrich
|
//-->
|
| 269 |
|
|
</script>
|
| 270 |
b9e255dd
|
Bill Marquette
|
|
| 271 |
5b237745
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
| 272 |
|
|
<?php include("fbegin.inc"); ?>
|
| 273 |
931066a8
|
Bill Marquette
|
<p class="pgtitle"><?=$pgtitle?></p>
|
| 274 |
5b237745
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
| 275 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
| 276 |
|
|
<?php if ($optcfg['if']): ?>
|
| 277 |
|
|
<form action="interfaces_opt.php" method="post" name="iform" id="iform">
|
| 278 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
| 279 |
7e45fdf4
|
Scott Ullrich
|
<tr>
|
| 280 |
386e9c57
|
Seth Mos
|
<td colspan="2" valign="top" class="listtopic">Optional Interface Configuration</td>
|
| 281 |
7e45fdf4
|
Scott Ullrich
|
</tr>
|
| 282 |
03b92764
|
Scott Ullrich
|
<tr>
|
| 283 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
| 284 |
|
|
<td width="78%" class="vtable">
|
| 285 |
007be4f3
|
Scott Ullrich
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
| 286 |
5b237745
|
Scott Ullrich
|
<strong>Enable Optional <?=$index;?> interface</strong></td>
|
| 287 |
0311dbd5
|
Scott Ullrich
|
</tr>
|
| 288 |
03b92764
|
Scott Ullrich
|
<tr>
|
| 289 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">Description</td>
|
| 290 |
03b92764
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
| 291 |
5b237745
|
Scott Ullrich
|
<input name="descr" type="text" class="formfld" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
| 292 |
|
|
<br> <span class="vexpl">Enter a description (name) for the interface here.</span>
|
| 293 |
0311dbd5
|
Scott Ullrich
|
</td>
|
| 294 |
|
|
</tr>
|
| 295 |
|
|
|
| 296 |
|
|
<tr>
|
| 297 |
|
|
<td colspan="2" valign="top" height="16"></td>
|
| 298 |
|
|
</tr>
|
| 299 |
|
|
<tr>
|
| 300 |
|
|
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
| 301 |
|
|
</tr>
|
| 302 |
|
|
<tr>
|
| 303 |
|
|
<td valign="middle" class="vncell"><strong>Type</strong></td>
|
| 304 |
|
|
<td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
|
| 305 |
|
|
<?php $opts = split(" ", "Static DHCP");
|
| 306 |
|
|
foreach ($opts as $opt): ?>
|
| 307 |
|
|
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
|
| 308 |
|
|
<?=htmlspecialchars($opt);?>
|
| 309 |
|
|
</option>
|
| 310 |
|
|
<?php endforeach; ?>
|
| 311 |
|
|
</select></td>
|
| 312 |
|
|
</tr>
|
| 313 |
|
|
<tr>
|
| 314 |
|
|
<td valign="top" class="vncell">MAC address</td>
|
| 315 |
|
|
<td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
|
| 316 |
|
|
<?php
|
| 317 |
|
|
$ip = getenv('REMOTE_ADDR');
|
| 318 |
|
|
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
|
| 319 |
|
|
$mac = str_replace("\n","",$mac);
|
| 320 |
|
|
?>
|
| 321 |
|
|
<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
|
| 322 |
|
|
<br>
|
| 323 |
|
|
This field can be used to modify ("spoof") the MAC
|
| 324 |
|
|
address of the WAN interface<br>
|
| 325 |
|
|
(may be required with some cable connections)<br>
|
| 326 |
|
|
Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
|
| 327 |
|
|
or leave blank</td>
|
| 328 |
|
|
</tr>
|
| 329 |
|
|
<tr>
|
| 330 |
|
|
<td valign="top" class="vncell">MTU</td>
|
| 331 |
|
|
<td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
|
| 332 |
|
|
<br>
|
| 333 |
|
|
If you enter a value in this field, then MSS clamping for
|
| 334 |
|
|
TCP connections to the value entered above minus 40 (TCP/IP
|
| 335 |
|
|
header size) will be in effect. If you leave this field blank,
|
| 336 |
|
|
an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
|
| 337 |
|
|
connection types will be assumed.</td>
|
| 338 |
|
|
</tr>
|
| 339 |
|
|
|
| 340 |
03b92764
|
Scott Ullrich
|
<tr>
|
| 341 |
5b237745
|
Scott Ullrich
|
<td colspan="2" valign="top" height="16"></td>
|
| 342 |
5b80d869
|
Scott Ullrich
|
</tr>
|
| 343 |
|
|
<tr>
|
| 344 |
a23d7248
|
Scott Ullrich
|
<td colspan="2" valign="top" class="listtopic">IP configuration</td>
|
| 345 |
5b80d869
|
Scott Ullrich
|
</tr>
|
| 346 |
6d6d0f14
|
Scott Ullrich
|
<tr>
|
| 347 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Bridge with</td>
|
| 348 |
|
|
<td width="78%" class="vtable">
|
| 349 |
007be4f3
|
Scott Ullrich
|
<select name="bridge" class="formfld" id="bridge" onChange="enable_change(false)">
|
| 350 |
5b237745
|
Scott Ullrich
|
<option <?php if (!$pconfig['bridge']) echo "selected";?> value="">none</option>
|
| 351 |
|
|
<?php $opts = array('lan' => "LAN", 'wan' => "WAN");
|
| 352 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
| 353 |
|
|
if ($i != $index)
|
| 354 |
|
|
$opts['opt' . $i] = "Optional " . $i . " (" .
|
| 355 |
|
|
$config['interfaces']['opt' . $i]['descr'] . ")";
|
| 356 |
|
|
}
|
| 357 |
|
|
foreach ($opts as $opt => $optname): ?>
|
| 358 |
03b92764
|
Scott Ullrich
|
<option <?php if ($opt == $pconfig['bridge']) echo "selected";?> value="<?=htmlspecialchars($opt);?>">
|
| 359 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($optname);?>
|
| 360 |
|
|
</option>
|
| 361 |
|
|
<?php endforeach; ?>
|
| 362 |
|
|
</select> </td>
|
| 363 |
6d6d0f14
|
Scott Ullrich
|
</tr>
|
| 364 |
03b92764
|
Scott Ullrich
|
<tr>
|
| 365 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">IP address</td>
|
| 366 |
03b92764
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
| 367 |
5b237745
|
Scott Ullrich
|
<input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()">
|
| 368 |
|
|
/
|
| 369 |
|
|
<select name="subnet" class="formfld" id="subnet">
|
| 370 |
21ab1cde
|
Scott Ullrich
|
<?php
|
| 371 |
|
|
for ($i = 32; $i > 0; $i--) {
|
| 372 |
|
|
if($i <> 31) {
|
| 373 |
|
|
echo "<option value=\"{$i}\" ";
|
| 374 |
|
|
if ($i == $pconfig['subnet']) echo "selected";
|
| 375 |
|
|
echo ">" . $i . "</option>";
|
| 376 |
|
|
}
|
| 377 |
|
|
}
|
| 378 |
|
|
?> </select>
|
| 379 |
5b237745
|
Scott Ullrich
|
</td>
|
| 380 |
|
|
</tr>
|
| 381 |
007be4f3
|
Scott Ullrich
|
<tr>
|
| 382 |
1aaa2a5f
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
| 383 |
007be4f3
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
| 384 |
|
|
<input name="gateway" value="<?php echo $pconfig['gateway']; ?>">
|
| 385 |
a12d2145
|
Scott Ullrich
|
<br>
|
| 386 |
8b7a1670
|
cbuechler
|
If you have multiple WAN connections, enter the next hop gateway (router) IP address here. Otherwise, leave this option blank.
|
| 387 |
007be4f3
|
Scott Ullrich
|
</td>
|
| 388 |
|
|
</tr>
|
| 389 |
c435798f
|
Scott Ullrich
|
<?php /* Wireless interface? */
|
| 390 |
|
|
if (isset($optcfg['wireless']))
|
| 391 |
|
|
wireless_config_print();
|
| 392 |
|
|
?>
|
| 393 |
af539d78
|
Scott Ullrich
|
<tr>
|
| 394 |
|
|
<td colspan="2" valign="top" height="16"></td>
|
| 395 |
|
|
</tr>
|
| 396 |
99586fca
|
Scott Ullrich
|
<tr>
|
| 397 |
|
|
<td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
|
| 398 |
|
|
</tr>
|
| 399 |
|
|
<tr>
|
| 400 |
|
|
<td valign="top" class="vncell">Hostname</td>
|
| 401 |
|
|
<td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
|
| 402 |
|
|
<br>
|
| 403 |
|
|
The value in this field is sent as the DHCP client identifier
|
| 404 |
|
|
and hostname when requesting a DHCP lease. Some ISPs may require
|
| 405 |
|
|
this (for client identification).</td>
|
| 406 |
|
|
</tr>
|
| 407 |
|
|
<tr>
|
| 408 |
|
|
<td colspan="2" valign="top" height="16"></td>
|
| 409 |
|
|
</tr>
|
| 410 |
af539d78
|
Scott Ullrich
|
<tr>
|
| 411 |
|
|
<td colspan="2" valign="top" class="vnsepcell">Bandwidth Management (Traffic Shaping)</td>
|
| 412 |
|
|
</tr>
|
| 413 |
|
|
<tr>
|
| 414 |
|
|
<td valign="top" class="vncell">Interface Bandwidth Speed</td>
|
| 415 |
03b92764
|
Scott Ullrich
|
<td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($pconfig['bandwidth']);?>">
|
| 416 |
|
|
<select name="bandwidthtype">
|
| 417 |
|
|
<option value="<?=htmlspecialchars($pconfig['bandwidthtype']);?>"><?=htmlspecialchars($pconfig['bandwidthtype']);?></option>
|
| 418 |
|
|
<option value="b">bit/s</option>
|
| 419 |
|
|
<option value="Kb">Kilobit/s</option>
|
| 420 |
|
|
<option value="Mb">Megabit/s</option>
|
| 421 |
|
|
<option value="Gb">Gigabit/s</option>
|
| 422 |
d09c8936
|
Scott Ullrich
|
<option value=""></option>
|
| 423 |
03b92764
|
Scott Ullrich
|
</select>
|
| 424 |
ac3c2b2a
|
Scott Ullrich
|
<br> The bandwidth setting will define the speed of the interface for traffic shaping. Do not enter your "Internet" bandwidth here, only the physical speed!
|
| 425 |
03b92764
|
Scott Ullrich
|
</td>
|
| 426 |
c1ec2c2f
|
Scott Ullrich
|
</tr>
|
| 427 |
da56c4d7
|
Scott Ullrich
|
<tr>
|
| 428 |
|
|
<td colspan="2" valign="top" height="16"></td>
|
| 429 |
|
|
</tr>
|
| 430 |
|
|
<tr>
|
| 431 |
|
|
<td colspan="2" valign="top" class="listtopic">FTP Helper</td>
|
| 432 |
|
|
</tr>
|
| 433 |
c1ec2c2f
|
Scott Ullrich
|
<tr>
|
| 434 |
|
|
<td width="22%" valign="top" class="vncell">FTP Helper</td>
|
| 435 |
|
|
<td width="78%" class="vtable">
|
| 436 |
c2ce153a
|
Scott Ullrich
|
<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if (isset($pconfig['disableftpproxy'])) echo "checked"; ?> onclick="enable_change(false)" />
|
| 437 |
c1ec2c2f
|
Scott Ullrich
|
<strong>Disable the userland FTP-Proxy application</strong>
|
| 438 |
|
|
<br />
|
| 439 |
|
|
</td>
|
| 440 |
da56c4d7
|
Scott Ullrich
|
</tr>
|
| 441 |
c1ec2c2f
|
Scott Ullrich
|
<tr>
|
| 442 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
| 443 |
03b92764
|
Scott Ullrich
|
<td width="78%">
|
| 444 |
|
|
<input name="index" type="hidden" value="<?=$index;?>">
|
| 445 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
|
| 446 |
5b237745
|
Scott Ullrich
|
</td>
|
| 447 |
|
|
</tr>
|
| 448 |
03b92764
|
Scott Ullrich
|
<tr>
|
| 449 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
| 450 |
|
|
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
|
| 451 |
c55a8ab9
|
Holger Bauer
|
</strong></span>be sure to add <a href="firewall_rules.php">firewall rules</a> to permit traffic
|
| 452 |
|
|
through the interface. You also need firewall rules for an interface in
|
| 453 |
|
|
bridged mode as the firewall acts as a filtering bridge.</span></td>
|
| 454 |
5b237745
|
Scott Ullrich
|
</tr>
|
| 455 |
|
|
</table>
|
| 456 |
|
|
</form>
|
| 457 |
|
|
<script language="JavaScript">
|
| 458 |
|
|
<!--
|
| 459 |
|
|
enable_change(false);
|
| 460 |
|
|
//-->
|
| 461 |
|
|
</script>
|
| 462 |
|
|
<?php else: ?>
|
| 463 |
|
|
<p><strong>Optional <?=$index;?> has been disabled because there is no OPT<?=$index;?> interface.</strong></p>
|
| 464 |
|
|
<?php endif; ?>
|
| 465 |
|
|
<?php include("fend.inc"); ?>
|
| 466 |
|
|
</body>
|
| 467 |
|
|
</html>
|