Skip to content

tests/gnrc_rpl_srh: fix test assumption#12440

Merged
cgundogan merged 3 commits intoRIOT-OS:masterfrom
miri64:tests/fix/gnrc_rpl_srh
Oct 14, 2019
Merged

tests/gnrc_rpl_srh: fix test assumption#12440
cgundogan merged 3 commits intoRIOT-OS:masterfrom
miri64:tests/fix/gnrc_rpl_srh

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Oct 14, 2019

Contribution description

If the destination address or an address within the source route is multicast within a RPL source routing header, a receiving node is supposed to just discard the packets, but not to send an ICMPv6 error message, as the test assumes at the moment.

Source: https://tools.ietf.org/html/rfc6554#section-4.2

There is also a fix that prevents the implementation from sending such an error message: If we leave the err_ptr unset in these cases, the node will not send an error message.

Testing procedure

Read the algorithm provided above, especially the section regarding multicast:

     if Address[i] or the IPv6 Destination Address is multicast {
        discard the packet
     }

The test cases that check multicast addresses in tests/gnrc_rpl_srh should now pass (the test in general does not pass completely (but will, when #12442 is merged).

Issues/PRs references

Fixes one of the issues in #12436
Accompanies #12442

If the destination address or an address within the source route is
multicast within a RPL source routing header, a receiving node is
supposed to just discard the packets, but not to send an ICMPv6 error
message, as the test assumes at the moment.

Source: https://tools.ietf.org/html/rfc6554#section-4.2
@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch labels Oct 14, 2019
@miri64 miri64 added this to the Release 2019.10 milestone Oct 14, 2019
@miri64 miri64 requested review from cgundogan and kb2ma October 14, 2019 08:37
@miri64 miri64 force-pushed the tests/fix/gnrc_rpl_srh branch from 858ce4e to ee2126a Compare October 14, 2019 09:23
A node is not supposed to send an ICMPv6 error message when the
destination or one of the addresses in the source route is multicast
but is supposed to be silently discarded (see [RFC4443] and [RFC6554]).
If we leave the `err_ptr` unset, the [node will not send an error
message][err_ptr set].

[RFC 4443]: https://tools.ietf.org/html/rfc4443#section-2.4
[RFC 6554]: https://tools.ietf.org/html/rfc6554#section-4.2
[err_ptr set]: https://github.com/RIOT-OS/RIOT/blob/9bc600a/sys/net/gnrc/network_layer/ipv6/ext/rh/gnrc_ipv6_ext_rh.c#L100-L105
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

The test cases that check multicast addresses in tests/gnrc_rpl_srh should now pass (the test in general does not pass completely (see #12436 (comment), I will provide a separate fix for that).

See #12442 for that.

Copy link
Copy Markdown
Member

@cgundogan cgundogan left a comment

Choose a reason for hiding this comment

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

The change matches the spec [1] now 👍. However, what is the reasoning behind modifying the test to include UDP headers in the test packets? At first sight, the change to UDP appears unrelated to the fix, but there's probably something behind that? Though, I cannot find any hint neither in the code doc, nor in the commit message.

[1] https://tools.ietf.org/html/rfc6554#section-4.2

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

However, what is the reasoning behind modifying the test to include UDP headers in the test packets? At first sight, the change to UDP appears unrelated to the fix, but there's probably something behind that? Though, I cannot find any hint neither in the code doc, nor in the commit message.

Mainly to check if something is forwarded (in the error case). The routing header and the IPv6 header both change so they are no guaranteed point of reference. The added UDP header provides that with the (randomly selected) destination port.

Copy link
Copy Markdown
Member

@cgundogan cgundogan left a comment

Choose a reason for hiding this comment

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

Just some nitpicking and I do not have a strong opinion on this, but maybe you could use a number from the dynamic and/or private port range [1] instead of the randomly chosen 2606.
I leave the decision to you. ACK to the core change of this PR.

[1] https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

Isn't using a User Port just as valid? The dynamic range is mainly for ephemeral ports. As this is a "fantasy application" using 2602 as specific port might be just as valid. Especially since I don't bind the port (neither on the node nor the host), there should be no worries about using that port.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

(fun fact: scapy uses port 53 for UDP as default ;-))

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

Or do you want me to change it because of that so the DNS "reply" is to an ephemeral port?

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

Or do you want me to change it because of that so the DNS "reply" is to an ephemeral port?

If yes, I still disagree with changing since specifically for testing it is important to send unexpectedly formatted or valued packets ;-).

@cgundogan
Copy link
Copy Markdown
Member

Alright, was just a suggestion (: GO

@cgundogan cgundogan merged commit b4cb32a into RIOT-OS:master Oct 14, 2019
@cgundogan cgundogan added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines labels Oct 14, 2019
@miri64 miri64 deleted the tests/fix/gnrc_rpl_srh branch October 14, 2019 12:43
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Oct 14, 2019

Backport provided in #12443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants