summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2011-03-03 15:30:27 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2011-03-03 15:30:27 -0800
commit9f5f83e6ac48511e2c7616b31f9f5263197fc0e1 (patch)
tree47003068636bfc34cc0960c0a554273c0c79b499
parent10056a2c7c8756960838c9207a466e32dc2d952a (diff)
parentba5aeb6086e8c6aef86c18e2646b7c80e05f8e3d (diff)
downloadvyatta-cfg-system-9f5f83e6ac48511e2c7616b31f9f5263197fc0e1.tar.gz
vyatta-cfg-system-9f5f83e6ac48511e2c7616b31f9f5263197fc0e1.zip
Merge branch 'napa' of vm:vyatta/napa/vyatta-cfg-system into napa
-rwxr-xr-xscripts/vyatta_net_name13
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];