From: Roy Marples Date: Tue, 18 Jun 2013 22:20:52 +0000 (+0000) Subject: We may not have a state when we drop delegates X-Git-Tag: v6.0.0~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cab2853a376354c39d02168f4d9585f16be28f9d;p=thirdparty%2Fdhcpcd.git We may not have a state when we drop delegates --- diff --git a/dhcp6.c b/dhcp6.c index ecb6a1c0..02b3f99f 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -2395,6 +2395,21 @@ dhcp6_freedrop(struct interface *ifp, int drop, const char *reason) struct dhcp6_state *state; eloop_timeout_delete(NULL, ifp); + + /* + * 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. + * 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 & (DHCPCD_STOPPING | DHCPCD_RELEASE)) + dhcp6_delete_delegates(ifp); + state = D6_STATE(ifp); if (state) { if (ifp->options->options & DHCPCD_RELEASE) { @@ -2403,17 +2418,6 @@ dhcp6_freedrop(struct interface *ifp, int drop, const char *reason) unlink(state->leasefile); } dhcp6_freedrop_addrs(ifp, drop, NULL); - /* 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. - * 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 & (DHCPCD_STOPPING | DHCPCD_RELEASE)) - dhcp6_delete_delegates(ifp); if (drop && state->new) { if (reason == NULL) reason = "STOP6";