+ struct dhcpv6_assignment *c;
+ struct interface *iface;
+ char *buf;
+ int buf_len;
+ int buf_idx;
+};
+
+void dhcpv6_write_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref,
+ _unused uint32_t valid, void *arg)
+{
+ struct write_ctxt *ctxt = (struct write_ctxt *)arg;
+ char ipbuf[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET6, addr, ipbuf, sizeof(ipbuf) - 1);
+
+ if (ctxt->c->length == 128 && ctxt->c->hostname) {
+ fputs(ipbuf, ctxt->fp);
+
+ char b[256];
+ if (dn_expand(ctxt->iface->search, ctxt->iface->search + ctxt->iface->search_len,
+ ctxt->iface->search, b, sizeof(b)) > 0)
+ fprintf(ctxt->fp, "\t%s.%s", ctxt->c->hostname, b);
+
+ fprintf(ctxt->fp, "\t%s\n", ctxt->c->hostname);
+ md5_hash(ipbuf, strlen(ipbuf), &ctxt->md5);
+ md5_hash(ctxt->c->hostname, strlen(ctxt->c->hostname), &ctxt->md5);
+ }
+
+ ctxt->buf_idx += snprintf(ctxt->buf + ctxt->buf_idx,ctxt->buf_len - ctxt->buf_idx,
+ "%s/%d ", ipbuf, prefix);
+}
+
+void dhcpv6_write_statefile(void)
+{
+ struct write_ctxt ctxt;
+
+ md5_begin(&ctxt.md5);