From ba5aeb6086e8c6aef86c18e2646b7c80e05f8e3d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger <stephen.hemminger@vyatta.com> Date: Thu, 3 Mar 2011 15:27:29 -0800 Subject: 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. --- scripts/vyatta_net_name | 13 +++++++------ 1 file 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]; -- cgit v1.2.3