summaryrefslogtreecommitdiffstats
path: root/contrib/ecs-gen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-17 07:16:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-17 07:16:07 +0000
commitdf8f0bdca092616a259724cc3bfb9152e928715f (patch)
tree3fdad2d562c12f9b03535564576b39b287f7176b /contrib/ecs-gen
parentAdding upstream version 2.5.2. (diff)
downloaddnsperf-df8f0bdca092616a259724cc3bfb9152e928715f.tar.xz
dnsperf-df8f0bdca092616a259724cc3bfb9152e928715f.zip
Adding upstream version 2.6.0.upstream/2.6.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/ecs-gen')
-rw-r--r--contrib/ecs-gen/README.md10
-rwxr-xr-xcontrib/ecs-gen/dnsperf-ecs-gen.py10
2 files changed, 20 insertions, 0 deletions
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]>")