From: Roy Marples Date: Tue, 2 May 2017 18:58:19 +0000 (+0100) Subject: DHCPv6: drop Prefix Delegations when dropping the lease. X-Git-Tag: v7.0.0-rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0958b8934d88652b0683a2364c7079d73fca8f2;p=thirdparty%2Fdhcpcd.git DHCPv6: drop Prefix Delegations when dropping the lease. 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 --- diff --git a/src/dhcp6.c b/src/dhcp6.c index 3b304f38..ee38fb05 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -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