From 531f96177092d44d3dc6ad8597ae353d4cf989ca Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen.hemminger@vyatta.com>
Date: Tue, 26 Oct 2010 14:32:09 -0700
Subject: Sort the interface names when adding

Makes new entries show up in order.
---
 scripts/system/vyatta_interface_rescan | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'scripts/system')

diff --git a/scripts/system/vyatta_interface_rescan b/scripts/system/vyatta_interface_rescan
index 62d550bf..2803099b 100755
--- a/scripts/system/vyatta_interface_rescan
+++ b/scripts/system/vyatta_interface_rescan
@@ -89,10 +89,13 @@ sub interface_rescan {
     my $xcp = new XorpConfigParser();
     $xcp->parse($BOOTFILE);
 
+    # get list of changed interfaces
     opendir( my $dir, $VYATTAUDEV )
 	or die "Can't open $VYATTAUDEV : $!";
+    my @interfaces = grep { ! /^\./ } readdir($dir);
+    close $dir;
 
-    foreach my $ifname (grep { ! /^\./ } readdir($dir)) {
+    foreach my $ifname (sort @interfaces) {
 	my $ifpath = interface_type($ifname) . " $ifname";
 	if ($xcp->get_node(['interfaces', $ifpath])) {
 	    syslog(LOG_INFO, "%s: is already in config file", $ifname);
-- 
cgit v1.2.3