]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Handle psuedo interfaces better when preferring addresses.
authorRoy Marples <roy@marples.name>
Thu, 16 Oct 2014 08:30:25 +0000 (08:30 +0000)
committerRoy Marples <roy@marples.name>
Thu, 16 Oct 2014 08:30:25 +0000 (08:30 +0000)
ipv4.c
ipv6.c

diff --git a/ipv4.c b/ipv4.c
index 15470d4dcd3015ba2df5b3fa42e2a2ba6257d3fe..e9d56d782c17a22d6f78bef861331ee64672f34e 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -757,7 +757,8 @@ ipv4_applyaddr(void *arg)
                                addr = state->addr;
                                delete_address(ifp);
                                TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
-                                       if (ifn == ifp)
+                                       if (ifn == ifp ||
+                                           strcmp(ifn->name, ifp->name) == 0)
                                                continue;
                                        nstate = D_STATE(ifn);
                                        if (nstate && !nstate->added &&
@@ -788,7 +789,7 @@ ipv4_applyaddr(void *arg)
 
        /* Ensure only one interface has the address */
        TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
-               if (ifn == ifp)
+               if (ifn == ifp || strcmp(ifn->name, ifp->name) == 0)
                        continue;
                nstate = D_STATE(ifn);
                if (nstate && nstate->added &&
diff --git a/ipv6.c b/ipv6.c
index 564751cc490b5d6745e88e0f33c3ac8546ac161a..29ffda96198925eef601952667eb1fa2dfa3fe37 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -718,7 +718,9 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs)
                {
                        apf = ipv6_findaddr(ap->iface->ctx,
                            &ap->addr, IPV6_AF_ADDED);
-                       if (apf && apf->iface != ap->iface) {
+                       if (apf && apf->iface != ap->iface &&
+                           strcmp(apf->iface->name, ap->iface->name))
+                       {
                                if (apf->iface->metric <= ap->iface->metric) {
                                        syslog(LOG_INFO,
                                            "%s: preferring %s on %s",
@@ -765,7 +767,9 @@ ipv6_freedrop_addrs(struct ipv6_addrhead *addrs, int drop,
                {
                        /* Find the same address somewhere else */
                        apf = ipv6_findaddr(ap->iface->ctx, &ap->addr, 0);
-                       if (apf == NULL || apf->iface != ap->iface)
+                       if (apf == NULL ||
+                           (apf->iface != ap->iface &&
+                           strcmp(apf->iface->name, ap->iface->name)))
                                ipv6_deleteaddr(ap);
                        if (!(ap->iface->options->options &
                            DHCPCD_EXITING) && apf)