Skip to content

Commit

Permalink
Merge pull request #286 from jelu/tld-list-doc-typo
Browse files Browse the repository at this point in the history
TLD list, doc typo
  • Loading branch information
jelu authored May 15, 2023
2 parents 588a4ce + c3afee4 commit 7e9aeb7
Show file tree
Hide file tree
Showing 9 changed files with 5,399 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/dns_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ const char* dns_message_QnameToNld(const char* qname, int nld)
if (have_tld_list) {
// Use TLD list to find labels that are the "TLD"
const char *lt = 0, *ot = t;
int done = 0;
while (t > qname) {
t--;
if ('.' == *t) {
Expand All @@ -427,6 +428,7 @@ const char* dns_message_QnameToNld(const char* qname, int nld)
t = ot;
state = 0;
}
done = 1;
break;
}
}
Expand All @@ -435,6 +437,10 @@ const char* dns_message_QnameToNld(const char* qname, int nld)
state = 0;
}
}
if (!done) {
// nothing found, reset t
t = e;
}
}
while (t > qname && dotcount < nld) {
t--;
Expand Down
2 changes: 1 addition & 1 deletion src/dsc.conf.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ output_format XML;
#asn_indexer_backend geoip;
#country_indexer_backend geoip;
#maxminddb_asn "/path/to/GeoLite2/ASN.mmdb";
#maxminddb_country "/path/to/GeoList2/Country.mmdb";
#maxminddb_country "/path/to/GeoLite2/Country.mmdb";

#client_v4_mask 255.255.255.0;
#client_v6_mask ffff:ffff:ffff:ffff:ffff:ffff:0000:0000;
Expand Down
2 changes: 1 addition & 1 deletion src/dsc.conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ dataset direction_vs_ipproto ip Direction:ip_direction IPProto:ip_proto any;
#asn_indexer_backend geoip;
#country_indexer_backend geoip;
#maxminddb_asn "/path/to/GeoLite2/ASN.mmdb";
#maxminddb_country "/path/to/GeoList2/Country.mmdb";
#maxminddb_country "/path/to/GeoLite2/Country.mmdb";

# Client Subnet Mask
#
Expand Down
17 changes: 14 additions & 3 deletions src/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ CLEANFILES = test*.log test*.trs \
1458044657.tld_list.dist \
tld_list.dat \
dotdoh.dnstap.dist 1643283234.dscdata.xml \
test13.conf
test13.conf \
test_285.pcap.dist test_285.tldlist.dist 1683879752.xml

EXTRA_DIST =

TESTS = test1.sh test2.sh test3.sh test4.sh test6.sh test7.sh test8.sh \
test9.sh test10.sh test11.sh test12.sh test_dnstap_unixsock.sh \
test_dnstap_tcp.sh test_pslconv.sh test_encrypted.sh test13.sh
test_dnstap_tcp.sh test_pslconv.sh test_encrypted.sh test13.sh \
test_285.sh

if USE_DNSTAP
TESTS += test5.sh
Expand Down Expand Up @@ -79,6 +81,14 @@ dotdoh.dnstap.dist: dotdoh.dnstap

test13.sh: 1458044657.pcap.dist 1458044657.tld_list.dist

test_285.pcap.dist: test_285.pcap
ln -s "$(srcdir)/test_285.pcap" test_285.pcap.dist

test_285.tldlist.dist: test_285.tldlist
ln -s "$(srcdir)/test_285.tldlist" test_285.tldlist.dist

test_285.sh: test_285.pcap.dist test_285.tldlist.dist

EXTRA_DIST += $(TESTS) \
1458044657.conf 1458044657.pcap 1458044657.json_gold 1458044657.xml_gold \
pid.conf pid.pcap \
Expand All @@ -98,4 +108,5 @@ EXTRA_DIST += $(TESTS) \
dnstap_unixsock.conf dnstap_tcp.conf \
1458044657.tld_list \
public_suffix_list.dat tld_list.dat.gold \
dnstap_encrypted.conf dnstap_encrypted.gold dotdoh.dnstap
dnstap_encrypted.conf dnstap_encrypted.gold dotdoh.dnstap \
test_285.pcap test_285.conf test_285.tldlist test_285.xml_gold
8 changes: 8 additions & 0 deletions src/test/test_285.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
local_address 127.0.0.1;
run_dir ".";
minfree_bytes 5000000;
interface ./test_285.pcap.dist;

dataset test285 dns All:null TLD:tld queries-only;

tld_list ./test_285.tldlist.dist;
Binary file added src/test/test_285.pcap
Binary file not shown.
11 changes: 11 additions & 0 deletions src/test/test_285.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -xe

rm -f 1683879752.xml

../dsc "$srcdir/test_285.conf"

test -f 1683879752.dscdata.xml || sleep 1
test -f 1683879752.dscdata.xml || sleep 2
test -f 1683879752.dscdata.xml || sleep 3
test -f 1683879752.dscdata.xml
diff -u 1683879752.dscdata.xml "$srcdir/test_285.xml_gold"
Loading

0 comments on commit 7e9aeb7

Please sign in to comment.