]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Check active before link status when sorting
authorRoy Marples <roy@marples.name>
Thu, 17 Dec 2015 12:35:33 +0000 (12:35 +0000)
committerRoy Marples <roy@marples.name>
Thu, 17 Dec 2015 12:35:33 +0000 (12:35 +0000)
if.c

diff --git a/if.c b/if.c
index 3b2c79f6c6dc8f7b7ff5d18f50a9e6c2029ee49d..017025d105106035a2b3b068e0436f0a6151f48a 100644 (file)
--- a/if.c
+++ b/if.c
@@ -607,7 +607,13 @@ if_cmp(const struct interface *si, const struct interface *ti)
        int r;
 #endif
 
-       /* Check carrier status first */
+       /* Check active first */
+       if (si->active && !ti->active)
+               return -1;
+       if (!si->active && ti->active)
+               return 1;
+
+       /* Check carrier status next */
        if (si->carrier > ti->carrier)
                return -1;
        if (si->carrier < ti->carrier)