From: Roy Marples Date: Thu, 17 Dec 2015 12:35:33 +0000 (+0000) Subject: Check active before link status when sorting X-Git-Tag: v6.10.0~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=281d4736367f815335a981b5a5b943b7f40eabe2;p=thirdparty%2Fdhcpcd.git Check active before link status when sorting --- diff --git a/if.c b/if.c index 3b2c79f6..017025d1 100644 --- 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)