Commit f2700f3e authored by Štěpán Balážik's avatar Štěpán Balážik

mostly references, but other changes as well :/

parent 8cc0825b
......@@ -12,6 +12,10 @@ sleep 5
PICKLED=$(./pcap_analyzer.py --pcap $PCAP --scenario $SCENARIO)
python3 -m pytest stats_comparator.py -k "sanity" -v -rs --under-test $PICKLED
for ref in $(ls $SCENARIO/references/*.pickle)
do
python3 -m pytest stats_comparator.py -k "reference_is_newer_than_scenario" -v -rs --under-test $PICKLED --reference $ref
done
if [ $? -ne 0 ]; then
echo "Sanity check failed, something is seriously broken."
......@@ -33,4 +37,4 @@ done
cp $PICKLED $SCENARIO/references/result_previous_stats.pickle
systemctl status maze-resolver
# systemctl status maze-resolver
{% if valgrind == True %}
jit.off()
{% endif %}
net = { {%- for ip in address -%} "{{ip}}", {% endfor %} }
net.ipv6 = {{ "false" if ipv6 == false else "true"}}
......@@ -33,5 +37,6 @@ function a()
end
event.recurrent(100, a) #}
cache.size = 10*MB
cache.min_ttl(1)
\ No newline at end of file
......@@ -231,7 +231,6 @@ if __name__ == "__main__":
name = NAME_DICT.get(basename, basename)
with open(filename, "rb") as f:
print(filename)
full_data[name] = pickle.load(f)
full_data[name]["color"] = COLOR_DICT.get(basename, None)
......
......@@ -8,8 +8,11 @@ import math
import os.path
import pickle
import statistics
import struct
from typing import Dict, List
import dns.message
from dns.exception import DNSException
import dpkt
import process_generator
......@@ -44,12 +47,22 @@ class PCAPAnalyzer:
self.sliding_window_rtt()
def process_packet(self, ts, packet):
# Unpack Linux cooked capture
ip_packet = dpkt.sll.SLL(packet).data
for member_name in dir(self):
# all methods starting with "_packet" are applied on each packet from PCAP
if member_name.startswith("_packet"):
# Unpack Linux cooked capture
l2_packet = dpkt.sll.SLL(packet)
getattr(self, member_name)(ts, l2_packet.data)
getattr(self, member_name)(ts, ip_packet)
try:
# _dns_packet methods are applied only to DNS packets
dns_packet = dns.message.from_wire(ip_packet.data.data)
if member_name.startswith("_dns_packet"):
getattr(self, member_name)(ts, ip_packet, dns_packet)
except (DNSException, ValueError):
pass
def _packet_count_per_auth_ip(self, ts, ip_packet):
ip_src = ip(ip_packet.src)
......@@ -69,14 +82,13 @@ class PCAPAnalyzer:
self.stats["server_dst"][auth["name"]] += 1
self.stats["auth_config"][auth["name"]] = auth
def _packet_dns_answer_rcode_count(self, ts, ip_packet):
def _dns_packet_dns_answer_rcode_count(self, ts, ip_packet, dns_packet: dns.message.Message):
ip_src = ip(ip_packet.src)
ip_dst = ip(ip_packet.dst)
if ip_src in self.resolver_ips and ip_dst == self.client_ip:
dns_packet = dpkt.dns.DNS(ip_packet.data.data)
self.stats["rcode"][dns_packet.rcode] += 1
self.stats["rcode"][dns_packet.rcode()] += 1
def _packet_dns_query_count(self, ts, ip_packet):
def _packet_query_count(self, ts, ip_packet):
ip_src = ip(ip_packet.src)
ip_dst = ip(ip_packet.dst)
if ip_src in self.resolver_ips:
......@@ -91,23 +103,20 @@ class PCAPAnalyzer:
self.stats["answers"]["from_auths"] += 1
def _packet_get_rtts(self, ts, ip_packet):
def _dns_packet_get_rtts(self, ts, ip_packet, dns_packet: dns.message.Message):
# FIXME: DNS retransmits
ip_src = ip(ip_packet.src)
ip_dst = ip(ip_packet.dst)
if ip_src == self.client_ip:
dns_packet = dpkt.dns.DNS(ip_packet.data.data)
self.stats["rtts"][getattr(dns_packet, "id")] = -ts
if ip_src in self.resolver_ips and ip_dst == self.client_ip:
dns_packet = dpkt.dns.DNS(ip_packet.data.data)
self.stats["rtts"][getattr(dns_packet, "id")] += ts
def _packet_count_queries_per_qname(self, ts, ip_packet):
def _dns_packet_count_queries_per_qname(self, ts, ip_packet, dns_packet: dns.message.Message):
ip_src = ip(ip_packet.src)
ip_dst = ip(ip_packet.dst)
if ip_src in self.resolver_ips and ip_dst != self.client_ip:
if not isinstance(ip_packet.data.data, dpkt.icmp.ICMP.Unreach):
dns_packet = dpkt.dns.DNS(ip_packet.data.data)
self.stats["queries_by_qname"][dns_packet.qd[0].name.lower()] += 1
self.stats["queries_by_qname"][str(dns_packet.question[0].name).lower()] += 1
def sliding_window_rtt(self, window = 100):
......
#!/bin/sh
set -x
for res in named recursor unbound kresd
do
sed -i "s/config:.*/config: $res.conf/g" $1/resolver/config.yaml
sed -i "s/service:.*/service: $res/g" $1/resolver/config.yaml
EXEC=$(./process_generator.py $1)
cat $1/resolver/config.yaml
PCAP=$($EXEC)
sleep 5
./pcap_analyzer.py --pcap $PCAP --scenario $1 --reference
done
mv $1/references/result_kresd_stats.pickle $1/references/result_kresd-5-0-0_stats.pickle
\ No newline at end of file
name: "resolver"
service: "kresd"
service: kresd
address: ["3.0.0.1"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
tafile: "root.keys"
dnssec: yes
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.20", "1::20"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.20", "1::20"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.1"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
\ No newline at end of file
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.20", "1::20"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
. 86400 IN SOA j.root-servers.net. nstld.verisign-grs.com. 2019072500 1800 900 604800 86400
*. 3600 IN A 1.1.1.1
. 86400 IN NS j.root-servers.net.
j.root-servers.net. 86400 IN A 1.0.0.100
\ No newline at end of file
name: "dnsperf"
service: "dnsperf"
address: ["2.0.0.1"]
dnsperf: -d qq -Q 1 -v
\ No newline at end of file
dnsperf: -d q
\ No newline at end of file
This diff is collapsed.
0 A
1 A
\ No newline at end of file
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.1"]
config: kresd.conf
roothints: root.hints
verbose: yes
# verbose: yes
name: "resolver"
service: "kresd"
service: kresd
address: ["1.0.0.20", "1::20"]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
\ No newline at end of file
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
name: "resolver"
service: "kresd"
service: kresd
address: [1.0.0.1, 1::1]
config: "kresd.conf"
config: kresd.conf
roothints: "root.hints"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment