summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-01 01:59:37 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-01 01:59:37 +0000
commite522f83c67ef7b292c5ed4328fcf0280f41ec7aa (patch)
treea71f315e302c0bc487afd8a812dd32a61628e87e /etc
parentbaf888d1a0d6a5d234b42244566eff3103432277 (diff)
downloadpfsense-e522f83c67ef7b292c5ed4328fcf0280f41ec7aa.zip
pfsense-e522f83c67ef7b292c5ed4328fcf0280f41ec7aa.tar.gz
Correct the vlan_setup function.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc58
1 files changed, 30 insertions, 28 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 5df8bfd..0a80955 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -556,6 +556,7 @@ function set_networking_interfaces_ports() {
global $noreboot;
global $config;
global $g;
+ global $fp;
$fp = fopen('php://stdin', 'r');
@@ -782,50 +783,51 @@ EOD;
return null;
}
- function vlan_setup() {
- global $iflist, $config, $g, $fp;
+}
- if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
+function vlan_setup() {
+ global $iflist, $config, $g, $fp;
- echo <<<EOD
+ if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
+
+ echo <<<EOD
WARNING: all existing VLANs will be cleared if you proceed!
Do you want to proceed [y|n]?
EOD;
- if (strcasecmp(chop(fgets($fp)), "y") != 0)
- return;
- }
-
- $config['vlans']['vlan'] = array();
- echo "\n";
-
- while (1) {
- $vlan = array();
+ if (strcasecmp(chop(fgets($fp)), "y") != 0)
+ return;
+ }
- echo "\nEnter the parent interface name for the new VLAN (or nothing if finished): ";
- $vlan['if'] = chop(fgets($fp));
+ $config['vlans']['vlan'] = array();
+ echo "\n";
- if ($vlan['if']) {
- if (!array_key_exists($vlan['if'], $iflist)) {
- echo "\nInvalid interface name '{$vlan['if']}'\n";
- continue;
- }
- } else {
- break;
- }
+ while (1) {
+ $vlan = array();
- echo "Enter the VLAN tag (1-4094): ";
- $vlan['tag'] = chop(fgets($fp));
+ echo "\nEnter the parent interface name for the new VLAN (or nothing if finished): ";
+ $vlan['if'] = chop(fgets($fp));
- if (!is_numericint($vlan['tag']) || ($vlan['tag'] < 1) || ($vlan['tag'] > 4094)) {
- echo "\nInvalid VLAN tag '{$vlan['tag']}'\n";
+ if ($vlan['if']) {
+ if (!array_key_exists($vlan['if'], $iflist)) {
+ echo "\nInvalid interface name '{$vlan['if']}'\n";
continue;
}
+ } else {
+ break;
+ }
+
+ echo "Enter the VLAN tag (1-4094): ";
+ $vlan['tag'] = chop(fgets($fp));
- $config['vlans']['vlan'][] = $vlan;
+ if (!is_numericint($vlan['tag']) || ($vlan['tag'] < 1) || ($vlan['tag'] > 4094)) {
+ echo "\nInvalid VLAN tag '{$vlan['tag']}'\n";
+ continue;
}
+
+ $config['vlans']['vlan'][] = $vlan;
}
}
OpenPOWER on IntegriCloud