summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/filter.inc126
-rw-r--r--etc/inc/interfaces.inc36
-rwxr-xr-xusr/local/www/interfaces.php27
-rwxr-xr-xusr/local/www/interfaces_opt.php30
-rwxr-xr-xusr/local/www/interfaces_wan.php27
5 files changed, 197 insertions, 49 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 5892a7f..3c1ace3 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -695,31 +695,44 @@ function filter_nat_rules_generate() {
} else {
/* standard outbound rules (one for each interface) */
update_filter_reload_status("Creating outbound NAT rules");
-
+ $target = get_current_wan_address($interface = "wan");
+ if(is_ipaddr($wancfg['alias-address'])) {
+ $aliastarget = $wancfg['alias-address'];
+ $aliassubnet = $wancfg['alias-subnet'];
+ $natrules .= filter_nat_rules_generate_if($wanif,
+ "{$lansa}/{$lancfg['subnet']}", null, "$aliastarget/$aliassubnet", null, $aliastarget, null, false);
+ }
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$lansa}/{$lancfg['subnet']}", 500, "", 500, null, 500, false);
+ "{$lansa}/{$lancfg['subnet']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$lansa}/{$lancfg['subnet']}", 4500, "", 4500, null, 4500, false);
+ "{$lansa}/{$lancfg['subnet']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, null, 5060, false);
+ "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$lansa}/{$lancfg['subnet']}");
+ "{$lansa}/{$lancfg['subnet']}", null, "", null, $target, null, false);
$optints = array();
generate_optcfg_array($optints);
/* generate lan nat mappings for opts with a gateway opts */
- foreach($optints as $oc) {
+ foreach($optints as $ocname => $oc) {
$opt_interface = $oc['if'];
if (interface_has_gateway("$opt_interface")) {
+ if(is_ipaddr($config['interfaces'][$ocname]['alias-address'])) {
+ $aliastarget = $config['interfaces'][$ocname]['alias-address'];
+ $aliassubnet = $config['interfaces'][$ocname]['alias-subnet'];
+ $natrules .= filter_nat_rules_generate_if($opt_interface,
+ "{$lansa}/{$lancfg['subnet']}", null, "$aliastarget/$aliassubnet", null, $aliastarget, null, false);
+ }
+ $target = get_current_wan_address($interface = "$ocname");
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$lansa}/{$lancfg['subnet']}", 500, "", 500, null, 500, false);
+ "{$lansa}/{$lancfg['subnet']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$lansa}/{$lancfg['subnet']}", 4500, "", 4500, null, 4500, false);
+ "{$lansa}/{$lancfg['subnet']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, null, 5060, false);
+ "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$lansa}/{$lancfg['subnet']}");
+ "{$lansa}/{$lancfg['subnet']}", null, "", null, $target, null, false);
}
}
@@ -730,29 +743,42 @@ function filter_nat_rules_generate() {
if ((isset ($optcfg['enable'])) && (!$optcfg['bridge']) && (!interface_has_gateway("opt{$i}"))) {
$optsa = gen_subnet($optcfg['ipaddr'], $optcfg['subnet']);
-
+ $target = get_current_wan_address($interface = "opt$i");
+ if(is_ipaddr($wancfg['alias-address'])) {
+ $aliastarget = $wancfg['alias-address'];
+ $aliassubnet = $wancfg['alias-subnet'];
+ $natrules .= filter_nat_rules_generate_if($wanif,
+ "{$lansa}/{$lancfg['subnet']}", null, "$aliastarget/$aliassubnet", null, $aliastarget, null, false);
+ }
/* create outbound nat entries for primary wan */
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$optsa}/{$optcfg['subnet']}", 500, "", 500, null, 500, false);
+ "{$optsa}/{$optcfg['subnet']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$optsa}/{$optcfg['subnet']}", 4500, "", 4500, null, 4500, false);
+ "{$optsa}/{$optcfg['subnet']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, null, 5060, false);
+ "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$optsa}/{$optcfg['subnet']}", null, "", null, null, null, isset($optcfg['nonat']));
+ "{$optsa}/{$optcfg['subnet']}", null, "", null, $target, null, isset($optcfg['nonat']));
/* create outbound nat entries for all opt wans */
- foreach($optints as $oc) {
+ foreach($optints as $ocname => $oc) {
$opt_interface = $oc['if'];
if (interface_has_gateway("$opt_interface")) {
+ $target = get_current_wan_address($interface = "$ocname");
+ if(is_ipaddr($config['interfaces'][$ocname]['alias-address'])) {
+ $aliastarget = $config['interfaces'][$ocname]['alias-address'];
+ $aliassubnet = $config['interfaces'][$ocname]['alias-subnet'];
+ $natrules .= filter_nat_rules_generate_if($opt_interface,
+ "{$lansa}/{$lancfg['subnet']}", null, "$aliastarget/$aliassubnet", null, $aliastarget, null, false);
+ }
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$optsa}/{$optcfg['subnet']}", 500, "", 500, null, 500, false);
+ "{$optsa}/{$optcfg['subnet']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$optsa}/{$optcfg['subnet']}", 4500, "", 4500, null, 4500, false);
+ "{$optsa}/{$optcfg['subnet']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, null, 5060, false);
+ "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$optsa}/{$optcfg['subnet']}", null, "", null, null, null, isset($optcfg['nonat']));
+ "{$optsa}/{$optcfg['subnet']}", null, "", null, $target, null, isset($optcfg['nonat']));
}
}
}
@@ -763,27 +789,29 @@ function filter_nat_rules_generate() {
$pptp_subnet = $g['pptp_subnet'];
if($config['pptp']['pptp_subnet'] <> "")
$pptp_subnet = $config['pptp']['pptp_subnet'];
+ $target = get_current_wan_address($interface = "wan");
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, null, 500, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 4500, "", 4500, null, 4500, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, null, 5060, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}");
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", null, "", null, $target, null, false);
/* generate nat mappings for opts with a gateway opts */
- foreach($optints as $oc) {
+ foreach($optints as $ocname => $oc) {
$opt_interface = $oc['if'];
if ((is_private_ip($pptpdcfg['remoteip'])) && (interface_has_gateway($opt_interface))) {
+ $target = get_current_wan_address($interface = "$ocname");
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, null, 500, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 4500, "", 4500, null, 4500, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, null, 5060, false);
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pptpdcfg['remoteip']}/{$pptp_subnet}");
+ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", null, "", null, $target, null, false);
}
}
}
@@ -793,27 +821,29 @@ function filter_nat_rules_generate() {
$pppoe_subnet = $g['pppoe_subnet'];
if($config['pppoe']['pppoe_subnet'] <> "")
$pppoe_subnet = $config['pppoe']['pppoe_subnet'];
+ $target = get_current_wan_address($interface = "wan");
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, null, 500, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 4500, "", 4500, null, 4500, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, null, 5060, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}");
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", null, "", null, $target, null, false);
/* generate nat mappings for opts with a gateway opts */
- foreach($optints as $oc) {
+ foreach($optints as $ocname => $oc) {
$opt_interface = $oc['if'];
if ((is_private_ip($pppoecfg['remoteip'])) && (interface_has_gateway($opt_interface))) {
+ $target = get_current_wan_address($interface = "$ocname");
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, null, 500, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 4500, "", 4500, null, 4500, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, null, 5060, false);
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$pppoecfg['remoteip']}/{$pppoe_subnet}");
+ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", null, "", null, $target, null, false);
}
}
}
@@ -823,27 +853,29 @@ function filter_nat_rules_generate() {
foreach ($config['staticroutes']['route'] as $route) {
$netip = explode("/", $route['network']);
if ((! interface_has_gateway($route['interface'])) && (is_private_ip($netip[0]))) {
+ $target = get_current_wan_address($interface = "wan");
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$route['network']}", 500, "", 500, null, 500, false);
+ "{$route['network']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$route['network']}", 4500, "", 4500, null, 4500, false);
+ "{$route['network']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$route['network']}", 5060, "", 5060, null, 5060, false);
+ "{$route['network']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($wanif,
- "{$route['network']}", "", null);
+ "{$route['network']}", null, "", null, $target, null, false);
}
/* generate nat mapping for static routes on opts */
- foreach($optints as $oc) {
+ foreach($optints as $ocname => $oc) {
$opt_interface = $oc['if'];
if ((! interface_has_gateway($route['interface'])) && (is_private_ip($netip[0])) && (interface_has_gateway($opt_interface))) {
+ $target = get_current_wan_address($interface = "$ocname");
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$route['network']}", 500, "", 500, null, 500, false);
+ "{$route['network']}", 500, "", 500, $target, 500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$route['network']}", 4500, "", 4500, null, 4500, false);
+ "{$route['network']}", 4500, "", 4500, $target, 4500, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$route['network']}", 5060, "", 5060, null, 5060, false);
+ "{$route['network']}", 5060, "", 5060, $target, 5060, false);
$natrules .= filter_nat_rules_generate_if($opt_interface,
- "{$route['network']}", "", null);
+ "{$route['network']}", null, "", null, $target, null, false);
}
}
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index c77eeb6..9fb01fe 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -984,6 +984,17 @@ interface "{$optif}" {
EOD;
+if(is_ipaddr($optcfg['alias-address'])) {
+ $subnetmask = gen_subnet_mask($optcfg['alias-subnet']);
+ $dhclientconf .= <<<EOD
+alias {
+ interface "{$optif}";
+ fixed-address {$optcfg['alias-address']};
+ option subnet-mask {$subnetmask};
+}
+
+EOD;
+}
fwrite($fd, $dhclientconf);
fclose($fd);
@@ -1028,6 +1039,18 @@ interface "{$realinterface}" {
EOD;
+if(is_ipaddr($optcfg['alias-address'])) {
+ $subnetmask = gen_subnet_mask($optcfg['alias-subnet']);
+ $dhclientconf .= <<<EOD
+alias {
+ interface "{$optif}";
+ fixed-address {$optcfg['alias-address']};
+ option subnet-mask {$subnetmask};
+}
+
+EOD;
+}
+
fwrite($fd, $dhclientconf);
fclose($fd);
@@ -1075,6 +1098,17 @@ interface "{$wancfg['if']}" {
EOD;
+if(is_ipaddr($wancfg['alias-address'])) {
+ $subnetmask = gen_subnet_mask($wancfg['alias-subnet']);
+ $dhclientconf .= <<<EOD
+alias {
+ interface "{$wancfg['if']}";
+ fixed-address {$wancfg['alias-address']};
+ option subnet-mask {$subnetmask};
+}
+
+EOD;
+}
fwrite($fd, $dhclientconf);
fclose($fd);
@@ -1659,4 +1693,4 @@ function get_interface_mac($interface) {
return $mac;
}
-?> \ No newline at end of file
+?>
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