Bug 4132 - Openness/closeness of RANGE intervals in rpl files
Openness/closeness of RANGE intervals in rpl files
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
x86_64 Linux
: P5 minor
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-07-23 16:39 CEST by Štěpán Balážik
Modified: 2018-10-25 11:03 CEST (History)
2 users (show)

See Also:


Attachments
Patch for testdata/iter_pcnamech.rpl and testdata/iter_pcnamechrec.rpl (1.22 KB, patch)
2018-07-23 17:38 CEST, Štěpán Balážik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Štěpán Balážik 2018-07-23 16:39:15 CEST
Hi,

I noticed that there are a few rpl files in `testdata` (6 to be exact, list is attached below) which contain overlapping ranges with the same server address (usually by just one number, e.g. `RANGE 0 50` and `RANGE 50 100` are both present). And by reading code of function pending_find_match testcode/fake_event.c (line 238) I got an impression that RANGE intervals are handled as closed intervals (meaning `RANGE 0 20` will include both 0 and 20).

I think this might be bug-inducing since for example `iter_pcnamech.rpl` now relies only on the fragile (and AFAIK undocumented) fact that if such ambiguity occurs the first range appearing in the file is chosen. Simply reordering the ranges would IMHO change how the test behaves.

We plan to fix these in our copies we use for Deckard (our reimplementation of testbound). Should we be sending the patched versions of affected rpl files back?

Regards,
Štěpán Balážik @ CZ.NIC

List of affected files:
black_ds_entry.rpl
black_key_entry.rpl
black_prime_entry.rpl
iter_pcnamech.rpl
iter_pcnamechrec.rpl
net_signed_servfail.rpl
Comment 1 Wouter Wijngaards 2018-07-23 16:43:29 CEST
Hi Štěpán,

Yes please, that would be very nice.  I hadn't noticed, because the tests work for me.

Best regards, Wouter
Comment 2 Štěpán Balážik 2018-07-23 17:38:40 CEST
Created attachment 516 [details]
Patch for testdata/iter_pcnamech.rpl and testdata/iter_pcnamechrec.rpl

I fixed the two of the previously mentioned files we use in Deckard so that they actually test something in `STEP 50`.

That was not the case before, I think, since at time 50 the first nameserver (1.2.3.44) was still _running_ (according to `RANGE_BEGIN 0 50 ADDRESS 1.2.3.44` which comes first in the original files – before `RANGE_BEGIN 50 100 ADDRESS 1.2.3.44` which would send SERVFAIL) and resolvers did not need to ask the second server (1.2.3.55) at all.

Aaand we found a bug in Knot Resolver.

So thank you, I guess. :)
Štěpán Balážik
Comment 3 Wouter Wijngaards 2018-10-25 11:03:00 CEST
Hi Štěpán,

Incorporated the patch, and also adjusted the other tests and removed overlapping RANGE intervals from the files (with 0..49 and 0..99 in the files).

Nice to hear that you fixed a bug in Knot too.

Best regards, Wouter

The other changes:

Index: testdata/black_ds_entry.rpl
===================================================================
--- testdata/black_ds_entry.rpl	(revision 4946)
+++ testdata/black_ds_entry.rpl	(working copy)
@@ -19,7 +19,7 @@
 ; until the key entry expires.
 
 ; K.ROOT-SERVERS.NET.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 193.0.14.129 
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -47,7 +47,7 @@
 RANGE_END
 
 ; a.gtld-servers.net.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 192.5.6.30
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -116,7 +116,7 @@
 RANGE_END
 
 ; ns.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.4
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -228,7 +228,7 @@
 RANGE_END
 
 ; ns.blabla.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.5
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -336,7 +336,7 @@
 RANGE_END
 
 ; ns.sub.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.4.6
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -402,7 +402,7 @@
 RANGE_END
 
 ; ns.foo.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.4.7
 ENTRY_BEGIN
 MATCH opcode qtype qname
Index: testdata/black_key_entry.rpl
===================================================================
--- testdata/black_key_entry.rpl	(revision 4946)
+++ testdata/black_key_entry.rpl	(working copy)
@@ -19,7 +19,7 @@
 ; until the key entry expires.
 
 ; K.ROOT-SERVERS.NET.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 193.0.14.129 
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -47,7 +47,7 @@
 RANGE_END
 
 ; a.gtld-servers.net.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 192.5.6.30
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -116,7 +116,7 @@
 RANGE_END
 
 ; ns.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.4
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -228,7 +228,7 @@
 RANGE_END
 
 ; ns.blabla.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.5
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -336,7 +336,7 @@
 RANGE_END
 
 ; ns.sub.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.4.6
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -402,7 +402,7 @@
 RANGE_END
 
 ; ns.foo.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.4.7
 ENTRY_BEGIN
 MATCH opcode qtype qname
Index: testdata/black_prime_entry.rpl
===================================================================
--- testdata/black_prime_entry.rpl	(revision 4946)
+++ testdata/black_prime_entry.rpl	(working copy)
@@ -18,7 +18,7 @@
 ; comes from an 'expired signatures' name server.
 
 ; K.ROOT-SERVERS.NET.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 193.0.14.129 
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -46,7 +46,7 @@
 RANGE_END
 
 ; a.gtld-servers.net.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 192.5.6.30
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -96,7 +96,7 @@
 RANGE_END
 
 ; ns.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.4
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -177,7 +177,7 @@
 RANGE_END
 
 ; ns.blabla.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 1.2.3.5
 ENTRY_BEGIN
 MATCH opcode qtype qname
Index: testdata/net_signed_servfail.rpl
===================================================================
--- testdata/net_signed_servfail.rpl	(revision 4946)
+++ testdata/net_signed_servfail.rpl	(working copy)
@@ -19,7 +19,7 @@
 ; after introduction of a .NET DS in the root for a running validator.
 
 ; K.ROOT-SERVERS.NET. (before .net DS introduction)
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 99
 	ADDRESS 193.0.14.129 
 ENTRY_BEGIN
 MATCH opcode qtype qname