diff options
-rw-r--r-- | src/dhcpv6-ia.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 42268e5..d7848de 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -618,8 +618,7 @@ static bool assign_pd(struct interface *iface, struct dhcp_assignment *assign) return true; } - if (c->assigned != 0) - current = (c->assigned + (1 << (64 - c->length))); + current = (c->assigned + (1 << (64 - c->length))); } } @@ -630,6 +629,7 @@ static bool assign_pd(struct interface *iface, struct dhcp_assignment *assign) continue; current = (current + asize) & (~asize); + if (current + asize < c->assigned) { assign->assigned = current; list_add_tail(&assign->head, &c->head); @@ -640,8 +640,7 @@ static bool assign_pd(struct interface *iface, struct dhcp_assignment *assign) return true; } - if (c->assigned != 0) - current = (c->assigned + (1 << (64 - c->length))); + current = (c->assigned + (1 << (64 - c->length))); } return false; @@ -713,7 +712,7 @@ static void handle_addrlist_change(struct netevent_handler_info *info) c->managed_size) continue; - if (c->assigned == 0 || c->assigned >= border->assigned) + if (c->assigned >= border->assigned) list_move(&c->head, &reassign); else if (c->flags & OAF_BOUND) apply_lease(c, true); @@ -874,8 +873,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, o_ia_p.addr.s6_addr32[1] |= htonl(a->assigned); o_ia_p.addr.s6_addr32[2] = o_ia_p.addr.s6_addr32[3] = 0; - if ((a->assigned == 0 && a->managed_size == 0) || - !valid_prefix_length(a, addrs[i].prefix)) + if (!valid_prefix_length(a, addrs[i].prefix)) continue; if (buflen < ia_len + sizeof(o_ia_p)) @@ -896,8 +894,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, o_ia_a.addr.s6_addr32[3] = htonl(a->assigned); - if (!ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs) || - a->assigned == 0) + if (!ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs)) continue; if (buflen < ia_len + sizeof(o_ia_a)) |