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 make
# specific test output # 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 -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.exe; ./testbound.exe -s
# make testbound; ./testbound.exe -p testdata/acl.rpl -o -vvvv # make testbound; ./testbound.exe -p testdata/acl.rpl -o -vvvv
make testbound.exe; ./testbound.exe -p testdata/auth_nsec3_ent.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 *ctime_r(const time_t *timep, char *buf)
{ {
char* result; char* result;
printf("unbound_ctime_r called\n");
if(!ctime_r_init) { if(!ctime_r_init) {
/* still small race where this init can be done twice, /* still small race where this init can be done twice,
* which is mostly harmless */ * 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); log_err("should be: %s", p->str);
fatal_exit("autotrust_check failed"); 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); expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded) if(!expanded)
fatal_exit("could not expand macro line %d", lineno); 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); log_err("should be: %s", p->str);
fatal_exit("tempfile_check failed"); 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); expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded) if(!expanded)
fatal_exit("could not expand macro line %d", lineno); 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, addr_to_str((struct sockaddr_storage*)to_addr, to_addrlen,
addrbuf, sizeof(addrbuf)); addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) { 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_info("tcp to %s: %s", addrbuf, buf);
} }
log_assert(sldns_buffer_limit(query)-LDNS_HEADER_SIZE >= 2); 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, addr_to_str((struct sockaddr_storage*)addr, addrlen,
addrbuf, sizeof(addrbuf)); addrbuf, sizeof(addrbuf));
if(verbosity >= VERB_ALGO) { 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_info("udp to %s: %s", addrbuf, buf);
} }
log_assert(sldns_buffer_limit(packet)-LDNS_HEADER_SIZE >= 2); 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); free(rng);
} }
/** strip whitespace from end of string */ void
static void
strip_end_white(char* p) strip_end_white(char* p)
{ {
size_t i; 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) { if(strncmp(line, "FILE_END", 8) == 0) {
return; return;
} }
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */ strip_end_white(line);
if(!cfg_strlist_insert(last, strdup(line))) if(!cfg_strlist_insert(last, strdup(line)))
fatal_exit("malloc failure"); fatal_exit("malloc failure");
last = &( (*last)->next ); last = &( (*last)->next );
@ -249,7 +248,7 @@ read_assign_step(char* remain, struct replay_moment* mom)
if(eq != '=') if(eq != '=')
fatal_exit("no '=' in assign: %s", remain); fatal_exit("no '=' in assign: %s", remain);
remain += skip; remain += skip;
if(remain[0]) remain[strlen(remain)-1]=0; /* remove newline */ strip_end_white(remain);
mom->string = strdup(remain); mom->string = strdup(remain);
if(!mom->variable || !mom->string) if(!mom->variable || !mom->string)
fatal_exit("out of memory"); fatal_exit("out of memory");
@ -689,7 +688,7 @@ do_macro_ctime(char* arg)
return NULL; return NULL;
} }
ctime_r(&tt, buf); ctime_r(&tt, buf);
if(buf[0]) buf[strlen(buf)-1]=0; /* remove trailing newline */ strip_end_white(buf);
return strdup(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 */ /** get oldest enabled fake timer */
struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime); 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 * Create variable storage
* @return new or NULL on failure. * @return new or NULL on failure.

View file

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