]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCPv6: drop Prefix Delegations when dropping the lease.
authorRoy Marples <roy@marples.name>
Tue, 2 May 2017 18:58:19 +0000 (19:58 +0100)
committerRoy Marples <roy@marples.name>
Fri, 5 May 2017 13:25:02 +0000 (14:25 +0100)
Summary:
When dropping the lease, we should drop any Delegated Prefixes
as well, because they are from the lease.
Add a note to say if this needs to be changed, at least mark
the Delegated Prefixes as deprecated.

Fixes T114.

Test Plan:
Configure dhcpcd to request a Prefix Delegation and assign it to a downstream
interface.
Bring the interface down which dhcpcd requests the delegation from.
dhcpcd should remove the assigned delegation from the other interface.

Reviewers: Harri

Reviewed By: Harri

Maniphest Tasks: T114

Differential Revision: https://dev.marples.name/D111

src/dhcp6.c

index 3b304f38944846e65b7b9e150fd7845a6e324a28..ee38fb0544f0583a1339bb1f99fa3f60e237d351 100644 (file)
@@ -3419,40 +3419,20 @@ dhcp6_freedrop(struct interface *ifp, int drop, const char *reason)
        struct dhcp6_state *state;
        struct dhcpcd_ctx *ctx;
        unsigned long long options;
-#ifndef SMALL
-       int dropdele;
-#endif
 
-       /*
-        * As the interface is going away from dhcpcd we need to
-        * remove the delegated addresses, otherwise we lose track
-        * of which interface is delegating as we remeber it by pointer.
-        * So if we need to change this behaviour, we need to change
-        * how we remember which interface delegated.
-        *
-        * XXX The below is no longer true due to the change of the
-        * default IAID, but do PPP links have stable ethernet
-        * addresses?
-        *
-        * To make it more interesting, on some OS's with PPP links
-        * there is no guarantee the delegating interface will have
-        * the same name or index so think very hard before changing
-        * this.
-        */
        if (ifp->options)
                options = ifp->options->options;
        else
                options = ifp->ctx->options;
-#ifndef SMALL
-       dropdele = (options & (DHCPCD_STOPPING | DHCPCD_RELEASE) &&
-           (options & DHCPCD_NODROP) != DHCPCD_NODROP);
-#endif
 
        if (ifp->ctx->eloop)
                eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
 
 #ifndef SMALL
-       if (dropdele)
+       /* If we're dropping the lease, drop delegated addresses.
+        * If, for whatever reason, we don't drop them in the future
+        * then they should at least be marked as deprecated (pltime 0). */
+       if (drop && (options & DHCPCD_NODROP) != DHCPCD_NODROP)
                dhcp6_delete_delegates(ifp);
 #endif