Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence (serial) number comparison may be incorrect #13

Open
peter9477 opened this issue Oct 13, 2022 · 0 comments
Open

Sequence (serial) number comparison may be incorrect #13

peter9477 opened this issue Oct 13, 2022 · 0 comments

Comments

@peter9477
Copy link

I'm fairly n00b so may be wrong, but are sequence numbers being compared incorrectly relative to RFC1982? It looks like the comparison (and not just the addition) should account for the potential wraparound by only comparing values that lie within the same half-range (in this case ~32767 values) rather than within the full (65536) range of the values?

If I'm right, instead of doing it with raw u16 values it would probably make sense to integrate the sna crate instead, as it already does this properly (with tests to prove it).

As a quick sanity-check, I believe this test should pass, when applied to sequence numbers per the RFC: assert!(123u16 > 65230u16) It appears to me the current code would result in probably at least one ignored update of each entry every 65536 times around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant