From 13d7a730ee91a10fb2eb32295023cf022db00e14 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Wed, 7 Feb 2018 12:41:24 +0000 Subject: [PATCH] Further mitigate cache effects for OOOR by adding random label to delay lookup. It turns out that delay.getdnsapi.net only pays attention to the left-most label. --- src/tools/getdns_server_mon.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tools/getdns_server_mon.c b/src/tools/getdns_server_mon.c index d394e69a..f592ce81 100644 --- a/src/tools/getdns_server_mon.c +++ b/src/tools/getdns_server_mon.c @@ -1574,10 +1574,20 @@ static exit_value test_out_of_order(struct test_info_s *test_info, return EXIT_USAGE; } - /* A set of asynchronous queries to send. One exists. */ + /* + * A set of asynchronous queries to send. One exists. + * + * Replies from delay.getdns.api come back with a 1s TTL. It turns out + * that delay.getdns.api will ignore all leftmost labels bar the first, + * so to further mitigate any cache effects insert a random string + * into the name. + */ const char GOOD_NAME[] = "getdnsapi.net"; + char delay_name[50]; + srand(time(NULL)); + snprintf(delay_name, sizeof(delay_name) - 1, "400.n%04d.delay.getdnsapi.net", rand() % 10000); struct async_query async_queries[] = { - { "400.delay.getdnsapi.net", 0, false }, + { delay_name, 0, false }, { GOOD_NAME, 0, false } }; unsigned NQUERIES = sizeof(async_queries) / sizeof(async_queries[0]);