summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-12-21 17:32:51 -0800
committerStephen Hemminger <shemminger@vyatta.com>2011-12-21 17:32:51 -0800
commit537585b5e1a7d73f7c88b7726d0c1f112329bea3 (patch)
treea22c1f19f29eeb2c666c59a0bfe45561f4799d76
parent8d2e7843b4e390b63cbced108d93871c34761486 (diff)
downloadvyatta-cfg-system-537585b5e1a7d73f7c88b7726d0c1f112329bea3.tar.gz
vyatta-cfg-system-537585b5e1a7d73f7c88b7726d0c1f112329bea3.zip
interfaces: don't add config for missing devices
If device disappears or is renamed between the time udev script is run, and the vyatta-router script is run; then don't add an entry to the config file.
-rwxr-xr-xscripts/system/vyatta_interface_rescan7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/system/vyatta_interface_rescan b/scripts/system/vyatta_interface_rescan
index 5b72a480..eb45da60 100755
--- a/scripts/system/vyatta_interface_rescan
+++ b/scripts/system/vyatta_interface_rescan
@@ -115,6 +115,13 @@ sub interface_rescan {
foreach my $ifname (sort @interfaces) {
my $hwaddr = get_hwid("$VYATTAUDEV/$ifname");
+
+ # Ignore devices that disappear (or get renamed)
+ unless (-d "/sys/class/net/$ifname") {
+ syslog(LOG_INFO, "%s: does not exist", $ifname);
+ next;
+ }
+
unless (persistent_address($hwaddr)) {
syslog(LOG_NOTICE, "%s: skipping address %s is not persistent",
$ifname, $hwaddr);