From: Roy Marples Date: Tue, 11 Jun 2013 08:55:58 +0000 (+0000) Subject: If we get an invalid reply when rebinding a PD we should re-enter X-Git-Tag: v6.0.0~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc4975b7ce31717dbc27c61e474e08dfa642b750;p=thirdparty%2Fdhcpcd.git If we get an invalid reply when rebinding a PD we should re-enter the discover phase. --- diff --git a/dhcp6.c b/dhcp6.c index 99fd6337..a57df277 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -940,6 +940,7 @@ dhcp6_startdiscover(void *arg) state->new_len = 0; dhcp6_freedrop_addrs(ifp, 0, NULL); + unlink(state->leasefile); if (dhcp6_makemessage(ifp) == -1) syslog(LOG_ERR, "%s: dhcp6_makemessage: %m", ifp->name); @@ -1101,7 +1102,6 @@ dhcp6_startexpire(void *arg) dhcp6_delete_delegates(ifp); script_runreason(ifp, "EXPIRE6"); state = D6_CSTATE(ifp); - unlink(state->leasefile); dhcp6_startdiscover(ifp); } @@ -2023,8 +2023,14 @@ dhcp6_handledata(__unused void *arg) case DH6S_REQUEST: /* FALLTHROUGH */ case DH6S_RENEW: /* FALLTHROUGH */ case DH6S_REBIND: - if (dhcp6_validatelease(ifp, r, len, sfrom) == -1) + if (dhcp6_validatelease(ifp, r, len, sfrom) == -1) { + /* PD doesn't use CONFIRM, so REBIND could + * throw up an invalid prefix if we + * changed link */ + if (ifp->options->ia_type == D6_OPTION_IA_PD) + dhcp6_startdiscover(ifp); return; + } break; default: op = NULL;