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

udp: Encode 0 checksums as 0xFFFF #883

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arthurfabre
Copy link

RFC768 states:

If the computed checksum is zero, it is transmitted as all ones (the
equivalent in one's complement arithmetic). An all zero transmitted
checksum  value means that the transmitter generated no checksum.

Updated the serialization logic to correctly handle this. It isn't a big
problem for IPv4 where checksums are optional, but affects IPv6 which
has mandatory UDP checksums.

RFC768 states:

    If the computed checksum is zero, it is transmitted as all ones (the
    equivalent in one's complement arithmetic). An all zero transmitted
    checksum  value means that the transmitter generated no checksum.

Updated the serialization logic to correctly handle this. It isn't a big
problem for IPv4 where checksums are optional, but affects IPv6 which
has mandatory UDP checksums.
@MarcusWichelmann
Copy link

MarcusWichelmann commented Sep 6, 2022

@gconnell Sorry for tagging you, but is there a reason this PR hasn't been merged yet?
I'm currently working on a follow-up PR that refactors some things about the checksum calculation and also adds functions to verify checksums of decoded packets, and would like to base my work on this PR. Would be great, if this could be merged beforehand.

Also the changes in this PR look all valid IMO.

@joewilliams
Copy link

Please merge this PR.

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

Successfully merging this pull request may close these issues.

3 participants