diff --git a/dnsperf-ends-client-subnet.patch b/dnsperf-ends-client-subnet.patch new file mode 100644 index 0000000..a8043c0 --- /dev/null +++ b/dnsperf-ends-client-subnet.patch @@ -0,0 +1,230 @@ +From 08c78a932f4fd19039d2d2cf1cb90f2390fac6e8 Mon Sep 17 00:00:00 2001 +From: Mukund Sivaraman +Date: Fri, 9 Sep 2016 13:34:13 +0530 +Subject: [PATCH] Add support for sending EDNS CLIENT-SUBNET option in queries + to dnsperf and resperf (#42899) + +--- + dns.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- + dns.h | 2 ++ + dnsperf.c | 21 ++++++++++++++++++-- + resperf.c | 18 +++++++++++++++-- + 4 files changed, 100 insertions(+), 7 deletions(-) + +diff --git a/dns.c b/dns.c +index bfa2fa5..6e841ad 100644 +--- a/dns.c ++++ b/dns.c +@@ -302,7 +302,10 @@ perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp) + * Appends an OPT record to the packet. + */ + static isc_result_t +-add_edns(isc_buffer_t *packet, bool dnssec) { ++add_edns(isc_buffer_t *packet, bool dnssec, ++ bool ecs_zero, bool ecs_fixed, ++ bool ecs_random) ++{ + unsigned char *base; + + if (isc_buffer_availablelength(packet) < EDNSLEN) { +@@ -321,7 +324,62 @@ add_edns(isc_buffer_t *packet, bool dnssec) { + isc_buffer_putuint16(packet, 0x8000); + else + isc_buffer_putuint16(packet, 0); +- isc_buffer_putuint16(packet, 0); /* rdlen */ ++ if (!ecs_zero && !ecs_fixed && !ecs_random) { ++ isc_buffer_putuint16(packet, 0); /* rdlen */ ++ } else { ++ if (ecs_zero) { ++ /* rdlen */ ++ isc_buffer_putuint16(packet, 8); ++ /* CLIENT-SUBNET option code */ ++ isc_buffer_putuint16(packet, 0x0008); ++ /* CLIENT-SUBNET option length */ ++ isc_buffer_putuint16(packet, 4); ++ /* FAMILY=IPv4 */ ++ isc_buffer_putuint16(packet, 0x0001); ++ /* SOURCE PREFIX-LENGTH=0 */ ++ isc_buffer_putuint8(packet, 0); ++ /* SCOPE PREFIX-LENGTH=0 */ ++ isc_buffer_putuint8(packet, 0); ++ } else if (ecs_fixed) { ++ /* rdlen */ ++ isc_buffer_putuint16(packet, 11); ++ /* CLIENT-SUBNET option code */ ++ isc_buffer_putuint16(packet, 0x0008); ++ /* CLIENT-SUBNET option length */ ++ isc_buffer_putuint16(packet, 7); ++ /* FAMILY=IPv4 */ ++ isc_buffer_putuint16(packet, 0x0001); ++ /* SOURCE PREFIX-LENGTH=24 */ ++ isc_buffer_putuint8(packet, 24); ++ /* SCOPE PREFIX-LENGTH=0 */ ++ isc_buffer_putuint8(packet, 0); ++ isc_buffer_putuint8(packet, 149); ++ isc_buffer_putuint8(packet, 20); ++ isc_buffer_putuint8(packet, 64); ++ } else { ++ unsigned long r; ++ ++ /* rdlen */ ++ isc_buffer_putuint16(packet, 11); ++ /* CLIENT-SUBNET option code */ ++ isc_buffer_putuint16(packet, 0x0008); ++ /* CLIENT-SUBNET option length */ ++ isc_buffer_putuint16(packet, 7); ++ /* FAMILY=IPv4 */ ++ isc_buffer_putuint16(packet, 0x0001); ++ /* SOURCE PREFIX-LENGTH=24 */ ++ isc_buffer_putuint8(packet, 24); ++ /* SCOPE PREFIX-LENGTH=0 */ ++ isc_buffer_putuint8(packet, 0); ++ ++ r = (unsigned long) random(); ++ isc_buffer_putuint8(packet, r & 0xff); ++ r >>= 8; ++ isc_buffer_putuint8(packet, r & 0xff); ++ r >>= 8; ++ isc_buffer_putuint8(packet, r & 0xff); ++ } ++ } + + base[11]++; /* increment record count */ + +@@ -808,6 +866,8 @@ isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, + uint16_t qid, + bool edns, bool dnssec, ++ bool ecs_zero, bool ecs_fixed, ++ bool ecs_random, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg) + { + unsigned int flags; +@@ -835,7 +895,7 @@ perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, + return (result); + + if (edns) { +- result = add_edns(msg, dnssec); ++ result = add_edns(msg, dnssec, ecs_zero, ecs_fixed, ecs_random); + if (result != ISC_R_SUCCESS) + return (result); + } +diff --git a/dns.h b/dns.h +index 5d5583f..2f223b9 100644 +--- a/dns.h ++++ b/dns.h +@@ -64,6 +64,8 @@ isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, + uint16_t qid, + bool edns, bool dnssec, ++ bool ecs_zero, bool ecs_fixed, ++ bool ecs_random, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg); + + #endif +diff --git a/dnsperf.c b/dnsperf.c +index 3b1e602..8a694f8 100644 +--- a/dnsperf.c ++++ b/dnsperf.c +@@ -103,6 +103,9 @@ typedef struct { + uint32_t bufsize; + bool edns; + bool dnssec; ++ bool ecs_zero; ++ bool ecs_fixed; ++ bool ecs_random; + perf_dnstsigkey_t *tsigkey; + uint32_t max_outstanding; + uint32_t max_qps; +@@ -446,6 +449,15 @@ setup(int argc, char **argv, config_t *config) + perf_opt_add('D', perf_opt_boolean, NULL, + "set the DNSSEC OK bit (implies EDNS)", NULL, + &config->dnssec); ++ perf_opt_add('X', perf_opt_boolean, NULL, ++ "send 0/0 in EDNS CLIENT-SUBNET option", NULL, ++ &config->ecs_zero); ++ perf_opt_add('Y', perf_opt_boolean, NULL, ++ "send 149.20.64.0/24 in EDNS CLIENT-SUBNET option", NULL, ++ &config->ecs_fixed); ++ perf_opt_add('Z', perf_opt_boolean, NULL, ++ "send random/24 in EDNS CLIENT-SUBNET option", NULL, ++ &config->ecs_random); + perf_opt_add('y', perf_opt_string, "[alg:]name:secret", + "the TSIG algorithm, name and secret", NULL, + &tsigkey); +@@ -481,7 +493,8 @@ setup(int argc, char **argv, config_t *config) + config->maxruns = 1; + perf_datafile_setmaxruns(input, config->maxruns); + +- if (config->dnssec) ++ if (config->dnssec || config->ecs_zero || config->ecs_fixed || ++ config->ecs_random) + config->edns = true; + + if (tsigkey != NULL) +@@ -645,7 +658,11 @@ do_send(void *arg) + result = perf_dns_buildrequest(tinfo->dnsctx, + (isc_textregion_t *) &used, + qid, config->edns, +- config->dnssec, config->tsigkey, ++ config->dnssec, ++ config->ecs_zero, ++ config->ecs_fixed, ++ config->ecs_random, ++ config->tsigkey, + &msg); + if (result != ISC_R_SUCCESS) { + LOCK(&tinfo->lock); +diff --git a/resperf.c b/resperf.c +index a4f6555..12b254d 100644 +--- a/resperf.c ++++ b/resperf.c +@@ -110,6 +110,9 @@ static int *socks; + static uint64_t query_timeout; + static bool edns; + static bool dnssec; ++static bool ecs_zero; ++static bool ecs_fixed; ++static bool ecs_random; + + static perf_datafile_t *input; + +@@ -271,6 +274,15 @@ setup(int argc, char **argv) + "enable EDNS 0", NULL, &edns); + perf_opt_add('D', perf_opt_boolean, NULL, + "set the DNSSEC OK bit (implies EDNS)", NULL, &dnssec); ++ perf_opt_add('X', perf_opt_boolean, NULL, ++ "send 0/0 in EDNS CLIENT-SUBNET option", NULL, ++ &ecs_zero); ++ perf_opt_add('Y', perf_opt_boolean, NULL, ++ "send 149.20.64.0/24 in EDNS CLIENT-SUBNET option", NULL, ++ &ecs_fixed); ++ perf_opt_add('Z', perf_opt_boolean, NULL, ++ "send random/24 in EDNS CLIENT-SUBNET option", NULL, ++ &ecs_random); + perf_opt_add('y', perf_opt_string, "[alg:]name:secret", + "the TSIG algorithm, name and secret", NULL, + &tsigkey_str); +@@ -329,7 +341,7 @@ setup(int argc, char **argv) + + input = perf_datafile_open(mctx, filename); + +- if (dnssec) ++ if (dnssec || ecs_zero || ecs_fixed || ecs_random) + edns = true; + + if (tsigkey_str != NULL) +@@ -476,7 +488,9 @@ do_one_line(isc_buffer_t *lines, isc_buffer_t *msg) { + + isc_buffer_clear(msg); + result = perf_dns_buildrequest(NULL, (isc_textregion_t *) &used, +- qid, edns, dnssec, tsigkey, msg); ++ qid, edns, dnssec, ++ ecs_zero, ecs_fixed, ecs_random, ++ tsigkey, msg); + if (result != ISC_R_SUCCESS) + return (result); + +-- +2.14.5 + diff --git a/dnsperf-id-tags.patch b/dnsperf-id-tags.patch new file mode 100644 index 0000000..a3f8a9a --- /dev/null +++ b/dnsperf-id-tags.patch @@ -0,0 +1,40 @@ +From 970fa6cbb6491e0d1c0a7337670874a699b7129d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= +Date: Tue, 17 Apr 2018 09:32:20 -0700 +Subject: [PATCH] Remove $Id markers, Principal Author and Reviewed tags from + the full source tree + +--- + dnsperf.c | 2 -- + resperf.c | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/dnsperf.c b/dnsperf.c +index d4f2b32..67c5fc3 100644 +--- a/dnsperf.c ++++ b/dnsperf.c +@@ -34,8 +34,6 @@ + + /*** + *** DNS Performance Testing Tool +- *** +- *** Version $Id: dnsperf.c 263303 2015-12-15 01:09:36Z bwelling $ + ***/ + + #include +diff --git a/resperf.c b/resperf.c +index 4dfbb22..e94528e 100644 +--- a/resperf.c ++++ b/resperf.c +@@ -34,8 +34,6 @@ + + /*** + *** DNS Resolution Performance Testing Tool +- *** +- *** Version $Id: resperf.c 263304 2015-12-15 01:14:10Z bwelling $ + ***/ + + #include +-- +2.14.5 + diff --git a/dnsperf-inttypes.patch b/dnsperf-inttypes.patch new file mode 100644 index 0000000..f571777 --- /dev/null +++ b/dnsperf-inttypes.patch @@ -0,0 +1,93 @@ +From f664ec1f0c879c17a36d53fc379f135e510b359a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= +Date: Wed, 28 Mar 2018 14:56:40 +0200 +Subject: [PATCH 1/3] Replace ISC_PRINT_QUADFORMAT with inttypes.h format + constants + +--- + dnsperf.c | 12 +++++++----- + resperf.c | 9 +++++---- + 2 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/dnsperf.c b/dnsperf.c +index 67c5fc3..ba84de1 100644 +--- a/dnsperf.c ++++ b/dnsperf.c +@@ -36,6 +36,8 @@ + *** DNS Performance Testing Tool + ***/ + ++#include ++ + #include + #include + #include +@@ -278,16 +280,16 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) + + printf("Statistics:\n\n"); + +- printf(" %s sent: %" ISC_PRINT_QUADFORMAT "u\n", ++ printf(" %s sent: %" PRIu64 "\n", + units, stats->num_sent); +- printf(" %s completed: %" ISC_PRINT_QUADFORMAT "u (%.2lf%%)\n", ++ printf(" %s completed: %" PRIu64 " (%.2lf%%)\n", + units, stats->num_completed, + SAFE_DIV(100.0 * stats->num_completed, stats->num_sent)); +- printf(" %s lost: %" ISC_PRINT_QUADFORMAT "u (%.2lf%%)\n", ++ printf(" %s lost: %" PRIu64 " (%.2lf%%)\n", + units, stats->num_timedout, + SAFE_DIV(100.0 * stats->num_timedout, stats->num_sent)); + if (stats->num_interrupted > 0) +- printf(" %s interrupted: %" ISC_PRINT_QUADFORMAT "u " ++ printf(" %s interrupted: %" PRIu64 " " + "(%.2lf%%)\n", + units, stats->num_interrupted, + SAFE_DIV(100.0 * stats->num_interrupted, +@@ -303,7 +305,7 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) + first_rcode = ISC_FALSE; + else + printf(", "); +- printf("%s %" ISC_PRINT_QUADFORMAT "u (%.2lf%%)", ++ printf("%s %" PRIu64 " (%.2lf%%)", + perf_dns_rcode_strings[i], stats->rcodecounts[i], + (stats->rcodecounts[i] * 100.0) / stats->num_completed); + } +diff --git a/resperf.c b/resperf.c +index e94528e..7744d32 100644 +--- a/resperf.c ++++ b/resperf.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + #include + +@@ -387,11 +388,11 @@ print_statistics(void) { + + printf("\nStatistics:\n\n"); + +- printf(" Queries sent: %" ISC_PRINT_QUADFORMAT "u\n", ++ printf(" Queries sent: %" PRIu64 "\n", + num_queries_sent); +- printf(" Queries completed: %" ISC_PRINT_QUADFORMAT "u\n", ++ printf(" Queries completed: %" PRIu64 "\n", + num_responses_received); +- printf(" Queries lost: %" ISC_PRINT_QUADFORMAT "u\n", ++ printf(" Queries lost: %" PRIu64 "\n", + num_queries_sent - num_responses_received); + printf(" Response codes: "); + first_rcode = ISC_TRUE; +@@ -402,7 +403,7 @@ print_statistics(void) { + first_rcode = ISC_FALSE; + else + printf(", "); +- printf("%s %" ISC_PRINT_QUADFORMAT "u (%.2lf%%)", ++ printf("%s %" PRIu64 " (%.2lf%%)", + perf_dns_rcode_strings[i], rcodecounts[i], + (rcodecounts[i] * 100.0) / num_responses_received); + } +-- +2.14.5 + diff --git a/dnsperf-stdbool.patch b/dnsperf-stdbool.patch new file mode 100644 index 0000000..77d5035 --- /dev/null +++ b/dnsperf-stdbool.patch @@ -0,0 +1,704 @@ +From f5933c34153fce3b38c66e6e05da024fb8f84cc8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= +Date: Tue, 17 Apr 2018 08:29:14 -0700 +Subject: [PATCH] Replace custom isc_boolean_t with C standard bool type + +--- + datafile.c | 25 +++++++++++++------------ + datafile.h | 4 +++- + dns.c | 45 +++++++++++++++++++++++---------------------- + dns.h | 5 +++-- + dnsperf.c | 57 +++++++++++++++++++++++++++++---------------------------- + opt.c | 13 +++++++------ + os.c | 3 ++- + os.h | 3 ++- + resperf.c | 17 +++++++++-------- + util.h | 5 +++-- + 10 files changed, 94 insertions(+), 83 deletions(-) + +diff --git a/datafile.c b/datafile.c +index af42948..b2e0831 100644 +--- a/datafile.c ++++ b/datafile.c +@@ -16,6 +16,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -38,14 +39,14 @@ struct perf_datafile { + pthread_mutex_t lock; + int pipe_fd; + int fd; +- isc_boolean_t is_file; ++ bool is_file; + size_t size; +- isc_boolean_t cached; ++ bool cached; + char databuf[BUFFER_SIZE + 1]; + isc_buffer_t data; + unsigned int maxruns; + unsigned int nruns; +- isc_boolean_t read_any; ++ bool read_any; + }; + + static inline void +@@ -70,12 +71,12 @@ perf_datafile_open(isc_mem_t *mctx, const char *filename) + dfile->mctx = mctx; + MUTEX_INIT(&dfile->lock); + dfile->pipe_fd = -1; +- dfile->is_file = ISC_FALSE; ++ dfile->is_file = false; + dfile->size = 0; +- dfile->cached = ISC_FALSE; ++ dfile->cached = false; + dfile->maxruns = 1; + dfile->nruns = 0; +- dfile->read_any = ISC_FALSE; ++ dfile->read_any = false; + isc_buffer_init(&dfile->data, dfile->databuf, BUFFER_SIZE); + if (filename == NULL) { + dfile->fd = STDIN_FILENO; +@@ -84,7 +85,7 @@ perf_datafile_open(isc_mem_t *mctx, const char *filename) + if (dfile->fd < 0) + perf_log_fatal("unable to open file: %s", filename); + if (fstat(dfile->fd, &buf) == 0 && S_ISREG(buf.st_mode)) { +- dfile->is_file = ISC_TRUE; ++ dfile->is_file = true; + dfile->size = buf.st_size; + } + } +@@ -162,7 +163,7 @@ read_more(perf_datafile_t *dfile) + + if (dfile->is_file && + isc_buffer_usedlength(&dfile->data) == dfile->size) +- dfile->cached = ISC_TRUE; ++ dfile->cached = true; + + return (ISC_R_SUCCESS); + } +@@ -174,7 +175,7 @@ read_one_line(perf_datafile_t *dfile, isc_buffer_t *lines) + unsigned int length, curlen, nrem; + isc_result_t result; + +- while (ISC_TRUE) { ++ while (true) { + /* Get the current line */ + cur = isc_buffer_current(&dfile->data); + curlen = strcspn(cur, "\n"); +@@ -219,7 +220,7 @@ read_one_line(perf_datafile_t *dfile, isc_buffer_t *lines) + + isc_result_t + perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, +- isc_boolean_t is_update) ++ bool is_update) + { + const char *current; + isc_result_t result; +@@ -246,10 +247,10 @@ perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, + if (result != ISC_R_SUCCESS) { + goto done; + } +- dfile->read_any = ISC_TRUE; ++ dfile->read_any = true; + + if (is_update) { +- while (ISC_TRUE) { ++ while (true) { + current = isc_buffer_used(lines); + result = read_one_line(dfile, lines); + if (result == ISC_R_EOF && +diff --git a/datafile.h b/datafile.h +index 9e0edc6..c810d28 100644 +--- a/datafile.h ++++ b/datafile.h +@@ -18,6 +18,8 @@ + #ifndef PERF_DATAFILE_H + #define PERF_DATAFILE_H 1 + ++#include ++ + #include + + typedef struct perf_datafile perf_datafile_t; +@@ -36,7 +38,7 @@ perf_datafile_setpipefd(perf_datafile_t *dfile, int pipe_fd); + + isc_result_t + perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, +- isc_boolean_t is_update); ++ bool is_update); + + unsigned int + perf_datafile_nruns(const perf_datafile_t *dfile); +diff --git a/dns.c b/dns.c +index 25ae1df..bfa2fa5 100644 +--- a/dns.c ++++ b/dns.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -119,7 +120,7 @@ struct perf_dnsctx { + }; + + perf_dnsctx_t * +-perf_dns_createctx(isc_boolean_t updates) ++perf_dns_createctx(bool updates) + { + isc_mem_t *mctx; + perf_dnsctx_t *ctx; +@@ -301,7 +302,7 @@ perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp) + * Appends an OPT record to the packet. + */ + static isc_result_t +-add_edns(isc_buffer_t *packet, isc_boolean_t dnssec) { ++add_edns(isc_buffer_t *packet, bool dnssec) { + unsigned char *base; + + if (isc_buffer_availablelength(packet) < EDNSLEN) { +@@ -524,7 +525,7 @@ build_query(const isc_textregion_t *line, isc_buffer_t *msg) + return ISC_R_SUCCESS; + } + +-static isc_boolean_t ++static bool + token_equals(const isc_textregion_t *token, const char *str) + { + return (strlen(str) == token->length && +@@ -644,7 +645,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + unsigned char rdataarray[MAX_RDATA_LENGTH]; + isc_textregion_t token; + char *str; +- isc_boolean_t is_update; ++ bool is_update; + int updates = 0; + int prereqs = 0; + dns_fixedname_t fzname, foname; +@@ -686,7 +687,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + isc_buffer_putuint16(msg, dns_rdatatype_soa); + isc_buffer_putuint16(msg, dns_rdataclass_in); + +- while (ISC_TRUE) { ++ while (true) { + input.base += strlen(input.base) + 1; + if (input.base >= record->base + record->length) { + perf_log_warning("warning: incomplete update"); +@@ -699,7 +700,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + dns_rdata_init(&rdata); + rdlen = 0; + rdclass = dns_rdataclass_in; +- is_update = ISC_FALSE; ++ is_update = false; + + token.base = input.base; + token.length = strcspn(token.base, WHITESPACE); +@@ -708,42 +709,42 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + break; + } else if (token_equals(&token, "add")) { + result = read_update_line(ctx, &input, str, zname, +- ISC_TRUE, +- ISC_TRUE, ISC_TRUE, ISC_TRUE, ++ true, ++ true, true, true, + oname, &ttl, &rdtype, + &rdata, &rdatabuf); + rdclass = dns_rdataclass_in; +- is_update = ISC_TRUE; ++ is_update = true; + } else if (token_equals(&token, "delete")) { + result = read_update_line(ctx, &input, str, zname, +- ISC_FALSE, +- ISC_FALSE, ISC_TRUE, +- ISC_FALSE, oname, &ttl, ++ false, ++ false, true, ++ false, oname, &ttl, + &rdtype, &rdata, &rdatabuf); + if (isc_buffer_usedlength(&rdatabuf) > 0) + rdclass = dns_rdataclass_none; + else + rdclass = dns_rdataclass_any; +- is_update = ISC_TRUE; ++ is_update = true; + } else if (token_equals(&token, "require")) { + result = read_update_line(ctx, &input, str, zname, +- ISC_FALSE, +- ISC_FALSE, ISC_TRUE, +- ISC_FALSE, oname, &ttl, ++ false, ++ false, true, ++ false, oname, &ttl, + &rdtype, &rdata, &rdatabuf); + if (isc_buffer_usedlength(&rdatabuf) > 0) + rdclass = dns_rdataclass_in; + else + rdclass = dns_rdataclass_any; +- is_update = ISC_FALSE; ++ is_update = false; + } else if (token_equals(&token, "prohibit")) { + result = read_update_line(ctx, &input, str, zname, +- ISC_FALSE, +- ISC_FALSE, ISC_FALSE, +- ISC_FALSE, oname, &ttl, ++ false, ++ false, false, ++ false, oname, &ttl, + &rdtype, &rdata, &rdatabuf); + rdclass = dns_rdataclass_none; +- is_update = ISC_FALSE; ++ is_update = false; + } else { + perf_log_warning("invalid update command: %s", + input.base); +@@ -806,7 +807,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, + uint16_t qid, +- isc_boolean_t edns, isc_boolean_t dnssec, ++ bool edns, bool dnssec, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg) + { + unsigned int flags; +diff --git a/dns.h b/dns.h +index 5dab512..5d5583f 100644 +--- a/dns.h ++++ b/dns.h +@@ -33,6 +33,7 @@ + */ + + #include ++#include + + #include + +@@ -54,7 +55,7 @@ void + perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp); + + perf_dnsctx_t * +-perf_dns_createctx(isc_boolean_t updates); ++perf_dns_createctx(bool updates); + + void + perf_dns_destroyctx(perf_dnsctx_t **ctxp); +@@ -62,7 +63,7 @@ perf_dns_destroyctx(perf_dnsctx_t **ctxp); + isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, + uint16_t qid, +- isc_boolean_t edns, isc_boolean_t dnssec, ++ bool edns, bool dnssec, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg); + + #endif +diff --git a/dnsperf.c b/dnsperf.c +index ba0c5f8..3b1e602 100644 +--- a/dnsperf.c ++++ b/dnsperf.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -100,14 +101,14 @@ typedef struct { + isc_sockaddr_t local_addr; + uint64_t timeout; + uint32_t bufsize; +- isc_boolean_t edns; +- isc_boolean_t dnssec; ++ bool edns; ++ bool dnssec; + perf_dnstsigkey_t *tsigkey; + uint32_t max_outstanding; + uint32_t max_qps; + uint64_t stats_interval; +- isc_boolean_t updates; +- isc_boolean_t verbose; ++ bool updates; ++ bool verbose; + } config_t; + + typedef struct { +@@ -167,7 +168,7 @@ typedef struct { + + perf_dnsctx_t *dnsctx; + +- isc_boolean_t done_sending; ++ bool done_sending; + uint64_t done_send_time; + + const config_t *config; +@@ -184,9 +185,9 @@ static threadinfo_t *threads; + + static pthread_mutex_t start_lock = PTHREAD_MUTEX_INITIALIZER; + static pthread_cond_t start_cond = PTHREAD_COND_INITIALIZER; +-static isc_boolean_t started; ++static bool started; + +-static isc_boolean_t interrupted = ISC_FALSE; ++static bool interrupted = false; + + static int threadpipe[2]; + static int mainpipe[2]; +@@ -269,7 +270,7 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) + { + const char *units; + uint64_t run_time; +- isc_boolean_t first_rcode; ++ bool first_rcode; + uint64_t latency_avg; + unsigned int i; + +@@ -296,12 +297,12 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) + printf("\n"); + + printf(" Response codes: "); +- first_rcode = ISC_TRUE; ++ first_rcode = true; + for (i = 0; i < 16; i++) { + if (stats->rcodecounts[i] == 0) + continue; + if (first_rcode) +- first_rcode = ISC_FALSE; ++ first_rcode = false; + else + printf(", "); + printf("%s %" PRIu64 " (%.2lf%%)", +@@ -481,7 +482,7 @@ setup(int argc, char **argv, config_t *config) + perf_datafile_setmaxruns(input, config->maxruns); + + if (config->dnssec) +- config->edns = ISC_TRUE; ++ config->edns = true; + + if (tsigkey != NULL) + config->tsigkey = perf_dns_parsetsigkey(tsigkey, mctx); +@@ -683,7 +684,7 @@ do_send(void *arg) + stats->total_request_size += length; + } + tinfo->done_send_time = get_time(); +- tinfo->done_sending = ISC_TRUE; ++ tinfo->done_sending = true; + write(mainpipe[1], "", 1); + return NULL; + } +@@ -730,12 +731,12 @@ typedef struct { + unsigned int size; + uint64_t when; + uint64_t sent; +- isc_boolean_t unexpected; +- isc_boolean_t short_response; ++ bool unexpected; ++ bool short_response; + char *desc; + } received_query_t; + +-static isc_boolean_t ++static bool + recv_one(threadinfo_t *tinfo, int which_sock, + unsigned char *packet_buffer, unsigned int packet_size, + received_query_t *recvd, int *saved_errnop) +@@ -752,7 +753,7 @@ recv_one(threadinfo_t *tinfo, int which_sock, + now = get_time(); + if (n < 0) { + *saved_errnop = errno; +- return ISC_FALSE; ++ return false; + } + recvd->sock = s; + recvd->qid = ntohs(packet_header[0]); +@@ -760,10 +761,10 @@ recv_one(threadinfo_t *tinfo, int which_sock, + recvd->size = n; + recvd->when = now; + recvd->sent = 0; +- recvd->unexpected = ISC_FALSE; +- recvd->short_response = ISC_TF(n < 4); ++ recvd->unexpected = false; ++ recvd->short_response = (n < 4); + recvd->desc = NULL; +- return ISC_TRUE; ++ return true; + } + + static inline void +@@ -777,7 +778,7 @@ bit_set(unsigned char *bits, unsigned int bit) + bits[bit / 8] |= mask; + } + +-static inline isc_boolean_t ++static inline bool + bit_check(unsigned char *bits, unsigned int bit) + { + unsigned int shift; +@@ -785,8 +786,8 @@ bit_check(unsigned char *bits, unsigned int bit) + shift = 7 - (bit % 8); + + if ((bits[bit / 8] >> shift) & 0x01) +- return ISC_TRUE; +- return ISC_FALSE; ++ return true; ++ return false; + } + + static void * +@@ -860,7 +861,7 @@ do_recv(void *arg) + q->timestamp == UINT64_MAX || + q->sock != recvd[i].sock) + { +- recvd[i].unexpected = ISC_TRUE; ++ recvd[i].unexpected = true; + continue; + } + query_move(tinfo, q, append_unused); +@@ -975,7 +976,7 @@ cancel_queries(threadinfo_t *tinfo) + { + struct query_info *q; + +- while (ISC_TRUE) { ++ while (true) { + q = ISC_LIST_TAIL(tinfo->outstanding_queries); + if (q == NULL) + break; +@@ -1108,7 +1109,7 @@ main(int argc, char **argv) + + perf_datafile_setpipefd(input, threadpipe[0]); + +- perf_os_blocksignal(SIGINT, ISC_TRUE); ++ perf_os_blocksignal(SIGINT, true); + + print_initial_status(&config); + +@@ -1132,16 +1133,16 @@ main(int argc, char **argv) + times.stop_time_ns.tv_nsec = (times.stop_time % MILLION) * 1000; + + LOCK(&start_lock); +- started = ISC_TRUE; ++ started = true; + BROADCAST(&start_cond); + UNLOCK(&start_lock); + + perf_os_handlesignal(SIGINT, handle_sigint); +- perf_os_blocksignal(SIGINT, ISC_FALSE); ++ perf_os_blocksignal(SIGINT, false); + result = perf_os_waituntilreadable(mainpipe[0], intrpipe[0], + times.stop_time - times.start_time); + if (result == ISC_R_CANCELED) +- interrupted = ISC_TRUE; ++ interrupted = true; + + times.end_time = get_time(); + +diff --git a/opt.c b/opt.c +index cd3bd59..9b1b0c3 100644 +--- a/opt.c ++++ b/opt.c +@@ -16,6 +16,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -44,7 +45,7 @@ typedef struct { + union { + void *valp; + char **stringp; +- isc_boolean_t *boolp; ++ bool *boolp; + unsigned int *uintp; + uint64_t *uint64p; + double *doublep; +@@ -138,7 +139,7 @@ parse_timeval(const char *desc, const char *str) + { + const char *s; + char c; +- isc_boolean_t seen_dot = ISC_FALSE; ++ bool seen_dot = false; + + s = str; + while (*s != 0) { +@@ -146,7 +147,7 @@ parse_timeval(const char *desc, const char *str) + if (c == '.') { + if (seen_dot) + goto fail; +- seen_dot = ISC_TRUE; ++ seen_dot = true; + } else if (c < '0' || c > '9') { + goto fail; + } +@@ -163,14 +164,14 @@ static double + parse_double(const char *desc, const char *str) { + char c; + int index = 0; +- isc_boolean_t seen_dot = ISC_FALSE; ++ bool seen_dot = false; + + while (str[index] != 0) { + c = str[index]; + if (c == '.') { + if (seen_dot) + goto fail; +- seen_dot = ISC_TRUE; ++ seen_dot = true; + } else if (c < '0' || c > '9') { + goto fail; + } +@@ -215,7 +216,7 @@ perf_opt_parse(int argc, char **argv) + *opt->u.stringp = optarg; + break; + case perf_opt_boolean: +- *opt->u.boolp = ISC_TRUE; ++ *opt->u.boolp = true; + break; + case perf_opt_uint: + *opt->u.uintp = parse_uint(opt->desc, optarg, +diff --git a/os.c b/os.c +index 2c3eae7..7318cad 100644 +--- a/os.c ++++ b/os.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -31,7 +32,7 @@ + #include "util.h" + + void +-perf_os_blocksignal(int sig, isc_boolean_t block) ++perf_os_blocksignal(int sig, bool block) + { + sigset_t sset; + int op; +diff --git a/os.h b/os.h +index 1ca0b21..56d756c 100644 +--- a/os.h ++++ b/os.h +@@ -19,9 +19,10 @@ + #define PERF_OS_H 1 + + #include ++#include + + void +-perf_os_blocksignal(int sig, isc_boolean_t block); ++perf_os_blocksignal(int sig, bool block); + + void + perf_os_handlesignal(int sig, void (*handler)(int)); +diff --git a/resperf.c b/resperf.c +index 00106f4..a4f6555 100644 +--- a/resperf.c ++++ b/resperf.c +@@ -37,6 +37,7 @@ + ***/ + + #include ++#include + #include + #include + #include +@@ -107,8 +108,8 @@ static unsigned int nsocks; + static int *socks; + + static uint64_t query_timeout; +-static isc_boolean_t edns; +-static isc_boolean_t dnssec; ++static bool edns; ++static bool dnssec; + + static perf_datafile_t *input; + +@@ -329,7 +330,7 @@ setup(int argc, char **argv) + input = perf_datafile_open(mctx, filename); + + if (dnssec) +- edns = ISC_TRUE; ++ edns = true; + + if (tsigkey_str != NULL) + tsigkey = perf_dns_parsetsigkey(tsigkey_str, mctx); +@@ -382,7 +383,7 @@ print_statistics(void) { + int i; + double max_throughput; + double loss_at_max_throughput; +- isc_boolean_t first_rcode; ++ bool first_rcode; + uint64_t run_time = time_of_end_of_run - time_of_program_start; + + printf("\nStatistics:\n\n"); +@@ -394,12 +395,12 @@ print_statistics(void) { + printf(" Queries lost: %" PRIu64 "\n", + num_queries_sent - num_responses_received); + printf(" Response codes: "); +- first_rcode = ISC_TRUE; ++ first_rcode = true; + for (i = 0; i < 16; i++) { + if (rcodecounts[i] == 0) + continue; + if (first_rcode) +- first_rcode = ISC_FALSE; ++ first_rcode = false; + else + printf(", "); + printf("%s %" PRIu64 " (%.2lf%%)", +@@ -462,7 +463,7 @@ do_one_line(isc_buffer_t *lines, isc_buffer_t *msg) { + isc_result_t result; + + isc_buffer_clear(lines); +- result = perf_datafile_next(input, lines, ISC_FALSE); ++ result = perf_datafile_next(input, lines, false); + if (result != ISC_R_SUCCESS) + perf_log_fatal("ran out of query data"); + isc_buffer_usedregion(lines, &used); +@@ -580,7 +581,7 @@ retire_old_queries(void) + { + query_info *q; + +- while (ISC_TRUE) { ++ while (true) { + q = ISC_LIST_TAIL(outstanding_list); + if (q == NULL || + (time_now - q->sent_timestamp) < query_timeout) +diff --git a/util.h b/util.h +index 4cf0794..548a9af 100644 +--- a/util.h ++++ b/util.h +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + + #include +@@ -102,12 +103,12 @@ + + #define TIMEDWAIT(cond, mutex, when, timedout) do { \ + int __n = pthread_cond_timedwait((cond), (mutex), (when)); \ +- isc_boolean_t *res = (timedout); \ ++ bool *res = (timedout); \ + if (__n != 0 && __n != ETIMEDOUT) \ + perf_log_fatal("pthread_cond_timedwait failed: %s", \ + strerror(__n)); \ + if (res != NULL) \ +- *res = ISC_TF(__n != 0); \ ++ *res = (__n != 0); \ + } while (0) + + static __inline__ uint64_t +-- +2.14.5 + diff --git a/dnsperf-stdint.patch b/dnsperf-stdint.patch new file mode 100644 index 0000000..198c3ca --- /dev/null +++ b/dnsperf-stdint.patch @@ -0,0 +1,640 @@ +From ce304a44fb2c982c34f6c3109844e1bbcd87957e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= +Date: Wed, 28 Mar 2018 14:19:37 +0200 +Subject: [PATCH] Replace custom isc_u?intNN_t types with C99 u?intNN_t types + +--- + dns.c | 11 ++++--- + dns.h | 4 ++- + dnsperf.c | 109 +++++++++++++++++++++++++++++++------------------------------- + opt.c | 9 +++--- + os.c | 5 +-- + os.h | 6 ++-- + resperf.c | 51 ++++++++++++++--------------- + util.h | 5 +-- + 8 files changed, 103 insertions(+), 97 deletions(-) + +diff --git a/dns.c b/dns.c +index fb50710..25ae1df 100644 +--- a/dns.c ++++ b/dns.c +@@ -34,6 +34,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -422,7 +423,7 @@ add_tsig(isc_buffer_t *packet, perf_dnstsigkey_t *tsigkey) + unsigned int rdlen, totallen; + unsigned char tmpdata[512]; + isc_buffer_t tmp; +- isc_uint32_t now; ++ uint32_t now; + unsigned char digest[ISC_SHA256_DIGESTLENGTH]; + + hmac_init(tsigkey, &hmac); +@@ -537,7 +538,7 @@ static isc_result_t + read_update_line(perf_dnsctx_t *ctx, const isc_textregion_t *line, char *str, + dns_name_t *zname, int want_ttl, int need_type, + int want_rdata, int need_rdata, dns_name_t *name, +- isc_uint32_t *ttlp, dns_rdatatype_t *typep, ++ uint32_t *ttlp, dns_rdatatype_t *typep, + dns_rdata_t *rdata, isc_buffer_t *rdatabuf) + { + char *curr_str; +@@ -648,11 +649,11 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + int prereqs = 0; + dns_fixedname_t fzname, foname; + dns_name_t *zname, *oname; +- isc_uint32_t ttl; ++ uint32_t ttl; + dns_rdatatype_t rdtype; + dns_rdataclass_t rdclass; + dns_rdata_t rdata; +- isc_uint16_t rdlen; ++ uint16_t rdlen; + isc_result_t result; + + /* Reset compression context */ +@@ -804,7 +805,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, + + isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, +- isc_uint16_t qid, ++ uint16_t qid, + isc_boolean_t edns, isc_boolean_t dnssec, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg) + { +diff --git a/dns.h b/dns.h +index 3ac98a4..5dab512 100644 +--- a/dns.h ++++ b/dns.h +@@ -32,6 +32,8 @@ + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#include ++ + #include + + #ifndef PERF_DNS_H +@@ -59,7 +61,7 @@ perf_dns_destroyctx(perf_dnsctx_t **ctxp); + + isc_result_t + perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, +- isc_uint16_t qid, ++ uint16_t qid, + isc_boolean_t edns, isc_boolean_t dnssec, + perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg); + +diff --git a/dnsperf.c b/dnsperf.c +index 6679a5f..ba0c5f8 100644 +--- a/dnsperf.c ++++ b/dnsperf.c +@@ -37,7 +37,6 @@ + ***/ + + #include +- + #include + #include + #include +@@ -93,52 +92,52 @@ typedef struct { + int argc; + char **argv; + int family; +- isc_uint32_t clients; +- isc_uint32_t threads; +- isc_uint32_t maxruns; +- isc_uint64_t timelimit; ++ uint32_t clients; ++ uint32_t threads; ++ uint32_t maxruns; ++ uint64_t timelimit; + isc_sockaddr_t server_addr; + isc_sockaddr_t local_addr; +- isc_uint64_t timeout; +- isc_uint32_t bufsize; ++ uint64_t timeout; ++ uint32_t bufsize; + isc_boolean_t edns; + isc_boolean_t dnssec; + perf_dnstsigkey_t *tsigkey; +- isc_uint32_t max_outstanding; +- isc_uint32_t max_qps; +- isc_uint64_t stats_interval; ++ uint32_t max_outstanding; ++ uint32_t max_qps; ++ uint64_t stats_interval; + isc_boolean_t updates; + isc_boolean_t verbose; + } config_t; + + typedef struct { +- isc_uint64_t start_time; +- isc_uint64_t end_time; +- isc_uint64_t stop_time; ++ uint64_t start_time; ++ uint64_t end_time; ++ uint64_t stop_time; + struct timespec stop_time_ns; + } times_t; + + typedef struct { +- isc_uint64_t rcodecounts[16]; ++ uint64_t rcodecounts[16]; + +- isc_uint64_t num_sent; +- isc_uint64_t num_interrupted; +- isc_uint64_t num_timedout; +- isc_uint64_t num_completed; ++ uint64_t num_sent; ++ uint64_t num_interrupted; ++ uint64_t num_timedout; ++ uint64_t num_completed; + +- isc_uint64_t total_request_size; +- isc_uint64_t total_response_size; ++ uint64_t total_request_size; ++ uint64_t total_response_size; + +- isc_uint64_t latency_sum; +- isc_uint64_t latency_sum_squares; +- isc_uint64_t latency_min; +- isc_uint64_t latency_max; ++ uint64_t latency_sum; ++ uint64_t latency_sum_squares; ++ uint64_t latency_min; ++ uint64_t latency_max; + } stats_t; + + typedef ISC_LIST(struct query_info) query_list; + + typedef struct query_info { +- isc_uint64_t timestamp; ++ uint64_t timestamp; + query_list *list; + char *desc; + int sock; +@@ -169,16 +168,16 @@ typedef struct { + perf_dnsctx_t *dnsctx; + + isc_boolean_t done_sending; +- isc_uint64_t done_send_time; ++ uint64_t done_send_time; + + const config_t *config; + const times_t *times; + stats_t stats; + +- isc_uint32_t max_outstanding; +- isc_uint32_t max_qps; ++ uint32_t max_outstanding; ++ uint32_t max_qps; + +- isc_uint64_t last_recv; ++ uint64_t last_recv; + } threadinfo_t; + + static threadinfo_t *threads; +@@ -257,7 +256,7 @@ print_final_status(const config_t *config) + } + + static double +-stddev(isc_uint64_t sum_of_squares, isc_uint64_t sum, isc_uint64_t total) ++stddev(uint64_t sum_of_squares, uint64_t sum, uint64_t total) + { + double squared; + +@@ -269,9 +268,9 @@ static void + print_statistics(const config_t *config, const times_t *times, stats_t *stats) + { + const char *units; +- isc_uint64_t run_time; ++ uint64_t run_time; + isc_boolean_t first_rcode; +- isc_uint64_t latency_avg; ++ uint64_t latency_avg; + unsigned int i; + + units = config->updates ? "Updates" : "Queries"; +@@ -543,7 +542,7 @@ query_move(threadinfo_t *tinfo, query_info *q, query_move_op op) + } + } + +-static inline isc_uint64_t ++static inline uint64_t + num_outstanding(const stats_t *stats) + { + return stats->num_sent - stats->num_completed - stats->num_timedout; +@@ -567,7 +566,7 @@ do_send(void *arg) + stats_t *stats; + unsigned int max_packet_size; + isc_buffer_t msg; +- isc_uint64_t now, run_time, req_time; ++ uint64_t now, run_time, req_time; + char input_data[MAX_INPUT_DATA]; + isc_buffer_t lines; + isc_region_t used; +@@ -626,7 +625,7 @@ do_send(void *arg) + + q = ISC_LIST_HEAD(tinfo->unused_queries); + query_move(tinfo, q, prepend_outstanding); +- q->timestamp = ISC_UINT64_MAX; ++ q->timestamp = UINT64_MAX; + q->sock = tinfo->socks[tinfo->current_sock++ % tinfo->nsocks]; + + UNLOCK(&tinfo->lock); +@@ -690,7 +689,7 @@ do_send(void *arg) + } + + static void +-process_timeouts(threadinfo_t *tinfo, isc_uint64_t now) ++process_timeouts(threadinfo_t *tinfo, uint64_t now) + { + struct query_info *q; + const config_t *config; +@@ -726,11 +725,11 @@ process_timeouts(threadinfo_t *tinfo, isc_uint64_t now) + + typedef struct { + int sock; +- isc_uint16_t qid; +- isc_uint16_t rcode; ++ uint16_t qid; ++ uint16_t rcode; + unsigned int size; +- isc_uint64_t when; +- isc_uint64_t sent; ++ uint64_t when; ++ uint64_t sent; + isc_boolean_t unexpected; + isc_boolean_t short_response; + char *desc; +@@ -741,12 +740,12 @@ recv_one(threadinfo_t *tinfo, int which_sock, + unsigned char *packet_buffer, unsigned int packet_size, + received_query_t *recvd, int *saved_errnop) + { +- isc_uint16_t *packet_header; ++ uint16_t *packet_header; + int s; +- isc_uint64_t now; ++ uint64_t now; + int n; + +- packet_header = (isc_uint16_t *) packet_buffer; ++ packet_header = (uint16_t *) packet_buffer; + + s = tinfo->socks[which_sock]; + n = recv(s, packet_buffer, packet_size, 0); +@@ -800,7 +799,7 @@ do_recv(void *arg) + unsigned int nrecvd; + int saved_errno; + unsigned char socketbits[MAX_SOCKETS / 8]; +- isc_uint64_t now, latency; ++ uint64_t now, latency; + query_info *q; + unsigned int current_socket, last_socket; + unsigned int i, j; +@@ -858,7 +857,7 @@ do_recv(void *arg) + + q = &tinfo->queries[recvd[i].qid]; + if (q->list != &tinfo->outstanding_queries || +- q->timestamp == ISC_UINT64_MAX || ++ q->timestamp == UINT64_MAX || + q->sock != recvd[i].sock) + { + recvd[i].unexpected = ISC_TRUE; +@@ -940,11 +939,11 @@ do_interval_stats(void *arg) + { + threadinfo_t *tinfo; + stats_t total; +- isc_uint64_t now; +- isc_uint64_t last_interval_time; +- isc_uint64_t last_completed; +- isc_uint64_t interval_time; +- isc_uint64_t num_completed; ++ uint64_t now; ++ uint64_t last_interval_time; ++ uint64_t last_completed; ++ uint64_t interval_time; ++ uint64_t num_completed; + double qps; + + tinfo = arg; +@@ -982,7 +981,7 @@ cancel_queries(threadinfo_t *tinfo) + break; + query_move(tinfo, q, append_unused); + +- if (q->timestamp == ISC_UINT64_MAX) ++ if (q->timestamp == UINT64_MAX) + continue; + + tinfo->stats.num_interrupted++; +@@ -994,10 +993,10 @@ cancel_queries(threadinfo_t *tinfo) + } + } + +-static isc_uint32_t +-per_thread(isc_uint32_t total, isc_uint32_t nthreads, unsigned int offset) ++static uint32_t ++per_thread(uint32_t total, uint32_t nthreads, unsigned int offset) + { +- isc_uint32_t value; ++ uint32_t value; + + value = total / nthreads; + if (value % nthreads > offset) +@@ -1128,7 +1127,7 @@ main(int argc, char **argv) + if (config.timelimit > 0) + times.stop_time = times.start_time + config.timelimit; + else +- times.stop_time = ISC_UINT64_MAX; ++ times.stop_time = UINT64_MAX; + times.stop_time_ns.tv_sec = times.stop_time / MILLION; + times.stop_time_ns.tv_nsec = (times.stop_time % MILLION) * 1000; + +diff --git a/opt.c b/opt.c +index 7fe46ba..cd3bd59 100644 +--- a/opt.c ++++ b/opt.c +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + #include + +@@ -45,7 +46,7 @@ typedef struct { + char **stringp; + isc_boolean_t *boolp; + unsigned int *uintp; +- isc_uint64_t *uint64p; ++ uint64_t *uint64p; + double *doublep; + in_port_t *portp; + } u; +@@ -115,11 +116,11 @@ perf_opt_usage(void) + } + } + +-static isc_uint32_t ++static uint32_t + parse_uint(const char *desc, const char *str, + unsigned int min, unsigned int max) + { +- isc_uint32_t val; ++ uint32_t val; + isc_result_t result; + + val = 0; +@@ -132,7 +133,7 @@ parse_uint(const char *desc, const char *str, + return val; + } + +-static isc_uint64_t ++static uint64_t + parse_timeval(const char *desc, const char *str) + { + const char *s; +diff --git a/os.c b/os.c +index 99234b4..2c3eae7 100644 +--- a/os.c ++++ b/os.c +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + #include + +@@ -57,7 +58,7 @@ perf_os_handlesignal(int sig, void (*handler)(int)) + } + + isc_result_t +-perf_os_waituntilreadable(int fd, int pipe_fd, isc_int64_t timeout) ++perf_os_waituntilreadable(int fd, int pipe_fd, int64_t timeout) + { + fd_set read_fds; + int maxfd; +@@ -91,7 +92,7 @@ perf_os_waituntilreadable(int fd, int pipe_fd, isc_int64_t timeout) + + isc_result_t + perf_os_waituntilanyreadable(int *fds, unsigned int nfds, int pipe_fd, +- isc_int64_t timeout) ++ int64_t timeout) + { + fd_set read_fds; + unsigned int i; +diff --git a/os.h b/os.h +index 6a75f4d..1ca0b21 100644 +--- a/os.h ++++ b/os.h +@@ -18,6 +18,8 @@ + #ifndef PERF_OS_H + #define PERF_OS_H 1 + ++#include ++ + void + perf_os_blocksignal(int sig, isc_boolean_t block); + +@@ -25,10 +27,10 @@ void + perf_os_handlesignal(int sig, void (*handler)(int)); + + isc_result_t +-perf_os_waituntilreadable(int fd, int pipe_fd, isc_int64_t timeout); ++perf_os_waituntilreadable(int fd, int pipe_fd, int64_t timeout); + + isc_result_t + perf_os_waituntilanyreadable(int *fds, unsigned int nfds, int pipe_fd, +- isc_int64_t timeout); ++ int64_t timeout); + + #endif +diff --git a/resperf.c b/resperf.c +index 7744d32..00106f4 100644 +--- a/resperf.c ++++ b/resperf.c +@@ -41,7 +41,6 @@ + #include + #include + #include +-#include + + #include + +@@ -83,7 +82,7 @@ struct query_info; + typedef ISC_LIST(struct query_info) query_list; + + typedef struct query_info { +- isc_uint64_t sent_timestamp; ++ uint64_t sent_timestamp; + /* + * This link links the query into the list of outstanding + * queries or the list of available query IDs. +@@ -107,7 +106,7 @@ static isc_sockaddr_t local_addr; + static unsigned int nsocks; + static int *socks; + +-static isc_uint64_t query_timeout; ++static uint64_t query_timeout; + static isc_boolean_t edns; + static isc_boolean_t dnssec; + +@@ -118,24 +117,24 @@ double max_qps = 100000.0; + + /* The time period over which we ramp up traffic */ + #define DEFAULT_RAMP_TIME 60 +-static isc_uint64_t ramp_time; ++static uint64_t ramp_time; + + /* How long to send constant traffic after the initial ramp-up */ + #define DEFAULT_SUSTAIN_TIME 0 +-static isc_uint64_t sustain_time; ++static uint64_t sustain_time; + + /* How long to wait for responses after sending traffic */ +-static isc_uint64_t wait_time = 40 * MILLION; ++static uint64_t wait_time = 40 * MILLION; + + /* Total duration of the traffic-sending part of the test */ +-static isc_uint64_t traffic_time; ++static uint64_t traffic_time; + + /* Total duration of the test */ +-static isc_uint64_t end_time; ++static uint64_t end_time; + + /* Interval between plot data points, in microseconds */ + #define DEFAULT_BUCKET_INTERVAL 0.5 +-static isc_uint64_t bucket_interval; ++static uint64_t bucket_interval; + + /* The number of plot data points */ + static int n_buckets; +@@ -149,15 +148,15 @@ static double max_loss_percent = 100.0; + /* The maximum number of outstanding queries */ + static unsigned int max_outstanding; + +-static isc_uint64_t num_queries_sent; +-static isc_uint64_t num_queries_outstanding; +-static isc_uint64_t num_responses_received; +-static isc_uint64_t num_queries_timed_out; +-static isc_uint64_t rcodecounts[16]; ++static uint64_t num_queries_sent; ++static uint64_t num_queries_outstanding; ++static uint64_t num_responses_received; ++static uint64_t num_queries_timed_out; ++static uint64_t rcodecounts[16]; + +-static isc_uint64_t time_now; +-static isc_uint64_t time_of_program_start; +-static isc_uint64_t time_of_end_of_run; ++static uint64_t time_now; ++static uint64_t time_of_program_start; ++static uint64_t time_of_end_of_run; + + /* + * The last plot data point containing actual data; this can +@@ -199,7 +198,7 @@ enum phase { + static enum phase phase = PHASE_RAMP; + + /* The time when the sustain/wait phase began */ +-static isc_uint64_t sustain_phase_began, wait_phase_began; ++static uint64_t sustain_phase_began, wait_phase_began; + + static perf_dnstsigkey_t *tsigkey; + +@@ -360,8 +359,8 @@ cleanup(void) + /* Find the ramp_bucket for queries sent at time "when" */ + + static ramp_bucket * +-find_bucket(isc_uint64_t when) { +- isc_uint64_t sent_at = when - time_of_program_start; ++find_bucket(uint64_t when) { ++ uint64_t sent_at = when - time_of_program_start; + int i = (int) ((n_buckets * sent_at) / traffic_time); + /* + * Guard against array bounds violations due to roundoff +@@ -384,7 +383,7 @@ print_statistics(void) { + double max_throughput; + double loss_at_max_throughput; + isc_boolean_t first_rcode; +- isc_uint64_t run_time = time_of_end_of_run - time_of_program_start; ++ uint64_t run_time = time_of_end_of_run - time_of_program_start; + + printf("\nStatistics:\n\n"); + +@@ -528,14 +527,14 @@ enter_wait_phase(void) { + static void + try_process_response(unsigned int sockindex) { + unsigned char packet_buffer[MAX_EDNS_PACKET]; +- isc_uint16_t *packet_header; +- isc_uint16_t qid, rcode; ++ uint16_t *packet_header; ++ uint16_t qid, rcode; + query_info *q; + double latency; + ramp_bucket *b; + int n; + +- packet_header = (isc_uint16_t *) packet_buffer; ++ packet_header = (uint16_t *) packet_buffer; + n = recvfrom(socks[sockindex], packet_buffer, sizeof(packet_buffer), + 0, NULL, NULL); + if (n < 0) { +@@ -596,7 +595,7 @@ retire_old_queries(void) + } + + static inline int +-num_scheduled(isc_uint64_t time_since_start) ++num_scheduled(uint64_t time_since_start) + { + if (phase == PHASE_RAMP) { + return 0.5 * max_qps * +@@ -650,7 +649,7 @@ main(int argc, char **argv) { + current_sock = 0; + for (;;) { + int should_send; +- isc_uint64_t time_since_start = time_now - ++ uint64_t time_since_start = time_now - + time_of_program_start; + switch (phase) { + case PHASE_RAMP: +diff --git a/util.h b/util.h +index fdaa8eb..4cf0794 100644 +--- a/util.h ++++ b/util.h +@@ -16,6 +16,7 @@ + */ + + #include ++#include + #include + + #include +@@ -27,7 +28,7 @@ + #ifndef PERF_UTIL_H + #define PERF_UTIL_H 1 + +-#define MILLION ((isc_uint64_t) 1000000) ++#define MILLION ((uint64_t) 1000000) + + #define THREAD(thread, start, arg) do { \ + int __n = pthread_create((thread), NULL, (start), (arg)); \ +@@ -109,7 +110,7 @@ + *res = ISC_TF(__n != 0); \ + } while (0) + +-static __inline__ isc_uint64_t ++static __inline__ uint64_t + get_time(void) + { + struct timeval tv; +-- +2.14.5 + diff --git a/dnsperf.spec b/dnsperf.spec index ba40534..71985b7 100644 --- a/dnsperf.spec +++ b/dnsperf.spec @@ -1,14 +1,39 @@ Summary: Benchmarking authorative and recursing DNS servers Name: dnsperf Version: 2.1.0.0 -Release: 17%{?dist} +Release: 18%{?dist} +# New page was found, but on github is also project, that seems to be official. +# +# Github project has different license and so far is the only one with any +# license mentioned. Unfortunately, project seems to be dead. +# It changed license text to Apache License 2.0 +# Url: https://github.com/akamai/dnsperf +# License: ASL 2.0 + License: MIT -Url: http://www.nominum.com/support/measurement-tools/ +Url: https://www.akamai.com/us/en/products/network-operator/measurement-tools.jsp +# Github has no release to point to, keep original working path + Source: ftp://ftp.nominum.com/pub/nominum/dnsperf/%{version}/dnsperf-src-%{version}-1.tar.gz Source3: queryfile-example-current.gz Patch1: dnsperf-buffer-inline.patch -BuildRequires: bind-devel >= 9.3.0, libcap-devel, gzip, openssl-devel -BuildRequires: krb5-devel, libxml2-devel, GeoIP-devel, gcc +# https://gitlab.isc.org/isc-projects/dnsperf/commit/970fa6cbb6491e0d1c0a7337670874a699b7129d +Patch2: dnsperf-id-tags.patch +# https://gitlab.isc.org/isc-projects/dnsperf/commit/f664ec1f0c879c17a36d53fc379f135e510b359a +Patch3: dnsperf-inttypes.patch +# https://gitlab.isc.org/isc-projects/dnsperf/commit/1354fbf653a5042fb53d50ceb4d32c01072f944c +Patch4: dnsperf-stdint.patch +# https://gitlab.isc.org/isc-projects/dnsperf/commit/c8aa375815539234227529a38cfe30f24249a885 +Patch5: dnsperf-stdbool.patch +# https://gitlab.isc.org/isc-projects/dnsperf/commit/3b0a0dfcfbe03d7926375d92b086a83838a75287 +Patch6: dnsperf-ends-client-subnet.patch + +BuildRequires: bind-devel >= 9.10.0, gcc, make +# Following are (incomplete dependencies of bind-devel) +# since 9.11.5 should provides all in requires, leave these for compatibility +BuildRequires: libcap-devel, gzip, openssl-devel +BuildRequires: krb5-devel, libxml2-devel, GeoIP-devel + Requires: gnuplot pcapy python2-dns %description @@ -18,6 +43,11 @@ For more information, see the dnsperf(1) and resperf(1) man pages. %prep %setup -q -n dnsperf-src-%{version}-1 %patch1 -p1 -b .buffer +%patch2 -p1 -b .ids +%patch3 -p1 -b .inttypes +%patch4 -p1 -b .stdint +%patch5 -p1 -b .stdbool +%patch6 -p1 -b .ends-subnet %build %configure @@ -41,6 +71,10 @@ chmod 644 %{buildroot}%{_datadir}/%{name}/queryfile-example-current %{_datadir}/dnsperf/queryfile-example-current %changelog +* Tue Nov 06 2018 Petr Menšík - 2.1.0.0-18 +- Update to standard types, required by bind 9.11.5 update +- Changed project URL + * Fri Jul 13 2018 Petr Menšík - 2.1.0.0-17 - Update to bind 9.11.4