]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Clear LL callbacks when dropping or freeing addresses.
authorRoy Marples <roy@marples.name>
Thu, 1 Sep 2016 11:48:21 +0000 (11:48 +0000)
committerRoy Marples <roy@marples.name>
Thu, 1 Sep 2016 11:48:21 +0000 (11:48 +0000)
ipv6.c

diff --git a/ipv6.c b/ipv6.c
index 3b8596dddae43eb2439412e609715698ee598ffe..2cd45be448700b04cf20e01784562f77d0f5b5ac 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -1626,6 +1626,12 @@ ipv6_freedrop(struct interface *ifp, int drop)
        if ((state = IPV6_STATE(ifp)) == NULL)
                return;
 
+       /* If we got here, we can get rid of any LL callbacks. */
+       while ((cb = TAILQ_FIRST(&state->ll_callbacks))) {
+               TAILQ_REMOVE(&state->ll_callbacks, cb, next);
+               free(cb);
+       }
+
        ipv6_freedrop_addrs(&state->addrs, drop ? 2 : 0, NULL);
        if (drop) {
                if (ifp->ctx->ipv6 != NULL) {
@@ -1635,10 +1641,6 @@ ipv6_freedrop(struct interface *ifp, int drop)
        } else {
                /* Because we need to cache the addresses we don't control,
                 * we only free the state on when NOT dropping addresses. */
-               while ((cb = TAILQ_FIRST(&state->ll_callbacks))) {
-                       TAILQ_REMOVE(&state->ll_callbacks, cb, next);
-                       free(cb);
-               }
                free(state);
                ifp->if_data[IF_DATA_IPV6] = NULL;
                eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);