From 5b2eaa7a12860c7e83fe20d1ae1888b5d4582d07 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 24 Nov 2010 16:44:59 -0800 Subject: Don't let biosdevname look at wireless devices Bug 6445 Biosdevname program converts everything to eth devices. --- scripts/vyatta_net_name | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'scripts/vyatta_net_name') diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name index c7b217d9..d34624ae 100755 --- a/scripts/vyatta_net_name +++ b/scripts/vyatta_net_name @@ -75,6 +75,22 @@ sub leave_rescan_hint { return 1; } +# Use biosdevname program (ethernet only) +# to try and find name based on PCI slot and DMI info +sub biosdevname { + my $ifname = shift; + + # biosdevname renames wlanX to ethX ?? + if ($ifname =~ /^eth/) { + my $biosname = `/sbin/biosdevname -i $ifname`; + chomp $biosname; + + return $biosname if ($biosname ne ''); + } + return $ifname; # Fallback to existing name + +} + # Determine network name to use based on Vyatta config during boot sub coldplug { my ($ifname, $hwaddr) = @_; @@ -113,17 +129,10 @@ sub coldplug { } } - # Does biosdevname have a suggestion? - my $biosname = `/sbin/biosdevname -i $ifname`; - chomp $biosname; - if ($biosname ne '') { - $newname = $biosname; - } else { - $newname = $ifname; - } - - $newname = find_available($interfaces, $newname) - unless (is_available($interfaces, $newname)); + $newname = biosdevname($ifname); + unless (is_available($interfaces, $newname)) { + $newname = find_available($interfaces, $newname); + } leave_rescan_hint($newname, $hwaddr); @@ -154,19 +163,10 @@ sub hotplug { my $newname = $interfaces->{$hwaddr}; return $newname if ($newname); - # Does biosdevname have a suggestion? - my $biosname = `/sbin/biosdevname -i $ifname`; - chomp $biosname; - syslog(LOG_DEBUG, "biosdevname for '%s' => '%s'", $ifname, $biosname); - - if ($biosname && ($biosname ne '')) { - $newname = $biosname; - } else { - $newname = $ifname; - } - - $newname = find_available($interfaces, $ifname) - unless is_available($interfaces, $biosname); + $newname = biosdevname($ifname); + unless (is_available($interfaces, $newname)) { + $newname = find_available($interfaces, $newname); + } syslog(LOG_INFO, "new name for '%s' is '%s'", $ifname, $newname); -- cgit v1.2.3