X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fdhcpv6-ia.c;h=90dcaf53f46ff66a83fdda5d97041bf9a656020c;hp=610bca3162a1aab8b5041a6199d8b1d69352708f;hb=e59238f32a47616091d8c78acb317d7b4023745f;hpb=ac448deb59fc9ed2f19a3549d521ab796ae6ca47 diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 610bca3..90dcaf5 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -269,7 +269,7 @@ void dhcpv6_write_statefile(void) inet_ntop(AF_INET6, &addr, ipbuf, sizeof(ipbuf) - 1); - if (c->length == 128 && c->hostname && i == 0) { + if (c->length == 128 && c->hostname) { fputs(ipbuf, fp); char b[256]; @@ -976,7 +976,6 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, goto out; update(iface); - bool update_state = false; struct dhcpv6_assignment *first = NULL; dhcpv6_for_each_option(start, end, otype, olen, odata) { @@ -1165,7 +1164,6 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, } a->accept_reconf = accept_reconf; apply_lease(iface, a, true); - update_state = true; } else if (!assigned && a && a->managed_size == 0) { // Cleanup failed assignment free_dhcpv6_assignment(a); } @@ -1184,11 +1182,9 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, } else if (hdr->msg_type == DHCPV6_MSG_RELEASE) { a->valid_until = 0; apply_lease(iface, a, false); - update_state = true; } else if (hdr->msg_type == DHCPV6_MSG_DECLINE && a->length == 128) { a->clid_len = 0; a->valid_until = now + 3600; // Block address for 1h - update_state = true; } } else if (hdr->msg_type == DHCPV6_MSG_CONFIRM && ia_addr_present) { // Send NOTONLINK for CONFIRM with addr present so that clients restart connection @@ -1213,8 +1209,7 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, response_len += 6; } - if (update_state) - dhcpv6_write_statefile(); + dhcpv6_write_statefile(); out: return response_len;