summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2007-09-01 18:30:20 +0000
committerSeth Mos <seth.mos@xs4all.nl>2007-09-01 18:30:20 +0000
commitbc40d758bea5ba6be700bd83fd9a7ae643378faa (patch)
treeb60c4130ee7b5e9cfdcae080538bbc6cc8672ce7 /usr
parentc1abd446e2a96ad48a3d477d0f24ff5bbd8ae097 (diff)
downloadpfsense-bc40d758bea5ba6be700bd83fd9a7ae643378faa.zip
pfsense-bc40d758bea5ba6be700bd83fd9a7ae643378faa.tar.gz
Create a management subnet on a wan interface if the interface is DHCP.
Create automatic nat rules for the management subnet. Make the automatic nat rules always use the interface address. Allow entry of these subnets on the interfaces page.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/interfaces.php27
-rwxr-xr-xusr/local/www/interfaces_opt.php30
-rwxr-xr-xusr/local/www/interfaces_wan.php27
3 files changed, 83 insertions, 1 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 380b07f..15cda1a 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -134,6 +134,8 @@ $pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
+$pconfig['alias-address'] = $wancfg['alias-address'];
+$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
$pconfig['use_rrd_gateway'] = $wancfg['use_rrd_gateway'];
if ($wancfg['ipaddr'] == "dhcp") {
@@ -244,6 +246,12 @@ if ($_POST) {
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
$input_errors[] = "A valid subnet bit count must be specified.";
}
+ if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
+ $input_errors[] = "A valid alias IP address must be specified.";
+ }
+ if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
+ $input_errors[] = "A valid alias subnet bit count must be specified.";
+ }
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
$input_errors[] = "A valid gateway must be specified.";
}
@@ -364,6 +372,8 @@ if ($_POST) {
} else if ($_POST['type'] == "DHCP") {
$wancfg['ipaddr'] = "dhcp";
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
+ $wancfg['alias-address'] = $_POST['alias-address'];
+ $wancfg['alias-subnet'] = $_POST['alias-subnet'];
} else if ($_POST['type'] == "PPPoE") {
$wancfg['ipaddr'] = "pppoe";
$config['pppoe']['username'] = $_POST['username'];
@@ -796,6 +806,23 @@ function show_mon_config() {
this (for client identification).</td>
</tr>
<tr>
+ <td width="100" valign="top" class="vncellreq">Alias IP address</td>
+ <td class="vtable"> <input name="alias-address" type="text" class="formfld" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
+ <select name="alias-subnet" class="formselect" id="alias-subnet">
+ <?php
+ for ($i = 32; $i > 0; $i--) {
+ if($i <> 31) {
+ echo "<option value=\"{$i}\" ";
+ if ($i == $pconfig['alias-subnet']) echo "selected";
+ echo ">" . $i . "</option>";
+ }
+ }
+ ?>
+ </select>
+ The value in this field is used as a fixed alias IP address by the
+ DHCP client.</td>
+ </tr>
+ <tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
<tr>
diff --git a/usr/local/www/interfaces_opt.php b/usr/local/www/interfaces_opt.php
index 6125797..66a26a3 100755
--- a/usr/local/www/interfaces_opt.php
+++ b/usr/local/www/interfaces_opt.php
@@ -62,6 +62,7 @@ $pconfig['spoofmac'] = $optcfg['spoofmac'];
$pconfig['mtu'] = $optcfg['mtu'];
$pconfig['disableftpproxy'] = isset($optcfg['disableftpproxy']);
+$pconfig['use_rrd_gateway'] = $optcfg['use_rrd_gateway'];
/* Wireless interface? */
if (isset($optcfg['wireless'])) {
@@ -72,7 +73,8 @@ if (isset($optcfg['wireless'])) {
if ($optcfg['ipaddr'] == "dhcp") {
$pconfig['type'] = "DHCP";
$pconfig['dhcphostname'] = $optcfg['dhcphostname'];
- $pconfig['use_rrd_gateway'] = $optcfg['use_rrd_gateway'];
+ $pconfig['alias-address'] = $optcfg['alias-address'];
+ $pconfig['alias-subnet'] = $optcfg['alias-subnet'];
} else {
$pconfig['type'] = "Static";
$pconfig['ipaddr'] = $optcfg['ipaddr'];
@@ -165,6 +167,13 @@ if ($_POST) {
}
}
}
+ if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
+ $input_errors[] = "A valid alias IP address must be specified.";
+ }
+ if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
+ $input_errors[] = "A valid alias subnet bit count must be specified.";
+ }
+
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
}
@@ -222,6 +231,8 @@ if ($_POST) {
} else if ($_POST['type'] == "DHCP") {
$optcfg['ipaddr'] = "dhcp";
$optcfg['dhcphostname'] = $_POST['dhcphostname'];
+ $optcfg['alias-address'] = $_POST['alias-address'];
+ $optcfg['alias-subnet'] = $_POST['alias-subnet'];
}
$optcfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
@@ -444,6 +455,23 @@ function show_mon_config() {
and hostname when requesting a DHCP lease. Some ISPs may require
this (for client identification).</td>
</tr>
+ <tr>
+ <td width="100" valign="top" class="vncellreq">Alias IP address</td>
+ <td class="vtable"> <input name="alias-address" type="text" class="formfld" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
+ <select name="alias-subnet" class="formselect" id="alias-subnet">
+ <?php
+ for ($i = 32; $i > 0; $i--) {
+ if($i <> 31) {
+ echo "<option value=\"{$i}\" ";
+ if ($i == $pconfig['alias-subnet']) echo "selected";
+ echo ">" . $i . "</option>";
+ }
+ }
+ ?>
+ </select>
+ The value in this field is used as a fixed alias IP address by the
+ DHCP client.</td>
+ </tr>
<tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
diff --git a/usr/local/www/interfaces_wan.php b/usr/local/www/interfaces_wan.php
index 380b07f..15cda1a 100755
--- a/usr/local/www/interfaces_wan.php
+++ b/usr/local/www/interfaces_wan.php
@@ -134,6 +134,8 @@ $pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
+$pconfig['alias-address'] = $wancfg['alias-address'];
+$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
$pconfig['use_rrd_gateway'] = $wancfg['use_rrd_gateway'];
if ($wancfg['ipaddr'] == "dhcp") {
@@ -244,6 +246,12 @@ if ($_POST) {
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
$input_errors[] = "A valid subnet bit count must be specified.";
}
+ if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
+ $input_errors[] = "A valid alias IP address must be specified.";
+ }
+ if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
+ $input_errors[] = "A valid alias subnet bit count must be specified.";
+ }
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
$input_errors[] = "A valid gateway must be specified.";
}
@@ -364,6 +372,8 @@ if ($_POST) {
} else if ($_POST['type'] == "DHCP") {
$wancfg['ipaddr'] = "dhcp";
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
+ $wancfg['alias-address'] = $_POST['alias-address'];
+ $wancfg['alias-subnet'] = $_POST['alias-subnet'];
} else if ($_POST['type'] == "PPPoE") {
$wancfg['ipaddr'] = "pppoe";
$config['pppoe']['username'] = $_POST['username'];
@@ -796,6 +806,23 @@ function show_mon_config() {
this (for client identification).</td>
</tr>
<tr>
+ <td width="100" valign="top" class="vncellreq">Alias IP address</td>
+ <td class="vtable"> <input name="alias-address" type="text" class="formfld" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
+ <select name="alias-subnet" class="formselect" id="alias-subnet">
+ <?php
+ for ($i = 32; $i > 0; $i--) {
+ if($i <> 31) {
+ echo "<option value=\"{$i}\" ";
+ if ($i == $pconfig['alias-subnet']) echo "selected";
+ echo ">" . $i . "</option>";
+ }
+ }
+ ?>
+ </select>
+ The value in this field is used as a fixed alias IP address by the
+ DHCP client.</td>
+ </tr>
+ <tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
<tr>
OpenPOWER on IntegriCloud