From: Roy Marples Date: Fri, 24 Apr 2015 09:21:47 +0000 (+0000) Subject: Move carrier state higher up the interface preference for sorting. X-Git-Tag: v6.8.2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0038a71ccc51d3add40c92702f3bee4ecb2bb29;p=thirdparty%2Fdhcpcd.git Move carrier state higher up the interface preference for sorting. --- diff --git a/if.c b/if.c index e3c16eb9..240f7fd2 100644 --- 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;