Skip to content

Update Connectivity04 implementation#1393

Merged
tgreenx merged 10 commits into
zonemaster:developfrom
tgreenx:update-connectivity04
Nov 12, 2024
Merged

Update Connectivity04 implementation#1393
tgreenx merged 10 commits into
zonemaster:developfrom
tgreenx:update-connectivity04

Conversation

@tgreenx

@tgreenx tgreenx commented Oct 22, 2024

Copy link
Copy Markdown
Contributor

Purpose

This PR proposes an update to the implementation of Connectivity04 following a specification update. As a drive by change, this also updates the t/TestUtil.pm module to add support for dynamic scenario testing for test cases.

Note that this is the first implementation to make use of MethodsV2.

Context

Test case specification update: zonemaster/zonemaster#1298

Test zones specification: zonemaster/zonemaster#1299

Changes

lib/Zonemaster/Engine/ASNLookup.pm
lib/Zonemaster/Engine/Test/Connectivity.pm
t/Test-connectivity04.t
t/Test-connectivity04.data
t/Test-connectivity04-A.t
t/Test-connectivity04-A.data
t/TestUtil.pm

How to test this PR

Unit tests are updated (based on zonemaster/zonemaster#1299) and should pass.

@tgreenx tgreenx added the A-TestCase Area: Test case specification or implementation of test case label Oct 22, 2024
@tgreenx tgreenx added this to the v2024.2 milestone Oct 22, 2024

@matsduf matsduf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When zonemaster/zonemaster#1298 has been fixed I will update zonemaster/zonemaster#1299 and test this implementation.

Comment thread t/Test-connectivity04.t
@tgreenx tgreenx requested a review from matsduf October 24, 2024 08:45
@matsduf

matsduf commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

Note that scenario ERROR-PREFIX-DATABASE-3 is currently disabled because since its query ends up blacklisted (no response), it causes subsequent queries to be blacklisted as well. I'll look for a workaround.

If that scenario is run by a separate t file it will not affect other scenarios. Isn't that the simple workaround? I do not think that the code should handle ASN lookup queries special in that sense.

@matsduf

matsduf commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

Should there be double space between tag and argument?

$ zonemaster-cli --hint=hintfile.zone --test=connectivity04 --level=info --show-testcase --raw GOOD-1.connectivity04.xa                                                                                        
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0                                                                                                                                                 
   0.23 INFO     Connectivity04 CN04_IPV4_DIFFERENT_PREFIX  ns_list=dns0.connectivity04.xa/127.100.100.1;dns1.connectivity04.xa/127.100.101.1                                                                  
   0.23 INFO     Connectivity04 CN04_IPV6_DIFFERENT_PREFIX  ns_list=dns0.connectivity04.xa/fda1:b2:c3:0:127:100:100:1;dns1.connectivity04.xa/fda1:b2:c3:0:127:100:101:1                                        

@matsduf

matsduf commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

I tested a domain that does not exist and got errors from Perl. It is not a big problem, but better if we can avoid it.

$ zonemaster-cli --hint=hintfile.zone --test=connectivity04 --level=info --show-testcase --raw ERROR-PREFIX-DATABASE-4.connectivity04.xa
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0
   0.04 CRITICAL Unspecified    MODULE_ERROR  module=Connectivity; msg=Can't use an undefined value as an ARRAY reference at /usr/local/share/perl/5.34.0/Zonemaster/Engine/Test/Connectivity.pm line 807.

@matsduf

matsduf commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

Tag without argument, but with two trailing space characters, CN04_IPV4_SINGLE_PREFIX .

@matsduf matsduf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario name Mandatory message tag Forbidden message tags
ERROR-PREFIX-DATABASE-6 CN04_IPV4_DIFFERENT_PREFIX, CN04_IPV6_DIFFERENT_PREFIX, CN04_ERROR_PREFIX_DATABASE 2)
$ zonemaster-cli --hint=hintfile.zone --test=connectivity04 --level=info --show-testcase --raw ERROR-PREFIX-DATABASE-6.connectivity04.xa                                                                       
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0                                                                                                                                                 
   0.15 INFO     Connectivity04 CN04_IPV4_DIFFERENT_PREFIX  ns_list=dns1.connectivity04.xa/127.100.101.1;dns25.connectivity04.xa/127.100.125.1                                                                 
   0.15 INFO     Connectivity04 CN04_IPV6_DIFFERENT_PREFIX  ns_list=dns1.connectivity04.xa/fda1:b2:c3:0:127:100:101:1;dns25.connectivity04.xa/fda1:b2:c3:0:127:100:125:1                                       

--> Unexpected

Two TXT are returned and one of them does not have a prefix matching the queried IP address.

;; ANSWER SECTION:
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.125.0/24 | NA | NA | NA"
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.255.0/24 | NA | NA | NA"

- Check for definedness before looping over name servers
	This can happen with the new methods (TestMethodsV2), for example when a domain does not exist
- Move test scenario ERROR-PREFIX-DATABASE-3 to a separate unit test file
	Since queries for this scenario time out (no response), this is needed as to avoid the blacklisting of subsequent queries
@tgreenx

tgreenx commented Oct 29, 2024

Copy link
Copy Markdown
Contributor Author

Note that scenario ERROR-PREFIX-DATABASE-3 is currently disabled because since its query ends up blacklisted (no response), it causes subsequent queries to be blacklisted as well. I'll look for a workaround.

If that scenario is run by a separate t file it will not affect other scenarios. Isn't that the simple workaround? I do not think that the code should handle ASN lookup queries special in that sense.

Yes, I will do that.

Should there be double space between tag and argument?

$ zonemaster-cli --hint=hintfile.zone --test=connectivity04 --level=info --show-testcase --raw GOOD-1.connectivity04.xa                                                                                        
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0                                                                                                                                                 
   0.23 INFO     Connectivity04 CN04_IPV4_DIFFERENT_PREFIX  ns_list=dns0.connectivity04.xa/127.100.100.1;dns1.connectivity04.xa/127.100.101.1                                                                  
   0.23 INFO     Connectivity04 CN04_IPV6_DIFFERENT_PREFIX  ns_list=dns0.connectivity04.xa/fda1:b2:c3:0:127:100:100:1;dns1.connectivity04.xa/fda1:b2:c3:0:127:100:101:1                                        

Unless I misunderstand, this is unrelated to this PR. This is also the case for other Test cases.

I tested a domain that does not exist and got errors from Perl. It is not a big problem, but better if we can avoid it.

$ zonemaster-cli --hint=hintfile.zone --test=connectivity04 --level=info --show-testcase --raw ERROR-PREFIX-DATABASE-4.connectivity04.xa
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0
   0.04 CRITICAL Unspecified    MODULE_ERROR  module=Connectivity; msg=Can't use an undefined value as an ARRAY reference at /usr/local/share/perl/5.34.0/Zonemaster/Engine/Test/Connectivity.pm line 807.

I agree, fixed.

Tag without argument, but with two trailing space characters, CN04_IPV4_SINGLE_PREFIX .

I don't see the issue. Could you provide an example? I get:

$ zonemaster-cli --hint=../zonemaster/test-zone-data/Connectivity-TP/connectivity04/hintfile.zone --test=connectivity04 --level=info --show-testcase --raw IPV4-SINGLE-NS-1.connectivity04.xa
   0.00 INFO     Unspecified    GLOBAL_VERSION  version=v6.0.0
   0.07 INFO     Connectivity04 CN04_IPV4_DIFFERENT_PREFIX  ns_list=dns19.connectivity04.xa/127.100.119.1
   0.07 WARNING  Connectivity04 CN04_IPV4_SINGLE_PREFIX

$ zonemaster-cli --hint=../zonemaster/test-zone-data/Connectivity-TP/connectivity04/hintfile.zone --test=connectivity04 --level=info --show-testcase IPV4-SING
LE-NS-1.connectivity04.xa

Seconds Level    Testcase       Message
======= ======== ============== =======
   0.00 INFO     Unspecified    Using version v6.0.0 of the Zonemaster engine.
   0.11 INFO     Connectivity04 The following name server(s) are announced in unique IPv4 prefix(es): "dns19.connectivity04.xa/127.100.119.1"
   0.11 WARNING  Connectivity04 All name server(s) IPv4 address(es) are announced in the same IPv4 prefix.

[ ... ]

--> Unexpected

Two TXT are returned and one of them does not have a prefix matching the queried IP address.

;; ANSWER SECTION:
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.125.0/24 | NA | NA | NA"
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.255.0/24 | NA | NA | NA"

I believe this one is a bit tricky from a specification standpoint. We have both a valid and invalid record. Shouldn't we care more about returning the correct one? Moreover the network mask is the same in both cases, which makes it even more of an edge case. Finally, for this scenario this will lead to output of message tags CN04_IPV{4,6}_SINGLE_PREFIX.
See https://github.com/zonemaster/zonemaster/blob/b38a3bd9acf37c55211117ff387c2220fec58fd0/docs/public/specifications/tests/Connectivity-TP/connectivity04.md?plain=1#L173-L187.

@tgreenx tgreenx requested a review from matsduf October 29, 2024 16:18
@tgreenx tgreenx linked an issue Oct 29, 2024 that may be closed by this pull request
@matsduf

matsduf commented Oct 30, 2024

Copy link
Copy Markdown
Contributor

Unless I misunderstand, this is unrelated to this PR. This is also the case for other Test cases.

Not an issue for this PR.

I don't see the issue. Could you provide an example? I get:

Just trailing spaces I observed. Nothing important.

--> Unexpected
Two TXT are returned and one of them does not have a prefix matching the queried IP address.

;; ANSWER SECTION:
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.125.0/24 | NA | NA | NA"
1.125.100.127.origin.asnlookup.zonemaster.net. 3600 IN TXT "64512 | 127.100.255.0/24 | NA | NA | NA"

I believe this one is a bit tricky from a specification standpoint. We have both a valid and invalid record. Shouldn't we care more about returning the correct one? Moreover the network mask is the same in both cases, which makes it even more of an edge case. Finally, for this scenario this will lead to output of message tags CN04_IPV{4,6}_SINGLE_PREFIX. See https://github.com/zonemaster/zonemaster/blob/b38a3bd9acf37c55211117ff387c2220fec58fd0/docs/public/specifications/tests/Connectivity-TP/connectivity04.md?plain=1#L173-L187.

If more than one ASN TXT record is returned then I think it is reasonable to see that as a set. If one is more specific than the other, and both are compatible with the address, that is fine. If one record is not compatible with address, but the other is, then I think it is reasonable to say that the set is broken. That is what I think the specification says, and is meant to say:

  1. If Input IP does not match the extracted subnet, output
    [CN04_ERROR_PREFIX_DATABASE], break the processing of TXT records and
    exit this loop without returning any prefix.

@matsduf

matsduf commented Oct 30, 2024

Copy link
Copy Markdown
Contributor

Moreover the network mask is the same in both cases, which makes it even more of an edge case.

I do not understand why the size of the mask matters. One prefix covers the address, the other does not.

Comment thread t/Test-connectivity04.t Outdated
- Fix logic when outputting of CN04_IPV{4,6}_SINGLE_PREFIX
- Update mandatory message tags in test scenario ERROR-PREFIX-DATABASE-6
@tgreenx tgreenx requested a review from matsduf October 30, 2024 10:17
matsduf
matsduf previously approved these changes Oct 30, 2024
@matsduf

matsduf commented Oct 30, 2024

Copy link
Copy Markdown
Contributor

@marc-vanderwal, @MichaelTimbert, @mattias-p, please review.

Comment thread t/Test-connectivity04.t Outdated

@marc-vanderwal marc-vanderwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@matsduf matsduf added V-Minor Versioning: The change gives an update of minor in version. V-Patch Versioning: The change gives an update of patch in version. and removed V-Minor Versioning: The change gives an update of minor in version. labels Nov 8, 2024
@tgreenx tgreenx merged commit 1b8482e into zonemaster:develop Nov 12, 2024
@tgreenx tgreenx deleted the update-connectivity04 branch November 12, 2024 11:11
@matsduf

matsduf commented Dec 6, 2024

Copy link
Copy Markdown
Contributor

Release testing for 2024.2: No issues.

@matsduf matsduf added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-TestCase Area: Test case specification or implementation of test case S-ReleaseTested Status: The PR has been successfully tested in release testing V-Patch Versioning: The change gives an update of patch in version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CONNECTIVITY04 - IP prefix diversity requirement

3 participants