summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.setlanip
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2008-02-22 09:07:18 +0000
committerChris Buechler <cmb@pfsense.org>2008-02-22 09:07:18 +0000
commitd01ccca84144a05c0b2ae830295433ee908bfcf5 (patch)
tree65176935168850911b7fbae0dd1045e9499a4c79 /etc/rc.initial.setlanip
parent49b94d3a12a5a8d455f5eb944278c896864931f9 (diff)
downloadpfsense-d01ccca84144a05c0b2ae830295433ee908bfcf5.zip
pfsense-d01ccca84144a05c0b2ae830295433ee908bfcf5.tar.gz
Fix numerous issues introduced with single interface support. Still some issues to be resolved here.
Single interface support Appliance Project
Diffstat (limited to 'etc/rc.initial.setlanip')
-rwxr-xr-xetc/rc.initial.setlanip60
1 files changed, 35 insertions, 25 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip
index 2df7024..066334d 100755
--- a/etc/rc.initial.setlanip
+++ b/etc/rc.initial.setlanip
@@ -42,24 +42,30 @@
if($config['interfaces']['lan']) {
$ifdescrs[] = "lan";
}
- for ($j = 1; isset ($config['interfaces']['opt' . $j]); $j++) {
+ for ($j = 0; isset ($config['interfaces']['opt' . $j]); $j++) {
if(isset($config['interfaces']['opt' . $j]['enable']))
$ifdescrs['opt' . $j] = filter_get_opt_interface_descr("opt" . $j);
}
if($config['interfaces']['lan'])
$j++;
- // incriment for wan
+ // increment for wan
$j++;
- /* grab interface that we will operate on */
- echo "Available interfaces:\n\n";
- $x=1;
- foreach($ifdescrs as $iface) {
- echo "{$x} - " . strtoupper($iface) . "\n";
- $x++;
+ /* grab interface that we will operate on, unless there is only one
+ interface */
+ if ($j > 1) {
+ echo "Available interfaces:\n\n";
+ $x=1;
+ foreach($ifdescrs as $iface) {
+ echo "{$x} - " . strtoupper($iface) . "\n";
+ $x++;
+ }
+ echo "\nEnter the number of the interface you wish to configure: ";
+ $intnum = chop(fgets($fp));
+ } else {
+ $intnum = $j;
}
- echo "\nEnter interface # that you would like to configure: ";
- $intnum = chop(fgets($fp));
+
if($intnum < 1)
exit;
@@ -75,7 +81,8 @@
do {
if($interface == "wan") {
- echo gettext("Would you like to enable DHCP on the {$interface} Press <ENTER> or n for no:") . "\n> ";
+ $upperifname = strtoupper($interface);
+ echo gettext("Configure {$upperifname} interface via DHCP? [y|n]") . "\n> ";
$intdhcp = chop(fgets($fp));
if(strtolower($intdhcp) == "y" || strtolower($intdhcp) == "yes") {
$intip = "DHCP";
@@ -86,33 +93,36 @@
if($isintdhcp == false or $interface <> "wan") {
do {
- echo "\n" . gettext("Enter the new {$interface} IPv4 address. Press <ENTER> for none:") . "\n> ";
+ $upperifname = strtoupper($interface);
+ echo "\n" . gettext("Enter the new {$upperifname} IPv4 address. Press <ENTER> for none:") . "\n> ";
$intip = chop(fgets($fp));
$addr_blank = false;
} while (!(is_ipaddr($intip) || $intip == ''));
+ if ($intip != '') {
+ echo "\n" . gettext("Subnet masks are entered as bit counts (as in CIDR notation) in {$g['product_name']}.") . "\n";
+ echo "e.g. 255.255.255.0 = 24\n";
+ echo " 255.255.0.0 = 16\n";
+ echo " 255.0.0.0 = 8\n";
+
+ do {
+ $upperifname = strtoupper($interface);
+ echo "\n" . gettext("Enter the new {$upperifname} IPv4 subnet bit count:") . "\n> ";
+ $intbits = chop(fgets($fp));
+ } while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > 31));
+ }
}
- if ($intip != '') {
- echo "\n" . gettext("Subnet masks are entered as bit counts (as in CIDR notation) in {$g['product_name']}.") . "\n";
- echo "e.g. 255.255.255.0 = 24\n";
- echo " 255.255.0.0 = 16\n";
- echo " 255.0.0.0 = 8\n";
-
- do {
- echo "\n" . gettext("Enter the new {$interface} IPv4 subnet bit count:") . "\n> ";
- $intbits = chop(fgets($fp));
- } while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > 31));
- }
} while ($addr_blank);
$config['interfaces'][$interface]['ipaddr'] = $intip;
$config['interfaces'][$interface]['subnet'] = $intbits;
- if($interface <> "wan") {
+ if($interface <> "wan" || !$config['interfaces']['lan']) {
do {
$good = false;
- echo "\n" . gettext("Do you want to enable the DHCP server on {$interface} [y|n]?") . " ";
+ $upperifname = strtoupper($interface);
+ echo "\n" . gettext("Do you want to enable the DHCP server on {$upperifname}? [y|n]") . " ";
$yn = strtolower(chop(fgets($fp)));
if ($yn[0] == "y" or $yn[0] == "n")
$good = true;
OpenPOWER on IntegriCloud