X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fdhcpv6-ia.c;h=e94dc381d93634812e848b8d0e3465bc204d02b8;hp=9afde3fcf865e3702f680dd2e263f32244490e63;hb=HEAD;hpb=96033e937c56a407d8ca9302c5901cd77366da29 diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 9afde3f..e94dc38 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -1161,7 +1161,8 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, if (((c->clid_len == clid_len && !memcmp(c->clid_data, clid_data, clid_len)) || (c->clid_len >= clid_len && !c->clid_data[0] && !c->clid_data[1] && !memcmp(c->mac, mac, sizeof(mac)))) && - (c->iaid == ia->iaid || INFINITE_VALID(c->valid_until) || now < c->valid_until) && + (!(c->flags & (OAF_BOUND|OAF_TENTATIVE)) || c->iaid == ia->iaid) && + (INFINITE_VALID(c->valid_until) || now < c->valid_until) && ((is_pd && c->length <= 64) || (is_na && c->length == 128))) { a = c; @@ -1257,9 +1258,11 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, /* Was only a solicitation: mark binding for removal */ if (assigned && hdr->msg_type == DHCPV6_MSG_SOLICIT) { a->flags &= ~OAF_BOUND; + a->flags |= OAF_TENTATIVE; if (!(a->flags & OAF_STATIC)) - a->valid_until = now; + /* Keep tentative assignment around for 60 seconds */ + a->valid_until = now + 60; } else if (assigned && (hdr->msg_type == DHCPV6_MSG_REQUEST || hdr->msg_type == DHCPV6_MSG_REBIND)) { @@ -1271,6 +1274,7 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, } } a->accept_reconf = accept_reconf; + a->flags &= ~OAF_TENTATIVE; a->flags |= OAF_BOUND; apply_lease(iface, a, true); } else if (!assigned && a && a->managed_size == 0) {