summaryrefslogtreecommitdiff
path: root/scripts/vyatta_net_name
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-24 16:44:59 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-24 16:44:59 -0800
commit5b2eaa7a12860c7e83fe20d1ae1888b5d4582d07 (patch)
tree76591f46244a8ba7b55071b391c8d0a141c7304a /scripts/vyatta_net_name
parent2c3ddde8f8f6ca2eba49c35ee3729db85b02139f (diff)
downloadvyatta-cfg-quagga-5b2eaa7a12860c7e83fe20d1ae1888b5d4582d07.tar.gz
vyatta-cfg-quagga-5b2eaa7a12860c7e83fe20d1ae1888b5d4582d07.zip
Don't let biosdevname look at wireless devices
Bug 6445 Biosdevname program converts everything to eth devices.
Diffstat (limited to 'scripts/vyatta_net_name')
-rwxr-xr-xscripts/vyatta_net_name48
1 files changed, 24 insertions, 24 deletions
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);