Adding upstream version 2.10.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
07b818f278
commit
6dd69c3878
56 changed files with 405 additions and 112 deletions
23
CHANGES
23
CHANGES
|
@ -1,3 +1,26 @@
|
||||||
|
2022-11-11 Jerry Lundström
|
||||||
|
|
||||||
|
Release 2.10.0
|
||||||
|
|
||||||
|
This release adds a binary datafile (DNS wire) format to `dnsperf`
|
||||||
|
thanks to a contribution from Petr Špaček @pspacek (ISC).
|
||||||
|
|
||||||
|
The new binary format greatly improves performance in some cases, for
|
||||||
|
Petr's case it was testing dynamic updates. Switching to this
|
||||||
|
pre-compiled DNS wire format increased QPS from 4k to 600k, an increase
|
||||||
|
of 150 times throughput from `dnsperf`!
|
||||||
|
|
||||||
|
See man-page for `-B` for more information and examples how to use.
|
||||||
|
|
||||||
|
5971cb9 Doc
|
||||||
|
a241068 CodeQL
|
||||||
|
2a7d10a Fix CodeQL workflow
|
||||||
|
0ce15f6 Fix COPR
|
||||||
|
0ae4a54 CodeQL
|
||||||
|
f52e4b1 wire format input
|
||||||
|
c423aa9 wire format input
|
||||||
|
2b0693d Input binary format
|
||||||
|
|
||||||
2021-12-08 Jerry Lundström
|
2021-12-08 Jerry Lundström
|
||||||
|
|
||||||
Release 2.9.0
|
Release 2.9.0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -100,7 +100,7 @@ The contrib directory contains additional software related to `dnsperf` and
|
||||||
## License
|
## License
|
||||||
|
|
||||||
```
|
```
|
||||||
Copyright 2019-2021 OARC, Inc.
|
Copyright 2019-2022 OARC, Inc.
|
||||||
Copyright 2017-2018 Akamai Technologies
|
Copyright 2017-2018 Akamai Technologies
|
||||||
Copyright 2006-2016 Nominum, Inc.
|
Copyright 2006-2016 Nominum, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
20
configure
vendored
20
configure
vendored
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for dnsperf 2.9.0.
|
# Generated by GNU Autoconf 2.69 for dnsperf 2.10.0.
|
||||||
#
|
#
|
||||||
# Report bugs to <admin@dns-oarc.net>.
|
# Report bugs to <admin@dns-oarc.net>.
|
||||||
#
|
#
|
||||||
|
@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='dnsperf'
|
PACKAGE_NAME='dnsperf'
|
||||||
PACKAGE_TARNAME='dnsperf'
|
PACKAGE_TARNAME='dnsperf'
|
||||||
PACKAGE_VERSION='2.9.0'
|
PACKAGE_VERSION='2.10.0'
|
||||||
PACKAGE_STRING='dnsperf 2.9.0'
|
PACKAGE_STRING='dnsperf 2.10.0'
|
||||||
PACKAGE_BUGREPORT='admin@dns-oarc.net'
|
PACKAGE_BUGREPORT='admin@dns-oarc.net'
|
||||||
PACKAGE_URL='https://github.com/DNS-OARC/dnsperf/issues'
|
PACKAGE_URL='https://github.com/DNS-OARC/dnsperf/issues'
|
||||||
|
|
||||||
|
@ -1360,7 +1360,7 @@ if test "$ac_init_help" = "long"; then
|
||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures dnsperf 2.9.0 to adapt to many kinds of systems.
|
\`configure' configures dnsperf 2.10.0 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ fi
|
||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of dnsperf 2.9.0:";;
|
short | recursive ) echo "Configuration of dnsperf 2.10.0:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
|
@ -1570,7 +1570,7 @@ fi
|
||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
dnsperf configure 2.9.0
|
dnsperf configure 2.10.0
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
|
@ -1939,7 +1939,7 @@ cat >config.log <<_ACEOF
|
||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by dnsperf $as_me 2.9.0, which was
|
It was created by dnsperf $as_me 2.10.0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
|
@ -2802,7 +2802,7 @@ fi
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='dnsperf'
|
PACKAGE='dnsperf'
|
||||||
VERSION='2.9.0'
|
VERSION='2.10.0'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
@ -14410,7 +14410,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by dnsperf $as_me 2.9.0, which was
|
This file was extended by dnsperf $as_me 2.10.0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
|
@ -14477,7 +14477,7 @@ _ACEOF
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
dnsperf config.status 2.9.0
|
dnsperf config.status 2.10.0
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
AC_PREREQ(2.64)
|
AC_PREREQ(2.64)
|
||||||
AC_INIT([dnsperf], [2.9.0], [admin@dns-oarc.net], [dnsperf], [https://github.com/DNS-OARC/dnsperf/issues])
|
AC_INIT([dnsperf], [2.10.0], [admin@dns-oarc.net], [dnsperf], [https://github.com/DNS-OARC/dnsperf/issues])
|
||||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
|
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
|
||||||
AC_CONFIG_SRCDIR([src/dnsperf.c])
|
AC_CONFIG_SRCDIR([src/dnsperf.c])
|
||||||
AC_CONFIG_HEADER([src/config.h])
|
AC_CONFIG_HEADER([src/config.h])
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" Copyright 2019-2021 OARC, Inc.
|
.\" Copyright 2019-2022 OARC, Inc.
|
||||||
.\" Copyright 2017-2018 Akamai Technologies
|
.\" Copyright 2017-2018 Akamai Technologies
|
||||||
.\" Copyright 2006-2016 Nominum, Inc.
|
.\" Copyright 2006-2016 Nominum, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -33,7 +33,10 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
perf_datafile_t* perf_datafile_open(const char* filename)
|
static perf_result_t read_one_blob(perf_datafile_t* dfile, perf_buffer_t* wire);
|
||||||
|
static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines);
|
||||||
|
|
||||||
|
perf_datafile_t* perf_datafile_open(const char* filename, perf_input_format_t format)
|
||||||
{
|
{
|
||||||
perf_datafile_t* dfile;
|
perf_datafile_t* dfile;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
@ -63,6 +66,18 @@ perf_datafile_t* perf_datafile_open(const char* filename)
|
||||||
dfile->size = buf.st_size;
|
dfile->size = buf.st_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dfile->format = format;
|
||||||
|
switch (format) {
|
||||||
|
case input_format_text_query:
|
||||||
|
case input_format_text_update:
|
||||||
|
dfile->readfunc = read_one_line;
|
||||||
|
break;
|
||||||
|
case input_format_tcp_wire_format:
|
||||||
|
dfile->readfunc = read_one_blob;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
perf_log_fatal("invalid datafile format");
|
||||||
|
};
|
||||||
|
|
||||||
return dfile;
|
return dfile;
|
||||||
}
|
}
|
||||||
|
@ -129,13 +144,15 @@ static perf_result_t read_more(perf_datafile_t* dfile)
|
||||||
dfile->at = 0;
|
dfile->at = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* leave space for \0 string termination at the end */
|
||||||
n = read(dfile->fd, &dfile->databuf[dfile->have], sizeof(dfile->databuf) - dfile->have - 1);
|
n = read(dfile->fd, &dfile->databuf[dfile->have], sizeof(dfile->databuf) - dfile->have - 1);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
return (PERF_R_FAILURE);
|
return (PERF_R_FAILURE);
|
||||||
|
} else if (n == 0) {
|
||||||
|
return (PERF_R_EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
dfile->have += n;
|
dfile->have += n;
|
||||||
dfile->databuf[dfile->have] = 0;
|
|
||||||
|
|
||||||
if (dfile->is_file && dfile->have == dfile->size) {
|
if (dfile->is_file && dfile->have == dfile->size) {
|
||||||
dfile->cached = true;
|
dfile->cached = true;
|
||||||
|
@ -144,6 +161,61 @@ static perf_result_t read_more(perf_datafile_t* dfile)
|
||||||
return (PERF_R_SUCCESS);
|
return (PERF_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Binary format: (<uint16_t> for blob length, <bytes>), repeat
|
||||||
|
* Outputs single packet _without_ the length preambule. */
|
||||||
|
static perf_result_t read_one_blob(perf_datafile_t* dfile, perf_buffer_t* wire)
|
||||||
|
{
|
||||||
|
perf_result_t result;
|
||||||
|
uint16_t packet_size; /* 2-byte preambule like in the TCP stream */
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if ((dfile->have - dfile->at) < sizeof(packet_size)) {
|
||||||
|
/* we don't have complete preambule yet */
|
||||||
|
if (dfile->cached) {
|
||||||
|
if ((dfile->have - dfile->at) == 0) {
|
||||||
|
return PERF_R_EOF;
|
||||||
|
} else {
|
||||||
|
return PERF_R_INVALIDFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = read_more(dfile);
|
||||||
|
if (result != PERF_R_SUCCESS) {
|
||||||
|
if (result == PERF_R_EOF && (dfile->have - dfile->at) != 0) {
|
||||||
|
/* incomplete preambule at the end of file */
|
||||||
|
result = PERF_R_INVALIDFILE;
|
||||||
|
}
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
memcpy(&packet_size, &dfile->databuf[dfile->at], sizeof(uint16_t));
|
||||||
|
packet_size = ntohs(packet_size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (true) {
|
||||||
|
if (sizeof(packet_size) + packet_size > (dfile->have - dfile->at)) {
|
||||||
|
if (dfile->cached) {
|
||||||
|
return PERF_R_INVALIDFILE;
|
||||||
|
}
|
||||||
|
result = read_more(dfile);
|
||||||
|
if (result != PERF_R_SUCCESS) {
|
||||||
|
if (result == PERF_R_EOF) {
|
||||||
|
/* incomplete blob at the end of file */
|
||||||
|
result = PERF_R_INVALIDFILE;
|
||||||
|
}
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
perf_buffer_putmem(wire, ((unsigned char*)&dfile->databuf[dfile->at]) + sizeof(packet_size), packet_size);
|
||||||
|
dfile->at += sizeof(packet_size) + packet_size;
|
||||||
|
return (PERF_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* String in output buffer is not \0 terminated, check length in dfile->have */
|
||||||
static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines)
|
static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines)
|
||||||
{
|
{
|
||||||
const char* cur;
|
const char* cur;
|
||||||
|
@ -163,11 +235,12 @@ static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines)
|
||||||
if (curlen == nrem) {
|
if (curlen == nrem) {
|
||||||
if (!dfile->cached) {
|
if (!dfile->cached) {
|
||||||
result = read_more(dfile);
|
result = read_more(dfile);
|
||||||
|
/* line terminator for text input */
|
||||||
|
dfile->databuf[dfile->have] = 0;
|
||||||
if (result != PERF_R_SUCCESS)
|
if (result != PERF_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
if (dfile->have - dfile->at == 0) {
|
if (dfile->have - dfile->at == 0) {
|
||||||
dfile->nruns++;
|
|
||||||
return (PERF_R_EOF);
|
return (PERF_R_EOF);
|
||||||
}
|
}
|
||||||
if (dfile->have - dfile->at > nrem)
|
if (dfile->have - dfile->at > nrem)
|
||||||
|
@ -176,7 +249,7 @@ static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines)
|
||||||
|
|
||||||
/* We now have a line. Advance the buffer past it. */
|
/* We now have a line. Advance the buffer past it. */
|
||||||
dfile->at += curlen;
|
dfile->at += curlen;
|
||||||
if (dfile->have - dfile->at > 0) {
|
if (dfile->at < dfile->have) {
|
||||||
dfile->at += 1;
|
dfile->at += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +267,7 @@ static perf_result_t read_one_line(perf_datafile_t* dfile, perf_buffer_t* lines)
|
||||||
return (PERF_R_SUCCESS);
|
return (PERF_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines, bool is_update)
|
perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines)
|
||||||
{
|
{
|
||||||
const char* current;
|
const char* current;
|
||||||
perf_result_t result;
|
perf_result_t result;
|
||||||
|
@ -206,15 +279,16 @@ perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines, b
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = read_one_line(dfile, lines);
|
result = dfile->readfunc(dfile, lines);
|
||||||
if (result == PERF_R_EOF) {
|
if (result == PERF_R_EOF) {
|
||||||
if (!dfile->read_any) {
|
if (!dfile->read_any) {
|
||||||
result = PERF_R_INVALIDFILE;
|
result = PERF_R_INVALIDFILE;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
dfile->nruns++;
|
||||||
if (dfile->maxruns != dfile->nruns) {
|
if (dfile->maxruns != dfile->nruns) {
|
||||||
reopen_file(dfile);
|
reopen_file(dfile);
|
||||||
result = read_one_line(dfile, lines);
|
result = dfile->readfunc(dfile, lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != PERF_R_SUCCESS) {
|
if (result != PERF_R_SUCCESS) {
|
||||||
|
@ -222,13 +296,16 @@ perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines, b
|
||||||
}
|
}
|
||||||
dfile->read_any = true;
|
dfile->read_any = true;
|
||||||
|
|
||||||
if (is_update) {
|
if (dfile->format == input_format_text_update) {
|
||||||
while (true) {
|
while (true) {
|
||||||
current = perf_buffer_used(lines);
|
current = perf_buffer_used(lines);
|
||||||
result = read_one_line(dfile, lines);
|
result = dfile->readfunc(dfile, lines);
|
||||||
if (result == PERF_R_EOF && dfile->maxruns != dfile->nruns) {
|
if (result == PERF_R_EOF) {
|
||||||
|
dfile->nruns++;
|
||||||
|
if (dfile->maxruns != dfile->nruns) {
|
||||||
reopen_file(dfile);
|
reopen_file(dfile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (result != PERF_R_SUCCESS || strcasecmp(current, "send") == 0)
|
if (result != PERF_R_SUCCESS || strcasecmp(current, "send") == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -25,27 +25,38 @@
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct perf_datafile {
|
typedef enum {
|
||||||
|
input_format_text_query,
|
||||||
|
input_format_text_update,
|
||||||
|
input_format_tcp_wire_format
|
||||||
|
} perf_input_format_t;
|
||||||
|
|
||||||
|
typedef struct perf_datafile perf_datafile_t;
|
||||||
|
struct perf_datafile {
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
int pipe_fd;
|
int pipe_fd;
|
||||||
int fd;
|
int fd;
|
||||||
bool is_file;
|
bool is_file;
|
||||||
size_t size, at, have;
|
size_t size, at, have;
|
||||||
bool cached;
|
bool cached;
|
||||||
char databuf[(64 * 1024) + 1];
|
char databuf[(64 * 1024) + sizeof(uint16_t)]; /* pad for null-terminated string or TCP wire length */
|
||||||
unsigned int maxruns;
|
unsigned int maxruns;
|
||||||
unsigned int nruns;
|
unsigned int nruns;
|
||||||
bool read_any;
|
bool read_any;
|
||||||
} perf_datafile_t;
|
|
||||||
|
|
||||||
perf_datafile_t* perf_datafile_open(const char* filename);
|
perf_input_format_t format;
|
||||||
|
perf_result_t (*readfunc)(perf_datafile_t* dfile, perf_buffer_t* lines);
|
||||||
|
};
|
||||||
|
|
||||||
|
perf_datafile_t* perf_datafile_open(const char* filename, perf_input_format_t format);
|
||||||
|
|
||||||
void perf_datafile_close(perf_datafile_t** dfilep);
|
void perf_datafile_close(perf_datafile_t** dfilep);
|
||||||
void perf_datafile_setmaxruns(perf_datafile_t* dfile, unsigned int maxruns);
|
void perf_datafile_setmaxruns(perf_datafile_t* dfile, unsigned int maxruns);
|
||||||
void perf_datafile_setpipefd(perf_datafile_t* dfile, int pipe_fd);
|
void perf_datafile_setpipefd(perf_datafile_t* dfile, int pipe_fd);
|
||||||
|
|
||||||
perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines, bool is_update);
|
perf_result_t perf_datafile_next(perf_datafile_t* dfile, perf_buffer_t* lines);
|
||||||
|
|
||||||
unsigned int perf_datafile_nruns(const perf_datafile_t* dfile);
|
unsigned int perf_datafile_nruns(const perf_datafile_t* dfile);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" Copyright 2019-2021 OARC, Inc.
|
.\" Copyright 2019-2022 OARC, Inc.
|
||||||
.\" Copyright 2017-2018 Akamai Technologies
|
.\" Copyright 2017-2018 Akamai Technologies
|
||||||
.\" Copyright 2006-2016 Nominum, Inc.
|
.\" Copyright 2006-2016 Nominum, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
@ -22,6 +22,7 @@ dnsperf \- test the performance of a DNS server
|
||||||
.ad l
|
.ad l
|
||||||
\fBdnsperf\fR\ [\fB\-a\ \fIlocal_addr\fR]
|
\fBdnsperf\fR\ [\fB\-a\ \fIlocal_addr\fR]
|
||||||
[\fB\-b\ \fIbufsize\fR]
|
[\fB\-b\ \fIbufsize\fR]
|
||||||
|
[\fB\-B\fR]
|
||||||
[\fB\-c\ \fIclients\fR]
|
[\fB\-c\ \fIclients\fR]
|
||||||
[\fB\-d\ \fIdatafile\fR]
|
[\fB\-d\ \fIdatafile\fR]
|
||||||
[\fB\-D\fR]
|
[\fB\-D\fR]
|
||||||
|
@ -192,6 +193,42 @@ Sets the size of the socket's send and receive buffers, in kilobytes.
|
||||||
If not specified, the operating system's default is used.
|
If not specified, the operating system's default is used.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
\fB-B\fR
|
||||||
|
.br
|
||||||
|
.RS
|
||||||
|
Instructs \fBdnsperf\fR to read datafile in TCP-stream binary format
|
||||||
|
as specified by RFC 1035 section "4.2.2. TCP usage".
|
||||||
|
Each packet is preceded by 2-byte preambule which specifies length of
|
||||||
|
the following DNS packet in network byte order, immediatelly followed
|
||||||
|
by raw bytes of the packet.
|
||||||
|
First two bytes of any packet should contain message ID and are
|
||||||
|
overwritten by \fBdnsperf\fR on the fly. All other bytes are left
|
||||||
|
intact.
|
||||||
|
Packets shorter than two bytes are sent intact.
|
||||||
|
Packets in datafile can contain arbitrary bytes and are not checked for
|
||||||
|
validity.
|
||||||
|
Malformed packets probably will not be responded to by servers and will
|
||||||
|
cause timeouts.
|
||||||
|
This option is mutually exclusive with \fB-D\fR, \fB-e\fR, \fB-E\fR,
|
||||||
|
\fB-u\fR and \fB-y\fR.
|
||||||
|
|
||||||
|
These binary datafiles can be generated using arbitrary TCP listeners such
|
||||||
|
as \fBnetcat\fR (nc) and \fBsockat\fR.
|
||||||
|
TCP must be used so that the length is prepended.
|
||||||
|
Following example shows how to generate a datafile with two query and
|
||||||
|
then using it, you need two terminals.
|
||||||
|
|
||||||
|
.EX
|
||||||
|
(terminal 1) $ nc -l 127.0.0.1 5300 > dns.blob
|
||||||
|
(terminal 2) $ echo "example.com A" | dnsperf -s 127.0.0.1 -p 5300 -m tcp
|
||||||
|
...wait for dnsperf to finish...
|
||||||
|
(terminal 1) $ nc -l 127.0.0.1 5300 >> dns.blob
|
||||||
|
(terminal 2) $ echo "example.com AAAA" | dnsperf -s 127.0.0.1 -p 5300 -m tcp
|
||||||
|
...wait for dnsperf to finish...
|
||||||
|
(terminal 1) $ dnsperf -B -d dns.blob -s $IP
|
||||||
|
.EE
|
||||||
|
.RE
|
||||||
|
|
||||||
\fB-c \fIclients\fR
|
\fB-c \fIclients\fR
|
||||||
.br
|
.br
|
||||||
.RS
|
.RS
|
||||||
|
@ -212,12 +249,14 @@ If not specified, \fBdnsperf\fR will read from standard input.
|
||||||
.RS
|
.RS
|
||||||
Sets the DO (DNSSEC OK) bit [RFC3225] in all packets sent.
|
Sets the DO (DNSSEC OK) bit [RFC3225] in all packets sent.
|
||||||
This also enables EDNS0, which is required for DNSSEC.
|
This also enables EDNS0, which is required for DNSSEC.
|
||||||
|
This option is mutually exclusive with \fB-B\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB-e\fR
|
\fB-e\fR
|
||||||
.br
|
.br
|
||||||
.RS
|
.RS
|
||||||
Enables EDNS0 [RFC2671], by adding an OPT record to all packets sent.
|
Enables EDNS0 [RFC2671], by adding an OPT record to all packets sent.
|
||||||
|
This option is mutually exclusive with \fB-B\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB-E \fIcode:value\fR
|
\fB-E \fIcode:value\fR
|
||||||
|
@ -226,6 +265,7 @@ Enables EDNS0 [RFC2671], by adding an OPT record to all packets sent.
|
||||||
Add an EDNS [RFC2671] option to all packets sent, using the specified
|
Add an EDNS [RFC2671] option to all packets sent, using the specified
|
||||||
numeric option code and value expressed as a a hex-encoded string.
|
numeric option code and value expressed as a a hex-encoded string.
|
||||||
This also enables EDNS0.
|
This also enables EDNS0.
|
||||||
|
This option is mutually exclusive with \fB-B\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB-f \fIfamily\fR
|
\fB-f \fIfamily\fR
|
||||||
|
@ -331,6 +371,7 @@ Instructs \fBdnsperf\fR to send DNS dynamic update messages, rather than
|
||||||
queries.
|
queries.
|
||||||
The format of the input file is different in this case; see the
|
The format of the input file is different in this case; see the
|
||||||
"Constructing a dynamic update input file" section for more details.
|
"Constructing a dynamic update input file" section for more details.
|
||||||
|
This option is mutually exclusive with \fB-B\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB-v\fR
|
\fB-v\fR
|
||||||
|
@ -373,6 +414,7 @@ key algorithm, name and secret, where the algorithm defaults to hmac-md5 and
|
||||||
the secret is expressed as a base-64 encoded string.
|
the secret is expressed as a base-64 encoded string.
|
||||||
Available algorithms are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
|
Available algorithms are: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,
|
||||||
hmac-sha384 and hmac-sha512.
|
hmac-sha384 and hmac-sha512.
|
||||||
|
This option is mutually exclusive with \fB-B\fR.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB-O \fIoption=value\fR
|
\fB-O \fIoption=value\fR
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -86,6 +86,8 @@ typedef struct {
|
||||||
uint32_t max_qps;
|
uint32_t max_qps;
|
||||||
uint64_t stats_interval;
|
uint64_t stats_interval;
|
||||||
bool updates;
|
bool updates;
|
||||||
|
bool binary_input;
|
||||||
|
perf_input_format_t input_format;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
enum perf_net_mode mode;
|
enum perf_net_mode mode;
|
||||||
perf_suppress_t suppress;
|
perf_suppress_t suppress;
|
||||||
|
@ -483,6 +485,9 @@ setup(int argc, char** argv, config_t* config)
|
||||||
perf_opt_add('u', perf_opt_boolean, NULL,
|
perf_opt_add('u', perf_opt_boolean, NULL,
|
||||||
"send dynamic updates instead of queries",
|
"send dynamic updates instead of queries",
|
||||||
NULL, &config->updates);
|
NULL, &config->updates);
|
||||||
|
perf_opt_add('B', perf_opt_boolean, NULL,
|
||||||
|
"read input file as TCP-stream binary format",
|
||||||
|
NULL, &config->binary_input);
|
||||||
perf_opt_add('v', perf_opt_boolean, NULL,
|
perf_opt_add('v', perf_opt_boolean, NULL,
|
||||||
"verbose: report each query and additional information to stdout",
|
"verbose: report each query and additional information to stdout",
|
||||||
NULL, &config->verbose);
|
NULL, &config->verbose);
|
||||||
|
@ -538,7 +543,19 @@ setup(int argc, char** argv, config_t* config)
|
||||||
perf_net_parselocal(config->server_addr.sa.sa.sa_family,
|
perf_net_parselocal(config->server_addr.sa.sa.sa_family,
|
||||||
local_name, local_port, &config->local_addr);
|
local_name, local_port, &config->local_addr);
|
||||||
|
|
||||||
input = perf_datafile_open(filename);
|
if (config->binary_input
|
||||||
|
&& (config->edns || config->edns_option || config->dnssec
|
||||||
|
|| config->tsigkey || config->updates)) {
|
||||||
|
fprintf(stderr, "-B is mutually exclusive with -D, -e, -E, -u, -y\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (config->updates)
|
||||||
|
config->input_format = input_format_text_update;
|
||||||
|
else if (config->binary_input)
|
||||||
|
config->input_format = input_format_tcp_wire_format;
|
||||||
|
else
|
||||||
|
config->input_format = input_format_text_query;
|
||||||
|
input = perf_datafile_open(filename, config->input_format);
|
||||||
|
|
||||||
if (config->maxruns == 0 && config->timelimit == 0)
|
if (config->maxruns == 0 && config->timelimit == 0)
|
||||||
config->maxruns = 1;
|
config->maxruns = 1;
|
||||||
|
@ -736,20 +753,35 @@ do_send(void* arg)
|
||||||
PERF_UNLOCK(&tinfo->lock);
|
PERF_UNLOCK(&tinfo->lock);
|
||||||
|
|
||||||
perf_buffer_clear(&lines);
|
perf_buffer_clear(&lines);
|
||||||
result = perf_datafile_next(input, &lines, config->updates);
|
result = perf_datafile_next(input, &lines);
|
||||||
if (result != PERF_R_SUCCESS) {
|
if (result != PERF_R_SUCCESS) {
|
||||||
if (result == PERF_R_INVALIDFILE)
|
if (result == PERF_R_INVALIDFILE)
|
||||||
perf_log_fatal("input file contains no data");
|
perf_log_fatal("input file contains no data");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
perf_buffer_t* send = &msg;
|
||||||
qid = q - tinfo->queries;
|
qid = q - tinfo->queries;
|
||||||
perf_buffer_usedregion(&lines, &used);
|
switch (config->input_format) {
|
||||||
|
case input_format_text_query:
|
||||||
|
case input_format_text_update:
|
||||||
perf_buffer_clear(&msg);
|
perf_buffer_clear(&msg);
|
||||||
|
perf_buffer_usedregion(&lines, &used);
|
||||||
result = perf_dns_buildrequest(&used, qid,
|
result = perf_dns_buildrequest(&used, qid,
|
||||||
config->edns, config->dnssec, config->updates,
|
config->edns, config->dnssec, config->input_format == input_format_text_update,
|
||||||
config->tsigkey, config->edns_option,
|
config->tsigkey, config->edns_option,
|
||||||
&msg);
|
&msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case input_format_tcp_wire_format:
|
||||||
|
send = &lines;
|
||||||
|
if (perf_buffer_usedlength(send) > 1) {
|
||||||
|
((uint8_t*)perf_buffer_base(send))[0] = qid >> 8;
|
||||||
|
((uint8_t*)perf_buffer_base(send))[1] = qid;
|
||||||
|
}
|
||||||
|
result = PERF_R_SUCCESS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (result != PERF_R_SUCCESS) {
|
if (result != PERF_R_SUCCESS) {
|
||||||
PERF_LOCK(&tinfo->lock);
|
PERF_LOCK(&tinfo->lock);
|
||||||
query_move(tinfo, q, prepend_unused);
|
query_move(tinfo, q, prepend_unused);
|
||||||
|
@ -758,13 +790,17 @@ do_send(void* arg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = perf_buffer_base(&msg);
|
base = perf_buffer_base(send);
|
||||||
length = perf_buffer_usedlength(&msg);
|
length = perf_buffer_usedlength(send);
|
||||||
|
|
||||||
now = perf_get_time();
|
now = perf_get_time();
|
||||||
if (config->verbose) {
|
if (config->verbose) {
|
||||||
free(q->desc);
|
free(q->desc);
|
||||||
|
if (config->input_format == input_format_tcp_wire_format) {
|
||||||
|
q->desc = strdup("binary input");
|
||||||
|
} else {
|
||||||
q->desc = strdup(lines.base);
|
q->desc = strdup(lines.base);
|
||||||
|
}
|
||||||
if (q->desc == NULL)
|
if (q->desc == NULL)
|
||||||
perf_log_fatal("out of memory");
|
perf_log_fatal("out of memory");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
2
src/os.c
2
src/os.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
2
src/os.h
2
src/os.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright 2019-2021 OARC, Inc.
|
# Copyright 2019-2022 OARC, Inc.
|
||||||
# Copyright 2017-2018 Akamai Technologies
|
# Copyright 2017-2018 Akamai Technologies
|
||||||
# Copyright 2006-2016 Nominum, Inc.
|
# Copyright 2006-2016 Nominum, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" Copyright 2019-2021 OARC, Inc.
|
.\" Copyright 2019-2022 OARC, Inc.
|
||||||
.\" Copyright 2017-2018 Akamai Technologies
|
.\" Copyright 2017-2018 Akamai Technologies
|
||||||
.\" Copyright 2006-2016 Nominum, Inc.
|
.\" Copyright 2006-2016 Nominum, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -401,7 +401,7 @@ static void setup(int argc, char** argv)
|
||||||
perf_net_parselocal(server_addr.sa.sa.sa_family, local_name,
|
perf_net_parselocal(server_addr.sa.sa.sa_family, local_name,
|
||||||
local_port, &local_addr);
|
local_port, &local_addr);
|
||||||
|
|
||||||
input = perf_datafile_open(filename);
|
input = perf_datafile_open(filename, input_format_text_query);
|
||||||
if (reopen_datafile) {
|
if (reopen_datafile) {
|
||||||
perf_datafile_setmaxruns(input, -1);
|
perf_datafile_setmaxruns(input, -1);
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ do_one_line(perf_buffer_t* lines, perf_buffer_t* msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
perf_buffer_clear(lines);
|
perf_buffer_clear(lines);
|
||||||
result = perf_datafile_next(input, lines, false);
|
result = perf_datafile_next(input, lines);
|
||||||
if (result != PERF_R_SUCCESS)
|
if (result != PERF_R_SUCCESS)
|
||||||
perf_log_fatal("ran out of query data");
|
perf_log_fatal("ran out of query data");
|
||||||
perf_buffer_usedregion(lines, &used);
|
perf_buffer_usedregion(lines, &used);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||||
|
|
||||||
CLEANFILES = test*.log test*.trs \
|
CLEANFILES = test*.log test*.trs \
|
||||||
test2.out test4.out test4err.out key.pem cert.pem test6.out
|
test2.out test4.out test4err.out key.pem cert.pem test6.out \
|
||||||
|
10queries.tmp.blob 10queries.tmp.out empty.out emptypayload.out \
|
||||||
|
largesttcp.out largestudp.out missingpayload.out querywithcookie.out \
|
||||||
|
shortpayload.out tooshortlength.out twoquerieswithnsid.out
|
||||||
|
|
||||||
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
|
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTS) \
|
EXTRA_DIST = $(TESTS) \
|
||||||
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
|
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6 \
|
||||||
|
empty.blob emptypayload.blob largesttcp.blob largestudp.blob \
|
||||||
|
missingpayload.blob querywithcookie.blob shortpayload.blob \
|
||||||
|
tooshortlength.blob twoquerieswithnsid.blob
|
||||||
|
|
|
@ -465,11 +465,17 @@ top_builddir = @top_builddir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||||
CLEANFILES = test*.log test*.trs \
|
CLEANFILES = test*.log test*.trs \
|
||||||
test2.out test4.out test4err.out key.pem cert.pem test6.out
|
test2.out test4.out test4err.out key.pem cert.pem test6.out \
|
||||||
|
10queries.tmp.blob 10queries.tmp.out empty.out emptypayload.out \
|
||||||
|
largesttcp.out largestudp.out missingpayload.out querywithcookie.out \
|
||||||
|
shortpayload.out tooshortlength.out twoquerieswithnsid.out
|
||||||
|
|
||||||
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
|
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh
|
||||||
EXTRA_DIST = $(TESTS) \
|
EXTRA_DIST = $(TESTS) \
|
||||||
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
|
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6 \
|
||||||
|
empty.blob emptypayload.blob largesttcp.blob largestudp.blob \
|
||||||
|
missingpayload.blob querywithcookie.blob shortpayload.blob \
|
||||||
|
tooshortlength.blob twoquerieswithnsid.blob
|
||||||
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
|
@ -701,6 +707,13 @@ test6.sh.log: test6.sh
|
||||||
--log-file $$b.log --trs-file $$b.trs \
|
--log-file $$b.log --trs-file $$b.trs \
|
||||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||||
|
test7.sh.log: test7.sh
|
||||||
|
@p='test7.sh'; \
|
||||||
|
b='test7.sh'; \
|
||||||
|
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||||
|
--log-file $$b.log --trs-file $$b.trs \
|
||||||
|
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||||
|
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||||
.test.log:
|
.test.log:
|
||||||
@p='$<'; \
|
@p='$<'; \
|
||||||
$(am__set_b); \
|
$(am__set_b); \
|
||||||
|
|
0
src/test/empty.blob
Normal file
0
src/test/empty.blob
Normal file
BIN
src/test/emptypayload.blob
Normal file
BIN
src/test/emptypayload.blob
Normal file
Binary file not shown.
1
src/test/largesttcp.blob
Normal file
1
src/test/largesttcp.blob
Normal file
File diff suppressed because one or more lines are too long
1
src/test/largestudp.blob
Normal file
1
src/test/largestudp.blob
Normal file
File diff suppressed because one or more lines are too long
BIN
src/test/missingpayload.blob
Normal file
BIN
src/test/missingpayload.blob
Normal file
Binary file not shown.
BIN
src/test/querywithcookie.blob
Normal file
BIN
src/test/querywithcookie.blob
Normal file
Binary file not shown.
BIN
src/test/shortpayload.blob
Normal file
BIN
src/test/shortpayload.blob
Normal file
Binary file not shown.
83
src/test/test7.sh
Executable file
83
src/test/test7.sh
Executable file
|
@ -0,0 +1,83 @@
|
||||||
|
#!/bin/sh -xe
|
||||||
|
|
||||||
|
# expect non-zero exit code
|
||||||
|
malformed_input_fmt() {
|
||||||
|
FILESTEM="$1"
|
||||||
|
! ../dnsperf -vvv -B -d "$srcdir/$FILESTEM.blob" > "$FILESTEM.out" 2>&1
|
||||||
|
grep -F "Error: input file contains no data" "$FILESTEM.out"
|
||||||
|
}
|
||||||
|
|
||||||
|
malformed_input_fmt "empty"
|
||||||
|
malformed_input_fmt "tooshortlength"
|
||||||
|
malformed_input_fmt "missingpayload"
|
||||||
|
|
||||||
|
test "$TEST_DNSPERF_WITH_NETWORK" = "1" || exit 0
|
||||||
|
|
||||||
|
check_sent_and_lost() {
|
||||||
|
FILESTEM="$1"
|
||||||
|
EXPECTEDCOUNT="$2"
|
||||||
|
grep "Queries sent: $EXPECTEDCOUNT$" "$FILESTEM.out"
|
||||||
|
grep -F "Queries lost: $EXPECTEDCOUNT (" "$FILESTEM.out"
|
||||||
|
}
|
||||||
|
|
||||||
|
# send to an address which does not reply anyway;
|
||||||
|
# typically for weird blobs which do not even have DNS header - so we cannot expect a response
|
||||||
|
blackhole() {
|
||||||
|
FILESTEM="$1"
|
||||||
|
EXTRAARGS="$2"
|
||||||
|
EXPECTEDCOUNT="$3"
|
||||||
|
../dnsperf -t 0.001 -vvv -B -d "$srcdir/$FILESTEM.blob" -s 192.0.2.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
|
||||||
|
check_sent_and_lost "$FILESTEM" "$EXPECTEDCOUNT"
|
||||||
|
}
|
||||||
|
blackhole2() {
|
||||||
|
FILESTEM="$1"
|
||||||
|
EXTRAARGS="$2"
|
||||||
|
EXPECTEDCOUNT="$3"
|
||||||
|
../dnsperf -t 0.001 -vvv -B -d "$FILESTEM.blob" -s 192.0.2.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
|
||||||
|
check_sent_and_lost "$FILESTEM" "$EXPECTEDCOUNT"
|
||||||
|
}
|
||||||
|
|
||||||
|
blackhole "emptypayload" "" 1
|
||||||
|
blackhole "shortpayload" "" 1
|
||||||
|
blackhole "largestudp" "" 1
|
||||||
|
# too large for UDP; at least it should not crash
|
||||||
|
blackhole "largesttcp" "" 0
|
||||||
|
grep -F 'failed to send packet' largesttcp.out
|
||||||
|
|
||||||
|
# valid DNS queries as blobs
|
||||||
|
expect_noerror() {
|
||||||
|
FILESTEM="$1"
|
||||||
|
EXTRAARGS="$2"
|
||||||
|
EXPECTEDCOUNT="$3"
|
||||||
|
../dnsperf -vvv -B -d "$srcdir/$FILESTEM.blob" -s 1.1.1.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
|
||||||
|
grep "Queries sent: $EXPECTEDCOUNT$" "$FILESTEM.out"
|
||||||
|
grep -F "Queries completed: $EXPECTEDCOUNT (" "$FILESTEM.out"
|
||||||
|
}
|
||||||
|
|
||||||
|
# single plain run
|
||||||
|
expect_noerror "querywithcookie" "" 1
|
||||||
|
|
||||||
|
# loop over the binary twice
|
||||||
|
expect_noerror "querywithcookie" "-n 2" 2
|
||||||
|
|
||||||
|
# multiple queries in one file
|
||||||
|
expect_noerror "twoquerieswithnsid" "" 2
|
||||||
|
|
||||||
|
# file too big to cache
|
||||||
|
rm -f 10queries.tmp.blob
|
||||||
|
cat "$srcdir/twoquerieswithnsid.blob" "$srcdir/querywithcookie.blob" "$srcdir/emptypayload.blob" \
|
||||||
|
"$srcdir/largestudp.blob" "$srcdir/twoquerieswithnsid.blob" "$srcdir/querywithcookie.blob" \
|
||||||
|
"$srcdir/emptypayload.blob" "$srcdir/largestudp.blob" \
|
||||||
|
> 10queries.tmp.blob
|
||||||
|
blackhole2 "10queries.tmp" "" 10
|
||||||
|
|
||||||
|
# repeat non-cacheable file the same twice
|
||||||
|
blackhole2 "10queries.tmp" "-n 2" 20
|
||||||
|
|
||||||
|
# large binary on stdin should work too
|
||||||
|
cat 10queries.tmp.blob | ../dnsperf -t 0.001 -vvv -B -s 192.0.2.1 > "stdinlarge.out" 2>&1
|
||||||
|
check_sent_and_lost "stdinlarge" 10
|
||||||
|
|
||||||
|
# small binary on stdin
|
||||||
|
cat "$srcdir/twoquerieswithnsid.blob" | ../dnsperf -t 0.001 -vvv -B -s 192.0.2.1 > "stdinsmall.out" 2>&1
|
||||||
|
check_sent_and_lost "stdinsmall" 2
|
BIN
src/test/tooshortlength.blob
Normal file
BIN
src/test/tooshortlength.blob
Normal file
Binary file not shown.
BIN
src/test/twoquerieswithnsid.blob
Normal file
BIN
src/test/twoquerieswithnsid.blob
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2021 OARC, Inc.
|
* Copyright 2019-2022 OARC, Inc.
|
||||||
* Copyright 2017-2018 Akamai Technologies
|
* Copyright 2017-2018 Akamai Technologies
|
||||||
* Copyright 2006-2016 Nominum, Inc.
|
* Copyright 2006-2016 Nominum, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|
Loading…
Add table
Reference in a new issue