]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix removal of addresses
authorRoy Marples <roy@marples.name>
Wed, 22 May 2013 08:11:47 +0000 (08:11 +0000)
committerRoy Marples <roy@marples.name>
Wed, 22 May 2013 08:11:47 +0000 (08:11 +0000)
ipv6rs.c

index a231bcfb0fef4f98f4b2e3d8f239ec18ca5c19fe..7d130009348c62277540431af9f06478aafbcd6d 100644 (file)
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -1284,29 +1284,24 @@ ipv6rs_start(struct interface *ifp)
 void
 ipv6rs_drop(struct interface *ifp)
 {
-       struct ra *rap, *ran;
+       struct ra *rap;
        int expired = 0;
-       TAILQ_HEAD(, ipv6_addr) addrs;
+       TAILQ_HEAD(rahead, ra) rtrs;
 
        eloop_timeout_delete(NULL, ifp);
-       /* We need to drop routes before addresses
-        * We do this by moving addresses to a local list, then building
-        * the routes and finally adding the addresses back to a RA before
-        * dropping it. Which RA the addresses end up on does not matter. */
-       TAILQ_INIT(&addrs);
+       TAILQ_INIT(&rtrs);
        TAILQ_FOREACH(rap, &ipv6_routers, next) {
                if (rap->iface == ifp) {
                        rap->expired = expired = 1;
-                       TAILQ_CONCAT(&addrs, &rap->addrs, next);
+                       TAILQ_REMOVE(&ipv6_routers, rap, next);
+                       TAILQ_INSERT_TAIL(&rtrs, rap, next);
                }
        }
        if (expired) {
                ipv6_buildroutes();
-               TAILQ_FOREACH_SAFE(rap, &ipv6_routers, next, ran) {
-                       if (rap->iface == ifp) {
-                               TAILQ_CONCAT(&rap->addrs, &addrs, next);
-                               ipv6rs_drop_ra(rap);
-                       }
+               while ((rap = TAILQ_FIRST(&rtrs))) {
+                       TAILQ_REMOVE(&rtrs, rap, next);
+                       ipv6rs_drop_ra(rap);
                }
                script_runreason(ifp, "ROUTERADVERT");
        }