diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2011-01-24 22:51:10 +1000 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2011-01-24 11:54:44 -0800 |
commit | 39f9647acbc45c1f7868d2f40342b276679ea3b8 (patch) | |
tree | 626d634baaba0a380e09a9bc135cdb704410c76c | |
parent | 4180f0bfb54ac3628e3f6f465bdc5284bd6d4d34 (diff) | |
download | vyatta-cfg-quagga-39f9647acbc45c1f7868d2f40342b276679ea3b8.tar.gz vyatta-cfg-quagga-39f9647acbc45c1f7868d2f40342b276679ea3b8.zip |
Add more debug output
Put more messages in to help debug current problem and future ones
(cherry picked from commit 8cc21571cb4efde31f3cf6b58ad8e3d80d4487cf)
-rwxr-xr-x | scripts/vyatta_net_name | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name index 7e27fd38..7e6d2a8a 100755 --- a/scripts/vyatta_net_name +++ b/scripts/vyatta_net_name @@ -82,15 +82,14 @@ sub leave_rescan_hint { sub biosdevname { my $ifname = shift; - # biosdevname renames wlanX to ethX ?? - if ($ifname =~ /^eth/) { - my $biosname = `/sbin/biosdevname --policy all_ethN -i $ifname`; - chomp $biosname; + # biosdevname works only on ethernet devices + return $ifname unless ($ifname =~ /^eth/); - return $biosname if ($biosname ne ''); - } - return $ifname; # Fallback to existing name + my $biosname = `/sbin/biosdevname --policy all_ethN -i $ifname 2>>$UDEVLOG/biosdevname`; + chomp $biosname; + # if biosdevname has no answer it outputs a nothing + return ($biosname eq '') ? $ifname : $biosname; } # Determine network name to use based on Vyatta config during boot @@ -100,7 +99,8 @@ sub coldplug { # at this time root directory is read-only so use log file instead mkdir ($UDEVLOG); open (my $log, '>>', $LOGFILE) - or warn "Can't open $LOGFILE : $!"; + or die "Can't open $LOGFILE : $!"; + print {$log} "lookup $ifname $hwaddr\n"; # parse config file to produce map of existing hw-id values my $xcp = new XorpConfigParser(); @@ -115,17 +115,18 @@ sub coldplug { my $intf = $1; my $hwid = get_hwid_from_children($child->{'children'}); next unless $hwid; - - # TBD this could be a hash with name and path? + + print {$log} "config hw-id $hwid => $intf\n"; $interfaces->{$hwid} = $intf; } + } else { + print {$log} "no interfaces found in $BOOTFILE\n"; } # is name already in config file my $newname = $interfaces->{$hwaddr}; if ($newname) { - printf {$log} "hw-id %s in config mapped to '%s'", $hwaddr, $newname - if $log; + print {$log} "use hw-id $hwaddr in config mapped to '$newname'\n"; return $newname; } @@ -143,18 +144,17 @@ sub coldplug { } $newname = biosdevname($ifname); - printf {$log} "biosdevname for %s returned '%s'\n", $ifname, $newname - if $log; + print {$log} "biosdevname for $ifname returned '$newname'\n"; unless (is_available($interfaces, $newname)) { $newname = find_available($interfaces, $newname); } - print {$log} "new name for '%s' is '%s'", $ifname, $newname - if $log; - leave_rescan_hint($newname, $hwaddr); + print {$log} "new name for '$ifname' is '$newname'\n", $ifname, $newname; close $log; + leave_rescan_hint($newname, $hwaddr); + return $newname; } @@ -182,7 +182,7 @@ sub hotplug { my $newname = $interfaces->{$hwaddr}; if ($newname) { - syslog(LOG_INFO, "hw-id %s in config mapped to '%s'", $hwaddr, $newname); + syslog(LOG_DEBUG, "use hw-id %s in config mapped to '%s'", $hwaddr, $newname); return $newname; } |