summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES14
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--contrib/ecs-gen/README.md10
-rwxr-xr-xcontrib/ecs-gen/dnsperf-ecs-gen.py10
-rw-r--r--src/resperf.c17
-rwxr-xr-xsrc/test/test3.sh9
7 files changed, 66 insertions, 16 deletions
diff --git a/CHANGES b/CHANGES
index 6bb9cba..46bf1b8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,14 @@
-2020-03-25 Jerry Lundström
+2021-05-31 Jerry Lundström
+
+ Release 2.6.0
+
+ This release adds EDNS options parameter `-E` to `resperf` and a script
+ for generating EDNS Client Subnet options (see `contrib/ecs-gen`).
+
+ d29d880 ECS opt
+ 877f31e edns option
+
+2021-03-25 Jerry Lundström
Release 2.5.2
@@ -26,7 +36,7 @@
22f49df network tests
8e5b56e reconnect
-2020-03-22 Jerry Lundström
+2021-03-22 Jerry Lundström
Release 2.5.1
diff --git a/configure b/configure
index 5ee2397..2720add 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dnsperf 2.5.2.
+# Generated by GNU Autoconf 2.69 for dnsperf 2.6.0.
#
# Report bugs to <admin@dns-oarc.net>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dnsperf'
PACKAGE_TARNAME='dnsperf'
-PACKAGE_VERSION='2.5.2'
-PACKAGE_STRING='dnsperf 2.5.2'
+PACKAGE_VERSION='2.6.0'
+PACKAGE_STRING='dnsperf 2.6.0'
PACKAGE_BUGREPORT='admin@dns-oarc.net'
PACKAGE_URL='https://github.com/DNS-OARC/dnsperf/issues'
@@ -1356,7 +1356,7 @@ if test "$ac_init_help" = "long"; then
# 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.
cat <<_ACEOF
-\`configure' configures dnsperf 2.5.2 to adapt to many kinds of systems.
+\`configure' configures dnsperf 2.6.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1427,7 +1427,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dnsperf 2.5.2:";;
+ short | recursive ) echo "Configuration of dnsperf 2.6.0:";;
esac
cat <<\_ACEOF
@@ -1562,7 +1562,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dnsperf configure 2.5.2
+dnsperf configure 2.6.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1931,7 +1931,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dnsperf $as_me 2.5.2, which was
+It was created by dnsperf $as_me 2.6.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2794,7 +2794,7 @@ fi
# Define the identity of the package.
PACKAGE='dnsperf'
- VERSION='2.5.2'
+ VERSION='2.6.0'
cat >>confdefs.h <<_ACEOF
@@ -14202,7 +14202,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dnsperf $as_me 2.5.2, which was
+This file was extended by dnsperf $as_me 2.6.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14269,7 +14269,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dnsperf config.status 2.5.2
+dnsperf config.status 2.6.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 5d965f2..4d5bb80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@
# limitations under the License.
AC_PREREQ(2.64)
-AC_INIT([dnsperf], [2.5.2], [admin@dns-oarc.net], [dnsperf], [https://github.com/DNS-OARC/dnsperf/issues])
+AC_INIT([dnsperf], [2.6.0], [admin@dns-oarc.net], [dnsperf], [https://github.com/DNS-OARC/dnsperf/issues])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_SRCDIR([src/dnsperf.c])
AC_CONFIG_HEADER([src/config.h])
diff --git a/contrib/ecs-gen/README.md b/contrib/ecs-gen/README.md
new file mode 100644
index 0000000..acd1cac
--- /dev/null
+++ b/contrib/ecs-gen/README.md
@@ -0,0 +1,10 @@
+# dnsperf-ecs-gen
+
+Small python script to generate EDNS Client Subnet options for `dnsperf`.
+
+Requires `dnspython` to be installed.
+
+```
+$ ./dnsperf-ecs-gen 192.168.0.1/24
+-e 8:00011800c0a800
+```
diff --git a/contrib/ecs-gen/dnsperf-ecs-gen.py b/contrib/ecs-gen/dnsperf-ecs-gen.py
new file mode 100755
index 0000000..9a637e2
--- /dev/null
+++ b/contrib/ecs-gen/dnsperf-ecs-gen.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import dns.edns
+import sys
+
+if len(sys.argv) > 1:
+ opt = dns.edns.ECSOption.from_text(sys.argv[1])
+ print("-e %d:%s" % (dns.edns.ECS, opt.to_wire().hex()))
+else:
+ print("usage: dnsperf-ecs-gen.py <address/srclen[/scopelen]>")
diff --git a/src/resperf.c b/src/resperf.c
index a6d120c..f7038e9 100644
--- a/src/resperf.c
+++ b/src/resperf.c
@@ -103,6 +103,8 @@ static uint64_t query_timeout;
static bool edns;
static bool dnssec;
+static perf_ednsoption_t* edns_option = 0;
+
static perf_datafile_t* input;
/* The target traffic level at the end of the ramp-up */
@@ -229,7 +231,8 @@ setup(int argc, char** argv)
int sock_family;
unsigned int bufsize;
unsigned int i;
- const char* _mode = 0;
+ const char* _mode = 0;
+ const char* edns_option_str = NULL;
sock_family = AF_UNSPEC;
server_port = 0;
@@ -270,6 +273,8 @@ setup(int argc, char** argv)
&bufsize);
perf_opt_add('e', perf_opt_boolean, NULL,
"enable EDNS 0", NULL, &edns);
+ perf_opt_add('E', perf_opt_string, "code:value",
+ "send EDNS option", NULL, &edns_option_str);
perf_opt_add('D', perf_opt_boolean, NULL,
"set the DNSSEC OK bit (implies EDNS)", NULL, &dnssec);
perf_opt_add('y', perf_opt_string, "[alg:]name:secret",
@@ -350,12 +355,15 @@ setup(int argc, char** argv)
perf_datafile_setmaxruns(input, -1);
}
- if (dnssec)
+ if (dnssec || edns_option_str)
edns = true;
if (tsigkey_str != NULL)
tsigkey = perf_tsig_parsekey(tsigkey_str);
+ if (edns_option_str != NULL)
+ edns_option = perf_edns_parseoption(edns_option_str);
+
if (!(socks = calloc(nsocks, sizeof(*socks)))) {
perf_log_fatal("out of memory");
}
@@ -380,6 +388,9 @@ cleanup(void)
(void)perf_net_close(socks[i]);
close(dummypipe[0]);
close(dummypipe[1]);
+
+ if (edns_option)
+ perf_edns_destroyoption(&edns_option);
}
/* Find the ramp_bucket for queries sent at time "when" */
@@ -586,7 +597,7 @@ do_one_line(perf_buffer_t* lines, perf_buffer_t* msg)
perf_buffer_clear(msg);
result = perf_dns_buildrequest(&used, qid,
edns, dnssec, false,
- tsigkey, 0,
+ tsigkey, edns_option,
msg);
if (result != PERF_R_SUCCESS)
return (result);
diff --git a/src/test/test3.sh b/src/test/test3.sh
index 006ea2e..58ebd12 100755
--- a/src/test/test3.sh
+++ b/src/test/test3.sh
@@ -37,6 +37,15 @@ echo "" | ../dnsperf -W -y test: | grep "unable to setup TSIG, secret empty"
../dnsperf -W -E a:aa | grep "invalid EDNS Option code 'a'"
../dnsperf -W -E 1:xx | grep "invalid EDNS Option hex value 'xx'"
+! ../resperf -e -E invalid
+! ../resperf -e -E 9999999:invalid
+! ../resperf -e -E 123:invalid
+! ../resperf -e -E 123:fa0
+../resperf -W -E a: | grep "invalid EDNS Option, value is empty"
+../resperf -W -E a:a | grep "invalid EDNS Option, value must hex string (even number of characters)"
+../resperf -W -E a:aa | grep "invalid EDNS Option code 'a'"
+../resperf -W -E 1:xx | grep "invalid EDNS Option hex value 'xx'"
+
! ../resperf -d does_not_exist
! ../resperf -r 0 -c 0
! ../resperf -f invalid