]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ipv6nd: Don't sort interfaces when picking best address
authorRoy Marples <roy@marples.name>
Mon, 4 Mar 2019 11:42:06 +0000 (11:42 +0000)
committerRoy Marples <roy@marples.name>
Mon, 4 Mar 2019 11:42:06 +0000 (11:42 +0000)
src/ipv6nd.c

index bef77b2a328e5897c6be751096a4e5dfc7b70dc5..e148f862c5248a24df90daa62a8814cd117473e3 100644 (file)
@@ -403,7 +403,6 @@ ipv6nd_advertise(struct ipv6_addr *ia)
                return;
 
        ctx = ia->iface->ctx;
-       if_sortinterfaces(ctx);
        /* Find the most preferred address to advertise. */
        iaf = NULL;
        TAILQ_FOREACH(ifp, ctx->ifaces, next) {
@@ -424,7 +423,8 @@ ipv6nd_advertise(struct ipv6_addr *ia)
                            iap->addr_flags & IN6_IFF_NOTUSEABLE)
                                continue;
 
-                       if (iaf == NULL)
+                       if (iaf == NULL ||
+                           iaf->iface->metric > iap->iface->metric)
                                iaf = iap;
                }
        }