}
rr = sldns_buffer_begin(scratch_buffer);
rr_len = sldns_buffer_limit(scratch_buffer);
- char buf[512];
- (void)sldns_wire2str_rr_buf(rr, rr_len, buf, sizeof(buf));
- log_info("decompress is %s", buf);
dname_len = dname_valid(rr, rr_len);
return az_insert_rr(z, rr, rr_len, dname_len, duplicate);
}
d = soa->data;
xfr->have_zone = 1;
xfr->serial = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-20));
- xfr->retry = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-16));
- xfr->refresh = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-12));
+ xfr->refresh = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-16));
+ xfr->retry = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-12));
xfr->expiry = sldns_read_uint32(d->rr_data[0]+(d->rr_len[0]-8));
/* soa minimum at d->rr_len[0]-4 */
return 1;
/* unlock */
lock_rw_unlock(&z->lock);
+ if(verbosity >= VERB_QUERY && xfr->have_zone) {
+ char zname[256];
+ dname_str(xfr->name, zname);
+ verbose(VERB_QUERY, "auth zone %s updated to serial %u", zname,
+ (unsigned)xfr->serial);
+ }
/* see if we need to write to a zonefile */
xfr_write_after_update(xfr, env);
return 1;
case repevt_back_reply: return "REPLY";
case repevt_back_query: return "CHECK_OUT_QUERY";
case repevt_autotrust_check: return "CHECK_AUTOTRUST";
+ case repevt_tempfile_check: return "CHECK_TEMPFILE";
case repevt_error: return "ERROR";
case repevt_assign: return "ASSIGN";
case repevt_traffic: return "TRAFFIC";
log_info("autotrust %s is OK", mom->autotrust_id);
}
+/** check tempfile file contents */
+static void
+tempfile_check(struct replay_runtime* runtime, struct replay_moment* mom)
+{
+ char name[1024], line[1024];
+ FILE *in;
+ int lineno = 0, oke=1;
+ char* expanded;
+ struct config_strlist* p;
+ line[sizeof(line)-1] = 0;
+ log_assert(mom->autotrust_id);
+ fake_temp_file("_temp_", mom->autotrust_id, name, sizeof(name));
+ in = fopen(name, "r");
+ if(!in) fatal_exit("could not open %s: %s", name, strerror(errno));
+ for(p=mom->file_content; p; p=p->next) {
+ lineno++;
+ if(!fgets(line, (int)sizeof(line)-1, in)) {
+ log_err("tempfile check failed, could not read line");
+ log_err("file %s, line %d", name, lineno);
+ log_err("should be: %s", p->str);
+ fatal_exit("tempfile_check failed");
+ }
+ if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
+ expanded = macro_process(runtime->vars, runtime, p->str);
+ if(!expanded)
+ fatal_exit("could not expand macro line %d", lineno);
+ if(verbosity >= 7 && strcmp(p->str, expanded) != 0)
+ log_info("expanded '%s' to '%s'", p->str, expanded);
+ if(strcmp(expanded, line) != 0) {
+ log_err("mismatch in file %s, line %d", name, lineno);
+ log_err("file has : %s", line);
+ log_err("should be: %s", expanded);
+ free(expanded);
+ oke = 0;
+ continue;
+ }
+ free(expanded);
+ fprintf(stderr, "%s:%2d ok : %s\n", name, lineno, line);
+ }
+ if(fgets(line, (int)sizeof(line)-1, in)) {
+ log_err("tempfile check failed, extra lines in %s after %d",
+ name, lineno);
+ do {
+ fprintf(stderr, "file has: %s", line);
+ } while(fgets(line, (int)sizeof(line)-1, in));
+ oke = 0;
+ }
+ fclose(in);
+ if(!oke)
+ fatal_exit("tempfile_check STEP %d failed", mom->time_step);
+ log_info("tempfile %s is OK", mom->autotrust_id);
+}
+
/** Store RTT in infra cache */
static void
do_infra_rtt(struct replay_runtime* runtime)
autotrust_check(runtime, runtime->now);
advance_moment(runtime);
break;
+ case repevt_tempfile_check:
+ tempfile_check(runtime, runtime->now);
+ advance_moment(runtime);
+ break;
case repevt_assign:
moment_assign(runtime, runtime->now);
advance_moment(runtime);
mom->autotrust_id = strdup(remain);
if(!mom->autotrust_id) fatal_exit("out of memory");
read_file_content(in, &pstate->lineno, mom);
+ } else if(parse_keyword(&remain, "CHECK_TEMPFILE")) {
+ mom->evt_type = repevt_tempfile_check;
+ while(isspace((unsigned char)*remain))
+ remain++;
+ if(strlen(remain)>0 && remain[strlen(remain)-1]=='\n')
+ remain[strlen(remain)-1] = 0;
+ mom->autotrust_id = strdup(remain);
+ if(!mom->autotrust_id) fatal_exit("out of memory");
+ read_file_content(in, &pstate->lineno, mom);
} else if(parse_keyword(&remain, "ERROR")) {
mom->evt_type = repevt_error;
} else if(parse_keyword(&remain, "TRAFFIC")) {