Analysis workflow, debug output.

This commit is contained in:
W.C.A. Wijngaards 2021-06-25 10:12:40 +02:00
parent 358bc0d8bd
commit 6ed49bf45f
6 changed files with 18 additions and 13 deletions

View file

@ -234,6 +234,8 @@ jobs:
make
# specific test output
if echo "i686-mingw64" | grep -i -e linux -e dragonfly >/dev/null; then echo yes; else echo no; fi
if echo "i686-mingw64" | grep -i -e linux >/dev/null; then echo yeslinux; else echo nolinux; fi
if echo "i686-mingw64" | grep -i -e dragonfly >/dev/null; then echo yesdragonfly; else echo nodragonfly; fi
make testbound.exe; ./testbound.exe -s
# make testbound; ./testbound.exe -p testdata/acl.rpl -o -vvvv
make testbound.exe; ./testbound.exe -p testdata/auth_nsec3_ent.rpl -o -vvvv

View file

@ -23,6 +23,7 @@ ctime_r_cleanup(void)
char *ctime_r(const time_t *timep, char *buf)
{
char* result;
printf("unbound_ctime_r called\n");
if(!ctime_r_init) {
/* still small race where this init can be done twice,
* which is mostly harmless */

View file

@ -599,7 +599,7 @@ autotrust_check(struct replay_runtime* runtime, struct replay_moment* mom)
log_err("should be: %s", p->str);
fatal_exit("autotrust_check failed");
}
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
strip_end_white(line);
expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded)
fatal_exit("could not expand macro line %d", lineno);
@ -652,7 +652,7 @@ tempfile_check(struct replay_runtime* runtime, struct replay_moment* mom)
log_err("should be: %s", p->str);
fatal_exit("tempfile_check failed");
}
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
strip_end_white(line);
expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded)
fatal_exit("could not expand macro line %d", lineno);
@ -1717,7 +1717,7 @@ struct comm_point* outnet_comm_point_for_tcp(struct outside_network* outnet,
addr_to_str((struct sockaddr_storage*)to_addr, to_addrlen,
addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) {
if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/
strip_end_white(buf);
log_info("tcp to %s: %s", addrbuf, buf);
}
log_assert(sldns_buffer_limit(query)-LDNS_HEADER_SIZE >= 2);
@ -1807,7 +1807,7 @@ int comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
addr_to_str((struct sockaddr_storage*)addr, addrlen,
addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) {
if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/
strip_end_white(buf);
log_info("udp to %s: %s", addrbuf, buf);
}
log_assert(sldns_buffer_limit(packet)-LDNS_HEADER_SIZE >= 2);

View file

@ -124,8 +124,7 @@ replay_range_delete(struct replay_range* rng)
free(rng);
}
/** strip whitespace from end of string */
static void
void
strip_end_white(char* p)
{
size_t i;
@ -227,7 +226,7 @@ read_file_content(FILE* in, int* lineno, struct replay_moment* mom)
if(strncmp(line, "FILE_END", 8) == 0) {
return;
}
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
strip_end_white(line);
if(!cfg_strlist_insert(last, strdup(line)))
fatal_exit("malloc failure");
last = &( (*last)->next );
@ -249,7 +248,7 @@ read_assign_step(char* remain, struct replay_moment* mom)
if(eq != '=')
fatal_exit("no '=' in assign: %s", remain);
remain += skip;
if(remain[0]) remain[strlen(remain)-1]=0; /* remove newline */
strip_end_white(remain);
mom->string = strdup(remain);
if(!mom->variable || !mom->string)
fatal_exit("out of memory");
@ -689,7 +688,7 @@ do_macro_ctime(char* arg)
return NULL;
}
ctime_r(&tt, buf);
if(buf[0]) buf[strlen(buf)-1]=0; /* remove trailing newline */
strip_end_white(buf);
return strdup(buf);
}

View file

@ -425,6 +425,9 @@ int replay_var_compare(const void* a, const void* b);
/** get oldest enabled fake timer */
struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime);
/** strip whitespace from end of string */
void strip_end_white(char* p);
/**
* Create variable storage
* @return new or NULL on failure.

View file

@ -168,7 +168,7 @@ spool_temp_file_name(int* lineno, FILE* cfg, char* id)
id++;
if(*id == '\0')
fatal_exit("TEMPFILE_NAME must have id, line %d", *lineno);
id[strlen(id)-1]=0; /* remove newline */
strip_end_white(id);
fake_temp_file("_temp_", id, line, sizeof(line));
fprintf(cfg, "\"%s\"\n", line);
}
@ -185,7 +185,7 @@ spool_temp_file(FILE* in, int* lineno, char* id)
id++;
if(*id == '\0')
fatal_exit("TEMPFILE_CONTENTS must have id, line %d", *lineno);
id[strlen(id)-1]=0; /* remove newline */
strip_end_white(id);
fake_temp_file("_temp_", id, line, sizeof(line));
/* open file and spool to it */
spool = fopen(line, "w");
@ -205,7 +205,7 @@ spool_temp_file(FILE* in, int* lineno, char* id)
char* tid = parse+17;
while(isspace((unsigned char)*tid))
tid++;
tid[strlen(tid)-1]=0; /* remove newline */
strip_end_white(tid);
fake_temp_file("_temp_", tid, l2, sizeof(l2));
snprintf(line, sizeof(line), "$INCLUDE %s\n", l2);
}
@ -230,7 +230,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
id++;
if(*id == '\0')
fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
id[strlen(id)-1]=0; /* remove newline */
strip_end_white(id);
fake_temp_file("_auto_", id, line, sizeof(line));
/* add option for the file */
fprintf(cfg, "server: auto-trust-anchor-file: \"%s\"\n", line);