dhcpv6_client: fix scaling of get_rand_us_factor#16661
Closed
miri64 wants to merge 1 commit intoRIOT-OS:masterfrom
Closed
dhcpv6_client: fix scaling of get_rand_us_factor#16661miri64 wants to merge 1 commit intoRIOT-OS:masterfrom
miri64 wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
Member
Author
|
Since #16668 changed the scaling to milliseconds anyways, this PR is no longer necessary. |
Member
Author
|
(cmp. this change and following). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
From what I can tell, this is a bug. The RFC defines RAND "a random number chosen with a uniform distribution between -0.1 and +0.1.", so we want to first take a number between 0μs and 200000μs and then subtract 100000μs from it to get the desired range, not take a number between 0μs and 200000μs and then subtract 100000000μs like it is the case in the current code.
Testing procedure
Since I found this bug only through code review, I'm not sure how to test this. I think the retransmission times of the DHCPv6 should now be far less erratic.
Issues/PRs references
None