diff options
-rw-r--r-- | usr.sbin/unbound/testcode/checklocks.c | 3 | ||||
-rw-r--r-- | usr.sbin/unbound/testcode/testpkts.c | 6 | ||||
-rw-r--r-- | usr.sbin/unbound/testcode/testpkts.h | 2 | ||||
-rw-r--r-- | usr.sbin/unbound/testcode/unitauth.c | 8 | ||||
-rw-r--r-- | usr.sbin/unbound/testcode/unitecs.c | 2 |
5 files changed, 19 insertions, 2 deletions
diff --git a/usr.sbin/unbound/testcode/checklocks.c b/usr.sbin/unbound/testcode/checklocks.c index 7e6f0bb5db5..1b5ef282b5e 100644 --- a/usr.sbin/unbound/testcode/checklocks.c +++ b/usr.sbin/unbound/testcode/checklocks.c @@ -71,6 +71,9 @@ static pid_t check_lock_pid; /** print all possible debug info on the state of the system */ static void total_debug_info(void); +/** print pretty lock error and exit (decl for NORETURN attribute) */ +static void lock_error(struct checked_lock* lock, const char* func, + const char* file, int line, const char* err) ATTR_NORETURN; /** print pretty lock error and exit */ static void lock_error(struct checked_lock* lock, diff --git a/usr.sbin/unbound/testcode/testpkts.c b/usr.sbin/unbound/testcode/testpkts.c index 01f23e48ed2..1d89c38fc8f 100644 --- a/usr.sbin/unbound/testcode/testpkts.c +++ b/usr.sbin/unbound/testcode/testpkts.c @@ -236,6 +236,8 @@ static void adjustline(char* line, struct entry* e, e->copy_query = 1; } else if(str_keyword(&parse, "copy_ednsdata_assume_clientsubnet")) { e->copy_ednsdata_assume_clientsubnet = 1; + } else if(str_keyword(&parse, "increment_ecs_scope")) { + e->increment_ecs_scope = 1; } else if(str_keyword(&parse, "sleep=")) { e->sleeptime = (unsigned int) strtol(parse, (char**)&parse, 10); while(isspace((unsigned char)*parse)) @@ -274,6 +276,7 @@ static struct entry* new_entry(void) e->copy_id = 0; e->copy_query = 0; e->copy_ednsdata_assume_clientsubnet = 0; + e->increment_ecs_scope = 0; e->sleeptime = 0; e->next = NULL; return e; @@ -1593,6 +1596,9 @@ adjust_packet(struct entry* match, uint8_t** answer_pkt, size_t *answer_len, if(walk_qlen >= 15 && walk_plen >= 15) { walk_p[15] = walk_q[14]; } + if(match->increment_ecs_scope) { + walk_p[15]++; + } } if(match->sleeptime > 0) { diff --git a/usr.sbin/unbound/testcode/testpkts.h b/usr.sbin/unbound/testcode/testpkts.h index b175cab066a..6e032fa90a6 100644 --- a/usr.sbin/unbound/testcode/testpkts.h +++ b/usr.sbin/unbound/testcode/testpkts.h @@ -208,6 +208,8 @@ struct entry { /** copy ednsdata to reply, assume it is clientsubnet and * adjust scopemask to match sourcemask */ uint8_t copy_ednsdata_assume_clientsubnet; + /** increment the ECS scope copied from the sourcemask by one */ + uint8_t increment_ecs_scope; /** in seconds */ unsigned int sleeptime; diff --git a/usr.sbin/unbound/testcode/unitauth.c b/usr.sbin/unbound/testcode/unitauth.c index c162e7ef964..4b3410c9ef7 100644 --- a/usr.sbin/unbound/testcode/unitauth.c +++ b/usr.sbin/unbound/testcode/unitauth.c @@ -42,6 +42,7 @@ #include "testcode/unitmain.h" #include "util/regional.h" #include "util/net_help.h" +#include "util/config_file.h" #include "util/data/msgreply.h" #include "services/cache/dns.h" #include "sldns/str2wire.h" @@ -522,6 +523,7 @@ addzone(struct auth_zones* az, const char* name, char* fname) struct auth_zone* z; size_t nmlen; uint8_t* nm = sldns_str2wire_dname(name, &nmlen); + struct config_file* cfg; if(!nm) fatal_exit("out of memory"); lock_rw_wrlock(&az->lock); z = auth_zone_create(az, nm, nmlen, LDNS_RR_CLASS_IN); @@ -529,12 +531,16 @@ addzone(struct auth_zones* az, const char* name, char* fname) if(!z) fatal_exit("cannot find zone"); auth_zone_set_zonefile(z, fname); z->for_upstream = 1; + cfg = config_create(); + free(cfg->chrootdir); + cfg->chrootdir = NULL; - if(!auth_zone_read_zonefile(z)) { + if(!auth_zone_read_zonefile(z, cfg)) { fatal_exit("parse failure for auth zone %s", name); } lock_rw_unlock(&z->lock); free(nm); + config_delete(cfg); return z; } diff --git a/usr.sbin/unbound/testcode/unitecs.c b/usr.sbin/unbound/testcode/unitecs.c index 097ae9ebba6..b240bfcc666 100644 --- a/usr.sbin/unbound/testcode/unitecs.c +++ b/usr.sbin/unbound/testcode/unitecs.c @@ -158,7 +158,7 @@ static void consistency_test(void) { addrlen_t l; time_t i; - unsigned int count; + uint32_t count; addrkey_t *k; struct addrtree* t; struct module_env env; |