Project

General

Profile

« Previous | Next » 

Revision bc40d758

Added by Seth Mos almost 18 years ago

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.

View differences:

usr/local/www/interfaces_opt.php
62 62
$pconfig['mtu'] = $optcfg['mtu'];
63 63

  
64 64
$pconfig['disableftpproxy'] = isset($optcfg['disableftpproxy']);
65
$pconfig['use_rrd_gateway'] = $optcfg['use_rrd_gateway'];
65 66

  
66 67
/* Wireless interface? */
67 68
if (isset($optcfg['wireless'])) {
......
72 73
if ($optcfg['ipaddr'] == "dhcp") {
73 74
	$pconfig['type'] = "DHCP";
74 75
	$pconfig['dhcphostname'] = $optcfg['dhcphostname'];
75
	$pconfig['use_rrd_gateway'] = $optcfg['use_rrd_gateway'];
76
	$pconfig['alias-address'] = $optcfg['alias-address'];
77
	$pconfig['alias-subnet'] = $optcfg['alias-subnet'];
76 78
} else {
77 79
	$pconfig['type'] = "Static";
78 80
	$pconfig['ipaddr'] = $optcfg['ipaddr'];
......
165 167
				}
166 168
			}
167 169
		}
170
		if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
171
			$input_errors[] = "A valid alias IP address must be specified.";
172
		}
173
		if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
174
			$input_errors[] = "A valid alias subnet bit count must be specified.";
175
		}
176

  
168 177
	        if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
169 178
			$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
170 179
		}		
......
222 231
		} else if ($_POST['type'] == "DHCP") {
223 232
			$optcfg['ipaddr'] = "dhcp";
224 233
			$optcfg['dhcphostname'] = $_POST['dhcphostname'];
234
			$optcfg['alias-address'] = $_POST['alias-address'];
235
			$optcfg['alias-subnet'] = $_POST['alias-subnet'];
225 236
		}
226 237

  
227 238
		$optcfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
......
444 455
                    and hostname when requesting a DHCP lease. Some ISPs may require
445 456
                    this (for client identification).</td>
446 457
                </tr>
458
		<tr>
459
		  <td width="100" valign="top" class="vncellreq">Alias IP address</td>
460
		  <td class="vtable"> <input name="alias-address" type="text" class="formfld" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
461
		    <select name="alias-subnet" class="formselect" id="alias-subnet">
462
		        <?php
463
		        for ($i = 32; $i > 0; $i--) {
464
		                if($i <> 31) {
465
		                        echo "<option value=\"{$i}\" ";
466
		                        if ($i == $pconfig['alias-subnet']) echo "selected";
467
		                        echo ">" . $i . "</option>";
468
		                }
469
		        }
470
		        ?>
471
		    </select>
472
		    The value in this field is used as a fixed alias IP address by the
473
		    DHCP client.</td>
474
		</tr>
447 475
                <tr>
448 476
                  <td colspan="2" valign="top" height="16"></td>
449 477
                </tr>		

Also available in: Unified diff