]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Move carrier state higher up the interface preference for sorting.
authorRoy Marples <roy@marples.name>
Fri, 24 Apr 2015 09:21:47 +0000 (09:21 +0000)
committerRoy Marples <roy@marples.name>
Fri, 24 Apr 2015 09:21:47 +0000 (09:21 +0000)
if.c

diff --git a/if.c b/if.c
index e3c16eb96d948869c454e07c0a1b84df4583facf..240f7fd23c7635211385d8d1cca9b543740f3c7a 100644 (file)
--- a/if.c
+++ b/if.c
@@ -604,6 +604,12 @@ if_cmp(const struct interface *si, const struct interface *ti)
            !(ti->options->options & DHCPCD_PFXDLGONLY))
                return 1;
 
+       /* Check carrier status first */
+       if (si->carrier > ti->carrier)
+               return -1;
+       if (si->carrier < ti->carrier)
+               return 1;
+
        if (D_STATE_RUNNING(si) && !D_STATE_RUNNING(ti))
                return -1;
        if (!D_STATE_RUNNING(si) && D_STATE_RUNNING(ti))
@@ -618,16 +624,11 @@ if_cmp(const struct interface *si, const struct interface *ti)
                return 1;
 
 #ifdef INET
-       /* Special attention needed hereto due take states and IPv4LL. */
+       /* Special attention needed here due to states and IPv4LL. */
        if ((r = ipv4_ifcmp(si, ti)) != 0)
                return r;
 #endif
 
-       /* Then carrier status. */
-       if (si->carrier > ti->carrier)
-               return -1;
-       if (si->carrier < ti->carrier)
-               return 1;
        /* Finally, metric */
        if (si->metric < ti->metric)
                return -1;