summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-08-08 11:08:45 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-08-08 11:08:45 -0500
commit11838faf598644c436d5d16c689918503b31185e (patch)
treea16fa9092fb1b38f500ffbaaa96ceca434ab90c2
parent5a50034c30bf284bcf3cec10dd6c5d14b93e334d (diff)
parent08615f465009878cf977f27d72ad1a9d3c8fb80e (diff)
downloadvyatta-cfg-quagga-11838faf598644c436d5d16c689918503b31185e.tar.gz
vyatta-cfg-quagga-11838faf598644c436d5d16c689918503b31185e.zip
Merge branch 'oxnard' of git.vyatta.com:/git/vyatta-cfg-system into oxnard
-rw-r--r--debian/changelog19
-rw-r--r--debian/control2
-rwxr-xr-xscripts/vyatta-interfaces.pl39
-rw-r--r--templates/interfaces/ethernet/node.def11
4 files changed, 43 insertions, 28 deletions
diff --git a/debian/changelog b/debian/changelog
index a7b07c9a..1ac5eb5d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,22 @@
+vyatta-cfg-system (0.19.109) unstable; urgency=low
+
+ * 0.19.108
+ * fix missing command in debian/control
+
+ -- Stephen Hemminger <shemminger@vyatta.com> Sun, 07 Aug 2011 20:46:26 -0700
+
+vyatta-cfg-system (0.19.108) unstable; urgency=low
+
+ * Force dependency on later vyatta-cfg package
+
+ -- Stephen Hemminger <shemminger@vyatta.com> Sun, 07 Aug 2011 20:45:23 -0700
+
+vyatta-cfg-system (0.19.107) unstable; urgency=low
+
+ * ethernet: avoid needlessly setting mac address
+
+ -- Stephen Hemminger <shemminger@vyatta.com> Fri, 05 Aug 2011 20:55:41 -0700
+
vyatta-cfg-system (0.19.106) unstable; urgency=low
* Added to make "force" op-mode command accessible to user type
diff --git a/debian/control b/debian/control
index b9b6eb52..0b06b260 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Depends: acpid,
procps (>= 1:3.2.7-3),
coreutils (>= 5.97-5.3),
libpam-radius-auth,
- vyatta-cfg (>= 0.18.58),
+ vyatta-cfg (>= 0.99.8),
libc6 (>= 2.7-6),
libpam-runtime (>= 1.0.1-5),
vyatta-bash | bash (>= 3.1),
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index a5bb2553..0365266c 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -39,7 +39,6 @@ use Vyatta::File qw(touch);
use Vyatta::Interface;
use Getopt::Long;
-use POSIX;
use strict;
use warnings;
@@ -225,27 +224,29 @@ sub stop_dhclient {
}
sub update_mac {
- my ($mac, $intf) = @_;
+ my ($mac, $name) = @_;
+ my $intf = new Vyatta::Interface($name);
+ $intf or die "Unknown interface name/type: $name\n";
- open my $fh, "<", "/sys/class/net/$intf/flags"
- or die "Error: $intf is not a network device\n";
-
- my $flags = <$fh>;
- chomp $flags;
- close $fh or die "Error: can't read state\n";
-
- if (POSIX::strtoul($flags) & 1) {
- # NB: Perl 5 system return value is bass-ackwards
- system "ip link set $intf down"
- and die "Could not set $intf down ($!)\n";
- system "ip link set $intf address $mac"
- and die "Could not set $intf address ($!)\n";
- system "ip link set $intf up"
- and die "Could not set $intf up ($!)\n";
+ # maybe nothing needs to change
+ my $oldmac = $intf->hw_address();
+ exit 0 if (lc($oldmac) eq lc($mac));
+
+ # try the direct approach
+ if (system "ip link set $name address $mac" == 0) {
+ exit 0;
+ } elsif ($intf->up()) {
+ # some hardware can not change MAC address if up
+ system "ip link set $name down"
+ and die "Could not set $name down\n";
+ system "ip link set $name address $mac"
+ and die "Could not set $name address\n";
+ system "ip link set $name up"
+ and die "Could not set $name up\n";
} else {
- system "ip link set $intf address $mac"
- and die "Could not set $intf address ($!)\n";
+ die "Could not set mac address for $name\n";
}
+
exit 0;
}
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
index a9113e7a..426f8f87 100644
--- a/templates/interfaces/ethernet/node.def
+++ b/templates/interfaces/ethernet/node.def
@@ -14,15 +14,10 @@ syntax:expression: exec \
fi"
begin: rm -f /tmp/speed-duplex.$VAR(@)
- if [ -d "/sys/class/net/$VAR(@)" ]; then
- s_mac="$VAR(hw-id/@)"
- if [ -n "$VAR(mac/@)" ]; then
- s_mac="$VAR(mac/@)"
- fi
- if [ -n "$s_mac" ]; then
+ if [ -n "$VAR(mac/@)" ] &&
+ [ -d "/sys/class/net/$VAR(@)" ]; then
/opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(@) \
- --set-mac $s_mac
- fi
+ --set-mac "$VAR(mac/@)"
fi
create: ip link set "$VAR(@)" up