summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-06-08 17:57:15 +0000
committerErmal Luçi <eri@pfsense.org>2009-06-08 17:57:15 +0000
commit83bdca55920ca6ab3d848f0993d57a1f9b85098f (patch)
tree19bf46f0ddb0566af0bc8994ee9ba2df8e9deab4 /etc/inc
parentef0269508610f837212ec2d0ecd2435f126d61a9 (diff)
downloadpfsense-83bdca55920ca6ab3d848f0993d57a1f9b85098f.zip
pfsense-83bdca55920ca6ab3d848f0993d57a1f9b85098f.tar.gz
Do not use tags for vlan interface names since there might be same vlan tags on different parent interfaces and this will break configs and will hide the reason it does not work. Thanks-to: smos@
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/config.inc8
-rw-r--r--etc/inc/interfaces.inc16
-rw-r--r--etc/inc/upgrade_config.inc2
3 files changed, 12 insertions, 14 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 6dd751d..5d8661a 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -810,12 +810,12 @@ EOD;
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
echo "\n\nVLAN interfaces:\n\n";
- foreach ($config['vlans']['vlan'] as $vlan) {
+ foreach ($config['vlans']['vlan'] as $vlanid => $vlan) {
- echo sprintf("% -8s%s\n", "vlan{$vlan['tag']}",
+ echo sprintf("% -8s%s\n", "vlan{$vlanid}",
"VLAN tag {$vlan['tag']}, interface {$vlan['if']}");
- $iflist['vlan' . $vlan['tag']] = array();
+ $iflist['vlan' . $vlanid] = array();
}
}
@@ -1146,7 +1146,7 @@ EOD;
echo "Enter the VLAN tag (1-4094): ";
$vlan['tag'] = chop(fgets($fp));
- $vlan['vlanif'] = "vlan{$vlan['tag']}";
+ $vlan['vlanif'] = "vlan{$vlanif}";
if (!is_numericint($vlan['tag']) || ($vlan['tag'] < 1) || ($vlan['tag'] > 4094)) {
echo "\nInvalid VLAN tag '{$vlan['tag']}'\n";
continue;
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 72fb3a1..603e7b3 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -88,9 +88,9 @@ function interfaces_loopback_configure() {
function interfaces_vlan_configure() {
global $config;
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
- foreach ($config['vlans']['vlan'] as $vlan) {
+ foreach ($config['vlans']['vlan'] as $vlanid => $vlan) {
if(empty($vlan['vlanif']))
- $vlan['vlanif'] = "vlan{$vlan['tag']}";
+ $vlan['vlanif'] = "vlan{$vlanid}";
/* XXX: Maybe we should report any errors?! */
interface_vlan_configure($vlan);
}
@@ -105,11 +105,10 @@ function interface_vlan_configure($vlan) {
return;
}
$if = $vlan['if'];
- $vlanif = empty($vlan['vlanif']) ? "vlan{$vlan['tag']}" : $vlan['vlanif'];
$tag = $vlan['tag'];
- if(empty($if)) {
- log_error("interface_vlan_confgure called with if undefined.");
+ if (empty($if)) {
+ log_error("interface_vlan_confgure called with parent if undefined.");
return;
}
@@ -148,14 +147,13 @@ function interface_vlan_configure($vlan) {
/* all vlans need to spoof their parent mac address, too. see
* ticket #1514: http://cvstrac.pfsense.com/tktview?tn=1514,33
*/
- foreach($config['interfaces'] as $interfaces) {
- if($interfaces['if'] == $if && $interfaces['spoofmac']) {
+ foreach ($config['interfaces'] as $interfaces) {
+ if ($interfaces['if'] == $if && $interfaces['spoofmac']) {
mwexec("/sbin/ifconfig " . escapeshellarg($vlanif) .
" link " . escapeshellarg($interfaces['spoofmac']));
}
}
- /* XXX: ermal -- for now leave it here at the moment it does not hurt. */
interfaces_bring_up($if);
return $vlanif;
@@ -170,7 +168,7 @@ function interface_qinq_configure($vlan, $fd = NULL) {
}
$if = $vlan['if'];
- $vlanif = empty($vlan['vlanif']) ? "vlan{$vlan['tag']}" : $vlan['vlanif'];
+ $vlanif = empty($vlan['vlanif']) ? "vlan" . count($config['qinqs']['qinq']) : $vlan['vlanif'];
$tag = $vlan['tag'];
if(empty($if)) {
log_error("interface_qinq_confgure called with if undefined.\n");
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc
index 2e00622..48b94d5 100644
--- a/etc/inc/upgrade_config.inc
+++ b/etc/inc/upgrade_config.inc
@@ -772,7 +772,7 @@ function upgrade_044_to_045() {
global $config;
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $id => &$vlan)
- $vlan['vlanif'] = "vlan{$vlan['tag']}";
+ $vlan['vlanif'] = "vlan{$id}";
}
}
OpenPOWER on IntegriCloud