diff options
-rwxr-xr-x | usr/local/www/firewall_shaper_queues_edit.php | 1 | ||||
-rwxr-xr-x | usr/local/www/gui.css | 6 | ||||
-rwxr-xr-x | usr/local/www/guiconfig.inc | 8 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 182 | ||||
-rwxr-xr-x | usr/local/www/interfaces_lan.php | 65 | ||||
-rwxr-xr-x | usr/local/www/interfaces_wan.php | 182 |
6 files changed, 257 insertions, 187 deletions
diff --git a/usr/local/www/firewall_shaper_queues_edit.php b/usr/local/www/firewall_shaper_queues_edit.php index e9237b5..c9198d3 100755 --- a/usr/local/www/firewall_shaper_queues_edit.php +++ b/usr/local/www/firewall_shaper_queues_edit.php @@ -81,6 +81,7 @@ if ($_POST) { $queue = array(); $queue['options']['schedulertype'] = $_POST['schedulertype']; $queue['bandwidth'] = $_POST['bandwidth']; + $queue['bandwidthtype'] = $_POST['bandwidthtype']; $queue['priority'] = $_POST['priority']; $queue['name'] = ereg_replace(" ", "", $_POST['name']); $queue['options']['linkshare'] = $_POST['linkshare']; diff --git a/usr/local/www/gui.css b/usr/local/www/gui.css index d94ae6f..667561b 100755 --- a/usr/local/www/gui.css +++ b/usr/local/www/gui.css @@ -2,6 +2,12 @@ body,td,th,input,select { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; } +rebootbox { + a:link {color: #FFFFFF; text-decoration: underline; } + a:active {color: #FFFFFF; text-decoration: underline; } + a:visited {color: #FFFFFF; text-decoration: underline; } + a:hover {color: #FFFF00; text-decoration: none; } +} form { margin: 0px; } diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index cd9f6a0..4ac00bf 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -167,10 +167,10 @@ function verify_gzip_file($fname) { function print_info_box_np($msg) { echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\">\n"; - echo "<tr><td bgcolor=\"#687BA4\" align=\"center\" valign=\"top\" width=\"36\"><img src=\"/exclam.gif\" width=\"28\" height=\"32\"></td>\n"; - echo "<td bgcolor=\"#D9DEE8\" style=\"padding-left: 8px\">"; + echo "<tr><td bgcolor=\"#7F3B00\" align=\"center\" valign=\"top\" width=\"36\"><img src=\"/exclam.gif\" width=\"28\" height=\"32\"></td>\n"; + echo "<td bgcolor=\"#00000\" style=\"padding-left: 8px\"><font color=\"#ffffff\">"; echo $msg; - echo "</td></tr></table>"; + echo "</td></tr></table><br>"; } function print_info_box($msg) { @@ -196,7 +196,7 @@ function get_std_save_message($ok) { if ($ok == 0) { if (file_exists($d_sysrebootreqd_path)) - return "The changes have been saved. You must <a href=\"/reboot.php\">reboot</a> your firewall for changes to take effect."; + return "The changes have been saved. You must <a class=\"navlnk\" href=\"/reboot.php\">reboot</a> your firewall for changes to take effect."; else return "The changes have been applied successfully."; } else { diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index b4cc30b..675e29a 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -1,22 +1,22 @@ #!/usr/local/bin/php -<?php +<?php /* interfaces_wan.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -37,6 +37,10 @@ $optcfg = &$config['interfaces']['wan']; $pconfig['username'] = $config['pppoe']['username']; $pconfig['password'] = $config['pppoe']['password']; $pconfig['provider'] = $config['pppoe']['provider']; + +$pconfig['bandwidth'] = $config['bandwidth']; +$pconfig['bandwidthtype'] = $config['bandwidthtype']; + $pconfig['pppoe_dialondemand'] = $config['pppoe']['ondemand']; $pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout']; @@ -114,7 +118,7 @@ if ($_POST) { $reqdfieldsn = explode(",", "BigPond username,BigPond password"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } - + if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } @@ -157,7 +161,7 @@ if ($_POST) { if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) { $input_errors[] = "The MTU must be between 576 and 1500 bytes."; } - + /* Wireless interface? */ if (isset($optcfg['wireless'])) { $wi_input_errors = wireless_config_post(); @@ -167,10 +171,12 @@ if ($_POST) { } if (!$input_errors) { - + unset($wancfg['ipaddr']); unset($wancfg['subnet']); unset($wancfg['gateway']); + unset($wancfg['bandwidth']); + unset($wancfg['bandwidthtype']); unset($wancfg['dhcphostname']); unset($config['pppoe']['username']); unset($config['pppoe']['password']); @@ -189,7 +195,10 @@ if ($_POST) { unset($config['bigpond']['authserver']); unset($config['bigpond']['authdomain']); unset($config['bigpond']['minheartbeatinterval']); - + + $wancfg['bandwidth'] = $_POST['bandwidth']; + $wancfg['bandwidthtype'] = $_POST['bandwidthtype']; + if ($_POST['type'] == "Static") { $wancfg['ipaddr'] = $_POST['ipaddr']; $wancfg['subnet'] = $_POST['subnet']; @@ -221,13 +230,13 @@ if ($_POST) { $config['bigpond']['authdomain'] = $_POST['bigpond_authdomain']; $config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval']; } - + $wancfg['blockpriv'] = $_POST['blockpriv'] ? true : false; $wancfg['spoofmac'] = $_POST['spoofmac']; $wancfg['mtu'] = $_POST['mtu']; - + write_config(); - + $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); @@ -402,105 +411,120 @@ function type_change(enable_change,enable_change_pptp) { <?php if ($savemsg) print_info_box($savemsg); ?> <form action="interfaces_wan.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> + <tr> <td valign="middle"><strong>Type</strong></td> <td> <select name="type" class="formfld" id="type" onchange="type_change()"> <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond"); foreach ($opts as $opt): ?> - <option <?php if ($opt == $pconfig['type']) echo "selected";?>> + <option <?php if ($opt == $pconfig['type']) echo "selected";?>> <?=htmlspecialchars($opt);?> </option> <?php endforeach; ?> </select></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="4"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">General configuration</td> </tr> - <tr> + + <tr> + <td valign="top" class="vncell">Interface Bandwidth Speed</td> + <td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> + <select name="bandwidthtype"> + <option value="<?=htmlspecialchars($pconfig['bandwidthtype']);?>"><?=htmlspecialchars($pconfig['bandwidthtype']);?></option> + <option value="b">bit/s</option> + <option value="Kb">Kilobit/s</option> + <option value="Mb">Megabit/s</option> + <option value="Gb">Gigabit/s</option> + </select> + <br> The bandwidth setting will define the speed of the interface for traffic shaping. + </td> + </tr> + + <tr> <td valign="top" class="vncell">MAC address</td> - <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>"> + <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>"> <br> - This field can be used to modify ("spoof") the MAC + This field can be used to modify ("spoof") the MAC address of the WAN interface<br> (may be required with some cable connections)<br> - Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx + Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank</td> </tr> - <tr> + <tr> <td valign="top" class="vncell">MTU</td> - <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>"> + <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>"> <br> - If you enter a value in this field, then MSS clamping for - TCP connections to the value entered above minus 40 (TCP/IP - header size) will be in effect. If you leave this field blank, - an MTU of 1492 bytes for PPPoE and 1500 bytes for all other + If you enter a value in this field, then MSS clamping for + TCP connections to the value entered above minus 40 (TCP/IP + header size) will be in effect. If you leave this field blank, + an MTU of 1492 bytes for PPPoE and 1500 bytes for all other connection types will be assumed.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">Static IP configuration</td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">IP address</td> <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>"> - / + / <select name="subnet" class="formfld" id="subnet"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>> + <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>> <?=$i;?> </option> <?php endfor; ?> </select></td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Gateway</td> - <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> + <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> </td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">DHCP client configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Hostname</td> <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>"> <br> - The value in this field is sent as the DHCP client identifier - and hostname when requesting a DHCP lease. Some ISPs may require + The value in this field is sent as the DHCP client identifier + and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">PPPoE configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> + <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> + <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Service name</td> - <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>"> - <br> <span class="vexpl">Hint: this field can usually be left + <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>"> + <br> <span class="vexpl">Hint: this field can usually be left empty</span></td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Dial on demand</td> - <td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change(false)" > + <td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change(false)" > <strong>Enable Dial-On-Demand mode</strong><br> This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td> </tr> @@ -511,42 +535,42 @@ function type_change(enable_change,enable_change_pptp) { seconds<br> If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">PPTP configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> + <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> + <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> </td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">Local IP address</td> <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>"> - / + / <select name="pptp_subnet" class="formfld" id="pptp_subnet"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>> + <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>> <?=$i;?> </option> <?php endfor; ?> </select></td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">Remote IP address</td> - <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> + <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Dial on demand</td> - <td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change_pptp(false)" > + <td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change_pptp(false)" > <strong>Enable Dial-On-Demand mode</strong><br> This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td> </tr> @@ -557,29 +581,29 @@ function type_change(enable_change,enable_change_pptp) { seconds<br> If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">BigPond Cable configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> + <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> + <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Authentication server</td> <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>"> <br> <span class="vexpl">If this field is left empty, the default ("dce-server") is used. </span></td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Authentication domain</td> <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>"> <br> @@ -598,24 +622,24 @@ function type_change(enable_change,enable_change_pptp) { if (isset($optcfg['wireless'])) wireless_config_print(); ?> - <tr> + <tr> <td height="16" colspan="2" valign="top"></td> </tr> - <tr> + <tr> <td valign="middle"> </td> - <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv'] == "yes") echo "checked"; ?>> + <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv'] == "yes") echo "checked"; ?>> <strong>Block private networks</strong><br> - When set, this option blocks traffic from IP addresses that + When set, this option blocks traffic from IP addresses that are reserved for private<br> - networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as + networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as well as loopback addresses<br> - (127/8). You should generally leave this option turned on, + (127/8). You should generally leave this option turned on, unless your WAN network<br> lies in such a private address space, too.</td> </tr> - <tr> + <tr> <td width="100" valign="top"> </td> - <td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)"> + <td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)"> </td> </tr> </table> diff --git a/usr/local/www/interfaces_lan.php b/usr/local/www/interfaces_lan.php index 66af153..e4b2d65 100755 --- a/usr/local/www/interfaces_lan.php +++ b/usr/local/www/interfaces_lan.php @@ -1,22 +1,22 @@ #!/usr/local/bin/php -<?php +<?php /* interfaces_lan.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -50,16 +50,16 @@ if ($_POST) { /* input validation */ $reqdfields = explode(" ", "ipaddr subnet"); $reqdfieldsn = explode(",", "IP address,Subnet bit count"); - + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - + if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) { $input_errors[] = "A valid subnet bit count must be specified."; } - + /* Wireless interface? */ if (isset($optcfg['wireless'])) { $wi_input_errors = wireless_config_post(); @@ -71,18 +71,20 @@ if ($_POST) { if (!$input_errors) { $config['interfaces']['lan']['ipaddr'] = $_POST['ipaddr']; $config['interfaces']['lan']['subnet'] = $_POST['subnet']; - + $config['interfaces']['lan']['bandwidth'] = $_POST['bandwidth']; + $config['interfaces']['lan']['bandwidthtype'] = $_POST['bandwidthtype']; + $dhcpd_was_enabled = 0; if (isset($config['dhcpd']['enable'])) { unset($config['dhcpd']['enable']); $dhcpd_was_enabled = 1; } - + write_config(); touch($d_sysrebootreqd_path); - + $savemsg = get_std_save_message(0); - + if ($dhcpd_was_enabled) $savemsg .= "<br>Note that the DHCP server has been disabled.<br>Please review its configuration " . "and enable it again prior to rebooting."; @@ -104,7 +106,7 @@ function gen_bits(ipaddr) { return ""; if (adr[0] == 0 && adr[1] == 0 && adr[2] == 0 && adr[3] == 0) return ""; - + if (adr[0] <= 127) return "8"; else if (adr[0] <= 191) @@ -129,11 +131,11 @@ function ipaddr_change() { <?php if ($savemsg) print_info_box($savemsg); ?> <form action="interfaces_lan.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> + <tr> <td width="22%" valign="top" class="vncellreq">IP address</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ipaddr" type="text" class="formfld" id="hostname" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()"> - / + / <select name="subnet" class="formfld" id="subnet"> <?php for ($i = 31; $i > 0; $i--): ?> <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>> @@ -146,19 +148,32 @@ function ipaddr_change() { if (isset($optcfg['wireless'])) wireless_config_print(); ?> - <tr> + <tr> + <td valign="top" class="vncell">Interface Bandwidth Speed</td> + <td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> + <select name="bandwidthtype"> + <option value="<?=htmlspecialchars($pconfig['bandwidthtype']);?>"><?=htmlspecialchars($pconfig['bandwidthtype']);?></option> + <option value="b">bit/s</option> + <option value="Kb">Kilobit/s</option> + <option value="Mb">Megabit/s</option> + <option value="Gb">Gigabit/s</option> + </select> + <br> The bandwidth setting will define the speed of the interface for traffic shaping. + </td> + </tr> + <tr> <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="Save"> </td> </tr> - <tr> + <tr> <td width="22%" valign="top"> </td> <td width="78%"><span class="vexpl"><span class="red"><strong>Warning:<br> - </strong></span>after you click "Save", you must - reboot your firewall for changes to take effect. You may also - have to do one or more of the following steps before you can - access your firewall again: + </strong></span>after you click "Save", you must + reboot your firewall for changes to take effect. You may also + have to do one or more of the following steps before you can + access your firewall again: <ul> <li>change the IP address of your computer</li> <li>renew its DHCP lease</li> diff --git a/usr/local/www/interfaces_wan.php b/usr/local/www/interfaces_wan.php index b4cc30b..675e29a 100755 --- a/usr/local/www/interfaces_wan.php +++ b/usr/local/www/interfaces_wan.php @@ -1,22 +1,22 @@ #!/usr/local/bin/php -<?php +<?php /* interfaces_wan.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -37,6 +37,10 @@ $optcfg = &$config['interfaces']['wan']; $pconfig['username'] = $config['pppoe']['username']; $pconfig['password'] = $config['pppoe']['password']; $pconfig['provider'] = $config['pppoe']['provider']; + +$pconfig['bandwidth'] = $config['bandwidth']; +$pconfig['bandwidthtype'] = $config['bandwidthtype']; + $pconfig['pppoe_dialondemand'] = $config['pppoe']['ondemand']; $pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout']; @@ -114,7 +118,7 @@ if ($_POST) { $reqdfieldsn = explode(",", "BigPond username,BigPond password"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } - + if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } @@ -157,7 +161,7 @@ if ($_POST) { if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) { $input_errors[] = "The MTU must be between 576 and 1500 bytes."; } - + /* Wireless interface? */ if (isset($optcfg['wireless'])) { $wi_input_errors = wireless_config_post(); @@ -167,10 +171,12 @@ if ($_POST) { } if (!$input_errors) { - + unset($wancfg['ipaddr']); unset($wancfg['subnet']); unset($wancfg['gateway']); + unset($wancfg['bandwidth']); + unset($wancfg['bandwidthtype']); unset($wancfg['dhcphostname']); unset($config['pppoe']['username']); unset($config['pppoe']['password']); @@ -189,7 +195,10 @@ if ($_POST) { unset($config['bigpond']['authserver']); unset($config['bigpond']['authdomain']); unset($config['bigpond']['minheartbeatinterval']); - + + $wancfg['bandwidth'] = $_POST['bandwidth']; + $wancfg['bandwidthtype'] = $_POST['bandwidthtype']; + if ($_POST['type'] == "Static") { $wancfg['ipaddr'] = $_POST['ipaddr']; $wancfg['subnet'] = $_POST['subnet']; @@ -221,13 +230,13 @@ if ($_POST) { $config['bigpond']['authdomain'] = $_POST['bigpond_authdomain']; $config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval']; } - + $wancfg['blockpriv'] = $_POST['blockpriv'] ? true : false; $wancfg['spoofmac'] = $_POST['spoofmac']; $wancfg['mtu'] = $_POST['mtu']; - + write_config(); - + $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); @@ -402,105 +411,120 @@ function type_change(enable_change,enable_change_pptp) { <?php if ($savemsg) print_info_box($savemsg); ?> <form action="interfaces_wan.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> + <tr> <td valign="middle"><strong>Type</strong></td> <td> <select name="type" class="formfld" id="type" onchange="type_change()"> <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond"); foreach ($opts as $opt): ?> - <option <?php if ($opt == $pconfig['type']) echo "selected";?>> + <option <?php if ($opt == $pconfig['type']) echo "selected";?>> <?=htmlspecialchars($opt);?> </option> <?php endforeach; ?> </select></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="4"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">General configuration</td> </tr> - <tr> + + <tr> + <td valign="top" class="vncell">Interface Bandwidth Speed</td> + <td class="vtable"> <input name="bandwidth" type="text" class="formfld" id="bandwidth" size="30" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> + <select name="bandwidthtype"> + <option value="<?=htmlspecialchars($pconfig['bandwidthtype']);?>"><?=htmlspecialchars($pconfig['bandwidthtype']);?></option> + <option value="b">bit/s</option> + <option value="Kb">Kilobit/s</option> + <option value="Mb">Megabit/s</option> + <option value="Gb">Gigabit/s</option> + </select> + <br> The bandwidth setting will define the speed of the interface for traffic shaping. + </td> + </tr> + + <tr> <td valign="top" class="vncell">MAC address</td> - <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>"> + <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>"> <br> - This field can be used to modify ("spoof") the MAC + This field can be used to modify ("spoof") the MAC address of the WAN interface<br> (may be required with some cable connections)<br> - Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx + Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank</td> </tr> - <tr> + <tr> <td valign="top" class="vncell">MTU</td> - <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>"> + <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>"> <br> - If you enter a value in this field, then MSS clamping for - TCP connections to the value entered above minus 40 (TCP/IP - header size) will be in effect. If you leave this field blank, - an MTU of 1492 bytes for PPPoE and 1500 bytes for all other + If you enter a value in this field, then MSS clamping for + TCP connections to the value entered above minus 40 (TCP/IP + header size) will be in effect. If you leave this field blank, + an MTU of 1492 bytes for PPPoE and 1500 bytes for all other connection types will be assumed.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">Static IP configuration</td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">IP address</td> <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>"> - / + / <select name="subnet" class="formfld" id="subnet"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>> + <option value="<?=$i;?>" <?php if ($i == $pconfig['subnet']) echo "selected"; ?>> <?=$i;?> </option> <?php endfor; ?> </select></td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Gateway</td> - <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> + <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> </td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">DHCP client configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Hostname</td> <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>"> <br> - The value in this field is sent as the DHCP client identifier - and hostname when requesting a DHCP lease. Some ISPs may require + The value in this field is sent as the DHCP client identifier + and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">PPPoE configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> + <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> + <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Service name</td> - <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>"> - <br> <span class="vexpl">Hint: this field can usually be left + <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>"> + <br> <span class="vexpl">Hint: this field can usually be left empty</span></td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Dial on demand</td> - <td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change(false)" > + <td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change(false)" > <strong>Enable Dial-On-Demand mode</strong><br> This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td> </tr> @@ -511,42 +535,42 @@ function type_change(enable_change,enable_change_pptp) { seconds<br> If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">PPTP configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> + <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> + <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> </td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">Local IP address</td> <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>"> - / + / <select name="pptp_subnet" class="formfld" id="pptp_subnet"> <?php for ($i = 31; $i > 0; $i--): ?> - <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>> + <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>> <?=$i;?> </option> <?php endfor; ?> </select></td> </tr> - <tr> + <tr> <td width="100" valign="top" class="vncellreq">Remote IP address</td> - <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> + <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Dial on demand</td> - <td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change_pptp(false)" > + <td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand'] == "enable") echo "checked"; ?> onClick="enable_change_pptp(false)" > <strong>Enable Dial-On-Demand mode</strong><br> This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td> </tr> @@ -557,29 +581,29 @@ function type_change(enable_change,enable_change_pptp) { seconds<br> If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td> </tr> - <tr> + <tr> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr> <td colspan="2" valign="top" class="vnsepcell">BigPond Cable configuration</td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Username</td> - <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> + <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncellreq">Password</td> - <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> + <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> </td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Authentication server</td> <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>"> <br> <span class="vexpl">If this field is left empty, the default ("dce-server") is used. </span></td> </tr> - <tr> + <tr> <td valign="top" class="vncell">Authentication domain</td> <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>"> <br> @@ -598,24 +622,24 @@ function type_change(enable_change,enable_change_pptp) { if (isset($optcfg['wireless'])) wireless_config_print(); ?> - <tr> + <tr> <td height="16" colspan="2" valign="top"></td> </tr> - <tr> + <tr> <td valign="middle"> </td> - <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv'] == "yes") echo "checked"; ?>> + <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv'] == "yes") echo "checked"; ?>> <strong>Block private networks</strong><br> - When set, this option blocks traffic from IP addresses that + When set, this option blocks traffic from IP addresses that are reserved for private<br> - networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as + networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as well as loopback addresses<br> - (127/8). You should generally leave this option turned on, + (127/8). You should generally leave this option turned on, unless your WAN network<br> lies in such a private address space, too.</td> </tr> - <tr> + <tr> <td width="100" valign="top"> </td> - <td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)"> + <td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)"> </td> </tr> </table> |