summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-24 16:50:08 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-24 16:50:08 -0800
commit313756ea1d798fdc62359c677e472da25decde7a (patch)
treeb01716fbbfe992cfe22fc96ac01ea8794e28dba5
parente4cf3671127cf7e2c8621f20f8c6569ff26f6ba7 (diff)
parent5b2eaa7a12860c7e83fe20d1ae1888b5d4582d07 (diff)
downloadvyatta-cfg-quagga-313756ea1d798fdc62359c677e472da25decde7a.tar.gz
vyatta-cfg-quagga-313756ea1d798fdc62359c677e472da25decde7a.zip
Merge branch 'mendocino' of vm:rel/vyatta-cfg-system into mendocino
-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);