diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2011-03-03 15:27:29 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2011-03-03 15:27:29 -0800 |
commit | ba5aeb6086e8c6aef86c18e2646b7c80e05f8e3d (patch) | |
tree | 0e9fec9b6484f45b5901d0f5f8b4f06592f7c65d /scripts | |
parent | 31f6c82c43c1ad4bb259fdd6a6ffd94ba204c1c1 (diff) | |
download | vyatta-cfg-quagga-ba5aeb6086e8c6aef86c18e2646b7c80e05f8e3d.tar.gz vyatta-cfg-quagga-ba5aeb6086e8c6aef86c18e2646b7c80e05f8e3d.zip |
Fix network name scan for wireless
Bug 6818
The regex to extract wireless name was incorrect.
Recode for clarity rather than adding more complex regex.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta_net_name | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name index c3571f89..ade77623 100755 --- a/scripts/vyatta_net_name +++ b/scripts/vyatta_net_name @@ -109,13 +109,15 @@ sub parse_config_boot { my $inode = $xcp->get_node(['interfaces']); if ($inode) { foreach my $child (@{$inode->{'children'}}) { - my $name = $child->{'name'}; - next unless ($name =~ /^ethernet (.*)|^wireless (.*)/); - - my $intf = $1; + # is hwid defined in config? my $hwid = get_hwid_from_children($child->{'children'}); next unless $hwid; + # split into type 'ethernet' and 'eth0' + my ($type, $intf) = ($child->{'name'} =~ /^(\w+) (\w+)/); + next unless defined($type); + next unless ($type eq 'ethernet') || ($type eq 'wireless'); + $interfaces->{$hwid} = $intf; } } @@ -236,8 +238,7 @@ sub unlock_file { # This script is called from udev with two arguments # it outputs the new name (if any) to stdout if ($#ARGV != 1) { - die "vyatta_net_name called with wrong args(%d) : %s", - $#ARGV, join(' ', @ARGV); + die "vyatta_net_name called with wrong args:" . join(' ', @ARGV) . "\n"; } my $ifname = $ARGV[0]; |