Repository navigation
ndp: reject router advertisement durations that do not fit - #33
Merged
Merged
Conversation
A lifetime of 65536 seconds wrapped to a uint16 of 0, which means the router is not a default router. Reachable and retransmit times wrapped the same way. Marshal now returns an error instead. Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
mdlayher
approved these changes
Oct 11, 2026
Contributor
Author
|
Thanks for the merge. |
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.
Router advertisement marshal wrote RouterLifetime, ReachableTime, and RetransmitTimer with a narrowing cast. 65536 seconds became a uint16 of 0. RFC 4861 treats a lifetime of 0 as not a default router. A negative lifetime wrapped to a large positive value. Reachable time and the retransmit timer wrapped past 32 bits the same way.
Marshal now returns an error when a value does not fit. Zero and 65535 seconds still marshal, and sub-second truncation is unchanged.
go test -count=1 .passes. With the range checks disabled, the four new cases fail with "expected an error, but none occurred."